Add simpletls command

This commit is contained in:
Anthony Rose 2022-02-10 08:40:56 +00:00
parent 6ab822b847
commit 87dd504af1

View file

@ -213,6 +213,19 @@ usermotd () {
fi fi
} }
simpletls () {
# Create a self-signed certificate with:
# openssl req -new -x509 \
# -keyout $HOME/data/openssl/$(hostname)-key.pem \
# -out $HOME/data/openssl/$(hostname-cert.pem
if [ "x$1" == "x-l" ]
then
openssl s_server -cert $HOME/data/openssl/$(hostname)-cert.pem -key ~/data/openssl/$(hostname)-key.pem -tls1_3 -port $2
else
openssl s_client -CAfile $HOME/data/openssl/$1-cert.pem -tls1_3 -connect $1:$2
fi
}
case "$-" in case "$-" in
*i*) *i*)
# Shell is interactive # Shell is interactive