1. 설치 조건
1) Linux OS : 데비안 9 이상 / Ubuntu 18.04 이상 (루트 계정 설정)
2)접속 도구
Linux / macOS - OpenSSH 등
Windows - putty 또는 Proxifier 등
2. Dante 설치
1)APT install
//Debian 9/Ubuntu 18.04
#apt update
#apt install dante-server
2)Dante 버전 확인
// Debian 9
# danted -v
Dante v1.4.1
// Ubuntu 18.04
# danted -v
Dante v1.4.2
3. Dante-sever 시작하기
1) 네트워크 상태 확인
#ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:06:d1:d0 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.1 scope global ens33
valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:06:d1:d0 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.2/24 brd 10.0.0.2 scope global ens34
valid_lft forever preferred_lft forever
ip a 명령어로 네트워크 상태를 확인합니다.
네트워크 이름은 다를 수 있습니다. ens가 아니어도 괜찮습니다. 예제는 2개의 이더넷이 연결되어 있습니다.
2) 구성
구성을 변경하기 전에 conf 파일을 백업합니다.
#mv /etc/danted.conf /etc/danted.conf.old
nano로 Danted.conf를 엽니다.
#nano /etc/danted.conf
아래 구성을 참고하여 수정하거나 전체를 복사하여 붙여 넣습니다.
internal: ens33 port = 1080
external: ens33
internal: ens34 port = 1080
external: ens34
clientmethod: none
socksmethod: none
user.privileged: root
user.notprivileged: nobody
external.rotation: same-same
logoutput: /var/log/socks.log
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
Danted를 시작하고 상태를 확인합니다.위 예시는 ens33 ens34 인터페이스를 모두 사용한 예제입니다. socks5의 포트는 1080을 사용했습니다.
#systemctl start danted
#systemctl status danted
3) Socks5 접속 테스트
명령어
#curl -x socks5://<접속할 아이피>:<접속할 포트> ifconfig.co
예제
# curl -x socks5://10.0.0.1:1080 ifconfig.co
10.0.0.1
Dante-server를 이용해 누구나 접근 가능한 Socks5 프록시 서버 구성을 완료하였습니다.
4. SOCKS5 접속 제한하기
보안을 위해 아이피를 제한하거나 계정을 설정할 수 있습니다.
1)리눅스 로그인 계정으로만 접속 가능하도록 SOCKS5 접속 제한하기
nano로 Danted.conf를 엽니다.
#nano /etc/danted.conf
socksmethod: none 을 username으로 수정
socksmethod: username
저장 후 Danted 재시작
#systemctl restart danted
계정 없이 Socks5 접속 테스트
# curl -x socks5://10.0.0.1:1080 ifconfig.co
curl: (7) No authentication method was acceptable. (It is quite likely that the SOCKS5 server wanted a username/password, since none was supplied to the server on this connection.)
리눅스 계정으로 Socks5 접속 테스트
# curl -x socks5://user:password@10.0.0.1:1080 ifconfig.co
10.0.0.1
2) 아이피로 제한하기
nano로 Danted.conf를 엽니다.
#nano /etc/danted.conf
client pass에 접속을 허용할 아이피를 설정합니다.
client pass {
from: xxx.xxx.xxx.1/xx to: 0.0.0.0/0
log: error connect disconnect
}
아래와 같이여러 클라이언트를 추가할 수 있습니다.
client pass {
from: xxx.xxx.xxx.1/xx to: 0.0.0.0/0
log: error connect disconnect
}
client pass {
from: xxx.xxx.xxx.2/xx to: 0.0.0.0/0
log: error connect disconnect
}
저장 후 Danted 재시작
#systemctl restart danted
리눅스 계정 또는 IP주소를 제한하여 Socks5 프록시 서버 구성을 완료하였습니다.
'취미│Back-End > SERVER' 카테고리의 다른 글
클라우드 플레어 적용시 방문자의 실제 IP로 변환해주는 mod_remoteip (Linux/Apache) (0) | 2021.03.31 |
---|---|
가상머신(버츄얼박스, Vmware)에 우분투 리눅스 데스크탑 버전 설치하기 (0) | 2021.01.17 |
vmware에 우분투 서버버전(Ubuntu Server 20.04.1 LTS) 설치 (0) | 2021.01.12 |