Generate CSR for SSL in Ubuntu 18.04 LTS

Step:1 Create a file gen-csr.sh


Step:2 Edit the file gen-csr.sh


#/bin/sh

clear

echo -e "###########################################################################"

echo -e "#                      Automatically Generate Zimbra CSR                  #"

echo -e "#              Single Domain / UCC Multi Domain / Wildcard                #"

echo -e "#    If you have Any Further, Please do not Hestitate To Contact Me       #"

echo -e "#          E:muhammad@dhenandi.com          B:http://dhenandi.com         #"

echo -e "###########################################################################"

echo ""

shopt -s nocasematch

echo -n "SSL Type (Single)(UCC)(Wildcard) : "

read TIPESSL

       if [[ "$TIPESSL" =~ "Single" ]]; then

       echo -n "Organization (Ex: PT Excellent Infotama Kreasindo) : "

        read SGPERUSAHAAN

       echo -n "State (Ex: Jawa Barat) : "

        read SGPROVINSI

       echo -n "Location (Ex: Bekasi) : "

        read SGKOTA

       echo -n "Common Name (Ex: mail.dhenandi.com) : "

        read SGCN

        echo ""

        echo "Thank you for the information, CSR will be generated"

        /opt/zimbra/bin/zmcertmgr createcsr comm -new -subject "/C=BD/ST=$SGPROVINSI/L=$SGKOTA/O=$SGPERUSAHAAN/OU=NA/CN=$SGCN" -subjectAltNames $SGCN

        echo "SSL Already Generated"

        cat /opt/zimbra/ssl/zimbra/commercial/commercial.csr

        echo "Copy The Following Result, and Give to the Prinsipal"

else if [[ "$TIPESSL" =~ "UCC" ]]; then

        echo -n "Organization (Ex: PT Excellent Infotama Kreasindo) : "

        read UCCPERUSAHAAN

        echo -n "State (Ex: Jawa Barat) : "

        read UCCPROVINSI

        echo -n "Location (Ex: Bekasi) : "

        read UCCKOTA

        echo -n "Common Name (Ex: mail.excellent.co.id) : "

        read UCCCN

        echo -n "Domains To Use (Ex: mail.excellent.co.id,mail.dhenandi.web.id,mail.vavai.web.id) : "

        read UCCSUBALTNAME

        echo ""

        echo "Thank you for the information, CSR will be generate"

        /opt/zimbra/bin/zmcertmgr createcsr comm -new -subject "/C=BD/ST=$UCCPROVINSI/L=$UCCKOTA/O=$UCCPERUSAHAAN/OU=NA/CN=$UCCCN" -subjectAltNames $UCCSUBALTNAME

        echo "SSL Already Generated"

        cat /opt/zimbra/ssl/zimbra/commercial/commercial.csr

        echo "Copy The Following Result, and Give to the Prinsipal"

else if [[ "$TIPESSL" =~ "Wildcard" ]]; then

        echo -n "Company (Ex: PT Excellent Infotama Kreasindo) : "

        read WPERUSAHAAN

        echo -n "State (Ex: Jawa Barat) : "

        read WPROVINSI

        echo -n "Location (Ex: Bekasi) : "

        read WKOTA

        echo -n "Domain (Ex: excellent.co.id) : "

        read WDOMAIN

        echo ""

        echo "Thank you for the information, CSR will be generate"

        /opt/zimbra/bin/zmcertmgr createcsr comm -new -subject "/C=BD/ST=$WPROVINSI/L=$WKOTA/O=$WPERUSAHAAN/OU=NA/CN=*.$WDOMAIN"          

        echo "SSL Already Generated"

        cat /opt/zimbra/ssl/zimbra/commercial/commercial.csr

        echo "Copy The Following Result, and Give to the Prinsipal"

else

        echo "Sorry, parameter not found"

fi

fi

fi


[Or download the script by executing 

wget -c https://dhenandi.com/repo/automaticaly-generate-csr-zimbra.sh ]


Step:3 change the permission

chmod +x gen-csr.sh


Step:4 login as zimbra and execute the script

su zimbra

./gen-csr.sh




Ref: https://dhenandi.com/easy-ways-to-generate-zimbra-ssl-certificate/


Comments

Popular posts from this blog

Disabling Zimbra's AntiSpam, Amavis and AntiVirus filtering

Cambium cnPilot E400/E410/E500 Configuration Tutorial

Error "Unable to retrive Zimbra GPG key for package validation"