Created
March 18, 2026 13:59
-
-
Save mattiasghodsian/191591402ad58f904cad76518dce7451 to your computer and use it in GitHub Desktop.
[Linux] Generate custom SSL for local use
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 | |
| # Author: Mattias Ghodsian | |
| # Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5 | |
| # Donate coffee: https://www.buymeacoffee.com/mattiasghodsian | |
| if [ -z "$1" ]; then | |
| echo "Usage: ./generate.sh yourdomain.lan" | |
| exit 1 | |
| fi | |
| DOMAIN=$1 | |
| echo "Generating SSL certificate for: $DOMAIN" | |
| openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ | |
| -keyout "$DOMAIN.key" \ | |
| -out "$DOMAIN.crt" \ | |
| -subj "/CN=$DOMAIN" \ | |
| -addext "subjectAltName=DNS:$DOMAIN,DNS:*.$DOMAIN" | |
| echo "------------------------------------------" | |
| echo "Done! Created files:" | |
| echo "Private Key: $DOMAIN.key" | |
| echo "Certificate: $DOMAIN.crt" | |
| echo "------------------------------------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment