Tuesday, April 24, 2018

letsencrypt wildcard ssl certificate on Amazon Linux + Apache

mkdir certbot
cd certbot
chmod a+x certbot-auto
sudo ./certbot-auto certonly  --server https://acme-v02.api.letsencrypt.org/directory  --manual --preferred-challenges dns  -d *.domainname.com

For putting TXT record in NameCheap:
In HostName, put _acme-challenge, in value put the string given on the command line.

To check whether the txt record is deployed:
dig -t txt _acme-challenge.domainname.com

Then in httpd.conf:

<VirtualHost *:443>
    DocumentRoot "/var/www/html/somepath"
    ServerName other.domainname.com
    ServerAlias *. domainname .com
    SSLCertificateFile /etc/letsencrypt/live/ domainname .com-0001/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ domainname .com-0001/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/ domainname .com-0001/fullchain.pem
    ErrorLog logs/ domainname -error_log
    CustomLog logs/ domainname -access_log common

    <Directory "/var/www/html/somepath">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


Monday, April 23, 2018

Extracting directory name from file paths (after find,grep)

awk -F/  '{print $2}' | uniq

Blog Archive