/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-keygen

updated some partial manual pages

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
KEYDIR="/etc/mandos"
26
26
KEYTYPE=DSA
27
27
KEYLENGTH=1024
28
 
SUBKEYTYPE=ELG-E
29
 
SUBKEYLENGTH=2048
30
28
KEYNAME="`hostname --fqdn`"
31
29
KEYEMAIL=""
32
30
KEYCOMMENT="Mandos client key"
50
48
  -t TYPE, --type TYPE  Key type.  Default is DSA.
51
49
  -l BITS, --length BITS
52
50
                        Key length in bits.  Default is 1024.
53
 
  -s TYPE, --subtype TYPE
54
 
                        Subkey type.  Default is ELG-E.
55
 
  -L BITS, --sublength BITS
56
 
                        Subkey length in bits.  Default is 2048.
57
51
  -n NAME, --name NAME  Name of key.  Default is the FQDN.
58
52
  -e EMAIL, --email EMAIL
59
53
                        Email address of key.  Default is empty.
72
66
    case "$1" in
73
67
        -d|--dir) KEYDIR="$2"; shift 2;;
74
68
        -t|--type) KEYTYPE="$2"; shift 2;;
75
 
        -s|--subtype) SUBKEYTYPE="$2"; shift 2;;
76
69
        -l|--length) KEYLENGTH="$2"; shift 2;;
77
 
        -L|--sublength) SUBKEYLENGTH="$2"; shift 2;;
78
70
        -n|--name) KEYNAME="$2"; shift 2;;
79
71
        -e|--email) KEYEMAIL="$2"; shift 2;;
80
72
        -c|--comment) KEYCOMMENT="$2"; shift 2;;
81
 
        -x|--expire) KEYEXPIRE="$2"; shift 2;;
 
73
        -x|--expire) KEYCOMMENT="$2"; shift 2;;
82
74
        -f|--force) FORCE=yes; shift;;
83
75
        -v|--version) echo "$0 $VERSION"; exit;;
84
76
        -h|--help) help; exit;;
150
142
PUBRING="`mktemp -t mandos-gpg-pubring.XXXXXXXXXX`"
151
143
 
152
144
# Remove temporary files on exit
153
 
trap "
154
 
set +e; \
155
 
rm --force $PUBRING $BATCHFILE; \
156
 
shred --remove $SECRING; \
157
 
stty echo; \
158
 
" EXIT
 
145
trap "rm --force $PUBRING $BATCHFILE; shred --remove $SECRING" EXIT
159
146
 
160
147
# Create batch file for GnuPG
161
148
cat >"$BATCHFILE" <<EOF
162
149
Key-Type: $KEYTYPE
163
150
Key-Length: $KEYLENGTH
164
151
#Key-Usage: encrypt,sign,auth
165
 
Subkey-Type: $SUBKEYTYPE
166
 
Subkey-Length: $SUBKEYLENGTH
167
 
#Subkey-Usage: encrypt,sign,auth
168
152
Name-Real: $KEYNAME
169
153
$KEYCOMMENTLINE
170
154
$KEYEMAILLINE
171
155
Expire-Date: $KEYEXPIRE
172
 
#Preferences: <string>
173
 
#Handle: <no-spaces>
174
156
%pubring $PUBRING
175
157
%secring $SECRING
176
158
%commit
180
162
 
181
163
# Generate a new key in the key rings
182
164
gpg --no-random-seed-file --quiet --batch --no-tty \
183
 
    --no-default-keyring --no-options --enable-dsa2 \
 
165
    --no-default-keyring --no-options --batch \
184
166
    --secret-keyring "$SECRING" --keyring "$PUBRING" \
185
167
    --gen-key "$BATCHFILE"
186
168
rm --force "$BATCHFILE"
206
188
 
207
189
# Export keys from key rings to key files
208
190
gpg --no-random-seed-file --quiet --batch --no-tty --armor \
209
 
    --no-default-keyring --no-options --enable-dsa2 \
210
 
    --secret-keyring "$SECRING" --keyring "$PUBRING" \
211
 
    --export-options export-minimal --comment "$FILECOMMENT" \
212
 
    --output "$SECKEYFILE" --export-secret-keys
 
191
    --no-default-keyring --secret-keyring "$SECRING" \
 
192
    --keyring "$PUBRING" --export-options export-minimal \
 
193
    --comment "$FILECOMMENT" --output "$SECKEYFILE" \
 
194
    --export-secret-keys
213
195
gpg --no-random-seed-file --quiet --batch --no-tty --armor \
214
 
    --no-default-keyring --no-options --enable-dsa2 \
215
 
    --secret-keyring "$SECRING" --keyring "$PUBRING" \
216
 
    --export-options export-minimal --comment "$FILECOMMENT" \
217
 
    --output "$PUBKEYFILE" --export
 
196
    --no-default-keyring --secret-keyring "$SECRING" \
 
197
    --keyring "$PUBRING" --export-options export-minimal \
 
198
    --comment "$FILECOMMENT" --output "$PUBKEYFILE" \
 
199
    --export
218
200
 
219
201
trap - EXIT
220
202