1 00:00:00,000 --> 00:00:13,600 In this video you'll learn about UFW. UFW is Uncomplicated Firewall and it was developed 2 00:00:13,600 --> 00:00:19,480 to work with an intuitive syntax. It's a default that you will find on Ubuntu. Let's go to 3 00:00:19,480 --> 00:00:24,160 an Ubuntu server where I can show you how to work with it. So for this demo as you can 4 00:00:24,160 --> 00:00:33,840 see we are on an Ubuntu server. And a fun, complicating part is that I'm on SSH. So yeah, 5 00:00:33,840 --> 00:00:40,680 what are we going to do? Well, I want to check if UFW is currently available. So I'm using 6 00:00:40,680 --> 00:00:52,959 sudo ufw status. And there we can see that UFW is inactive. Well, I want to enable it. 7 00:00:52,959 --> 00:01:01,919 So sudo ufw enable. And oh boy, may disrupt existing SSH connection. Proceed with operation. 8 00:01:01,919 --> 00:01:11,320 Let's not do that. And let's do the smart thing and first use sudo ufw allow ssh. I want to make 9 00:01:11,320 --> 00:01:16,639 sure that we have a rule for SSH before I'm going to enable the firewall. And then I'm going to 10 00:01:16,639 --> 00:01:23,360 reset. And now we can see firewall is active and enabled on system startup. UFW status should show 11 00:01:23,519 --> 00:01:33,639 that at this moment. As you can see, port 22 is allowed over IPv4 as well as v6. Next, do I really 12 00:01:33,639 --> 00:01:45,519 want to sudo ufw reject out SSH? No, I don't want to do that. I want to do ufw reject out FTP. No 13 00:01:45,519 --> 00:01:52,800 FTP outgoing traffic. I'm not going to try to cut off the branch on which I'm sitting. So that is 14 00:01:52,800 --> 00:02:01,239 why I'm using FTP as I'm not using it anyway. So sudo ufw status is showing the reject out for FTP. 15 00:02:01,559 --> 00:02:10,320 And if you regret, you can always use sudo ufw delete reject out FTP. As you can see, the syntax 16 00:02:10,320 --> 00:02:17,000 is quite straightforward. But even if the syntax is straightforward, you can do pretty advanced 17 00:02:17,000 --> 00:02:30,080 things as well like sudo ufw deny proto TCP from 10.0.0.10 to any port 22. So what is that doing? 18 00:02:30,119 --> 00:02:40,000 Well, let's go back to sudo ufw status. And we can see that we have denied to port 22 for 10.0.0.10. 19 00:02:40,360 --> 00:02:47,279 So that is how you can deny one IP address or if you want to an entire network access to a specific 20 00:02:47,279 --> 00:02:57,960 port. Next, I'm going to show you sudo ufw app list because ufw can work with applications. But 21 00:02:57,960 --> 00:03:04,839 this application needs to be installed. And well, we see one only. And I can request information 22 00:03:04,839 --> 00:03:16,399 about it you using sudo ufw app info open SSH. And there we can see what it is doing its short 23 00:03:16,399 --> 00:03:21,919 description. So you can work with apps and you can work with ports. And if you want more 24 00:03:21,919 --> 00:03:28,720 information, sudo ufw logging on might be convenient that is going to enable logging so that 25 00:03:28,720 --> 00:03:34,639 you can find extensive information about firewall access, as well as blocks that might be helpful in 26 00:03:34,639 --> 00:03:43,080 troubleshooting. Finally, the man page for ufw is giving all the information about what you can do. 27 00:03:43,919 --> 00:03:50,160 Now man ufw is giving information about all the different syntax components. And based on that, you 28 00:03:50,160 --> 00:03:53,360 should be able to build yourself a pretty serious firewall.