From 81c90e26ccfcde6607b02fa35650cdb4c8bbb37c Mon Sep 17 00:00:00 2001 From: xfnw Date: Fri, 29 Oct 2021 16:39:10 -0400 Subject: [PATCH] allow specifying name for makekeypair --- Makefile.in | 1 + makekeypair => ratbox-makekeypair | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) rename makekeypair => ratbox-makekeypair (68%) diff --git a/Makefile.in b/Makefile.in index 7925ad0..25a9af8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -24,6 +24,7 @@ build: ratbox-respond.c install: ratbox-respond install ratbox-respond ${bindir} + install ratbox-makekeypair ${bindir} clean: ${RM} -f ratbox-respond *~ diff --git a/makekeypair b/ratbox-makekeypair similarity index 68% rename from makekeypair rename to ratbox-makekeypair index 517d490..f49e20e 100755 --- a/makekeypair +++ b/ratbox-makekeypair @@ -3,14 +3,16 @@ # Copyright (C) 2006 ircd-ratbox development team # This code is in the public domain. +KEYNAME=${1:-$USER} + openssl "no-aes256-cbc" >/dev/null if [ $? != 1 ]; then openssl "no-des3" >/dev/null if [ $? != 1 ]; then 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 " openssl genrsa -out private.key 2048" - echo " openssl rsa -in private.key -out public.key -pubout" + echo " openssl genrsa -out key.sec 2048" + echo " openssl rsa -in key.sec -out key.pub -pubout" echo "Though this is NOT recommended for security reasons." exit fi @@ -19,7 +21,7 @@ else enc="-aes256" fi -openssl genrsa -out private.key $enc 4096 +openssl genrsa -out "$KEYNAME.sec" "$enc" 4096 echo "Generating RSA public key..." -openssl rsa -in private.key -out public.key -pubout +openssl rsa -in "$KEYNAME.sec" -out "$KEYNAME.pub" -pubout