Git Product home page Git Product logo

torblock's Introduction

TorBlock

TorBlock is a Traefik plugin which can block requests originating from the Tor network. The publicly available list of Tor exit nodes (https://check.torproject.org/exit-addresses) is fetched regularly in order to identify the requests to be blocked.

Configuration

Requirements: Traefik >= v2.5.5

Static

For each plugin, the Traefik static configuration must define the module name (as is usual for Go packages).

The following declaration (given here in YAML) defines an plugin:

# Static configuration
pilot:
  token: xxxxx

experimental:
  plugins:
    torblock:
      moduleName: github.com/jpxd/torblock
      version: v0.1.1

Here is an example of a file provider dynamic configuration (given here in YAML), where the interesting part is the http.middlewares section:

# Dynamic configuration

http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        - web
      middlewares:
        - my-middleware

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://127.0.0.1:5000
  
  middlewares:
    my-middleware:
      torblock:
        enabled: true

Local Mode

Traefik also offers a developer mode that can be used for temporary testing or offline usage of plugins not hosted on GitHub. To use a plugin in local mode, the Traefik static configuration must define the module name (as is usual for Go packages) and a path to a Go workspace, which can be the local GOPATH or any directory.

The plugins must be placed in ./plugins-local directory, which should be next to the Traefik binary. The source code of the plugin should be organized as follows:

./plugins-local/
    └── src
        └── github.com
            └── jpxd
                └── torblock
                    ├── torblock.go
                    ├── torblock_test.go
                    ├── go.mod
                    ├── LICENSE
                    ├── Makefile
                    └── README.md
# Static configuration
pilot:
  token: xxxxx

experimental:
  localPlugins:
    example:
      moduleName: github.com/jpxd/torblock

(In the above example, the torblock plugin will be loaded from the path ./plugins-local/src/github.com/jpxd/torblock.)

# Dynamic configuration

http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        - web
      middlewares:
        - my-middleware

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://127.0.0.1:5000
  
  middlewares:
    my-middleware:
      plugin:
        torblock:
          enabled: true

Examples

You can also see a working example docker-compose.yml in the examples directory, which loads the plugin in local mode.

torblock's People

Contributors

jpxd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sizasl wildone gpb88

torblock's Issues

[Traefik Pilot] Traefik Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Pilot.

Cause:

failed to get the latest tag: missing tag/version

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

[Traefik Pilot] Traefik Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Pilot.

Cause:

failed to get the latest tag: missing tag/version

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.