Compare commits

...

1 commit

Author SHA1 Message Date
Dalf
112768e71f [mod] move rules.json to rules.json.template
start.sh create rules.json from rules.json.template. It replaces $CHECK_SEARX_SPACE_IPS by the IPs of check.searx.space.

Related to https://github.com/asciimoo/filtron/issues/12
2020-07-10 10:46:01 +02:00
3 changed files with 9 additions and 1 deletions

View file

@ -1,7 +1,7 @@
[ [
{ {
"name": "searx.space", "name": "searx.space",
"filters": ["Header:X-Forwarded-For=(2001:41d0:8:de3::1|176.31.252.227)"], "filters": ["Header:X-Forwarded-For=$CHECK_SEARX_SPACE_IPS"],
"stop": true, "stop": true,
"actions": [{ "name": "log"}] "actions": [{ "name": "log"}]
}, },

View file

@ -5,6 +5,8 @@ cd -- "$BASE_DIR"
. ./util.sh . ./util.sh
create_rules_json "check.searx.space" > rules.json
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE down -v $DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE down -v
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE rm -fv $DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE rm -fv
$DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE up $DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE up

View file

@ -24,3 +24,9 @@ if [ ! -f "${DOCKERCOMPOSEFILE}" ]; then
echo "${DOCKERCOMPOSEFILE} not found" 1>&2 echo "${DOCKERCOMPOSEFILE} not found" 1>&2
exit 1 exit 1
fi fi
create_rules_json() {
# $1 : requests host name $1 will bypass filtron
IPS="($(host $1 | rev | cut -d\ -f1 | rev | tr '\n' '|' | sed 's/.$//'))"
sed "s/\$CHECK_SEARX_SPACE_IPS/$IPS/" rules.json.template
}