mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-15 16:24:24 +00:00
Added script to automatically generate basic keys, updated the KB
This commit is contained in:
31
scripts/gpg.generate-keys.bash
Executable file
31
scripts/gpg.generate-keys.bash
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Sources:
|
||||
# - https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
|
||||
|
||||
: "${REAL_NAME:?required but not set}"
|
||||
: "${PASSPHRASE:?required but not set}"
|
||||
|
||||
: "${KEY_TYPE:=rsa}"
|
||||
: "${KEY_LENGTH:=4096}"
|
||||
: "${EXPIRE_DATE:=5y}"
|
||||
|
||||
for EMAIL in $@
|
||||
do
|
||||
if gpg --list-secret-keys "$EMAIL" >/dev/null 2>&1
|
||||
then
|
||||
echo "gpg key for ${EMAIL} already exists" >&2
|
||||
else
|
||||
gpg --batch --generate-key <<-EOF
|
||||
%echo generating key for $EMAIL
|
||||
Key-Type: $KEY_TYPE
|
||||
Key-Length: $KEY_LENGTH
|
||||
Name-Real: $REAL_NAME
|
||||
Name-Email: $EMAIL
|
||||
Expire-Date: $EXPIRE_DATE
|
||||
Passphrase: $PASSPHRASE
|
||||
%commit
|
||||
%echo done
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user