Z-Car

Installing LetsEncrypt Certbot on Amazon Linux Server

The LetsEncrypt Certbot is an awesome tool for getting and maintaining SSL certificates for your sites.  In most cases, it is extremely easy to setup and maintain.  However, installing it on Amazon’s proprietary Linux server in EC2, it often fails.  These are the steps I took to get it to install properly in my environment.  

wget https://dl.eff.org/certbot-auto
chmod a+x ./certbot-auto
sudo yum install libffi-devel
sudo yum install openssl-devel
sudo chown -R ec2-user:ec2-user .well-known/
./certbot-auto –no-self-upgrade –no-bootstrap

After performing these commands, you should now be able to use Certbot as you would normally.

Certbot will place your completed SSL certs in the following paths.

  • Certificate: /etc/letsencrypt/live/YOUR_WEBSITE_HERE/cert.pem
  • Full Chain: /etc/letsencrypt/live/YOUR_WEBSITE_HERE/fullchain.pem
  • Private Key: /etc/letsencrypt/live/YOUR_WEBSITE_HERE/privkey.pem

To setup auto renew, you will need to add the following line to your crontab file.  Make sure you are running as root when you do so using sudo su.

Adding this  line will run the renewal process twice per day.

0 2,14 * * * /home/ec2-user/certbot-auto renew

 If you have any issues, leave a message in the comments so we can help.


Cookie Monster – WordPress URL Parameter Utility

 

cookie monster girl

I recently had a situation in which I needed to pass a URL parameter into WordPress so that it could be inserted into all links off of a blog page.  For example, a partner would pass traffic to a blog using the format http://www.myblog.com?refcode=joe.  All links embedded in the post would need to pass the value of refcode if it existed, even if the visitor requested multiple pages after the initial visit.

I created a Plugin (Cookie Monster) that will allow a Blog Admin to define which URL parameters should be captured, and then creates a shortcode so that the value can be used in your Posts and Pages.  A WordPress shortcode is a macro code that is embedded in your content.

In the example above, if you define refcode in the Cookie Monster Admin Settings, and if that URL parameter refcode contains a value in the querystring, it will automatically be saved into a cookie in the visitors browser. Anywhere that you place the shortcode in your Post, Cookie Monster will insert the querystring value into your Post.  The cookie value will persist across browser sessions.

If you click on this link, you will see that the querystring value refcode is now

Try changing refcode= in the link and reload this page.  Let me know if you have any further ideas for expanding this plugin.

You can download the latest copy here.

If you want to be able to build plugins like this yourself, click here and more.