~~~~

~~~~

오픈행사를 하고 싶어요토르라우터.

내 종료 정책은 다음과 유사합니다감소된 종료 정책.

하지만 나는 또한 Tor 네트워크가 내 리소스를 남용하는 것을 어렵게 만들고 싶습니다.

클라이언트가 Tor를 통해 수행하는 것을 방지하고 싶은 경우:

  • 매우 많은 패킷으로 하나의 사이트를 망치는 것입니다.
  • 전체 IP 블록에 대한 공격적인 넷스캔

클라이언트가 Tor를 통해 수행하는 것을 방지하고 싶지 않은 경우:

  • 수백 개의 이미지 파일을 클라우드에 업로드
  • 토렌트 시드하기

제 질문은 이것이 과연 가능하며, 어떻게 할 수 있느냐는 것입니다.

내 첫 번째 생각은 일부 방화벽(Linux/iptables 또는 *BSD/ipfw/pf)이었습니다. 그러나 이는 Onion 라우터의 고유한 속성으로 인해 아마도 쓸모가 없을 것입니다.

이 주제에 대해 진행 중인 torproject 팀 개발이 있습니까?

또한 Tor 출구 노드 보안에 대한 일반적인 힌트도 요청합니다.

업데이트(2012년 9월)

유용한 답변과 다른 연구 결과에 따르면 이것이 불가능하다고 생각합니다.

사람들이 DDOS에 기여하기 위해 출구 노드를 남용하는 것을 막기 위해 할 수 있는 최선의 방법은 하나의 IP로 전달되는 매우 빈번한 패킷을 감지하는 것입니다.

"매우 빈번함" 임계값은 전체 노드 대역폭에 따라 다릅니다. 이것이 틀리면 거짓 긍정이 발생하여 실시간 TCP 앱의 합법적인 트래픽과 매우 많은 클라이언트에서 하나의 대상으로 전달되는 트래픽을 차단합니다.

업데이트(2014년 12월)

내 예측은 분명히 사실이었습니다. 인터넷 제공업체로부터 네트워크 남용에 대한 불만을 여러 차례 받았습니다.

