forked from preetam221/proxy-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy-server-setup.sh
76 lines (66 loc) · 2.59 KB
/
proxy-server-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Update Package repositories
sudo apt-get update
# Upgrade the system
sudo apt-get full-upgrade -y
# Install required packages
sudo apt-get install -y tinyproxy sed figlet wget
# Configure the server
sudo systemctl enable tinyproxy.service
sudo cp /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.conf.default
sudo sed -i 's/Port 8888/Port 443/g' /etc/tinyproxy/tinyproxy.conf
sudo sed -i 's/Allow 127.0.0.1/#Allow 127.0.0.1/g' /etc/tinyproxy/tinyproxy.conf
sudo sed -i 's/Allow ::1/#Allow ::1/g' /etc/tinyproxy/tinyproxy.conf
sudo sed -i 's/#DisableViaHeader Yes/DisableViaHeader Yes/g' /etc/tinyproxy/tinyproxy.conf
sudo sed -i 's/ViaProxyName "tinyproxy"/ViaProxyName "airtel"/g' /etc/tinyproxy/tinyproxy.conf
sudo echo "#
# MinSpareServers/MaxSpareServers: These settings set the upper and
# lower limit for the number of spare servers that should be available.
#
# If the number of spare servers falls below MinSpareServers then new
# server processes will be spawned. If the number of servers exceeds
# MaxSpareServers then the extras will be killed off.
#
MinSpareServers 20
MaxSpareServers 50
#
# StartServers: The number of servers to start initially.
#
StartServers 20
#
# MaxRequestsPerChild: The number of connections a thread will handle
# before it is killed. In practise this should be set to 0, which
# disables thread reaping. If you do notice problems with memory
# leakage, then set this to something like 10000.
#
MaxRequestsPerChild 1000" >> /etc/tinyproxy/tinyproxy.conf
sudo systemctl restart tinyproxy.service
# Edit DNS
sudo cp /etc/systemd/resolved.conf /etc/systemd/resolved.conf.default
sudo sed -i 's/#DNS=/DNS=8.8.4.4/g' /etc/systemd/resolved.conf
sudo sed -i 's/#FallbackDNS=/FallbackDNS=8.8.8.8/g' /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved
sudo mv /etc/resolv.conf /etc/resolv.conf.default
sudo echo "## Google Public DNS
#IPv4 nameservers
nameserver 8.8.4.4
nameserver 8.8.8.8
#IPv6 Nameservers
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888" >> /etc/resolv.conf
# Disable IPv6
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
# Disable IPv6 on startup
sudo echo "[Unit]
Description=Startup Script
[Service]
ExecStart=sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
[Install]
WantedBy=multi-user.target" >> /lib/systemd/system/startup.service
sudo systemctl enable startup.service
# Success Message
figlet SUCCESS.
echo You can now connect to your proxy using the credentials below:
echo Address: $(wget -qO- ipinfo.io/ip)
echo Port: 443