4==========================
5How to protect an instance
6==========================
8.. sidebar:: further reading
11 - :ref:`nginx searx site`
19.. _filtron: https://github.com/asciimoo/filtron
21Searx depends on external search services. To avoid the abuse of these services
22it is advised to limit the number of requests processed by searx.
24An application firewall, filtron_ solves exactly this problem. Filtron is just
25a middleware between your web server (nginx, apache, ...) and searx, we describe
26such infratructures in chapter: :ref:`architecture`.
32.. _Go: https://golang.org/
33.. _filtron README: https://github.com/asciimoo/filtron/blob/master/README.md
35Filtron needs Go_ installed. If Go_ is preinstalled, filtron_ is simply
36installed by ``go get`` package management (see `filtron README`_). If you use
37filtron as middleware, a more isolated setup is recommended. To simplify such
38an installation and the maintenance of, use our script :ref:`filtron.sh`.
40.. _Sample configuration of filtron:
42Sample configuration of filtron
43===============================
45.. sidebar:: Tooling box
47 - :origin:`/etc/filtron/rules.json <utils/templates/etc/filtron/rules.json>`
49An example configuration can be find below. This configuration limits the access
52- scripts or applications (roboagent limit)
53- webcrawlers (botlimit)
54- IPs which send too many requests (IP limit)
55- too many json, csv, etc. requests (rss/json limit)
56- the same UserAgent of if too many requests (useragent limit)
62 "name": "search request",
67 "interval": "<time-interval-in-sec (int)>",
68 "limit": "<max-request-number-in-interval (int)>",
71 "name": "missing Accept-Language",
72 "filters": ["!Header:Accept-Language"],
73 "limit": "<max-request-number-in-interval (int)>",
78 "params": {"message": "Rate limit exceeded"}}
82 "name": "suspiciously Connection=close header",
83 "filters": ["Header:Connection=close"],
84 "limit": "<max-request-number-in-interval (int)>",
89 "params": {"message": "Rate limit exceeded"}}
94 "interval": "<time-interval-in-sec (int)>",
95 "limit": "<max-request-number-in-interval (int)>",
98 "Header:X-Forwarded-For"
104 "message": "Rate limit exceeded"
110 "name": "rss/json limit",
112 "Param:format=(csv|json|rss)"
114 "interval": "<time-interval-in-sec (int)>",
115 "limit": "<max-request-number-in-interval (int)>",
121 "message": "Rate limit exceeded"
127 "name": "useragent limit",
128 "interval": "<time-interval-in-sec (int)>",
129 "limit": "<max-request-number-in-interval (int)>",
137 "message": "Rate limit exceeded"
147.. _filtron route request:
149Route request through filtron
150=============================
152.. sidebar:: further reading
154 - :ref:`filtron.sh overview`
155 - :ref:`installation nginx`
156 - :ref:`installation apache`
158Filtron can be started using the following command:
162 $ filtron -rules rules.json
164It listens on ``127.0.0.1:4004`` and forwards filtered requests to
165``127.0.0.1:8888`` by default.
167Use it along with ``nginx`` with the following example configuration.
171 # https://example.org/searx
174 proxy_pass http://127.0.0.1:4004/;
176 proxy_set_header Host $host;
177 proxy_set_header Connection $http_connection;
178 proxy_set_header X-Real-IP $remote_addr;
179 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
180 proxy_set_header X-Scheme $scheme;
181 proxy_set_header X-Script-Name /searx;
184 location /searx/static {
185 /usr/local/searx/searx-src/searx/static;
189Requests are coming from port 4004 going through filtron and then forwarded to
190port 8888 where a searx is being run. For a complete setup see: :ref:`nginx
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list