Adding search engine user
This commit is contained in:
parent
d1b0b0d921
commit
e87d8cc04b
|
@ -258,6 +258,7 @@ SEARCH_ENGINE_PATH=/etc
|
|||
SEARCH_ENGINE_ONION_PORT=8094
|
||||
SEARCH_ENGINE_ONION_HOSTNAME=
|
||||
SEARCH_ENGINE_LOGIN_TEXT=$"Search engine login"
|
||||
SEARCH_ENGINE_PASSWORD=
|
||||
|
||||
GPG_KEYSERVER="hkp://keys.gnupg.net"
|
||||
|
||||
|
@ -1047,6 +1048,9 @@ function read_configuration {
|
|||
if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
|
||||
cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
|
||||
fi
|
||||
if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
|
||||
SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "XMPP_PASSWORD" $CONFIGURATION_FILE; then
|
||||
XMPP_PASSWORD=$(grep "XMPP_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
|
@ -9203,7 +9207,7 @@ function install_search_engine {
|
|||
return
|
||||
fi
|
||||
|
||||
apt-get -y install python-pip libyaml-dev python-werkzeug python-babel python-lxml
|
||||
apt-get -y install python-pip libyaml-dev python-werkzeug python-babel python-lxml apache2-utils
|
||||
apt-get -y install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python libapache2-mod-uwsgi
|
||||
|
||||
pip install --upgrade pip
|
||||
|
@ -9301,8 +9305,9 @@ function install_search_engine {
|
|||
echo ' proxy_set_header X-Remote-Port $remote_port;' >> /etc/nginx/sites-available/searx
|
||||
echo ' proxy_set_header X-Forwarded-Proto $scheme;' >> /etc/nginx/sites-available/searx
|
||||
echo ' proxy_redirect off;' >> /etc/nginx/sites-available/searx
|
||||
echo " auth_pam \"${SEARCH_ENGINE_LOGIN_TEXT}\";" >> /etc/nginx/sites-available/searx
|
||||
echo ' auth_pam_service_name "nginx";' >> /etc/nginx/sites-available/searx
|
||||
|
||||
echo " auth_basic \"${SEARCH_ENGINE_LOGIN_TEXT}\";" >> /etc/nginx/sites-available/searx
|
||||
echo ' auth_basic_user_file /etc/nginx/.htpasswd;' >> /etc/nginx/sites-available/searx
|
||||
echo ' }' >> /etc/nginx/sites-available/searx
|
||||
echo '' >> /etc/nginx/sites-available/searx
|
||||
echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/searx
|
||||
|
@ -9351,6 +9356,25 @@ function install_search_engine {
|
|||
systemctl daemon-reload
|
||||
systemctl start searx.service
|
||||
|
||||
if ! grep -q "Your search engine password is" /home/$MY_USERNAME/README; then
|
||||
if [ ${#SEARCH_ENGINE_PASSWORD} -lt 8 ]; then
|
||||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
SEARCH_ENGINE_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 16)"
|
||||
fi
|
||||
fi
|
||||
echo "$SEARCH_ENGINE_PASSWORD" | htpasswd -i -d -c /etc/nginx/.htpasswd $MY_USERNAME
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
echo $'Search Engine' >> /home/$MY_USERNAME/README
|
||||
echo '=============' >> /home/$MY_USERNAME/README
|
||||
echo $"Search engine onion domain: ${SEARCH_ENGINE_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
|
||||
echo $"Your search engine password is: $SEARCH_ENGINE_PASSWORD" >> /home/$MY_USERNAME/README
|
||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
||||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo 'install_search_engine' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue