Last active
October 13, 2016 21:46
-
-
Save tomas-edwardsson/31f3bc6f5f4bf69e436db9165c2507bd to your computer and use it in GitHub Desktop.
Encrypted Network Pasting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
KEY=$(mktemp key.XXXXXX) | |
CRT=$(mktemp crt.XXXXXX) | |
cleanup() { | |
rm -f "${KEY}" "${CRT}" | |
} | |
trap cleanup EXIT | |
openssl req \ | |
-subj "/C=XX/ST=XX/L=XXXX/O=XXXXX/CN=tmpserv" \ | |
-newkey rsa:2048 -nodes -keyout "${KEY}" \ | |
-x509 -days 365 -out "${CRT}" | |
echo;echo;echo | |
echo "--------------------------------------------------" | |
echo "Starting up, use the following command to connect:" | |
echo " openssl s_client -connect <your-host>:4433" | |
echo "Hit ctrl-c to exit" | |
echo "--------------------------------------------------" | |
echo;echo;echo | |
openssl s_server -cert "${CRT}" -key "${KEY}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment