on master help sign in
utils/morty.sh: set morty key to avoid service abuse
ea32558Markus Heiser
utils/morty.sh+4−1
@@ -208,6 +208,9 @@ main() {
208}
208}
209
209
210install_all() {
210install_all() {
211+
212+ MORTY_KEY="$(head -c 32 /dev/urandom | base64)"
213+
211 rst_title "Install $SERVICE_NAME (service)"
214 rst_title "Install $SERVICE_NAME (service)"
212 assert_user
215 assert_user
213 wait_key
216 wait_key
@@ -233,7 +236,7 @@ install_all() {
233 fi
236 fi
234 info_searx
237 info_searx
235 if ask_yn "Add image and result proxy to searx settings.yml?" Yn; then
238 if ask_yn "Add image and result proxy to searx settings.yml?" Yn; then
236− "${REPO_ROOT}/utils/searx.sh" option result-proxy "${PUBLIC_URL_MORTY}"
239+ "${REPO_ROOT}/utils/searx.sh" option result-proxy "${PUBLIC_URL_MORTY}" "${MORTY_KEY}"
237 "${REPO_ROOT}/utils/searx.sh" option image-proxy-on
240 "${REPO_ROOT}/utils/searx.sh" option image-proxy-on
238 fi
241 fi
239
242
utils/searx.sh+2−2
@@ -584,7 +584,7 @@ set_result_proxy() {
584
584
585 # usage: set_result_proxy <URL> [<key>]
585 # usage: set_result_proxy <URL> [<key>]
586
586
587− info_msg "try to set result proxy: $1"
587+ info_msg "try to set result proxy: '$1' ($2)"
588 cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
588 cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
589 _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
589 _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
590}
590}
@@ -593,7 +593,7 @@ _set_result_proxy() {
593 local line
593 local line
594 local stage=0
594 local stage=0
595 local url=" url: $1"
595 local url=" url: $1"
596− local key=" key: $2"
596+ local key=" key: !!binary \"$2\""
597 if [[ -z $2 ]]; then
597 if [[ -z $2 ]]; then
598 key=
598 key=
599 fi
599 fi
utils/templates/lib/systemd/system/morty.service+1−1
@@ -10,7 +10,7 @@ Type=simple
10User=${SERVICE_USER}
10User=${SERVICE_USER}
11Group=${SERVICE_GROUP}
11Group=${SERVICE_GROUP}
12WorkingDirectory=${SERVICE_HOME}
12WorkingDirectory=${SERVICE_HOME}
13−ExecStart=${SERVICE_HOME}/go-apps/bin/morty -key '' -listen '${MORTY_LISTEN}' -timeout ${MORTY_TIMEOUT}
13+ExecStart=${SERVICE_HOME}/go-apps/bin/morty -key '${MORTY_KEY}' -listen '${MORTY_LISTEN}' -timeout ${MORTY_TIMEOUT}
14
14
15Restart=always
15Restart=always
16Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME} DEBUG=${SERVICE_ENV_DEBUG}
16Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME} DEBUG=${SERVICE_ENV_DEBUG}