|  | @@ -258,6 +258,7 @@ SEARCH_ENGINE_PATH=/etc
 | 
	
		
			
			| 258 | 258 |  SEARCH_ENGINE_ONION_PORT=8094
 | 
	
		
			
			| 259 | 259 |  SEARCH_ENGINE_ONION_HOSTNAME=
 | 
	
		
			
			| 260 | 260 |  SEARCH_ENGINE_LOGIN_TEXT=$"Search engine login"
 | 
	
		
			
			|  | 261 | +SEARCH_ENGINE_PASSWORD=
 | 
	
		
			
			| 261 | 262 |  
 | 
	
		
			
			| 262 | 263 |  GPG_KEYSERVER="hkp://keys.gnupg.net"
 | 
	
		
			
			| 263 | 264 |  
 | 
	
	
		
			
			|  | @@ -1047,6 +1048,9 @@ function read_configuration {
 | 
	
		
			
			| 1047 | 1048 |          if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
 | 
	
		
			
			| 1048 | 1049 |              cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
 | 
	
		
			
			| 1049 | 1050 |          fi
 | 
	
		
			
			|  | 1051 | +        if grep -q "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE; then
 | 
	
		
			
			|  | 1052 | +            SEARCH_ENGINE_PASSWORD=$(grep "SEARCH_ENGINE_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 | 
	
		
			
			|  | 1053 | +        fi
 | 
	
		
			
			| 1050 | 1054 |          if grep -q "XMPP_PASSWORD" $CONFIGURATION_FILE; then
 | 
	
		
			
			| 1051 | 1055 |              XMPP_PASSWORD=$(grep "XMPP_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 | 
	
		
			
			| 1052 | 1056 |          fi
 | 
	
	
		
			
			|  | @@ -9203,7 +9207,7 @@ function install_search_engine {
 | 
	
		
			
			| 9203 | 9207 |          return
 | 
	
		
			
			| 9204 | 9208 |      fi
 | 
	
		
			
			| 9205 | 9209 |  
 | 
	
		
			
			| 9206 |  | -    apt-get -y install python-pip libyaml-dev python-werkzeug python-babel python-lxml
 | 
	
		
			
			|  | 9210 | +    apt-get -y install python-pip libyaml-dev python-werkzeug python-babel python-lxml apache2-utils
 | 
	
		
			
			| 9207 | 9211 |      apt-get -y install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python libapache2-mod-uwsgi
 | 
	
		
			
			| 9208 | 9212 |  
 | 
	
		
			
			| 9209 | 9213 |      pip install --upgrade pip
 | 
	
	
		
			
			|  | @@ -9301,8 +9305,9 @@ function install_search_engine {
 | 
	
		
			
			| 9301 | 9305 |      echo '        proxy_set_header X-Remote-Port $remote_port;' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9302 | 9306 |      echo '        proxy_set_header X-Forwarded-Proto $scheme;' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9303 | 9307 |      echo '        proxy_redirect off;' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9304 |  | -    echo "        auth_pam \"${SEARCH_ENGINE_LOGIN_TEXT}\";" >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9305 |  | -    echo '        auth_pam_service_name "nginx";' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			|  | 9308 | +
 | 
	
		
			
			|  | 9309 | +    echo "        auth_basic \"${SEARCH_ENGINE_LOGIN_TEXT}\";" >> /etc/nginx/sites-available/searx
 | 
	
		
			
			|  | 9310 | +    echo '        auth_basic_user_file /etc/nginx/.htpasswd;' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9306 | 9311 |      echo '    }' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9307 | 9312 |      echo '' >> /etc/nginx/sites-available/searx
 | 
	
		
			
			| 9308 | 9313 |      echo '    fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/searx
 | 
	
	
		
			
			|  | @@ -9351,6 +9356,25 @@ function install_search_engine {
 | 
	
		
			
			| 9351 | 9356 |      systemctl daemon-reload
 | 
	
		
			
			| 9352 | 9357 |      systemctl start searx.service
 | 
	
		
			
			| 9353 | 9358 |  
 | 
	
		
			
			|  | 9359 | +    if ! grep -q "Your search engine password is" /home/$MY_USERNAME/README; then
 | 
	
		
			
			|  | 9360 | +        if [ ${#SEARCH_ENGINE_PASSWORD} -lt 8 ]; then
 | 
	
		
			
			|  | 9361 | +            if [ -f $IMAGE_PASSWORD_FILE ]; then
 | 
	
		
			
			|  | 9362 | +                SEARCH_ENGINE_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
 | 
	
		
			
			|  | 9363 | +            else
 | 
	
		
			
			|  | 9364 | +                SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 16)"
 | 
	
		
			
			|  | 9365 | +            fi
 | 
	
		
			
			|  | 9366 | +        fi
 | 
	
		
			
			|  | 9367 | +		echo "$SEARCH_ENGINE_PASSWORD" | htpasswd -i -d -c /etc/nginx/.htpasswd $MY_USERNAME
 | 
	
		
			
			|  | 9368 | +        echo '' >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9369 | +        echo '' >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9370 | +        echo $'Search Engine' >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9371 | +        echo '=============' >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9372 | +        echo $"Search engine onion domain: ${SEARCH_ENGINE_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9373 | +        echo $"Your search engine password is: $SEARCH_ENGINE_PASSWORD" >> /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9374 | +        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9375 | +        chmod 600 /home/$MY_USERNAME/README
 | 
	
		
			
			|  | 9376 | +    fi
 | 
	
		
			
			|  | 9377 | +
 | 
	
		
			
			| 9354 | 9378 |      echo 'install_search_engine' >> $COMPLETION_FILE
 | 
	
		
			
			| 9355 | 9379 |  }
 | 
	
		
			
			| 9356 | 9380 |  
 |