Created
July 13, 2019 00:15
-
-
Save haryx8/dddf713977589ccc9f96d06b177bfebc to your computer and use it in GitHub Desktop.
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 | |
PIN1=`openssl x509 -pubkey < primary.crt | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64` | |
PIN2=`openssl x509 -pubkey < backup.crt | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64` | |
echo | |
echo ================================== | |
echo == Public_Key_Pinning generator == | |
echo ================================== | |
echo | |
echo -e "\033[5m\033[1m\033[31mapache:\033[0m" | |
echo Header always set Public-Key-Pins "pin-sha256=\"$PIN1\"; pin-sha256=\"$PIN2\"; max-age=5184000; includeSubDomains" | |
echo | |
echo -e "\033[5m\033[1m\033[92mnginx:\033[0m" | |
echo "add_header Public-Key-Pins 'pin-sha256=\"$PIN1\"; pin-sha256=\"$PIN2\"; max-age=5184000; includeSubDomains' always;" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment