Как установить и настроить частный анонимный прокси-сервер Squid на базе Linux Ubuntu/Debian

Proxy

Задача: установить и настроить частный анонимный прокси-сервер Squid на базе Linux Ubuntu/Debian.

Видео инструкция на нашем YouTube канале:

 

Итак поехали, у нас система:

[email protected]:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
[email protected]:~#

 

Обновим репозиторий нашей системы:

[email protected]:~# apt-get update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Get:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease [107 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu xenial/universe i386 Packages [7,512 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu xenial/multiverse i386 Packages [140 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 Packages [813 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu xenial-updates/main Translation-en [376 kB]
Get:11 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe i386 Packages [682 kB]
Get:12 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe Translation-en [309 kB]
Get:13 http://mirrors.digitalocean.com/ubuntu xenial-updates/multiverse i386 Packages [15.8 kB]
Get:14 http://mirrors.digitalocean.com/ubuntu xenial-updates/multiverse Translation-en [8,440 B]
Get:15 http://mirrors.digitalocean.com/ubuntu xenial-backports/main i386 Packages [7,288 B]
Get:16 http://mirrors.digitalocean.com/ubuntu xenial-backports/main Translation-en [4,456 B]
Get:17 http://mirrors.digitalocean.com/ubuntu xenial-backports/universe i386 Packages [7,488 B]
Get:18 http://mirrors.digitalocean.com/ubuntu xenial-backports/universe Translation-en [4,184 B]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [530 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [261 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [377 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [175 kB]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/multiverse i386 Packages [5,764 B]
Get:24 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,676 B]
Fetched 16.0 MB in 6s (2,624 kB/s)
Reading package lists... Done
[email protected]:~#

 

Обновляем пакеты:



[email protected]:~# apt-get dist-upgrade
Reading package lists... 0%
Reading package lists... 100%
Reading package lists... Done
Building dependency tree... 0%
Building dependency tree... 0%
Building dependency tree... 50%
Building dependency tree... 50%
Building dependency tree
Reading state information... 0%
Reading state information... 5%
Reading state information... Done
Calculating upgrade... 0%
Calculating upgrade... 10%
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-4.4.0-145 linux-headers-4.4.0-145-generic linux-image-4.4.0-145-generic linux-modules-4.4.0-145-generic
The following packages will be upgraded:
apt apt-transport-https apt-utils busybox-initramfs busybox-static grub-common grub-pc grub-pc-bin grub2-common libapt-inst2.0 libapt-pkg5.0 libpam-systemd
libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libsystemd0 libudev1 linux-headers-generic linux-headers-virtual linux-image-virtual
linux-virtual ntfs-3g policykit-1 rsyslog snapd systemd systemd-sysv ubuntu-core-launcher udev
29 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 51.8 MB of archives.
After this operation, 127 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
0% [Working]

Get:1 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libapt-pkg5.0 i386 1.2.31 [752 kB]
0% [1 libapt-pkg5.0 0 B/752 kB 0%]

2% [Working]

Get:2 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libapt-inst2.0 i386 1.2.31 [57.5 kB]
2% [2 libapt-inst2.0 0 B/57.5 kB 0%]

2% [Working]

Get:3 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 apt i386 1.2.31 [1,104 kB]
2% [3 apt 0 B/1,104 kB 0%]

5% [Working]

Get:4 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 apt-utils i386 1.2.31 [205 kB]
5% [4 apt-utils 0 B/205 kB 0%]

6% [Working]

Get:5 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 systemd-sysv i386 229-4ubuntu21.19 [11.3 kB]
6% [5 systemd-sysv 0 B/11.3 kB 0%]

6% [Working]

Get:6 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libpam-systemd i386 229-4ubuntu21.19 [123 kB]
6% [6 libpam-systemd 0 B/123 kB 0%]

7% [Working]

Get:7 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libsystemd0 i386 229-4ubuntu21.19 [222 kB]
7% [7 libsystemd0 0 B/222 kB 0%]

8% [Working]

Get:8 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 systemd i386 229-4ubuntu21.19 [3,653 kB]
8% [8 systemd 0 B/3,653 kB 0%]

14% [Working]

Get:9 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 udev i386 229-4ubuntu21.19 [1,000 kB]
14% [9 udev 0 B/1,000 kB 0%]

16% [Working]

Get:10 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libudev1 i386 229-4ubuntu21.19 [57.1 kB]
16% [10 libudev1 0 B/57.1 kB 0%]

17% [Working]

Get:11 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 ntfs-3g i386 1:2015.3.14AR.1-1ubuntu0.2 [518 kB]
17% [11 ntfs-3g 0 B/518 kB 0%]

19% [Working]

Get:12 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 grub-pc i386 2.02~beta2-36ubuntu3.21 [198 kB]
19% [12 grub-pc 0 B/198 kB 0%]

19% [Working]

Get:13 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 grub-pc-bin i386 2.02~beta2-36ubuntu3.21 [917 kB]
19% [13 grub-pc-bin 0 B/917 kB 0%]

22% [Working]

Get:14 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 grub2-common i386 2.02~beta2-36ubuntu3.21 [545 kB]
22% [14 grub2-common 0 B/545 kB 0%]

23% [Working]

Get:15 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 grub-common i386 2.02~beta2-36ubuntu3.21 [1,741 kB]
23% [15 grub-common 0 B/1,741 kB 0%]

26% [Working]

Get:16 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 ubuntu-core-launcher i386 2.37.4ubuntu0.1 [1,572 B]
26% [16 ubuntu-core-launcher 0 B/1,572 B 0%]

27% [Working]

Get:17 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 snapd i386 2.37.4ubuntu0.1 [10.5 MB]
27% [17 snapd 0 B/10.5 MB 0%]

44% [Working]

Get:18 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 busybox-initramfs i386 1:1.22.0-15ubuntu1.4 [166 kB]
44% [18 busybox-initramfs 0 B/166 kB 0%]

45% [Working]

Get:19 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 rsyslog i386 8.16.0-1ubuntu3.1 [399 kB]
45% [19 rsyslog 0 B/399 kB 0%]

46% [Working]

Get:20 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 apt-transport-https i386 1.2.31 [28.5 kB]
46% [20 apt-transport-https 0 B/28.5 kB 0%]

46% [Working]

Get:21 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 busybox-static i386 1:1.22.0-15ubuntu1.4 [798 kB]
46% [21 busybox-static 0 B/798 kB 0%]

48% [Working]

Get:22 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libpolkit-gobject-1-0 i386 0.105-14.1ubuntu0.5 [38.5 kB]
48% [22 libpolkit-gobject-1-0 0 B/38.5 kB 0%]

49% [Working]

Get:23 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libpolkit-agent-1-0 i386 0.105-14.1ubuntu0.5 [15.8 kB]
49% [23 libpolkit-agent-1-0 0 B/15.8 kB 0%]

50% [Working]

Get:24 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 libpolkit-backend-1-0 i386 0.105-14.1ubuntu0.5 [41.3 kB]
50% [24 libpolkit-backend-1-0 0 B/41.3 kB 0%]

50% [Working]

Get:25 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-headers-4.4.0-145 all 4.4.0-145.171 [10.0 MB]
50% [25 linux-headers-4.4.0-145 0 B/10.0 MB 0%]

66% [Working]

Get:26 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-headers-4.4.0-145-generic i386 4.4.0-145.171 [803 kB]
66% [26 linux-headers-4.4.0-145-generic 0 B/803 kB 0%]

68% [Working]

Get:27 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-modules-4.4.0-145-generic i386 4.4.0-145.171 [11.0 MB]
68% [27 linux-modules-4.4.0-145-generic 0 B/11.0 MB 0%]

86% [Working]

Get:28 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-image-4.4.0-145-generic i386 4.4.0-145.171 [6,782 kB]
86% [28 linux-image-4.4.0-145-generic 0 B/6,782 kB 0%]

97% [Working]

Get:29 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-virtual i386 4.4.0.145.153 [1,776 B]
97% [29 linux-virtual 0 B/1,776 B 0%]

97% [Working]

Get:30 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-image-virtual i386 4.4.0.145.153 [2,694 B]
97% [30 linux-image-virtual 0 B/2,694 B 0%]

98% [Working]

Get:31 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-headers-virtual i386 4.4.0.145.153 [1,760 B]
98% [31 linux-headers-virtual 0 B/1,760 B 0%]

99% [Working]

Get:32 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 linux-headers-generic i386 4.4.0.145.153 [2,568 B]
99% [32 linux-headers-generic 0 B/2,568 B 0%]

99% [Working]

Get:33 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 policykit-1 i386 0.105-14.1ubuntu0.5 [53.0 kB]
99% [33 policykit-1 0 B/53.0 kB 0%]

