Quellcode durchsuchen

Use cookie authentication method for wiki #69

Bob Mottram vor 7 Jahren
Ursprung
Commit
bd3627a14a
1 geänderte Dateien mit 15 neuen und 5 gelöschten Zeilen
  1. 15
    5
      src/freedombone-app-fedwiki

+ 15
- 5
src/freedombone-app-fedwiki Datei anzeigen

@@ -9,7 +9,6 @@
9 9
 #                    Freedom in the Cloud
10 10
 #
11 11
 # Federated wiki
12
-# The only authentication options are proprietary, so deprecated
13 12
 #
14 13
 # License
15 14
 # =======
@@ -29,7 +28,7 @@
29 28
 # You should have received a copy of the GNU Affero General Public License
30 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
31 30
 
32
-VARIANTS=""
31
+VARIANTS="full full-vim media"
33 32
 
34 33
 IN_DEFAULT_INSTALL=0
35 34
 SHOW_ON_ABOUT=1
@@ -40,9 +39,11 @@ FEDWIKI_VERSION='0.13.0'
40 39
 FEDWIKI_ONION_PORT=8131
41 40
 FEDWIKI_PORT=3053
42 41
 FEDWIKI_DATA=/var/lib/fedwiki
42
+FEDWIKI_COOKIE=
43 43
 
44 44
 fedwiki_variables=(FEDWIKI_DOMAIN_NAME
45 45
                    FEDWIKI_CODE
46
+                   FEDWIKI_COOKIE
46 47
                    FEDWIKI_ADMIN_PASSWORD
47 48
                    ONION_ONLY
48 49
                    DDNS_PROVIDER
@@ -81,6 +82,14 @@ function fedwiki_remove_bad_links {
81 82
     if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
82 83
         rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
83 84
     fi
85
+
86
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-twitter ]; then
87
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-twitter
88
+    fi
89
+
90
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-github ]; then
91
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-github
92
+    fi
84 93
 }
85 94
 
86 95
 function logging_on_fedwiki {
@@ -396,8 +405,9 @@ function install_fedwiki {
396 405
 
397 406
     FEDWIKI_ONION_HOSTNAME=$(add_onion_service fedwiki 80 ${FEDWIKI_ONION_PORT})
398 407
 
399
-    #TODO add a config file for the identity system
400
-    # $FEDWIKI_DATA/config.json
408
+    if [ ! $FEDWIKI_COOKIE ]; then
409
+        FEDWIKI_COOKIE="$(create_password 30)$(create_password 30)$(create_password 30)"
410
+    fi
401 411
 
402 412
     echo '[Unit]' > /etc/systemd/system/fedwiki.service
403 413
     echo 'Description=Fedwiki Decentralized video streaming platform' >> /etc/systemd/system/fedwiki.service
@@ -408,7 +418,7 @@ function install_fedwiki {
408 418
     echo 'User=fedwiki' >> /etc/systemd/system/fedwiki.service
409 419
     echo 'Group=fedwiki' >> /etc/systemd/system/fedwiki.service
410 420
     echo "WorkingDirectory=/usr/local/lib/node_modules/wiki" >> /etc/systemd/system/fedwiki.service
411
-    echo "ExecStart=/usr/local/bin/wiki --config $FEDWIKI_DATA/config.json --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
421
+    echo "ExecStart=/usr/local/bin/wiki --security_type friends --cookieSecret '${FEDWIKI_COOKIE}' --session_duration 7 --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
412 422
     echo 'StandardOutput=syslog' >> /etc/systemd/system/fedwiki.service
413 423
     echo 'StandardError=syslog' >> /etc/systemd/system/fedwiki.service
414 424
     echo 'SyslogIdentifier=fedwiki' >> /etc/systemd/system/fedwiki.service