1 00:00:00,05 --> 00:00:02,01 - [Instructor] Let's install Squid 2 00:00:02,01 --> 00:00:04,00 and block a website. 3 00:00:04,00 --> 00:00:17,00 Type sudo apt-get install squid. 4 00:00:17,00 --> 00:00:19,03 Press Enter. 5 00:00:19,03 --> 00:00:21,01 Type Y. 6 00:00:21,01 --> 00:00:25,07 And press Enter. 7 00:00:25,07 --> 00:00:28,08 To specify which site to block, 8 00:00:28,08 --> 00:00:31,08 we need to edit the configuration file. 9 00:00:31,08 --> 00:00:38,02 Type cd /etc/squid/. 10 00:00:38,02 --> 00:00:40,05 Press Enter. 11 00:00:40,05 --> 00:00:48,05 Type ls and squid.conf is the configuration file. 12 00:00:48,05 --> 00:00:53,00 Now type sudo nano 13 00:00:53,00 --> 00:00:56,03 squid.conf. 14 00:00:56,03 --> 00:00:58,07 Press Enter. 15 00:00:58,07 --> 00:01:04,00 Press Control and W together to do a search. 16 00:01:04,00 --> 00:01:12,05 Type url_regex. 17 00:01:12,05 --> 00:01:19,08 Press Enter. 18 00:01:19,08 --> 00:01:22,05 Let's add our rule here. 19 00:01:22,05 --> 00:01:26,04 Type acl space 20 00:01:26,04 --> 00:01:27,08 banned, 21 00:01:27,08 --> 00:01:33,01 B-A-N-N-E-D, space, 22 00:01:33,01 --> 00:01:38,08 url_regex. 23 00:01:38,08 --> 00:01:44,04 Here regex stands for regular expression used 24 00:01:44,04 --> 00:01:47,08 to specify search patterns. 25 00:01:47,08 --> 00:01:53,00 Our search pattern is a portion of a URL. 26 00:01:53,00 --> 00:01:56,00 We use the label banned 27 00:01:56,00 --> 00:01:58,00 to name this rule. 28 00:01:58,00 --> 00:02:02,08 We'll be using a file to store the banned URLs. 29 00:02:02,08 --> 00:02:07,04 Therefore, we need to specify where the file is. 30 00:02:07,04 --> 00:02:10,07 Type a double quotation mark. 31 00:02:10,07 --> 00:02:16,01 /etc/squid/ 32 00:02:16,01 --> 00:02:22,08 and then the name of the file, blocked. 33 00:02:22,08 --> 00:02:25,08 And close the double quotation mark. 34 00:02:25,08 --> 00:02:33,03 Now find a line that says insert your own rules. 35 00:02:33,03 --> 00:02:43,05 And add http_access deny 36 00:02:43,05 --> 00:02:46,06 space banned. 37 00:02:46,06 --> 00:02:53,08 Let's save the file by pressing Control and X together. 38 00:02:53,08 --> 00:02:55,08 Type Y. 39 00:02:55,08 --> 00:02:57,07 Press Enter. 40 00:02:57,07 --> 00:03:00,09 Next, let's create our file 41 00:03:00,09 --> 00:03:04,08 that contains the list of blocked sites. 42 00:03:04,08 --> 00:03:07,05 Type sudo 43 00:03:07,05 --> 00:03:10,08 nano space 44 00:03:10,08 --> 00:03:14,07 the name of the file, blocked. 45 00:03:14,07 --> 00:03:16,08 Press Enter. 46 00:03:16,08 --> 00:03:24,04 Type .microsoft.com. 47 00:03:24,04 --> 00:03:26,09 Based on this regular expression, 48 00:03:26,09 --> 00:03:30,01 our proxy server Squid will block 49 00:03:30,01 --> 00:03:36,06 whatever domain name ending with .microsoft.com. 50 00:03:36,06 --> 00:03:38,00 Let's save the file. 51 00:03:38,00 --> 00:03:41,03 Press Control and X together. 52 00:03:41,03 --> 00:03:43,02 Type Y. 53 00:03:43,02 --> 00:03:45,01 Press Enter. 54 00:03:45,01 --> 00:03:48,09 Now let's restart Squid 55 00:03:48,09 --> 00:03:52,06 to use the updated configuration file. 56 00:03:52,06 --> 00:04:00,03 Type sudo systemctl 57 00:04:00,03 --> 00:04:03,08 restart 58 00:04:03,08 --> 00:04:06,00 squid. 59 00:04:06,00 --> 00:04:07,09 Press Enter. 60 00:04:07,09 --> 00:04:11,07 If you didn't have any typos in the configuration file, 61 00:04:11,07 --> 00:04:16,05 this will go without any errors. 62 00:04:16,05 --> 00:04:19,03 Yes, success. 63 00:04:19,03 --> 00:04:26,01 Now, open a web browser, click on the gear icon, 64 00:04:26,01 --> 00:04:30,02 type proxy in the search field. 65 00:04:30,02 --> 00:04:33,03 Click on Settings. 66 00:04:33,03 --> 00:04:37,09 Choose manual proxy configuration. 67 00:04:37,09 --> 00:04:42,07 Our proxy server is the localhost. 68 00:04:42,07 --> 00:04:45,08 The port number we're using here 69 00:04:45,08 --> 00:04:49,05 is the default port number for the proxy servers, 70 00:04:49,05 --> 00:04:54,00 which is 3128. 71 00:04:54,00 --> 00:04:57,07 Click on OK. 72 00:04:57,07 --> 00:05:07,04 Let's try to visit World Wide Web .microsoft.com 73 00:05:07,04 --> 00:05:09,09 and see what happens. 74 00:05:09,09 --> 00:05:12,07 As you can see, our access attempt 75 00:05:12,07 --> 00:05:16,00 is being blocked by the proxy server.