How To Setup SOCKS5 Proxy Server
Ubuntu 18.04 пакеты в репозитарии
# apt update
# apt upgrade
# apt install mc
# adduser user
# usermod -aG sudo user
# su user
$ cd ~
$ mkdir ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa
Скачать и использовать для входа /home/user/.ssh/id_rsa
$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
$ rm ~/.ssh/id_rsa.pub
$ rm ~/.ssh/id_rsa
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys
$ exit
# nano /etc/ssh/sshd_config
Проверить:
PasswordAuthentication no
.....
PubkeyAuthentication yes
ChallengeResponseAuthentication no
Сохранить.
$ sudo systemctl reload sshd
После проверки входа и sudo
Отключть вход root по ssh
$ sudo nano /etc/ssh/sshd_config
Исправить:
PermitRootLogin no
Сохранить.
$ sudo systemctl reload sshd
# отключим ipv6
$ sudo /bin/su -c "echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf"
$ sudo /bin/su -c "echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf"
$ sudo /bin/su -c "echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf"
#sudo /bin/su -c "echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf"
$ sudo sysctl -p
$ sudo apt update
$ sudo apt install dante-server
$ ip a
inet X.X.X.X/24 brd X.X.X.255 scope global ens3
Использовать ens3!
external: ens3
$ sudo nano /etc/danted.conf
logoutput: syslog stdout /var/log/sockd.log
user.privileged: root
internal: 0.0.0.0 port = 443
external: ens3
socksmethod: username
clientmethod: none
user.libwrap: nobody
client pass {
from: 0/0 to: 0/0
log: connect disconnect error
}
socks pass {
from: 0/0 to: 0/0
log: connect disconnect error
}
Сохранить.
$ sudo adduser --system --no-create-home --disabled-login --group proxyuser
Adding system user `proxyuser' (UID 107) ...
Adding new group `proxyuser' (GID 112) ...
Adding new user `proxyuser' (UID 107) with group `proxyuser' ...
Not creating home directory `/home/proxyuser'.
$ sudo passwd proxyuser
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
$ sudo systemctl restart danted
$ sudo systemctl status danted
Jun 15 20:20:22 82567 systemd[1]: Starting SOCKS (v4 and v5) proxy daemon (danted)...
Jun 15 20:20:22 82567 systemd[1]: danted.service: Failed to parse PID from file /var/run/danted.pid: Invalid argument
Jun 15 20:20:22 82567 danted[3379]: info: Dante/server[1/1] v1.4.2 running
Jun 15 20:20:22 82567 systemd[1]: Started SOCKS (v4 and v5) proxy daemon (danted).
взято здесь
$ sudo nano /lib/systemd/system/danted.service
Закомментировать:
#PIDFile=/var/run/danted.pid
Добавить после:
ExecStopPost=/bin/rm -f /var/run/danted.pid
Сохранить.
$ sudo systemctl daemon-reload
$ sudo systemctl restart danted
$ sudo systemctl status danted
$ sudo systemctl enable danted
В firefox ставим расширение
https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-standard
Ubuntu 18.04 пакеты в репозитарии
# apt update
# apt upgrade
# apt install mc
# adduser user
# usermod -aG sudo user
# su user
$ cd ~
$ mkdir ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa
Скачать и использовать для входа /home/user/.ssh/id_rsa
$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
$ rm ~/.ssh/id_rsa.pub
$ rm ~/.ssh/id_rsa
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys
$ exit
# nano /etc/ssh/sshd_config
Проверить:
PasswordAuthentication no
.....
PubkeyAuthentication yes
ChallengeResponseAuthentication no
Сохранить.
$ sudo systemctl reload sshd
После проверки входа и sudo
Отключть вход root по ssh
$ sudo nano /etc/ssh/sshd_config
Исправить:
PermitRootLogin no
Сохранить.
$ sudo systemctl reload sshd
# отключим ipv6
$ sudo /bin/su -c "echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf"
$ sudo /bin/su -c "echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf"
$ sudo /bin/su -c "echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf"
#sudo /bin/su -c "echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf"
$ sudo sysctl -p
$ sudo apt update
$ sudo apt install dante-server
$ ip a
inet X.X.X.X/24 brd X.X.X.255 scope global ens3
Использовать ens3!
external: ens3
$ sudo nano /etc/danted.conf
logoutput: syslog stdout /var/log/sockd.log
user.privileged: root
internal: 0.0.0.0 port = 443
external: ens3
socksmethod: username
clientmethod: none
user.libwrap: nobody
client pass {
from: 0/0 to: 0/0
log: connect disconnect error
}
socks pass {
from: 0/0 to: 0/0
log: connect disconnect error
}
Сохранить.
$ sudo adduser --system --no-create-home --disabled-login --group proxyuser
Adding system user `proxyuser' (UID 107) ...
Adding new group `proxyuser' (GID 112) ...
Adding new user `proxyuser' (UID 107) with group `proxyuser' ...
Not creating home directory `/home/proxyuser'.
$ sudo passwd proxyuser
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
$ sudo systemctl restart danted
$ sudo systemctl status danted
Jun 15 20:20:22 82567 systemd[1]: Starting SOCKS (v4 and v5) proxy daemon (danted)...
Jun 15 20:20:22 82567 systemd[1]: danted.service: Failed to parse PID from file /var/run/danted.pid: Invalid argument
Jun 15 20:20:22 82567 danted[3379]: info: Dante/server[1/1] v1.4.2 running
Jun 15 20:20:22 82567 systemd[1]: Started SOCKS (v4 and v5) proxy daemon (danted).
взято здесь
$ sudo nano /lib/systemd/system/danted.service
Закомментировать:
#PIDFile=/var/run/danted.pid
Добавить после:
ExecStopPost=/bin/rm -f /var/run/danted.pid
Сохранить.
$ sudo systemctl daemon-reload
$ sudo systemctl restart danted
$ sudo systemctl status danted
$ sudo systemctl enable danted
В firefox ставим расширение
https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-standard
Комментариев нет:
Отправить комментарий