ProxyTracer: VPN 및 프록시 차단기

:information_source: Summary Detect and block VPN, Tor and proxy traffic during user registration, login, and/or globally using the ProxyTracer API.
:hammer_and_wrench: Repository Link https://github.com/ProxyTracer/discourse-proxytracer
:open_book: Install Guide How to install plugins in Discourse

This plugin uses the ProxyTracer API to detect and block VPN, Tor and proxy traffic in Discourse.

Features

  • It gives you fine control over blocking VPN, Tor and Proxy users during new user registrations, existing user authentication, or globally for all site visitors. If you’re fine with VPN, Tor and Proxy users having read access to your forum then you can save on API requests and only enable it for user registration and authentication.
  • It uses caching to store recent IP address evaluations thus saving requests to the API and lowering latency. You can control how long to remember an IP address evaluation in the settings.
  • In the event of an API timeout or network failure, the plugin prioritizes user access to prevent wide-scale lockouts. This behavior can be changed through the options.
  • Built-in support for exact IP and CIDR subnet whitelisting.

Configuration

  1. Procure a standard API key from the ProxyTracer Dashboard.
  2. Navigate to your Discourse administration panel: Admin → Plugins → ProxyTracer to find ProxyTracer’s settings.
  3. Input your API key into the ProxyTracer API Key field.
  4. Enable the protection parameters by toggling Enabled during Signup, Enabled during Login and/or Enabled for All Visitors.
  5. Add any trusted IPs or CIDR ranges to the Whitelisted IPs list.
  6. (Optional) Adjust the API timeout and Redis cache duration limits to suit your server’s specific traffic requirements.
  7. (Optional) Customize the Block Message that appears to blocked users. For instance, you can add instructions for contacting the administration of the site in case they believe that the block isn’t warranted and that they’re not accessing the site through a proxy, Tor or VPN.

Settings

Include a table of settings and setting descriptions

Name Description
API Timeout (ms) How long to wait for the API to respond before timing out.
Cache Duration (hours) How long to remember an IP address before checking the API again.
Fail Open on Error If the API crashes or times out, allow the user to register/login anyway to prevent locking everyone out.
Enabled during Signup Block proxies and VPNs when a new user attempts to register.
Enabled during Login Block proxies and VPNs when an existing user attempts to log in.
Enabled for All Visitors Block proxies and VPNs from accessing or viewing any page on the forum. (Warning: This checks every visitor and heavily utilizes your API quota).
Block Message The exact error message shown to the user when they are blocked.
Whitelisted IPs IP addresses or CIDR ranges (e.g., 192.168.1.0/24) that are strictly allowed to bypass the blocking.

Network Configuration: Cloudflare & Reverse Proxies

:warning: For ProxyTracer to function effectively, the Discourse application must receive the true client IP address.

To ensure correct IP address forwarding you can follow these detailed instructions.

Emergency Access

If you locked yourself out you can regain access by following these simple steps.


If you want to test things then you can signup to ProxyTracer and get some free API credits for testing.

5개의 좋아요

the credits restart every next month?

You’re asking about the free credit during signup? If that’s the case then it’s only a one-time top-up.

1개의 좋아요

Does this not defeat the entire point of the plugin? Anybody can use safe mode.

2개의 좋아요

It depends. There is a site setting that allows you to disable safe mode, which is helpful for the gated topic component and other components/plugins users shouldn’t easily disable like that (advertising, guest gate, …). But while you are logged out, that would also make using safe mode more difficult for admins. I think they can still enable it using admin-login.

For this plugin, I doubt safe mode helps. Safe mode disables only the front-end part of plugins, and this plugin in 100% Ruby. So I don’t think disabling JavaScript customizations is any help. This fact makes me a little skeptical about the plugin, as does the fact that it includes an about.json file as if it were a theme component. But in the end, everyone is responsible for the code they install on their forum.

4개의 좋아요

You are completely right on this, I can confirm this through my own testing with a freshly spun up Discourse instance. I went ahead and updated the documentation with instructions that actually work which consist of logging into the server and manually disabling the addon:

cd /var/discourse
./launcher enter app
rails c
SiteSetting.proxytracer_enabled = false
exit
exit

I can confirm that safe mode is inaccessible when the “Enabled for All Visitors” setting is enabled and someone tries to access safe mode while connecting using a VPN/proxy.

Indeed, an about.json is redundant for standard plugins, I went ahead and removed it from the repo.

Thanks for all of your feedback @Moin. If you have any other remarks or suggestions feel free to leave them here. The code is fully open source and any contribution is welcome: GitHub - ProxyTracer/discourse-proxytracer.

