allow specifying name for makekeypair

This commit is contained in:
xfnw 2021-10-29 16:39:10 -04:00
parent 239ac917bf
commit 81c90e26cc
2 changed files with 7 additions and 4 deletions

View file

@ -24,6 +24,7 @@ build: ratbox-respond.c
install: ratbox-respond install: ratbox-respond
install ratbox-respond ${bindir} install ratbox-respond ${bindir}
install ratbox-makekeypair ${bindir}
clean: clean:
${RM} -f ratbox-respond *~ ${RM} -f ratbox-respond *~

View file

@ -3,14 +3,16 @@
# Copyright (C) 2006 ircd-ratbox development team # Copyright (C) 2006 ircd-ratbox development team
# This code is in the public domain. # This code is in the public domain.
KEYNAME=${1:-$USER}
openssl "no-aes256-cbc" >/dev/null openssl "no-aes256-cbc" >/dev/null
if [ $? != 1 ]; then if [ $? != 1 ]; then
openssl "no-des3" >/dev/null openssl "no-des3" >/dev/null
if [ $? != 1 ]; then if [ $? != 1 ]; then
echo "Unable to find a suitable encryption for assigning a password to the key" echo "Unable to find a suitable encryption for assigning a password to the key"
echo "If you wish to generate a key without a passphrase, run:" echo "If you wish to generate a key without a passphrase, run:"
echo " openssl genrsa -out private.key 2048" echo " openssl genrsa -out key.sec 2048"
echo " openssl rsa -in private.key -out public.key -pubout" echo " openssl rsa -in key.sec -out key.pub -pubout"
echo "Though this is NOT recommended for security reasons." echo "Though this is NOT recommended for security reasons."
exit exit
fi fi
@ -19,7 +21,7 @@ else
enc="-aes256" enc="-aes256"
fi fi
openssl genrsa -out private.key $enc 4096 openssl genrsa -out "$KEYNAME.sec" "$enc" 4096
echo "Generating RSA public key..." echo "Generating RSA public key..."
openssl rsa -in private.key -out public.key -pubout openssl rsa -in "$KEYNAME.sec" -out "$KEYNAME.pub" -pubout