Browse Source

Notes on search engine

Bob Mottram 9 years ago
parent
commit
22d15f14d4
1 changed files with 39 additions and 16 deletions
  1. 39
    16
      src/freedombone

+ 39
- 16
src/freedombone View File

@@ -9160,6 +9160,14 @@ function install_gnu_social_markdown {
9160 9160
 }
9161 9161
 
9162 9162
 function install_search_engine {
9163
+    # Note: having a search engine is a nice idea, but at present there are a couple
9164
+    # of problems. One is that there is no access control, such that J random web surfer
9165
+    # could use your search engine. Secondly, the outgoing connection to other search
9166
+    # engines currently can't be socks5 proxied. This potentially causes legal liability
9167
+    # issues for the user - (i) providing secondard services beyond household members
9168
+    # and (ii) adversaries could try to incriminate you by searching for things illegal
9169
+    # within your zone.
9170
+    # Until these factors are addressed it's unwise to have this enabled by default.
9163 9171
     if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
9164 9172
         return
9165 9173
     fi
@@ -9172,6 +9180,13 @@ function install_search_engine {
9172 9180
     set_repo_commit $SEARCH_ENGINE_PATH/searx "Search engine commit" "$SEARCH_ENGINE_COMMIT" $SEARCH_ENGINE_REPO
9173 9181
     if grep "Search engine key" $COMPLETION_FILE; then
9174 9182
         if [ -f ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml ]; then
9183
+            # note: this might change to a --tor option in a later version
9184
+            if ! grep 'socks5://127.0.0.1:9050' ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml; then
9185
+                echo 'outgoing: # communication with search engines' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9186
+                echo '    proxies:' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9187
+                echo '        http : socks5://127.0.0.1:9050' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9188
+                echo '        https: socks5://127.0.0.1:9050' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9189
+            fi
9175 9190
             SEARCH_ENGINE_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
9176 9191
             sed -i "s|secret_key.*|secret_key : \"${SEARCH_ENGINE_SECRET_KEY}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9177 9192
             if [ -f /var/lib/tor/hidden_service_searx/hostname ]; then
@@ -9241,22 +9256,22 @@ function install_search_engine {
9241 9256
     useradd -d ${SEARCH_ENGINE_PATH}/searx/ -s /bin/false searx
9242 9257
 
9243 9258
     # daemon
9244
-	echo '[Unit]' > /etc/systemd/system/searx.service
9245
-	echo 'Description=Searx (search engine)' >> /etc/systemd/system/searx.service
9246
-	echo 'After=syslog.target' >> /etc/systemd/system/searx.service
9247
-	echo 'After=network.target' >> /etc/systemd/system/searx.service
9248
-	echo '' >> /etc/systemd/system/searx.service
9249
-	echo '[Service]' >> /etc/systemd/system/searx.service
9250
-	echo 'Type=simple' >> /etc/systemd/system/searx.service
9251
-	echo 'User=searx' >> /etc/systemd/system/searx.service
9252
-	echo 'Group=searx' >> /etc/systemd/system/searx.service
9253
-	echo "WorkingDirectory=${SEARCH_ENGINE_PATH}/searx" >> /etc/systemd/system/searx.service
9254
-	echo "ExecStart=/usr/bin/python ${SEARCH_ENGINE_PATH}/searx/searx/webapp.py" >> /etc/systemd/system/searx.service
9255
-	echo 'Restart=always' >> /etc/systemd/system/searx.service
9256
-	echo 'Environment="USER=searx"' >> /etc/systemd/system/searx.service
9257
-	echo '' >> /etc/systemd/system/searx.service
9258
-	echo '[Install]' >> /etc/systemd/system/searx.service
9259
-	echo 'WantedBy=multi-user.target' >> /etc/systemd/system/searx.service
9259
+    echo '[Unit]' > /etc/systemd/system/searx.service
9260
+    echo 'Description=Searx (search engine)' >> /etc/systemd/system/searx.service
9261
+    echo 'After=syslog.target' >> /etc/systemd/system/searx.service
9262
+    echo 'After=network.target' >> /etc/systemd/system/searx.service
9263
+    echo '' >> /etc/systemd/system/searx.service
9264
+    echo '[Service]' >> /etc/systemd/system/searx.service
9265
+    echo 'Type=simple' >> /etc/systemd/system/searx.service
9266
+    echo 'User=searx' >> /etc/systemd/system/searx.service
9267
+    echo 'Group=searx' >> /etc/systemd/system/searx.service
9268
+    echo "WorkingDirectory=${SEARCH_ENGINE_PATH}/searx" >> /etc/systemd/system/searx.service
9269
+    echo "ExecStart=/usr/bin/python ${SEARCH_ENGINE_PATH}/searx/searx/webapp.py" >> /etc/systemd/system/searx.service
9270
+    echo 'Restart=always' >> /etc/systemd/system/searx.service
9271
+    echo 'Environment="USER=searx"' >> /etc/systemd/system/searx.service
9272
+    echo '' >> /etc/systemd/system/searx.service
9273
+    echo '[Install]' >> /etc/systemd/system/searx.service
9274
+    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/searx.service
9260 9275
 
9261 9276
     # create a webserver file
9262 9277
     echo 'server {' >> /etc/nginx/sites-available/searx
@@ -9302,6 +9317,14 @@ function install_search_engine {
9302 9317
     sed -i "s|secret_key.*|secret_key : \"${SEARCH_ENGINE_SECRET_KEY}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9303 9318
     sed -i "s|base_url.*|base_url : \"http://${SEARCH_ENGINE_ONION_HOSTNAME}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9304 9319
 
9320
+    # note: this might change to a --tor option in a later version
9321
+    if ! grep 'socks5://127.0.0.1:9050' ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml; then
9322
+        echo 'outgoing: # communication with search engines' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9323
+        echo '    proxies:' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9324
+        echo '        http : socks5://127.0.0.1:9050' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9325
+        echo '        https: socks5://127.0.0.1:9050' >> ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9326
+    fi
9327
+
9305 9328
     chown -R searx:searx ${SEARCH_ENGINE_PATH}/searx
9306 9329
 
9307 9330
     # enable the site