on master help sign in
utils/searx.sh & filtron.sh: misc changes from first tests (WIP)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit6274a54746b4444f8850aecea0cb0734c6bdc29c authorMarkus Heiser <markus.heiser@darmarit.de> dateThu 30 Jan 2020, 19:55 (7 years ago) parent924bf65
4 files changed+30−3
utils/filtron.sh+9−1 utils/lib.sh+5−1 utils/searx.sh+3 utils/templates/etc/apache2/sites-available/searx.conf:filtron+13−1
utils/filtron.sh+9−1
@@ -11,6 +11,10 @@ source_dot_config
1111# config
1212# ----------------------------------------------------------------------------
1313
14+FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
15+| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
16+[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
17+
1418FILTRON_ETC="/etc/filtron"
1519
1620FILTRON_RULES="$FILTRON_ETC/rules.json"
@@ -192,7 +196,9 @@ installations that were installed with this script."
192196 wait_key
193197 remove_user
194198 rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout
195− wait_key
199+ if service_is_available "${PUBLIC_URL}"; then
200+ MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10
201+ fi
196202}
197203
198204install_service() {
@@ -329,6 +335,7 @@ inspect_service() {
329335sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
330336
331337 PUBLIC_URL : ${PUBLIC_URL}
338+ FILTRON_URL_PATH : ${FILTRON_URL_PATH}
332339 FILTRON_API : ${FILTRON_API}
333340 FILTRON_LISTEN : ${FILTRON_LISTEN}
334341 FILTRON_TARGET : ${FILTRON_TARGET}
@@ -395,6 +402,7 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SIT
395402 return
396403 fi
397404
405+ a2enmod headers
398406 a2enmod proxy
399407 a2enmod proxy_http
400408
utils/lib.sh+5−1
@@ -121,10 +121,11 @@ wait_key(){
121121
122122 clean_stdin
123123 local _t=$1
124+ local msg="${MSG:-** press any [KEY] to continue **}"
124125 [[ ! -z $FORCE_TIMEOUT ]] && _t=$FORCE_TIMEOUT
125126 [[ ! -z $_t ]] && _t="-t $_t"
126127 # shellcheck disable=SC2086
127− read -r -s -n1 $_t -p "** press any [KEY] to continue **"
128+ read -r -s -n1 $_t -p "$msg"
128129 echo
129130 clean_stdin
130131}
@@ -436,6 +437,9 @@ service_is_available() {
436437 if [[ $exit_val = 0 ]]; then
437438 info_msg "got $http_code from ${URL}"
438439 fi
440+ case "$http_code" in
441+ 404|410|423) exit_val=$http_code;;
442+ esac
439443 return $exit_val
440444}
441445
utils/searx.sh+3
@@ -275,6 +275,9 @@ installations that were installed with this script."
275275 remove_searx_uwsgi
276276 wait_key
277277 remove_user
278+ if service_is_available "${PUBLIC_URL}"; then
279+ MSG="** Don't forgett to remove your public site! (${PUBLIC_URL}) **" wait_key 10
280+ fi
278281}
279282
280283user_is_available() {
utils/templates/etc/apache2/sites-available/searx.conf:filtron+13−1
@@ -1,3 +1,15 @@
11# -*- coding: utf-8; mode: apache -*-
22
3−ProxyPass "/searx" "http://127.0.0.1:4004/"
3+<Location ${FILTRON_URL_PATH} >
4+
5+ Require all granted
6+ Allow from all
7+
8+ Order deny,allow
9+ Deny from all
10+ #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
11+
12+ ProxyPass "http://127.0.0.1:4004"
13+ RequestHeader set "X-Script-Name" "${FILTRON_URL_PATH}"
14+
15+</Location>