Changes between Version 11 and Version 12 of Csle2022/Agenda/databaseandweb


Ignore:
Timestamp:
Nov 22, 2022, 3:31:32 PM (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/databaseandweb

    v11 v12  
    517517
    518518[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web17.png)]]
     519
     520= Secure the Web Sites with Let's Encrypt =
     521
     522To secure web sites we need to install TLS/SSL certificates on the servers. These certificates are normally purchased from certificate vendors. But using Let's Encrypt we can have these certificates freely and easily. Here we will go through the steps to install certificates for your domains.
     523
     524Let's Encrypt simplifies the process by providing a software client called Certbot, that attempts to automate most of the required steps. So first we need to install the certbot.
     525
     526{{{
     527sudo apt install certbot python3-certbot-apache
     528}}}
     529
     530Once install we need to verify that in virtual host configuration we have set the ServerName and ServerAlias directives properly.
     531
     532{{{
     533sudo nano /etc/apache2/sites-available/wp.your_domain.com.conf
     534
     535ServerName wp.your_domain.com
     536ServerAlias wp.your_domain.com
     537}}}
     538
     539Then we will go ahead with obtaining the certicates using below command.
     540
     541{{{
     542sudo certbot --apache
     543}}}
     544
     545In the process it will ask for a valid email address which will be used for renewal notifications and security notices. Let's provide it.
     546
     547{{{
     548Saving debug log to /var/log/letsencrypt/letsencrypt.log
     549Plugins selected: Authenticator apache, Installer apache
     550Enter email address (used for urgent renewal and security notices) (Enter 'c' to
     551cancel): lalantha@learn.ac.lk
     552}}}
     553
     554You will then be prompted to confirm if you agree to Let’s Encrypt terms of service. You can confirm by pressing A and then ENTER.
     555
     556{{{
     557- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     558Please read the Terms of Service at
     559https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
     560agree in order to register with the ACME server at
     561https://acme-v02.api.letsencrypt.org/directory
     562- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     563(A)gree/(C)ancel: A
     564
     565}}}
     566
     567Next, you’ll be asked if you would like to share your email with the Electronic Frontier Foundation to receive news and other information.
     568
     569{{{
     570- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     571Would you be willing to share your email address with the Electronic Frontier
     572Foundation, a founding partner of the Let's Encrypt project and the non-profit
     573organization that develops Certbot? We'd like to send you email about our work
     574encrypting the web, EFF news, campaigns, and ways to support digital freedom.
     575- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     576(Y)es/(N)o: N
     577}}}
     578
     579Then the certbot will give an list of domains that it discoverd and to select one or more domains to obtain the certificates. For this I will choose only 3rd domain.
     580
     581{{{
     582Which names would you like to activate HTTPS for?
     583- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     5841: lms.your_domain.com
     5852: web.your_domain.com
     5863: wp.your_domain.com
     587- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     588Select the appropriate numbers separated by commas and/or spaces, or leave input
     589blank to select all options shown (Enter 'c' to cancel): 3   
     590}}}
     591
     592Next, you’ll be prompted to select whether or not you want HTTP traffic redirected to HTTPS. In practice, that means when someone visits your website through unencrypted channels (HTTP), they will be automatically redirected to the HTTPS address of your website. Choose 2 to enable the redirection.
     593
     594{{{
     595Obtaining a new certificate
     596Performing the following challenges:
     597http-01 challenge for wp.dhammikalalantha.com
     598Waiting for verification...
     599Cleaning up challenges
     600Created an SSL vhost at /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf
     601Enabled Apache socache_shmcb module
     602Enabled Apache ssl module
     603Deploying Certificate to VirtualHost /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf
     604Enabling available site: /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf
     605
     606Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
     607- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     6081: No redirect - Make no further changes to the webserver configuration.
     6092: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
     610new sites, or if you're confident your site works on HTTPS. You can undo this
     611change by editing your web server's configuration.
     612- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     613Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
     614
     615}}}
     616
     617Finally the below will be printed and if successful certificates will be installed.
     618
     619{{{
     620Redirecting vhost in /etc/apache2/sites-enabled/wp.dhammikalalantha.com.conf to ssl vhost in /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf
     621
     622- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     623Congratulations! You have successfully enabled https://wp.dhammikalalantha.com
     624
     625You should test your configuration at:
     626https://www.ssllabs.com/ssltest/analyze.html?d=wp.dhammikalalantha.com
     627- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     628
     629IMPORTANT NOTES:
     630 - Congratulations! Your certificate and chain have been saved at:
     631   /etc/letsencrypt/live/wp.dhammikalalantha.com/fullchain.pem
     632   Your key file has been saved at:
     633   /etc/letsencrypt/live/wp.dhammikalalantha.com/privkey.pem
     634   Your cert will expire on 2023-02-20. To obtain a new or tweaked
     635   version of this certificate in the future, simply run certbot again
     636   with the "certonly" option. To non-interactively renew *all* of
     637   your certificates, run "certbot renew"
     638 - Your account credentials have been saved in your Certbot
     639   configuration directory at /etc/letsencrypt. You should make a
     640   secure backup of this folder now. This configuration directory will
     641   also contain certificates and private keys obtained by Certbot so
     642   making regular backups of this folder is ideal.
     643 - If you like Certbot, please consider supporting our work by:
     644
     645   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
     646   Donating to EFF:                    https://eff.org/donate-le
     647}}}
     648
     649Please visit your domain now check whether SSL is enabled.
     650
     651[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web25.png)]]