главная - Статьи - Microsoft Windows - Прокси-сервер 3proxy
Примеры конфигов или опций 3proxy
Дата обновления: 16.04.2025Несмотря на возраст, 3proxy живет и пользуется спросом. Совсем недавно ко мне обратился человек с вопросом по 3proxy. Пока искал ответ, нашел несколько примеров конфигурационных файлов и комментарии к опциям конфига. Предлагаю частичный перевод, буду "допереводить" по мере времени.
DNS
Указать кастомные DNS-серверы:
nserver 10.1.2.1
nserver 10.2.2.2
Размер кеша положительно влияет на быстродействие:
nscache 65536
DNS-бан. А если какое-то домен не нужно передавать клиентам:
nsrecord evil.domain.name 0.0.0.0
И никто не получит доступа к этому домену.
Резолв
А если так:
nsrecord www.bozza.ru mirror.bozza.ru
то www.bozza.ru будет резолвится в mirror.bozza.ru.
dnspr
- слушает UDP/53 порт и отвечает клиентам. Требует настройки nserver/nscache.
Демоны
Создать "демона" в linux:
daemon
Создать "демона" (службу) в Windows:
service
Лог-файл
Укажем лог-файл, а опция D укажет на ежедневную ротацию:
log c:\3proxy\logs\3proxy.log D
Указав архиватор, скажем сжимать логи после закрытия:
#archiver gz /bin/gzip %F
#archiver zip zip -m -qq %A %F
#archiver zip pkzipc -add -silent -move %A %F
archiver rar rar a -df -inul %A %F
%A - имя файла архива, %f - оригинальное имя файла.
Хранить последние 30 лог-файлов:
rotate 30
Ограничение доступа
Ограничить доступ по:
По ip:
auth iponly
По netbios name:
auth nbname
По паролю:
auth strong
В режиме nbname proxy пошлет NetBIOS запрос на порт UDP/137 клиента, чтобы уточнить NetBIOS-имя.
Это попозже переведу, но в общем, и так понятно:
#allow ADMINISTRATOR,root
#allow * 127.0.0.1,192.168.1.1 * *
#parent 1000 http 192.168.1.2 80 * * * 80
#allow * 192.168.1.0/24 * 25,53,110,20-21,1024-65535
# we will allow everything if username matches ADMINISTRATOR or root or
# client ip is 127.0.0.1 or 192.168.1.1. Overwise we will redirect any request
# to port 80 to our Web-server 192.168.0.2.
# We will allow any outgoing connections from network 192.168.1.0/24 to
# SMTP, POP3, FTP, DNS and unprivileged ports.
# Note, that redirect may also be used with proxy or portmapper. It will
# allow you to redirect requests to different ports or different server
# for different clients.
# sharing access to internet
external 10.1.1.1
# external is address 3proxy uses for outgoing connections. 0.0.0.0 means any
# interface. Using 0.0.0.0 is not good because it allows to connect to 127.0.0.1
internal 192.168.1.1
# internal is address of interface proxy will listen for incoming requests
# 127.0.0.1 means only localhost will be able to use this proxy. This is
# address you should specify for clients as proxy IP.
# You MAY use 0.0.0.0 but you shouldn't, because it's a chance for you to
# have open proxy in your network in this case.
auth none
# no authentication is requires
#external $./external.ip
#internal $./internal.ip
# this is just an alternative form fo giving external and internal address
# allows you to read this addresses from files
auth strong
# We want to protect internal interface
deny * * 127.0.0.1,192.168.1.1
# and llow HTTP and HTTPS traffic.
allow * * * 80-88,8080-8088 HTTP
allow * * * 443,8443 HTTPS
proxy -n
auth none
# pop3p will be used without any authentication. It's bad choice
# because it's possible to use pop3p to access any port
pop3p
Разное
Портмаппинг:
tcppm 25 mail.my.provider 25
#udppm -s 53 ns.my.provider 53
# we can portmap port TCP/25 to provider's SMTP server and UDP/53
# to provider's DNS.
# Now we can use our proxy as SMTP and DNS server.
# -s switch for UDP means "single packet" service - instead of setting
# association for period of time association will only be set for 1 packet.
# It's very userfull for services like DNS but not for some massive services
# like multimedia streams or online games.
Конфиг:
- аутентификация по паролю для двух пользователей для доступа к socks
auth strong
flush
allow 3APA3A,test
maxconn 20
socks
Конфиг:
- разрешить доступ только к admin-интерфейсу пользователю 3APA3A и только с 127.0.0.1.
- но мало того, еще и ожидать подключениябудет только на 127.0.0.1.
auth strong
flush
internal 127.0.0.1
allow 3APA3A 127.0.0.1
maxconn 3
admin
# map external 80 and 443 ports to internal Web server
# examples below show how to use 3proxy to publish Web server in internal
# network to Internet. We must switch internal and external addresses and
# flush any ACLs
#auth none
#flush
#external $./internal.ip
#internal $./external.ip
#maxconn 300
#tcppm 80 websrv 80
#tcppm 443 websrv 443
#chroot /usr/local/jail
#setgid 65535
#setuid 65535
# now we needn't any root rights. We can chroot and setgid/setuid.
Источник: github.com
Авторизуйтесь для добавления комментариев!

Принимаю заказы на настройку серверов, mikrotik и других роутеров, точек доступа, nginx и т.п. В пределах Санкт-Петербурга возможен выезд к заказчику. См. контакты.