Changes between Version 19 and Version 20 of Csle2022/Agenda/FW


Ignore:
Timestamp:
Nov 25, 2022, 4:29:27 AM (2 years ago)
Author:
geethike
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/FW

    v19 v20  
    344344Nginx Full (v6)            ALLOW       Anywhere (v6)       
    345345}}}
     346
     347This output indicates that the '''Nginx Full''' application profile is currently enabled, allowing any and all connections to the web server both via HTTP as well as via HTTPS. If you’d want to only allow HTTPS requests from and to your web server, you’d have to first enable the most restrictive rule, which in this case would be '''Nginx HTTPS''', and then disable the currently active '''Nginx Full''' rule:
     348{{{
     349sudo ufw allow "Nginx HTTPS"
     350sudo ufw delete allow "Nginx Full"
     351}}}
     352
     353'''Allow SSH'''
     354
     355When working with remote servers, you’ll want to make sure that the SSH port is open to connections so that you are able to log in to your server remotely.
     356
     357The following command will enable the OpenSSH UFW application profile and allow all connections to the default SSH port on the server:
     358{{{
     359sudo ufw allow OpenSSH
     360}}}
     361Although less user-friendly, an alternative syntax is to specify the exact port number of the SSH service, which is typically set to 22 by default:
     362{{{
     363sudo ufw allow 22
     364}}}
     365'''Allow Incoming SSH from Specific IP Address or Subnet'''
     366
     367To allow incoming connections from a specific IP address or subnet, you’ll include a from directive to define the source of the connection. This will require that you also specify the destination address with a to parameter. To lock this rule to SSH only, you’ll limit the proto (protocol) to tcp and then use the port parameter and set it to 22, SSH’s default port.
     368
     369The following command will allow only SSH connections coming from the IP address 203.0.113.103:
     370{{{
     371sudo ufw allow from 203.0.113.103 proto tcp to any port 22
     372}}}
     373You can also use a subnet address as from parameter to allow incoming SSH connections from an entire network:
     374{{{
     375sudo ufw allow from 203.0.113.0/24 proto tcp to any port 22
     376}}}
     377'''Allow Nginx HTTP / HTTPS'''
     378
     379Upon installation, the Nginx web server sets up a few different UFW profiles within the server. Once you have Nginx installed and enabled as a service, run the following command to identify which profiles are available:
     380{{{
     381sudo ufw app list | grep Nginx
     382}}}
     383{{{
     384Output
     385  Nginx Full
     386  Nginx HTTP
     387  Nginx HTTPS
     388}}}
     389To enable both HTTP and HTTPS traffic, choose '''''Nginx Full'''''. Otherwise, choose either '''''Nginx HTTP''''' to allow only HTTP or '''''Nginx HTTPS''''' to allow only HTTPS.
     390
     391The following command will allow both HTTP and HTTPS traffic on the server (ports 80 and 443):
     392{{{
     393sudo ufw allow "Nginx Full"
     394}}}
     395'''Allow All Incoming HTTP and HTTPS'''
     396
     397If you want to allow both HTTP and HTTPS traffic, you can create a single rule that allows both ports. This usage requires that you also define the protocol with the proto parameter, which in this case should be set to tcp.
     398
     399To allow all incoming HTTP and HTTPS (ports 80 and 443) connections, run:
     400{{{
     401sudo ufw allow proto tcp from any to any port 80,443
     402}}}
     403
     404'''Allow MySQL Connection from Specific IP Address or Subnet'''
     405
     406MySQL listens for client connections on port 3306. If your MySQL database server is being used by a client on a remote server, you’ll need to create a UFW rule to allow that access.
     407
     408To allow incoming MySQL connections from a specific IP address or subnet, use the from parameter to specify the source IP address and the port parameter to set the destination port 3306.
     409
     410The following command will allow the IP address 203.0.113.103 to connect to the server’s MySQL port:
     411{{{
     412sudo ufw allow from 203.0.113.103 to any port 3306
     413}}}
     414To allow the entire 203.0.113.0/24 subnet to be able to connect to your MySQL server, run:
     415{{{
     416sudo ufw allow from 203.0.113.0/24 to any port 3306
     417}}}