1개의 좋아요

@ProxyTracer When I attempt to log with cloudflare warp return ‘unknown error’ and not the blocked message

Great catch! This should be fixed in version 0.1.1. Could you confirm if upgrading resolves the issue for you?

1개의 좋아요

현재 귀사의 서비스를 테스트 중인데, ‘templates/cloudflare.template.yml’ 파일과 충돌이 있는지, 그리고 Discourse 코어 업데이트가 발생할 경우 플러그인이 이를 지원할 수 있는지 알고 싶습니다.

프라이시를 존중하는 커뮤니티에서 저와 같은 사용자를 잃지 않는 중도적 방안이 무엇일지 궁금합니다.

테스트해 주셔서 감사합니다! README.md 문서에서 Cloudflare 통합에 대해 언급된 부분에서, "templates/cloudflare.template.yml" 파일의 포함을 명확히 권장하고 있습니다. 이는 포럼이 Cloudflare 뒤에 있는 경우 Discourse가 사용자의 실제 IP를 올바르게 추출하도록 보장하는 데 필수적이기 때문입니다. 따라서 해당 템플릿과 충돌하는 문제가 없으며, 오히려 이를 포함하는 것이 필요합니다.

그리고 네, 우리는 Discourse의 코어 업데이트를 따르겠다고 약속하며, 새로운 버전과의 완전한 호환성을 보장하기 위해 노력하고 있습니다.

2개의 좋아요

사용자를 차단하는 대신 단순히 hCaptcha를 통과하도록 요구하는 옵션을 추가하고, 이를 기본값으로 설정하는 것이 좋은 타협점이 될 수 있을지 궁금합니다. 이렇게 하면 스팸 사용자나 밴 회피자에게는 충분히 마찰을 주어 접근을 어렵게 만들면서도, VPN이나 Tor 등을 통해 온라인 프라이버시를 보호하려는 합법적인 사용자의 접근은 허용할 수 있기 때문입니다. 물론 해당 네트워크에 대한 완전한 차단을 유지하길 원하는 관리자에게는 여전히 해당 옵션이 제공될 것입니다. 여러분의 생각은 어떠신가요?

1개의 좋아요

정말 감사합니다! 방금 샌드박스에서 테스트를 해봤는데 완벽하게 작동합니다.

모바일 네트워크의 IP/ASN 관련 기능을 추가할 계획이 있으신가요? 제 포럼에서 자주 발생하는 상황이 있는데, 사용자가 브로드밴드 네트워크에서 벗어나 통신사의 4G/5G 네트워크로 전환하여 다른 IP를 확보하고, 이를 통해 Discourse의 가입 또는 로그인 제한을 우회하려는 경우입니다.

IP가 모바일 통신사의 ASN에 속하는지 식별하고, 필요에 따라 이러한 IP가 가입/로그인 과정에서 다르게 처리되도록 허용할 수 있다면 유용할 것 같습니다.

이것은 VPN/프록시와 직접적인 관련이 없으므로 ProxyTracer의 범위를 약간 벗어나는 내용일 수 있지만, Discourse가 IP당 계정 수 제한을 처리하는 방식과 관련된 특정 문제에 있어서는 도움이 될 것입니다.

1개의 좋아요

hCaptcha의 경우, 저는 이미 제 설치 환경에서 사용 중이며 매우 잘 작동하고 있습니다! Discourse 코어에 이미 포함된 것으로 보이는 플러그인과 여러분의 플러그인을 통합하여 추가 기능을 제공하는 것도 좋은 방법일 수 있겠네요.

완전한 차단을 유지하는 아이디어를 좋아합니다. 그것이 본래의 목적이기도 하니까요. 하지만 고정 및 모바일 네트워크의 IPv4와 IPv6에 관해서는, AI가 포럼에서 계정을 생성하는 것을 매우 좋아하기 때문에 챌린지를 통해 이러한 접근을 어렵게 만드는 것이 매우 유용해 보입니다.

1개의 좋아요

안녕하세요, 제 답변을 고려해 주셔서 감사합니다. 정말로 저에게 흥미로운 주제이며, 사용자와 관리자 모두에게 특히 민감하게 다뤄져야 할 구현 방식이라고 생각합니다.

솔직히 말하면, 저는 인간임을 증명하기 위해 캡차를 풀고 있는 로봇처럼, 의도적으로 봇처럼 행동하는 기분이 듭니다. 관련 주제에서 언급했듯이, 저에게는 Anubis의 구현 방식(POW)이 훨씬 더 쾌적하고 기능적으로 느껴집니다.

