Changes between Version 17 and Version 18 of Csle2022/Agenda/databaseandweb


Ignore:
Timestamp:
Nov 29, 2022, 10:35:06 PM (3 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/databaseandweb

    v17 v18  
    578578[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web17.png)]]
    579579
    580 = Secure the Web Sites with Let's Encrypt =
     580= Securing Apache =
     581
     582== Securing Apache with Basic Authentication ==
     583
     584Apache provides some inbuilt directory level authentication mechanism. Though this is not a most secure authentication method, this could be useful. To do this you need to create .htaccess within the web directory that you need to be password protected. For our lab we will protect our whole web site with this method. So let's create a .htaccess file on the document root.
     585
     586{{{
     587cd /var/www/web.your_domain.com/public_html
     588sudo nano .htaccess
     589}}
     590
     591And add below,
     592
     593{{{
     594AuthType Basic
     595AuthName "Authentication Required"
     596AuthUserFile "/var/www/web.your_domain.com/.htpasswd"
     597require valid-user
     598}}}
     599
     600Now you will add users using the htpasswd utility to a file call .htpasswd. Make sure this file to keep outside the document root.
     601
     602{{{
     603htpasswd -c /var/www/web.your_domain.com/.htpasswd user
     604}}}
     605
     606If you need to add another user please avoid the option -c,
     607
     608{{{
     609htpasswd -c /var/www/web.your_domain.com/.htpasswd user2
     610}}}
     611
     612Now refresh the site and you will be asked the password to enter the site.
     613
     614[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web33.png)]]
     615
     616== Secure the Web Sites with Let's Encrypt ==
    581617
    582618To 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.