Open VPN With LetsEncrypt Certificate

- - posted in Technical | Tagged as OpenVpn,LetsEncrypt | Comments

LetsEncrypt HTTPS Certificates for OpenVPN AS (Access Server)

So you want secure transport using ssl certificate for your openvpn Access server ( the admin GUI) To load a new HTTPS certificate for OpenVPN AS (Access Server), you.ll want to use the ./usr/local/openvpn_as/scripts/confdba command. This can be combined with a Lets Encrypt client to obtain free a HTTPs certificate for the AS web server.

Step 1 . Installing Certbot

The first step to using LetsEncrypt to obtain an SSL certificate is to install the certbot software on your server.

First, add the repository:

sudo add-apt-repository ppa:certbot/certbot ````

You'll need to press ENTER to accept. Afterwards, update the package list to pick up the new repository.s package information:

sudo apt-get update

And finally, install Certbot with apt-get:

sudo apt-get install python-certbot-nginx

The certbot LetsEncrypt client is now ready to use.

Step 2 . Setting up Nginx - Optional Not needed for OpenVPN

Certbot can automatically configure SSL for Nginx, but it needs to be able to find the correct server block in your config. It does this by looking for a server_name directive that matches the domain requesting a certificate for. If starting out with a fresh Nginx install, you can update the default config file:

sudo nano /etc/nginx/sites-available/default Find the existing server_name line:

/etc/nginx/sites-available/default server_name localhost; Replace localhost with your domain name:

/etc/nginx/sites-available/default server_name; Save the file and quit your editor. Verify the syntax of your configuration edits with:

sudo nginx -t If that runs with no errors, reload Nginx to load the new configuration:

sudo service nginx reload Certbot will now be able to find the correct server block and update it. Now we.ll update our firewall to allow HTTPS traffic.

Step 3 . Obtaining an SSL Certificate

Certbot provides a variety of ways to obtain SSL certificates, through various plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading the config whenever necessary:

sudo certbot --nginx -d -d This runs certbot with the --nginx plugin, using -d to specify the names we.d like the certificate to be valid for.

If this is your first time running certbot, you will be prompted to enter an email address and agree to the terms of service. After doing so, certbot will communicate with the Let.s Encrypt server, then run a challenge to verify that you control the domain requesting a certificate for.

If that.s successful, certbot will ask how you.d like to configure your HTTPS settings:


Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this

change by editing your web server's configuration.

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): Select your choice then hit ENTER. The configuration will be updated, and Nginx will reload to pick up the new settings. certbot will wrap up with a message telling you the process was successful and where your certificates are stored:

Output IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/ Your cert will expire on 2017-10-23. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew all of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: Donating to EFF: Your certificates are now downloaded, installed, and configured. Try reloading your website using https:// and notice your browser.s security indicator. It should represent that the site is properly secured, usually with a green lock icon. If you test your server using the SSL Labs Server Test, it will get an A grade.

Step 4 . Verifying Certbot Auto-Renewal

Let.s Encrypt.s certificates are only valid for ninety days. This is to encourage users to automate their certificate renewal process. The certbot package we installed takes care of this for us by running .certbot renew. twice a day via a systemd timer. On non-systemd distributions this functionality is provided by a script placed in /etc/cron.d. This task runs twice a day and will renew any certificate that.s within thirty days of expiration.

To test the renewal process, you can do a dry run with certbot:

sudo certbot renew --dry-run

Commands Used

Gravatar of Ashwani Kumar

Recent posts


Your Feedback encourages me

Learning and Developments

One Month Rails

, 2FA, AWS AWS, Active Authenticator Directory, Facebook Flash, Forwarding, GOD,Chat,Coffee Github,Feedback,Repo Google Google,Search HAProxy, IOT, IP-block JQuery LetsEncrypt Load MQ MQTT, Messaging Octopress Octopress, OpenVpn OpenVpn, PI, Plugin Plugin, Port Raspberry, S3, SSH, Shell,Commands Soapui, Tag Tag, Tree, Tunneling XML XML, XServer, Xming ajax, angular, animated architecture, balancing cloud, commenting, connectivity datapower datatables diagrams diaspora dropdown geocoding grep, hashicorp, ipaddress, ipv6, java, java,python mysql nokogiri, octopress-migration octopress-plugin openapi, openssl powershell proxy rails, repo reviews ruby, script scripts, security, sharepoint shell spring springboot, ssh, swagger, telnet, vault vi, vieditor vim, visualblock, webattacks windows,cleanup windowsxp