이것이 이 프로젝트의 범위를 벗어난 것임을 이해하지만, 제 위치에서 분석할 수 있는 바로는, 언급하신 캡차의 사용은 실현 가능하며, 사생활을 중시하고 차단되지 않고 기여하고 싶어 하는 사용자를 실제로 막지 않을 수 있을 것입니다.

1개의 좋아요

플러그인이 제공할 수 있는 또 다른 기능은 VPN/프록시를 사용하여 로그인 시도를 한 계정에 대한 정보를 제공하는 것입니다.

1개의 좋아요

테스트해 주셔서 감사합니다. 정말 감사드립니다!

흥미로운 사용 사례입니다. 사용자에게 이러한 세밀한 제어를 제공하는 데 가치를 인정합니다. 이는 v1 엔드포인트가 범위가 다소 제한적이고 특정 IP가 프록시/VPN인지 여부에 대한 불리언 값만 제공하기 때문에 완전히 새로운 API 엔드포인트가 필요합니다.

이러한 기능을 구현하려는 시도에 대해 데이터 정확성에 대한 몇 가지 우려가 있습니다. IP가 4G/5G 네트워크에 사용되는지 여부를 판별하는 정확도는 아직 이상적이지 않으며, 4G/5G 홈 무선 광대역 사용자와 같이 무고한 사용자가 부당하게 불이익을 받을 수 있는 애플리케이션이 있기 때문입니다.

그러나 현재는 API의 v1 엔드포인트를 개선하여 커버리지를 확장하는 데 집중하고 있습니다.

캡차 옵션이 포함된 확장 프로그램의 새로운 테스트 릴리스를 작업 중이며, 이 기능도 고려하고 있습니다. 이러한 탭이 충분하다고 생각하시나요, 아니면 더 많은 컬럼을 추가할 수 있다고 생각하시나요?

1개의 좋아요

이 정보만으로도 요청 사용 현황을 추적하는 데 더할 나위 없이 충분합니다. :high_five:

이 점에 대해서는 설명해 주셔서 감사합니다. 복잡한 문제라는 점을 이해하고 있습니다.

1개의 좋아요

@ProxyTracer 요청 사용에 대해 질문이 있습니다. 네트워크가 VPN/프록시가 아닌 경우에도 새로운 로그인 시마다 항상 차감되는 것을 확인했는데, 이것이 정상적인 동작인가요?

기록에서는 어쨌든 확인이 필요하고, 아마도 대시보드에서 요청 1회를 차감할 것 같아서 그렇습니다. 맞나요? 만약 이러한 접근에 대한 모든 사이트를 차단하도록 설정하면, 제가 구매한 패키지에서 훨씬 더 많은 양이 차감되겠지요?

'캐시 지속 시간(시간)'을 30일 정도로 늘리는 것을 고려해 보았는데, 그렇게 하는 것이 이상적이지 않은 것 같습니다. 제 생각이 틀린 건가요?

수신된 IP 주소가 VPN/프록시인지 아닌지를 결정하기 위해 플러그인은 ProxyTracer API를 쿼리해야 합니다.

그러나 결과(깨끗한 IP인지 VPN/프록시인지)는 포럼의 Redis 데이터베이스에 즉시 캐시됩니다. 설정된 ‘캐시 지속 시간(Cache Duration hours)’ 시간 창 내에서 해당 IP가 다시 로그인하는 경우, Discourse는 Redis에서 직접 답변을 제공합니다. 따라서 API 요청이 차감되지 않습니다. 모든 사이트 페이지에서 VPN/프록시를 차단하는 옵션을 활성화한 경우에도 동일한 원리가 적용됩니다.

방문자 수준 차단(Visitor-level blocking)은 익명 트래픽으로 인해 로그인 전용 보호(Login-only protection)보다 더 많은 요청을 소비합니다. 그러나 Redis 캐싱 덕분에 복귀 방문자의 반복적인 페이지 뷰는 불필요한 API 차감을 발생시키지 않습니다.

동적 주거용/모바일 IP는 때때로 순환하며, 새로운 VPN 출구 노드(Exit Node)도 시간이 지남에 따라 생성됩니다. 따라서 30일 캐시를 사용하면 이전에 깨끗했던 동적 IP가 VPN 제공업체에 재할당된 경우에도 캐시가 만료될 때까지 다시 확인되지 않을 수 있습니다. 이것이 30일보다 4일 정도가 훨씬 더 좋은 이유입니다.

이 설명이 도움이 되기를 바랍니다.

1개의 좋아요