100% [Working]

Fetched 51.8 MB in 1s (41.6 MB/s)
Extracting templates from packages: 90%
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54199 files and directories currently installed.)
Preparing to unpack .../libapt-pkg5.0_1.2.31_i386.deb ...
Unpacking libapt-pkg5.0:i386 (1.2.31) over (1.2.29ubuntu0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Setting up libapt-pkg5.0:i386 (1.2.31) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54199 files and directories currently installed.)
Preparing to unpack .../libapt-inst2.0_1.2.31_i386.deb ...
Unpacking libapt-inst2.0:i386 (1.2.31) over (1.2.29ubuntu0.1) ...
Preparing to unpack .../archives/apt_1.2.31_i386.deb ...
Unpacking apt (1.2.31) over (1.2.29ubuntu0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up apt (1.2.31) ...
Installing new version of config file /etc/apt/apt.conf.d/01autoremove ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54208 files and directories currently installed.)
Preparing to unpack .../apt-utils_1.2.31_i386.deb ...
Unpacking apt-utils (1.2.31) over (1.2.29ubuntu0.1) ...
Preparing to unpack .../systemd-sysv_229-4ubuntu21.19_i386.deb ...
Unpacking systemd-sysv (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up systemd-sysv (229-4ubuntu21.19) ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54208 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_229-4ubuntu21.19_i386.deb ...
Unpacking libpam-systemd:i386 (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Preparing to unpack .../libsystemd0_229-4ubuntu21.19_i386.deb ...
Unpacking libsystemd0:i386 (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Setting up libsystemd0:i386 (229-4ubuntu21.19) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54208 files and directories currently installed.)
Preparing to unpack .../systemd_229-4ubuntu21.19_i386.deb ...
Unpacking systemd (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up systemd (229-4ubuntu21.19) ...
addgroup: The group `systemd-journal' already exists as a system group. Exiting.
[/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54208 files and directories currently installed.)
Preparing to unpack .../udev_229-4ubuntu21.19_i386.deb ...
Unpacking udev (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Preparing to unpack .../libudev1_229-4ubuntu21.19_i386.deb ...
Unpacking libudev1:i386 (229-4ubuntu21.19) over (229-4ubuntu21.17) ...
Processing triggers for systemd (229-4ubuntu21.19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Setting up libudev1:i386 (229-4ubuntu21.19) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 54208 files and directories currently installed.)
Preparing to unpack .../ntfs-3g_1%3a2015.3.14AR.1-1ubuntu0.2_i386.deb ...
Unpacking ntfs-3g (1:2015.3.14AR.1-1ubuntu0.2) over (1:2015.3.14AR.1-1ubuntu0.1) ...
Preparing to unpack .../grub-pc_2.02~beta2-36ubuntu3.21_i386.deb ...
Unpacking grub-pc (2.02~beta2-36ubuntu3.21) over (2.02~beta2-36ubuntu3.20) ...
Preparing to unpack .../grub-pc-bin_2.02~beta2-36ubuntu3.21_i386.deb ...
Unpacking grub-pc-bin (2.02~beta2-36ubuntu3.21) over (2.02~beta2-36ubuntu3.20) ...
Preparing to unpack .../grub2-common_2.02~beta2-36ubuntu3.21_i386.deb ...
Unpacking grub2-common (2.02~beta2-36ubuntu3.21) over (2.02~beta2-36ubuntu3.20) ...
Preparing to unpack .../grub-common_2.02~beta2-36ubuntu3.21_i386.deb ...
Unpacking grub-common (2.02~beta2-36ubuntu3.21) over (2.02~beta2-36ubuntu3.20) ...
Preparing to unpack .../ubuntu-core-launcher_2.37.4ubuntu0.1_i386.deb ...
Unpacking ubuntu-core-launcher (2.37.4ubuntu0.1) over (2.37.4) ...
Preparing to unpack .../snapd_2.37.4ubuntu0.1_i386.deb ...
Unpacking snapd (2.37.4ubuntu0.1) over (2.37.4) ...
Preparing to unpack .../busybox-initramfs_1%3a1.22.0-15ubuntu1.4_i386.deb ...
Unpacking busybox-initramfs (1:1.22.0-15ubuntu1.4) over (1:1.22.0-15ubuntu1) ...
Preparing to unpack .../rsyslog_8.16.0-1ubuntu3.1_i386.deb ...
Unpacking rsyslog (8.16.0-1ubuntu3.1) over (8.16.0-1ubuntu3) ...
Preparing to unpack .../apt-transport-https_1.2.31_i386.deb ...
Unpacking apt-transport-https (1.2.31) over (1.2.29ubuntu0.1) ...
Preparing to unpack .../busybox-static_1%3a1.22.0-15ubuntu1.4_i386.deb ...
Unpacking busybox-static (1:1.22.0-15ubuntu1.4) over (1:1.22.0-15ubuntu1) ...
Preparing to unpack .../libpolkit-gobject-1-0_0.105-14.1ubuntu0.5_i386.deb ...
Unpacking libpolkit-gobject-1-0:i386 (0.105-14.1ubuntu0.5) over (0.105-14.1ubuntu0.4) ...
Preparing to unpack .../libpolkit-agent-1-0_0.105-14.1ubuntu0.5_i386.deb ...
Unpacking libpolkit-agent-1-0:i386 (0.105-14.1ubuntu0.5) over (0.105-14.1ubuntu0.4) ...
Preparing to unpack .../libpolkit-backend-1-0_0.105-14.1ubuntu0.5_i386.deb ...
Unpacking libpolkit-backend-1-0:i386 (0.105-14.1ubuntu0.5) over (0.105-14.1ubuntu0.4) ...
Selecting previously unselected package linux-headers-4.4.0-145.
Preparing to unpack .../linux-headers-4.4.0-145_4.4.0-145.171_all.deb ...
Unpacking linux-headers-4.4.0-145 (4.4.0-145.171) ...
Selecting previously unselected package linux-headers-4.4.0-145-generic.
Preparing to unpack .../linux-headers-4.4.0-145-generic_4.4.0-145.171_i386.deb ...
Unpacking linux-headers-4.4.0-145-generic (4.4.0-145.171) ...
Selecting previously unselected package linux-modules-4.4.0-145-generic.
Preparing to unpack .../linux-modules-4.4.0-145-generic_4.4.0-145.171_i386.deb ...
Unpacking linux-modules-4.4.0-145-generic (4.4.0-145.171) ...
Selecting previously unselected package linux-image-4.4.0-145-generic.
Preparing to unpack .../linux-image-4.4.0-145-generic_4.4.0-145.171_i386.deb ...
Unpacking linux-image-4.4.0-145-generic (4.4.0-145.171) ...
Preparing to unpack .../linux-virtual_4.4.0.145.153_i386.deb ...
Unpacking linux-virtual (4.4.0.145.153) over (4.4.0.143.151) ...
Preparing to unpack .../linux-image-virtual_4.4.0.145.153_i386.deb ...
Unpacking linux-image-virtual (4.4.0.145.153) over (4.4.0.143.151) ...
Preparing to unpack .../linux-headers-virtual_4.4.0.145.153_i386.deb ...
Unpacking linux-headers-virtual (4.4.0.145.153) over (4.4.0.143.151) ...
Preparing to unpack .../linux-headers-generic_4.4.0.145.153_i386.deb ...
Unpacking linux-headers-generic (4.4.0.145.153) over (4.4.0.143.151) ...
Preparing to unpack .../policykit-1_0.105-14.1ubuntu0.5_i386.deb ...
Created symlink from /run/systemd/system/polkitd.service to /dev/null.
Unpacking policykit-1 (0.105-14.1ubuntu0.5) over (0.105-14.1ubuntu0.4) ...
Processing triggers for initramfs-tools (0.122ubuntu8.14) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-143-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for systemd (229-4ubuntu21.19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Setting up libapt-inst2.0:i386 (1.2.31) ...
Setting up apt-utils (1.2.31) ...
Setting up libpam-systemd:i386 (229-4ubuntu21.19) ...
Setting up udev (229-4ubuntu21.19) ...
addgroup: The group `input' already exists as a system group. Exiting.
update-initramfs: deferring update (trigger activated)
Setting up ntfs-3g (1:2015.3.14AR.1-1ubuntu0.2) ...
Setting up grub-common (2.02~beta2-36ubuntu3.21) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up grub2-common (2.02~beta2-36ubuntu3.21) ...
Setting up grub-pc-bin (2.02~beta2-36ubuntu3.21) ...
Setting up grub-pc (2.02~beta2-36ubuntu3.21) ...
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-145-generic
Found linux image: /boot/vmlinuz-4.4.0-143-generic
Found initrd image: /boot/initrd.img-4.4.0-143-generic
done
Setting up snapd (2.37.4ubuntu0.1) ...
md5sum: /etc/apparmor.d/usr.lib.snapd.snap-confine: No such file or directory
snapd.failure.service is a disabled or a static unit, not starting it.
snapd.snap-repair.service is a disabled or a static unit, not starting it.
Setting up ubuntu-core-launcher (2.37.4ubuntu0.1) ...
Setting up busybox-initramfs (1:1.22.0-15ubuntu1.4) ...
Setting up rsyslog (8.16.0-1ubuntu3.1) ...
Installing new version of config file /etc/logrotate.d/rsyslog ...
The user `syslog' is already a member of `adm'.
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Setting up apt-transport-https (1.2.31) ...
Setting up busybox-static (1:1.22.0-15ubuntu1.4) ...
Setting up libpolkit-gobject-1-0:i386 (0.105-14.1ubuntu0.5) ...
Setting up libpolkit-agent-1-0:i386 (0.105-14.1ubuntu0.5) ...
Setting up libpolkit-backend-1-0:i386 (0.105-14.1ubuntu0.5) ...
Setting up linux-headers-4.4.0-145 (4.4.0-145.171) ...
Setting up linux-headers-4.4.0-145-generic (4.4.0-145.171) ...
Setting up linux-modules-4.4.0-145-generic (4.4.0-145.171) ...
Setting up linux-image-4.4.0-145-generic (4.4.0-145.171) ...
I: /vmlinuz is now a symlink to boot/vmlinuz-4.4.0-145-generic
I: /initrd.img is now a symlink to boot/initrd.img-4.4.0-145-generic
Setting up linux-image-virtual (4.4.0.145.153) ...
Setting up linux-headers-generic (4.4.0.145.153) ...
Setting up linux-headers-virtual (4.4.0.145.153) ...
Setting up linux-virtual (4.4.0.145.153) ...
Setting up policykit-1 (0.105-14.1ubuntu0.5) ...
Removed symlink /run/systemd/system/polkitd.service.
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for initramfs-tools (0.122ubuntu8.14) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-143-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
Processing triggers for linux-image-4.4.0-145-generic (4.4.0-145.171) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.4.0-145-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
/etc/kernel/postinst.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-4.4.0-143-generic
Found kernel: /boot/vmlinuz-4.4.0-145-generic
Found kernel: /boot/vmlinuz-4.4.0-143-generic
Replacing config file /run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-145-generic
Found initrd image: /boot/initrd.img-4.4.0-145-generic
Found linux image: /boot/vmlinuz-4.4.0-143-generic
Found initrd image: /boot/initrd.img-4.4.0-143-generic
done
[email protected]:~#

 

Так как у нас обновилось ядро Linux, то нужно перегрузить систему:

[email protected]:~# shutdown -r now

 

Установим прокси-сервер Squid3:

[email protected]:~# apt-get install squid3 apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libapr1 libaprutil1 libecap3 libltdl7 squid squid-common squid-langpack ssl-cert
Suggested packages:
squidclient squid-cgi squid-purge smbclient winbindd openssl-blacklist
The following NEW packages will be installed:
apache2-utils libapr1 libaprutil1 libecap3 libltdl7 squid squid-common squid-langpack squid3 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,031 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu xenial/main i386 libecap3 i386 1.0.1-3ubuntu3 [17.3 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu xenial/main i386 libltdl7 i386 2.4.6-0.1 [40.0 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu xenial/main i386 squid-langpack all 20150704-1 [145 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 squid-common all 3.5.12-1ubuntu7.6 [175 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu xenial/main i386 ssl-cert all 1.0.37 [16.9 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 squid i386 3.5.12-1ubuntu7.6 [2,339 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 squid3 all 3.5.12-1ubuntu7.6 [32.5 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu xenial/main i386 libapr1 i386 1.5.2-3 [95.1 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu xenial/main i386 libaprutil1 i386 1.5.4-1build1 [82.7 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu xenial-updates/main i386 apache2-utils i386 2.4.18-2ubuntu3.10 [86.5 kB]
Fetched 3,031 kB in 0s (17.7 MB/s)
Preconfiguring packages ...
Selecting previously unselected package libecap3:i386.
(Reading database ... 82212 files and directories currently installed.)
Preparing to unpack .../libecap3_1.0.1-3ubuntu3_i386.deb ...
Unpacking libecap3:i386 (1.0.1-3ubuntu3) ...
Selecting previously unselected package libltdl7:i386.
Preparing to unpack .../libltdl7_2.4.6-0.1_i386.deb ...
Unpacking libltdl7:i386 (2.4.6-0.1) ...
Selecting previously unselected package squid-langpack.
Preparing to unpack .../squid-langpack_20150704-1_all.deb ...
Unpacking squid-langpack (20150704-1) ...
Selecting previously unselected package squid-common.
Preparing to unpack .../squid-common_3.5.12-1ubuntu7.6_all.deb ...
Unpacking squid-common (3.5.12-1ubuntu7.6) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.37_all.deb ...
Unpacking ssl-cert (1.0.37) ...
Selecting previously unselected package squid.
Preparing to unpack .../squid_3.5.12-1ubuntu7.6_i386.deb ...
Unpacking squid (3.5.12-1ubuntu7.6) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Setting up libecap3:i386 (1.0.1-3ubuntu3) ...
Setting up libltdl7:i386 (2.4.6-0.1) ...
Setting up squid-langpack (20150704-1) ...
Setting up squid-common (3.5.12-1ubuntu7.6) ...
Setting up ssl-cert (1.0.37) ...
Setting up squid (3.5.12-1ubuntu7.6) ...
Skipping profile in /etc/apparmor.d/disable: usr.sbin.squid
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Selecting previously unselected package squid3.
(Reading database ... 84513 files and directories currently installed.)
Preparing to unpack .../squid3_3.5.12-1ubuntu7.6_all.deb ...
Unpacking squid3 (3.5.12-1ubuntu7.6) ...
Selecting previously unselected package libapr1:i386.
Preparing to unpack .../libapr1_1.5.2-3_i386.deb ...
Unpacking libapr1:i386 (1.5.2-3) ...
Selecting previously unselected package libaprutil1:i386.
Preparing to unpack .../libaprutil1_1.5.4-1build1_i386.deb ...
Unpacking libaprutil1:i386 (1.5.4-1build1) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.18-2ubuntu3.10_i386.deb ...
Unpacking apache2-utils (2.4.18-2ubuntu3.10) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up squid3 (3.5.12-1ubuntu7.6) ...
Setting up libapr1:i386 (1.5.2-3) ...
Setting up libaprutil1:i386 (1.5.4-1build1) ...
Setting up apache2-utils (2.4.18-2ubuntu3.10) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
[email protected]:~#

 

На всякий случай делаем резервную копию файла настроек squid3:

[email protected]:/etc/squid# cp squid.conf squid.conf.default

 

Редактируем файл конфигурации пркси сервера Squid3 до такого вида:

vim /etc/squid/squid.conf

# порт на котром доступен прокси
http_port 3128

dns_nameservers 208.67.222.222 208.67.220.220

# авторизация, подробности ниже
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwd
auth_param basic children 5 startup=5 idle=1
auth_param basic realm Welcome to Free VPN Proxy Master
auth_param basic credentialsttl 2 hours

acl all src all
acl Users proxy_auth REQUIRED
# пускать товарища с этого ip без пароля
acl KnownUsers src "/etc/squid3/KnownUsers.acl"

acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT

acl purge method PURGE
acl CONNECT method CONNECT

# доступ только с доверенных ip или по паролю
http_access allow KnownUsers
http_access allow Users

http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
icp_access deny all

# превращаем squid в анонимный прокси
forwarded_for off
header_access From deny all
header_access Server deny all
header_access User-Agent deny all
header_replace User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
header_access Referer deny all
header_replace Referer unknown
header_access WWW-Authenticate deny all
header_access Link deny all
header_access X-Forwarded-For deny all
header_access Via deny all
header_access Cache-Control deny all
# отправять URL источника запроса, многие сайты без него ведут себя некорректно. При параноидальном подходе следует использовать
##header_access Referer deny all

coredump_dir /var/spool/squid3

# Отключаем дисковый кэш полностью
cache_mem 8 MB
cache_dir null /tmp
cache deny all
shutdown_lifetime 5 seconds

# обрезаем логи, хранить лишнюю информацию о нас не нужно
access_log none all
cache_store_log none

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320

 

Запускаем squid3:

[email protected]:/etc/squid# service squid restart

 

Содержимое файла доверенных сетей:

[email protected]:/etc/squid# cat KnownUsers.acl
# KnownUsers
176.38.167.50
176.38.167.49
176.38.167.48
176.38.167.41
213.111.122.3

 

Содержимое файла аутентификации пользователей:

[email protected]:/etc/squid# cat passwd
free:$apr1$cEBF38co$VGRaiNX18nrv/cz.Lelr10

 

Добавляем нового пользователя:

[email protected]:/etc/squid# htpasswd /etc/squid/passwd MC
New password:
Re-type new password:
Adding password for user MC

 

Устанавливаем Pi-Hole

curl -sSL https://install.pi-hole.net | bash

 

 

Вот и все!

 

Спасибо за уделенное время на прочтение статьи!

Если возникли вопросы, задавайте их в комментариях.

Подписывайтесь на обновления нашего блога и оставайтесь в курсе новостей мира инфокоммуникаций!

Чтобы знать больше и выделяться знаниями среди толпы IT-шников, записывайтесь на курсы Ciscoкурсы по кибербезопасности,  полный курс по кибербезопасности от Академии Ciscoкурсы Linux от Linux Professional Institute на платформе SEDICOMM University (Университет СЭДИКОММ).

Курсы Cisco и Linux с трудоустройством!

Спешите подать заявку! Осталось пару мест. Группы стартуют 22 июля, а следующая 19 августа, 23 сентября, 21 октября, 25 ноября, 16 декабря, 20 января, 24 февраля.
Что Вы получите?
  • Поможем стать экспертом в сетевом администрировании и получить международные сертификаты Cisco CCNA Routing & Switching или Linux LPI.
  • Предлагаем проверенную программу и учебник экспертов из Cisco Networking Academy и Linux Professional Institute, сертифицированных инструкторов и личного куратора.
  • Поможем с трудоустройством и сделать карьеру. 100% наших выпускников трудоустраиваются.
Как проходит обучение?
  • Проводим вечерние онлайн-лекции на нашей платформе или обучайтесь очно на базе Киевского офиса.
  • Спросим у вас об удобном времени для практик и подстроимся: понимаем, что времени учиться мало.
  • Если хотите индивидуальный график — обсудим и осуществим.
  • Выставим четкие дедлайны для самоорганизации. Личный куратор будет на связи, чтобы ответить на вопросы, проконсультировать и мотивировать придерживаться сроков сдачи экзаменов.
А еще поможем Вам:
  • отредактировать резюме;
  • подготовиться к техническим интервью;
  • подготовиться к конкурсу на понравившуюся вакансию;
  • устроим на работу в Cisco по программе Cisco Incubator, New Graduate и Experienced. Наши студенты, которые уже работают там: жмите на #НашиВCisco Вконтакте, #НашиВCisco Facebook.
Чтобы учиться на курсах Cisco CCNA Routing & Switching и Linux LPI, подайте заявку или получите бесплатную консультацию.
Proxy

Больше похожих постов

How-to-configure-http-proxy-server-on-CentOS-7

Как настроить http прокси сервер на CentOS 7

354
0
Веб-прокси уже давно существуют и используются миллионами пользователей по всему миру. Они имеют широкий спектр задач, наиболее популярными являются онлайн-анонимность,…

4 комментария. Оставить новый

  • Добрый день!
    Очень интересный мастер-класс. Большое спасибо! Попробовал — все получилось. Зарегистрировался на Digital Ocean ($100 на 60 дней), создал минимальный за $5. Ubuntu 16.04. Все заработало.
    Решил пойти чуть дальше. В Pi-HOLE есть возможность указать свои DNS сервера. Взял OPENDNS, но для регистрации пришлось в UBUNTU прикрутить VNC сервер, FIREFOX и соответственно зайдя туда через VNC клиент ввести в браузере ссылку для активации IP, пришедшую в письме. Все получилось, теперь не только избавился от рекламы но и могу блокировать нужные сайты уже на анонимном прокси-сервере.
    Еще раз большое спасибо!
    Ответить
  • файла squid.conf по ссылке нету
    Ответить
  • […] мы сгенерируем. Меня на эту идею подталкнула другая статья. Прочитав ее, я решил что можно в ней кое что изменить, […]
    Ответить
  • Спасибо, без видоса было непонятно. С видосов все заработало! Еще если детальнее расскажете про настройки сквера будет кул
    Ответить

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Заполните поле
Заполните поле
Пожалуйста, введите корректный адрес email.
Вы должны согласиться с условиями для продолжения

Most Viewed Posts

Результатов не найдено.

Меню