From 87dd504af1b10f8dd8a20c62d9f9f2660b76cde1 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Thu, 10 Feb 2022 08:40:56 +0000 Subject: [PATCH] Add simpletls command --- roles/home-cli/files/bashrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/roles/home-cli/files/bashrc b/roles/home-cli/files/bashrc index 115739c..f0548a7 100644 --- a/roles/home-cli/files/bashrc +++ b/roles/home-cli/files/bashrc @@ -213,6 +213,19 @@ usermotd () { 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 *i*) # Shell is interactive