Last active
December 20, 2018 20:57
-
-
Save dkrusky/d26ee02d3172c2fdf791856636f1f86b to your computer and use it in GitHub Desktop.
LetsEncrypt get sha256 keypin headers for HSTS/HPKP apache2
This file contains hidden or 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 | |
HPKP=`openssl x509 -in /etc/letsencrypt/live/"$1"/cert.pem -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64` | |
echo "<IfModule mod_headers.c>" | |
echo " Header Always set Strict-Transport-Security \"max-age=31536000; includeSubdomains; preload\" env=HTTPS" | |
echo " Header always set Public-Key-Pins \"pin-sha256=\\\"$HPKP\\\"; max-age=5184000" | |
echo "</IfModule>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment