Gutzi
JeDependingnachonGrößetheeuressizeHeimnetzwerkesofmüssenyourdiehomeSchrittenetwork, the "ZertifikateCreateerstellen"certificates"dauerndstepsabgearbeitethavewerden,towasbenervigcarriedwerdeoutkann.continuously,VorwhichallencanDingenbewennannoying.manEspeciallysichifmalyounachwanteinigertoZeitdecidefüroneinenaneuennewDomänendomainNamennameentscheidenafterwill.some time...EsTheregibtareauchalsoGeräte,devices,z.B.e.g. AVMRouterroutersoderorAppsapps (z.B.e.g. Plex)diethatakzeptierenonlynuraccepteinea .pfx (PKCS#12-Standard)PKCS#12 standard)! Hm,undandschonwe'rewärenalreadywiroutgekniffenof luck 😤 ...
1. allesall in einemone Schritt,step, oups ...Scriptscript
FürFor alleall die,those diewho diehave Realisierungimplemented wiethe vonrealization miras empfohlenrecommended aufby einemme on a PI oderor Linux Gerätdevice, implementierthere haben,is kommta hierscript einthat Script,is dasquickly schnelladapted angepasstand istthen undtakes dannyour euredomain Domäneas alsa Parameterparameter nimmtand undautomatically allecreates erforderlichenall Dateienthe automatischnecessary erstellt.files.
8-tung! DasThe Stammzertifikatroot musscertificate vorhandenmust exist / bereitshave erstelltalready sein!been undcreated! sichand imbe gleichenlocated Verzeichnisin befindenthe wiesame dasdirectory Script.as the script.
#!/bin/bash
#Required
domain=$1
commonname=$domain
#Change to your company details
country=<>
state=<>
locality=<>
organization=<>
organizationalunit=<>
email=<>
if [ -z "$domain" ]
then
echo "Argument not present."
echo "Useage $0 [common name]"
exit 99
fi
echo "1. generating .key for $domain"
#generate a .key
openssl genrsa -out $domain.key 2048
echo "successful!"
echo ""
echo "2. generating .csr for $domain"
#generate a .csr
openssl req -new -key $domain.key -out $domain.csr \
-subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
echo "successful!"
echo ""
echo "3. generating .ext for $domain"
cat > $domain.ext <<EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = $domain
EOF
echo "successful!"
echo ""
echo "4. creating .csr for $domain"
openssl x509 -req -in $domain.csr -CA <SLD>.pem -CAkey <SLD>.key -CAcreateserial -out $domain.crt -days 3650 -sha256 -extfile $domain.ext
echo "successful!"
echo ""
echo "5. creating .pem for $domain"
cat $domain.crt $domain.key > $domain.pem
echo "successful!"
echo ""
echo "6. creating .pfx for $domain"
openssl pkcs12 -export -in $domain.pem -out $domain.pfx
echo "successful!"
echo ""
echo "---------------------------"
echo "-------- All Set! ---------"
echo "---------------------------"
echo
HierYoukönntcanihrdownloaddastheScriptscriptherunterladen:here: genCert.zipentpackenandundadaptaufiteuretoBedürfnisseyouranpassenneeds (suchtsearchnachfor <>und nachand <SLD>.DannThenabspeichern.save it.mitmakedemtheKommando:script executable with the command: "sudo chmod +x <scriptname>.sh"ausführbar machen
fertigDONE!!
ausführenExecute mitwith Kommando:command: "./<sriptname>.sh <subDomäne.SLD.TLD>" 🤗