alox-gandalf 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/aloxec/_gandalf +16 -0
- data/aloxec/_gandalf_ +24 -0
- data/aloxec/list-bundle +38 -0
- data/aloxec/list-secrets +38 -0
- data/aloxec/new-bundle +39 -0
- data/aloxec/new-key +46 -0
- data/aloxec/new-secrets +39 -0
- metadata +54 -0
data/aloxec/_gandalf
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [[ "$#" > 0 ]]; then
|
4
|
+
GANDALF="$1"; shift
|
5
|
+
else
|
6
|
+
: ${GANDALF:="$(cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"}
|
7
|
+
fi
|
8
|
+
|
9
|
+
export GANDALF
|
10
|
+
|
11
|
+
PATH="$PATH:$(dirname $BASH_SOURCE)"
|
12
|
+
|
13
|
+
if [[ ! -x "$(type -P gpg 2>&-)" ]]; then
|
14
|
+
echo "ERROR: could not find gpg tool" 1>&2
|
15
|
+
false
|
16
|
+
fi
|
data/aloxec/_gandalf_
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
function keys_path {
|
2
|
+
echo "$GANDALF/$(ryaml "$GANDALF/config/gandalf.yml" keys_path)"
|
3
|
+
}
|
4
|
+
|
5
|
+
function keys {
|
6
|
+
ryaml "$GANDALF/config/gandalf.yml" bundle "$nm_bundle" keys | awk '$1 == "-" { print $NF }' | xargs --
|
7
|
+
}
|
8
|
+
|
9
|
+
function secrets_path {
|
10
|
+
echo "$GANDALF/$(ryaml "$GANDALF/config/gandalf.yml" bundle "$nm_bundle" secrets_path)"
|
11
|
+
}
|
12
|
+
|
13
|
+
function recipients {
|
14
|
+
local _a
|
15
|
+
for _a in $(keys); do
|
16
|
+
echo -n " -r $_a"
|
17
|
+
done
|
18
|
+
}
|
19
|
+
|
20
|
+
function gpg {
|
21
|
+
logger_info "gpg $@"
|
22
|
+
"$(type -P gpg)" "$@"
|
23
|
+
}
|
24
|
+
|
data/aloxec/list-bundle
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ list bundle -- list the bundle for a bundle
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ list bundle name
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source _jason
|
14
|
+
require _gandalf "${GANDALF:-$shome}"
|
15
|
+
require _gandalf_
|
16
|
+
|
17
|
+
readonly cfg_gandalf="$GANDALF/config/gandalf.yml"
|
18
|
+
|
19
|
+
# entry point
|
20
|
+
function main {
|
21
|
+
if [[ "$#" = 0 ]]; then
|
22
|
+
local default_bundle="$(ryaml $cfg_gandalf bundle default)"
|
23
|
+
if [[ -n "$default_bundle" ]]; then
|
24
|
+
set -- "$default_bundle" "$@"
|
25
|
+
fi
|
26
|
+
fi
|
27
|
+
|
28
|
+
if [[ "$#" = 0 ]]; then
|
29
|
+
logger_fatal "missing name of secrets bundle"
|
30
|
+
exit 1
|
31
|
+
fi
|
32
|
+
|
33
|
+
readonly local nm_bundle="$1"; shift
|
34
|
+
|
35
|
+
gpg -a -d "$(secrets_path)/${nm_bundle}.gpg"
|
36
|
+
}
|
37
|
+
|
38
|
+
require sub "$BASH_SOURCE" "$@"
|
data/aloxec/list-secrets
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ list bundle -- list the bundle for a bundle
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ list bundle name
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source _jason
|
14
|
+
require _gandalf "${GANDALF:-$shome}"
|
15
|
+
require _gandalf_
|
16
|
+
|
17
|
+
readonly cfg_gandalf="$GANDALF/config/gandalf.yml"
|
18
|
+
|
19
|
+
# entry point
|
20
|
+
function main {
|
21
|
+
if [[ "$#" = 0 ]]; then
|
22
|
+
local default_bundle="$(ryaml $cfg_gandalf bundle default)"
|
23
|
+
if [[ -n "$default_bundle" ]]; then
|
24
|
+
set -- "$default_bundle" "$@"
|
25
|
+
fi
|
26
|
+
fi
|
27
|
+
|
28
|
+
if [[ "$#" = 0 ]]; then
|
29
|
+
logger_fatal "missing name of secrets bundle"
|
30
|
+
exit 1
|
31
|
+
fi
|
32
|
+
|
33
|
+
readonly local nm_bundle="$1"; shift
|
34
|
+
|
35
|
+
gpg -a -d "$(secrets_path)/${nm_bundle}.gpg"
|
36
|
+
}
|
37
|
+
|
38
|
+
require sub "$BASH_SOURCE" "$@"
|
data/aloxec/new-bundle
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ new bundle -- create a new password bundle
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ new bundle name
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source _jason
|
14
|
+
require _gandalf "${GANDALF:-$shome}"
|
15
|
+
require _gandalf_
|
16
|
+
|
17
|
+
readonly cfg_gandalf="$GANDALF/config/gandalf.yml"
|
18
|
+
|
19
|
+
# entry point
|
20
|
+
function main {
|
21
|
+
if [[ "$#" = 0 ]]; then
|
22
|
+
logger_fatal "missing name of secrets bundle"
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
readonly local nm_bundle="$1"; shift
|
27
|
+
readonly local tmp_keyring="$(mktemp -t XXXXXXXXX)"
|
28
|
+
|
29
|
+
local _rcpt
|
30
|
+
for _rcpt in $(keys); do
|
31
|
+
gpg --no-default-keyring --keyring "$tmp_keyring" --import "$(keys_path)/gpg/$_rcpt"
|
32
|
+
done
|
33
|
+
|
34
|
+
echo "---" | gpg --no-default-keyring --keyring "$tmp_keyring" -a -e -o "$(secrets_path)/$nm_bundle.gpg" $(recipients)
|
35
|
+
|
36
|
+
rm -f "$tmp_keyring"
|
37
|
+
}
|
38
|
+
|
39
|
+
require sub "$BASH_SOURCE" "$@"
|
data/aloxec/new-key
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ new key -- create a new gpg key
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ new key email
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source _jason
|
14
|
+
require _gandalf "${GANDALF:-$shome}"
|
15
|
+
require _gandalf_
|
16
|
+
|
17
|
+
readonly cfg_gandalf="$GANDALF/config/gandalf.yml"
|
18
|
+
|
19
|
+
# entry point
|
20
|
+
function main {
|
21
|
+
if [[ "$#" = 0 ]]; then
|
22
|
+
logger_fatal "missing email"
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
readonly local email="$1"; shift
|
27
|
+
readonly local tmp_genkey="$(mktemp -t XXXXXXXXX)"
|
28
|
+
|
29
|
+
cat > "$tmp_genkey" <<EOF
|
30
|
+
Key-Type: RSA
|
31
|
+
Key-Length: 2048
|
32
|
+
Subkey-Type: RSA
|
33
|
+
Subkey-Length: 2048
|
34
|
+
Name-Email: $email
|
35
|
+
Expire-Date: 1y
|
36
|
+
%commit
|
37
|
+
EOF
|
38
|
+
|
39
|
+
gpg --batch --gen-key "$tmp_genkey"
|
40
|
+
rm -f "$tmp_genkey"
|
41
|
+
gpg --edit-key "$email" passwd save
|
42
|
+
|
43
|
+
gpg --export -a "$email" > "$(keys_path)/gpg/$email"
|
44
|
+
}
|
45
|
+
|
46
|
+
require sub "$BASH_SOURCE" "$@"
|
data/aloxec/new-secrets
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ new bundle -- create a new password bundle
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ new bundle name
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source _jason
|
14
|
+
require _gandalf "${GANDALF:-$shome}"
|
15
|
+
require _gandalf_
|
16
|
+
|
17
|
+
readonly cfg_gandalf="$GANDALF/config/gandalf.yml"
|
18
|
+
|
19
|
+
# entry point
|
20
|
+
function main {
|
21
|
+
if [[ "$#" = 0 ]]; then
|
22
|
+
logger_fatal "missing name of secrets bundle"
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
readonly local nm_bundle="$1"; shift
|
27
|
+
readonly local tmp_keyring="$(mktemp -t XXXXXXXXX)"
|
28
|
+
|
29
|
+
local _rcpt
|
30
|
+
for _rcpt in $(keys); do
|
31
|
+
gpg --no-default-keyring --keyring "$tmp_keyring" --import "$(keys_path)/gpg/$_rcpt"
|
32
|
+
done
|
33
|
+
|
34
|
+
echo "---" | gpg --no-default-keyring --keyring "$tmp_keyring" -a -e -o "$(secrets_path)/$nm_bundle.gpg" $(recipients)
|
35
|
+
|
36
|
+
rm -f "$tmp_keyring"
|
37
|
+
}
|
38
|
+
|
39
|
+
require sub "$BASH_SOURCE" "$@"
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alox-gandalf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Nghiem
|
9
|
+
- Tom Bombadil
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: encrypt plaintext using gpg
|
16
|
+
email:
|
17
|
+
- nghidav@gmail.com
|
18
|
+
- amanibhavam@destructuring.org
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- aloxec/_gandalf
|
24
|
+
- aloxec/_gandalf_
|
25
|
+
- aloxec/list-bundle
|
26
|
+
- aloxec/list-secrets
|
27
|
+
- aloxec/new-bundle
|
28
|
+
- aloxec/new-key
|
29
|
+
- aloxec/new-secrets
|
30
|
+
homepage: https://github.com/destructuring/gandalf
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.25
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: encrypt plaintext using gpg
|
54
|
+
test_files: []
|