서비스 종료를 방지하기 위해 다음 규칙 세트를 사용해야 했습니다 iptables( ONEW나가는 TCP SYN(일명 NEW) 패킷에 대한 체인입니다.

이것이 충분할지 확신할 수 없지만 여기에는 다음과 같은 내용이 있습니다.

-A ONEW -o lo -j ACCEPT
-A ONEW -p udp --dport 53 -m limit --limit 2/sec --limit-burst 5 -j ACCEPT
-A ONEW -m hashlimit --hashlimit-upto 1/second --hashlimit-mode dstip --hashlimit-dstmask 24 --hashlimit-name ONEW -j ACCEPT
-A ONEW -m limit --limit 1/sec -j LOG --log-prefix "REJECTED: "
-A ONEW -j REJECT --reject-with icmp-admin-prohibited

답변1

다음 사항을 명심하세요.

  • Tor 클라이언트는 10분마다 가상 회로를 현재 이해하는 대로 전환합니다. 이는 소스 IP가 해당 기간에 변경되고 있음을 의미합니다. 해당 기간보다 오랫동안 악의적이라고 간주되는 행동을 방지할 가능성은 거의 없습니다.

  • Tor는 TCP 트래픽만 프록시하고 다른 프로토콜은 프록시하지 않는다는 사실이 남용 가능성을 상당히 제한한다는 점에 유의하세요.

iptables새로운 나가는 TCP 연결을 기존 연결과 다르게 처리할 수 있습니다. 모든 것은 "기존 TCP 연결" 체인을 통과 ESTABLISHED,RELATED해야 하며 ACCEPTED이에 의해 잡히지 않는 나가는 TCP는 속도가 제한될 수 있습니다. 나가는 모든 Tor 트래픽은 이에 따라야 합니다.

나는 위의 내용과 "퇴출 감소 정책"을 사용하는 것이 귀하가 할 수 있는 최선의 방법이라고 믿습니다.

이상적으로는 다음을 제외하고 Tor 상자에서 다른 것을 실행하지 마십시오.

  • 적어도 SSH를 실행하고 22가 아닌 다른 포트에 배치할 것입니다.
  • 아마도 간단한 웹 서버를 실행하여 표시하고 싶을 것입니다.이 페이지. chroot된 mini-httpd인스턴스가 그렇게 해야 합니다. 을 사용하지 마십시오 inetd.

다른 용도로 사용되는 상자에서 Tor를 실행하지 마십시오. "출구 릴레이" 섹션을 읽었는지 확인하세요.Tor 법적 FAQ그리고 그 의미를 완전히 이해합니다. 또한이거 다 읽고 해봐.

답변2

소스 IP가 일정하지 않기 때문에 이러한 공격을 예방하는 것이 평소보다 어렵습니다. 그러나 내가 아는 한 Tor의 경로는 몇 분마다 한 번씩만 변경됩니다.

따라서 소스 IP 뒤에 전체 네트워크가 있다고 가정해야 하기 때문에 표준 제한/필터링 규칙 중 일부를 계속 배포할 수 있지만 임계값은 더 높습니다.

다음을 필터링할 수 있습니다.

  • 불량하거나 일반적인 지문/스캐닝 패킷(불량한 TCP/IP 플래그, XMAS, 대부분의 ICMP 유형 등)
  • 진행 중인 연결이나 새 연결에 맞지 않는 INVALID 패킷(-m 상태)
  • 다소 높은 임계값에서 시작하는 새로운 연결

그러나 이러한 작업은 일반적으로 인바운드 트래픽에서 수행된다는 점에 유의하세요. 귀하는 귀하의 "고객"이 어떤 종류의 프로토콜을 실행할지 알지 못하며 짜증나거나 불분명할 수 있는 방식으로 이를 제한할 수 있습니다.

또한 속도 제한 NEW(또는 상태 비저장) 패킷의 경우 거부된(분명한 공격이 아닌 한 절대 DROP하지 않음) 패킷이 무작위로 지정되는 좀 더 복잡한 구성을 고려할 수 있습니다. 이렇게 하면 일반 사용자는 전체 속도가 현재 제한에 있더라도 다시 로드를 시도하여 행운을 얻을 수 있지만 동시 포트 스캐너는 속도 제한을 피할 수 없습니다.

또한 Tor 메일링 리스트에 문의해 보세요. 아마 여러분이 이런 생각을 하는 첫 번째 사람은 아닐 것입니다.https://lists.torproject.org/cgi-bin/mailman/listinfo

답변3

우선, 나는 이 모든 것을 해결하기 위해 iptables를 제안하지 않을 것입니다. 실제로 이상적인 출구 Tor 노드는 몇 개의 VPN 터널을 통해 균형 트래픽을 로드하여 ISP가 패킷과 실제 목적지에서 눈을 떼지 못하게 하고/하거나 캐싱 프록시를 활용하여 아웃바운드 반복 요청을 유지하는 것입니다. 대중적으로공전콘텐츠를 최소한으로... 해당 옵션을 살펴보는 동안 여기에반창고학대 불만 문제에 대해;

사용된 정보의 출처

http://www.ossramblings.com/using_iptables_rate_limiting_to_prevent_portscans

http://blog.nintechnet.com/how-to-block-w00tw00t-at-isc-sans-dfind-and-other-web-vulnerability-scanners/

포트 스캐닝을 위해 Tor 출구 노드를 사용하려는 봇을 좌절시키는 데 사용할 수 있는 규칙으로 두 소스 링크를 결합합니다. 이러한 규칙으로 인해 nmap 정지 시간이 발생하므로 종료 노드를 사용하는 해커가 매우 불쾌해질 수 있습니다.

#!/bin/bash
## Network interface used by Tor exit daemon
_tor_iface="eth1"
## Ports that Tor exit daemon binds to, maybe comma or space sepperated.
_tor_ports="9050,9051"
## Time to ban connections out in secconds, default equates to 10 minutes, same as default Tor cercut.
_ban_time="600"
## How long to monitor conections in seconds, default equates to 10 minutes.
_outgoing_tcp_update_seconds="600"
## How many new connections can be placed to a server in aloted update time limits. May nead to increes this depending on exit node usage and remote servers usages.
_outgoing_tcp_hitcount="8"
## How long to monitor connections for in minuets, default is 15 minutes but could be lessoned.
_outgoing_tcp_burst_minute="15"
## Hom many connections to accept untill un-matched
_outgoing_tcp_burst_limit="1000"

iptables -N out_temp_ban -m comment --comment "Make custom chain for tracking ban time limits" || exit 1
iptables -A out_temp_ban -m recent --set --name temp_tcp_ban -p TCP -j DROP -m comment --comment "Ban any TCP packet coming to this chain" || exit 1

iptables -N out_vuln_scan -m comment --comment "Make custom chain for mitigating port scans originating from ${_tor_iface}" || exit 1
for _tor_port in ${_tor_ports//,/ }; do
    iptables -A out_vuln_scan -p TCP -o ${_tor_iface} --sport ${_tor_port} -m recent --name temp_tcp_ban --update --seconds ${_ban_time} -j DROP -m comment --comment "Update ban time if IP address is found in temp_tcp_ban list" || exit 1
    iptables -A out_vuln_scan -p TCP -o ${_tor_iface} --sport ${_tor_port} -m state --state NEW -m recent --set -m comment --comment "Monitor number of new conncetions to ${_server_iface}" || exit 1
    iptables -A out_vuln_scan -p TCP -o ${_tor_iface} --sport ${_tor_port} -m state --state NEW -m recent --update --seconds 30 --hitcout 10 -j out_temp_ban -m comment --comment "Ban address when to many new connections are attempted on ${_tor_iface}" || exit 1
done
iptables -A out_vuln_scan -j RETURN -m comment --comment "Return un-matched packets for further processing" || exit 1

## Add rules to accept/allow outbound packets
iptables -N tor_out -m comment --comment "Make custom chain for allowing Tor exit node services" || exit 1
for _tor_port in ${_tor_ports//,/ }; do
    iptables -A tor_out -p TCP -o ${_tor_iface} --sport ${_tor_port} -m state --state NEW -m recent --set --name limit_${_tor_port} -m comment --comment "Track out-going tcp connections from port ${_tor_port}" || exit 1
    iptables -A tor_out -p TCP -o ${_tor_iface} --sport ${_tor_port} -m state --state NEW -m recent --update --seconds ${_outgoing_tcp_update_seconds:-60} --hitcount ${_outgoing_tcp_hitcount:-8} --rttl --name limit_${_tor_port} -j LOG --log-prefix "TCP flooding port ${_tor_port}" -m comment --comment "Log atempts to flood port ${_tor_port} from your server" || exit 1
    iptables -A tor_out -p TCP -o ${_tor_iface} --sport ${_tor_port} -m state --state NEW -m recent --update --seconds ${_outgoing_tcp_update_seconds:-60} --hitcount ${_outgoing_tcp_hitcount:-8} --rttl --name limit_${_tor_port} -j DROP -m comment --comment "Drop attempts to flood port ${_tor_port} from your server" || exit 1
    iptables -A tor_out -p TCP -o ${_tor_iface} --sport ${_tor_port} -m limit --limit ${_outgoing_tcp_burst_minute:-15}/minute --limit-burst ${_outgoing_tcp_burst_limit:-1000} -j ACCEPT -m comment --comment "Accept with conditions new connections from port ${_tor_port} from your server" || exit 1
done
iptables -A tor_out -j RETURN -m comment ---comment "Reurn un-matched packets for further filtering or default polices to take effect." || exit 1
## Activate jumps from default output chain to new custom filtering chains
iptables -A OUTPUT -p TCP -o ${_tor_iface} -j out_vuln_scan -m comment --comment "Jump outbound packets through vulnerability scaning mitigation" || exit 1
iptables -A OUTPUT -p TCP -o ${_tor_iface} -j tor_out -m comment --comment "Jump outbound packets through conditional acceptance" || exit 1

위에서 실행하면 cammas bash가 있는 변수에 대해 마법이 수행됩니다 ,.

user@host~# bash iptables_limit_tor.sh

변수 목록은 다음과 같습니다.

_tor_iface="eth1"
_tor_ports="9050,9051"
_ban_time="600"
_outgoing_tcp_update_seconds="600"
_outgoing_tcp_hitcount="8"
_outgoing_tcp_burst_minute="15"
_outgoing_tcp_burst_limit="1000"

-m state NEW ! --syn또한 다음 과 같은 종류 의 새 아웃바운드 연결을 필터링할 수도 있습니다 .재미있는악용 가능한 서버를 찾기 위해 일부 봇이 사용하는 비즈니스 여기에는 이러한 잘못된 형식의 채팅을 추가로 필터링하기 위해 위의 두 가지를 추가할 수 있는 예제 체인이 있습니다.

iptables -N out_bad_packets -m comment --comment "Make new chain for filtering malformed packets" || exit 1
iptables -A out_bad_packets -p TCP --fragment -j out_temp_ban -m comment --comment "Drop all fragmented packets" || exit 1
iptables -A out_bad_packets -p TCP -m state --state INVALID -j out_temp_ban -m comment --comment "Drop all invalid packets" || exit 1
iptables -A out_bad_packets -p TCP ! --syn -m state --state NEW -j out_temp_ban -m comment --comment "Drop new non-syn packets" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL NONE -j out_temp_ban -m comment --comment "Drop NULL scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL ALL -j out_temp_ban -m comment --comment "Drop XMAS scan"|| exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL FIN,URG,PSH -j out_temp_ban -m comment --comment "Drop stealth scan 1" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL SYN,RST,ACK,FIN,URG -j out_temp_ban -m comment --comment "Drop pscan 1"|| exit 1
iptables -A out_bad_packets -p TCP --tcp-flags SYN,FIN SYN,FIN -j out_temp_ban -m comment --comment "Drop pscan 2" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags FIN,RST FIN,RST -j out_temp_ban -m comment --comment "Drop pscan 3" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags SYN,RST SYN,RST -j out_temp_ban -m comment --comment "Drop SYN-RST scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ACK,URG URG -j out_temp_ban -m comment --comment "Drop URG scans" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL SYN,FIN -j out_temp_ban -m comment --comment "Drop SYNFIN scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL URG,PSH,FIN -j out_temp_ban -m comment --comment "Drop nmap Xmas scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL FIN -j out_temp_ban -m comment --comment "Drop FIN scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags ALL URG,PSH,SYN,FIN -j out_temp_ban -m comment --comment "Drop nmap-id scan" || exit 1
iptables -A out_bad_packets -p TCP --tcp-flags RST RST -o ${_tor_iface} --sport ${_tor_port} -m limit --limit 2/second --limit-burst 3 -j out_temp_ban -m comment --comment "Mitigate Smurf attacks from excesive RST packets"
iptables -A out_bad_packets -p TCP --tcp-flags RST RST -o ${_tor_iface} --sport ${_tor_port} -m limit --limit 2/second --limit-burst 2 -j RETURN -m comment --comment "Ban Smurf attacks using excesive RST packets"
iptables -A out_bad_packets -j RETURN -m comment --comment "Return un-matched packets for further processing." || exit 1

그러나 위의 체인은 일치하는 패킷이 해당 체인의 규칙에서 선택된 몇 초 동안 IP가 금지(아마도 테스트 -j out_temp_ban를 위해 변경 -j DROP되거나 테스트를 위해) 되기 때문에 매우 제한적입니다 . -j REJECT이 규칙 세트는 클라이언트 측의 잘못 코딩된 앱이 새로운 Tor 서컷을 통해 다시 연결될 때 오류 긍정을 유발할 수도 있습니다.

~~~~

추가 트래픽 형성을 위해 고려해야 할 소프트웨어 Linux를 확인하세요 firejail. 소스는 Github 및 Source forge에 있으며 매뉴얼 페이지는 이전 홈 페이지, wordpress 하위 도메인에서 찾을 수 있으며 DigitalOcean에는 PHP 및 Firejail이 포함된 Nginx에 대한 가이드가 있습니다. 약간만 수정하면 네트워크를 다시 제한해야 하는 위치를 훨씬 더 자극할 수 있습니다. KVM운영 경계 내에서 특정 서비스를 유지하는 데 사용할 수 있는 다른 도구도 있습니다 .가게귀하의 시스템에 가장 적합한 것을 찾으십시오.

또 다른 옵션은 미친 시스템 관리자가 귀하의 IP에 대한 http 또는 SSL 연결을 시도할 때 종료 알림 페이지를 요청하는 사람들에 대한 연결을 fail2ban끊는 규칙이 추가되는 방식으로 실행하는 것입니다 . -m state --state NEW금지 해제 시간 제한과 결합하면 시스템 관리자가 로그 오염에 대해 중얼거리는 동안 원격 서버가 중단될 수 있습니다. ;-) 그러나 이는 현재 답변의 범위를 벗어나며 서비스를 위해 사용하는 소프트웨어에 따라 다릅니다. 공지 페이지 종료; 이제 URL이 요청되면 nginx와 apache 모두 구성의 첫 번째 가상 호스트 또는 서버 블록을 제공할 것이라는 힌트를 받으세요. apache나 nginx 이외의 다른 것을 사용하는 경우 맨 페이지를 참조하고 싶지만 나에게는 첫 번째 가상 호스트가 다른 파일에 로그인하도록 설정하고 해당 로그의 모든 IP를 임시 금지 목록에 추가하는 Fail2ban만큼 간단했습니다. ; 이는 일반적으로 IP 주소를 사용하고 도메인 요청을 제공하지 않으면 서버가 봇 트랩을 제공하거나 이 경우 종료 알림을 제공하기 때문에 공용 서버에서 봇을 금지하는 데에도 효과적입니다.

나는 제한된 Tor 종료 정책(당신이 처리한 것처럼 보임)을 실행한 다음 VPN 터널을 통해 트래픽을 푸시하고 다중 터널 간의 로드 밸런싱을 위한 추가 크레딧 포인트를 두었습니다. 이렇게 하면 Tor 네트워크 트래픽에 대한 중단이 줄어들고 ISP가 VPN 트래픽을 스니핑하고 크래킹하는 것을 허용하지 않는 한 종료 노드를 실행하고 있다는 사실에 대해 ISP의 눈을 흐리게 할 수 있기 때문입니다. 이는 임시 금지 또는 원격 호스트의 자체 금지를 허용하는 규칙을 실행하면 트래픽을 VPN(또는 소수)으로 푸시하는 것이 클라이언트의 개인 정보 보호에 도움이 되고 노드의 클라이언트에 대한 개인 정보 보호 위반으로 이어질 수 있기 때문입니다. ISP가 쫓기는 것으로부터요청실행 가능한 모든 정부에서 네트워크 트래픽 로그를 확인합니다 whois www.some.domain.

~~~~~

편집/업데이트

~~~~~

나는 광범위한 메모를 살펴보고 내가 사용하는 공용 서버의 구성을 가져왔습니다.

다음은 Fail2ban jail.local스탠자 입니다.

[apache-ipscan]
enabled  = true
port = http,https
filter = apache-ipscan
logpath = /var/log/apache*/*error_ip*
action = iptables-repeater[name=ipscan]
maxretry = 1

그리고 여기 필터 apache-ipscan.conf파일이 있습니다

[DEFAULT]
_apache_error_msg = \[[^]]*\] \[\S*:error\] \[pid \d+\] \[client <HOST>(:\d{1,5})?\]
[Definition]
failregex = \[client <HOST>\] client denied by server .*(?i)/.*
#^<HOST>.*GET*.*(?!)/.*
#   ^%(_apache_error_msg)s (AH0\d+: )?client denied by server configuration: (uri )?.*$
#            ^%(_apache_error_msg)s script '\S+' not found or unable to stat(, referer: \S+)?\s*$
ignoreregex = 
# DEV Notes: 
# the web server only responds to clients with a valid Host: 
# header. anyone who tries using IP only will get shunted into 
# the dummy-error.log and get a client-denied message
#
# the second regex catches folks with otherwise valid CGI paths but no good Host: header
#
# Author: Paul Heinlein

그리고 여기에 작업 iptables-repeater.conf파일이 있습니다.

# Fail2Ban configuration file
#
# Author: Phil Hagen <[email protected]>
# Author: Cyril Jaquier
# Modified by Yaroslav Halchenko for multiport banning and Lukas Camenzind for persistent banning
# Modified by S0AndS0 to combine features of previous Authors and Modders
#
[Definition]
# Option:  actionstart
# Notes.:  command executed once at the start of Fail2Ban.
# Values:  CMD
#
actionstart = iptables -N fail2ban-BADIPS-<name>
              iptables -A fail2ban-BADIPS-<name> -j RETURN
          iptables -I INPUT -j fail2ban-BADIPS-<name>
          ## Comment above line and uncomment bello line to use multiport and protocol in addition to named jails
          #iptables -I INPUT -p <protocol> -m multiport --dports <port> -j fail2ban-BADIPS-<name>
          # set up from the static file
          #cat /etc/fail2ban/ip.blocklist.<name> |grep -v ^\s*#|awk '{print $1}' | while read IP; do iptables -I fail2ban-BADIPS-<name> 1 -s $IP -j DROP; done
          cat /etc/fail2ban/ip.blocklist.<name> |grep -v ^\s*#|awk '{print $1}' | while read IP; do iptables -I fail2ban-BADIPS-<name> 1 -d $IP -j DROP; done
          ## Comment above line and uncomment bellow line to check if there are blacklist files to load before attempting to load them
          # if [ -f /etc/fail2ban/ip.blacklist.<name> ]; then cat /etc/fail2ban/ip.blacklist.<name> | grep -e <name>$ | cut -d "," -s -f 1 | while read IP; do iptables -I fail2ban-BADIPS-<name> 1 -s $IP -j DROP; done; fi
# Option:  actionstop
# Notes.:  command executed once at the end of Fail2Ban
# Values:  CMD
#
actionstop = iptables -D INPUT -p <protocol> -m multiport --dports <port> -j fail2ban-BADIPS-<name>
         iptables -F fail2ban-BADIPS-<name> 
         iptables -X fail2ban-BADIPS-<name>
# Option:  actioncheck
# Notes.:  command executed once before each actionban command
# Values:  CMD
#
#actioncheck = iptables -n -L INPUT | grep -q fail2ban-BADIPS-<name>
actioncheck = iptables -n -L OUTPUT | grep -q fail2ban-BADIPS-<name>
# Option:  actionban
# Notes.:  command executed when banning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    <ip>  IP address
#          <failures>  number of failures
#          <time>  unix timestamp of the ban time
# Values:  CMD
#
#actionban = if ! iptables -C fail2ban-BADIPS-<name> -s <ip> -j DROP; then iptables -I fail2ban-BADIPS-<name> 1 -s <ip> -j DROP; fi
actionban = if ! iptables -C fail2ban-BADIPS-<name> -d <ip> -j DROP; then iptables -I fail2ban-BADIPS-<name> 1 -d <ip> -j DROP; fi
# Add offenders to local blacklist, if not already there
        if ! grep -Fxq '<ip>,<name>' /etc/fail2ban/ip.blocklist.<name>; then echo "<ip>,<name> # fail2ban/$( date '+%%Y-%%m-%%d %%T' ): auto-add for BadIP offender" >> /etc/fail2ban/ip.blocklist.<name>; fi
# Report offenders to badips.com
#        wget -q -O /dev/null www.badips.com/add/<name>/<ip>
# Option:  actionunban
# Notes.:  command executed when unbanning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    <ip>  IP address
#          <failures>  number of failures
#          <time>  unix timestamp of the ban time
# Values:  CMD
#
#actionunban = iptables -D fail2ban-REPEAT-<name> -s <ip> -j DROP
actionunban = iptables -D fail2ban-REPEAT-<name> -d <ip> -j DROP
# Disabled clearing out entry from ip.blacklist (somehow happens after each stop of fail2ban)
#sed --in-place '/<ip>,<name>/d' /etc/fail2ban/ip.blacklist.<name>
[Init]
# Defaut name of the chain
# 
# Defaut name of the chain
name = BADIPS
# Option:  port
# Notes.:  specifies port to monitor
# Values:  [ NUM | STRING ]  Default:
# 
#port = ssh
# Option:  protocol
# Notes.:  internally used by config reader for interpolations.
# Values:  [ tcp | udp | icmp | all ] Default: tcp

위의 필터는 시작/중지 작업을 차단하도록 편집되었지만 기록된 IP 주소에서 새 아웃바운드 연결만 금지되도록 각 줄에 구성을 OUTPUT추가하는 것이 좋습니다 .-p TCP -m state --state NEW

마지막은 도메인을 요청하지 않는 사용자를 특정 액세스 및 오류 로그로 라우팅하고 항상 오류가 발생하도록 허용된 액세스와 거부된 액세스를 설정하는 Apache vHost 구성을 설정하는 것입니다. 루프백도 오류를 표시하지 않고 페이지를 가져올 수 없어야 합니다. . 마지막으로 중요한 것은 Apache의 오류 페이지를 Tor의 기본 종료 알림으로 설정하여 해당 메시지가 평범한 메시지 대신 제공되도록 하는 것 503입니다 404. 또는 fall2ban에 대한 iptables 작업에 상태 줄을 추가한 경우 종료 알림에 사용된 것과 동일한 로그 파일을 쉽게 가리킬 수 있습니다. 결과적으로 귀하의 서버는 귀하의 IP 주소를 확인한 서버의 IP에 새로운 연결을 만들 수 없지만 설정된 관련 연결은 여전히 ​​허용됩니다. 즉, 다른 페이지는 계속 탐색할 수 있지만 귀하는 해당 페이지를 탐색할 수 없습니다. .

답변4

더 나은 솔루션이 있습니다: 오징어 캐시 서버. 오징어 캐시 서버는 acl귀하 deny또는 accept각각의 정의를 구성할 수 있습니다 acl. 귀하의 질문에서 발견한 위키에서 일련의 규칙을 정의하는 오징어 팀이 매우 흥미롭습니다.거기 iptables,PF아니면 다른 레이어에서 작업하기 때문에 다른 사람들이 귀하의 작업을 수행할 수 없습니다.

관련 정보