utils/searx.sh & filtron.sh: misc changes from first tests (WIP)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-01-30 19:55:51 +01:00
parent 924bf65517
commit 6274a54746
4 changed files with 30 additions and 3 deletions

View File

@ -11,6 +11,10 @@ source_dot_config
# config # config
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
FILTRON_ETC="/etc/filtron" FILTRON_ETC="/etc/filtron"
FILTRON_RULES="$FILTRON_ETC/rules.json" FILTRON_RULES="$FILTRON_ETC/rules.json"
@ -192,7 +196,9 @@ installations that were installed with this script."
wait_key wait_key
remove_user remove_user
rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout
wait_key if service_is_available "${PUBLIC_URL}"; then
MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10
fi
} }
install_service() { install_service() {
@ -329,6 +335,7 @@ inspect_service() {
sourced ${DOT_CONFIG#"$REPO_ROOT/"} : sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
PUBLIC_URL : ${PUBLIC_URL} PUBLIC_URL : ${PUBLIC_URL}
FILTRON_URL_PATH : ${FILTRON_URL_PATH}
FILTRON_API : ${FILTRON_API} FILTRON_API : ${FILTRON_API}
FILTRON_LISTEN : ${FILTRON_LISTEN} FILTRON_LISTEN : ${FILTRON_LISTEN}
FILTRON_TARGET : ${FILTRON_TARGET} FILTRON_TARGET : ${FILTRON_TARGET}
@ -395,6 +402,7 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SIT
return return
fi fi
a2enmod headers
a2enmod proxy a2enmod proxy
a2enmod proxy_http a2enmod proxy_http

View File

@ -121,10 +121,11 @@ wait_key(){
clean_stdin clean_stdin
local _t=$1 local _t=$1
local msg="${MSG:-** press any [KEY] to continue **}"
[[ ! -z $FORCE_TIMEOUT ]] && _t=$FORCE_TIMEOUT [[ ! -z $FORCE_TIMEOUT ]] && _t=$FORCE_TIMEOUT
[[ ! -z $_t ]] && _t="-t $_t" [[ ! -z $_t ]] && _t="-t $_t"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
read -r -s -n1 $_t -p "** press any [KEY] to continue **" read -r -s -n1 $_t -p "$msg"
echo echo
clean_stdin clean_stdin
} }
@ -436,6 +437,9 @@ service_is_available() {
if [[ $exit_val = 0 ]]; then if [[ $exit_val = 0 ]]; then
info_msg "got $http_code from ${URL}" info_msg "got $http_code from ${URL}"
fi fi
case "$http_code" in
404|410|423) exit_val=$http_code;;
esac
return $exit_val return $exit_val
} }

View File

@ -275,6 +275,9 @@ installations that were installed with this script."
remove_searx_uwsgi remove_searx_uwsgi
wait_key wait_key
remove_user remove_user
if service_is_available "${PUBLIC_URL}"; then
MSG="** Don't forgett to remove your public site! (${PUBLIC_URL}) **" wait_key 10
fi
} }
user_is_available() { user_is_available() {

View File

@ -1,3 +1,15 @@
# -*- coding: utf-8; mode: apache -*- # -*- coding: utf-8; mode: apache -*-
ProxyPass "/searx" "http://127.0.0.1:4004/" <Location ${FILTRON_URL_PATH} >
Require all granted
Allow from all
Order deny,allow
Deny from all
#Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
ProxyPass "http://127.0.0.1:4004"
RequestHeader set "X-Script-Name" "${FILTRON_URL_PATH}"
</Location>