Quellcode durchsuchen

Search engine access control

Bob Mottram vor 9 Jahren
Ursprung
Commit
73ca1e0bbf
1 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen
  1. 14
    8
      src/freedombone

+ 14
- 8
src/freedombone Datei anzeigen

@@ -257,6 +257,7 @@ SEARCH_ENGINE_COMMIT='fee556c9904637051a9ba874ba7e71cd9f10789f'
257 257
 SEARCH_ENGINE_PATH=/etc
258 258
 SEARCH_ENGINE_ONION_PORT=8094
259 259
 SEARCH_ENGINE_ONION_HOSTNAME=
260
+SEARCH_ENGINE_LOGIN_TEXT=$"Search engine login"
260 261
 
261 262
 GPG_KEYSERVER="hkp://keys.gnupg.net"
262 263
 
@@ -6235,6 +6236,15 @@ function install_web_server {
6235 6236
     echo 'install_web_server' >> $COMPLETION_FILE
6236 6237
 }
6237 6238
 
6239
+function install_web_server_access_control {
6240
+    if [ ! -f /etc/pam.d/nginx ]; then
6241
+        echo '#%PAM-1.0' > /etc/pam.d/nginx
6242
+        echo '@include common-auth' >> /etc/pam.d/nginx
6243
+        echo '@include common-account' >> /etc/pam.d/nginx
6244
+        echo '@include common-session' >> /etc/pam.d/nginx
6245
+    fi
6246
+}
6247
+
6238 6248
 function configure_php {
6239 6249
     sed -i "s/memory_limit = 128M/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php5/fpm/php.ini
6240 6250
     sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
@@ -9160,14 +9170,7 @@ function install_gnu_social_markdown {
9160 9170
 }
9161 9171
 
9162 9172
 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.
9173
+    # Note: currently socks5 outgoing proxies to other search engines does not work
9171 9174
     if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
9172 9175
         return
9173 9176
     fi
@@ -9293,6 +9296,8 @@ function install_search_engine {
9293 9296
     echo '        proxy_set_header X-Remote-Port $remote_port;' >> /etc/nginx/sites-available/searx
9294 9297
     echo '        proxy_set_header X-Forwarded-Proto $scheme;' >> /etc/nginx/sites-available/searx
9295 9298
     echo '        proxy_redirect off;' >> /etc/nginx/sites-available/searx
9299
+    echo "        auth_pam \"${SEARCH_ENGINE_LOGIN_TEXT}\";" >> /etc/nginx/sites-available/searx
9300
+    echo '        auth_pam_service_name "nginx";' >> /etc/nginx/sites-available/searx
9296 9301
     echo '    }' >> /etc/nginx/sites-available/searx
9297 9302
     echo '' >> /etc/nginx/sites-available/searx
9298 9303
     echo '    fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/searx
@@ -10680,6 +10685,7 @@ encrypt_all_email
10680 10685
 import_email
10681 10686
 script_for_attaching_usb_drive
10682 10687
 install_web_server
10688
+install_web_server_access_control
10683 10689
 configure_firewall_for_web_server
10684 10690
 install_owncloud
10685 10691
 install_owncloud_music_app