Browse Source

Use the i2p user for bdsmail daemon

Bob Mottram 7 years ago
parent
commit
97d6524c90
1 changed files with 7 additions and 10 deletions
  1. 7
    10
      src/freedombone-app-bdsmail

+ 7
- 10
src/freedombone-app-bdsmail View File

@@ -86,7 +86,7 @@ function upgrade_bdsmail {
86 86
 
87 87
     # update to the next commit
88 88
     set_repo_commit /etc/bdsmail "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
89
-    chown -R bdsmail:bdsmail /etc/bdsmail
89
+    chown -R i2psvc:i2psvc /etc/bdsmail
90 90
 }
91 91
 
92 92
 function backup_local_bdsmail {
@@ -118,7 +118,7 @@ function restore_local_bdsmail {
118 118
             fi
119 119
             cp -rp $temp_restore_dir/* $bdsmail_dir
120 120
         fi
121
-        chown -R bdsmail:bdsmail $bdsmail_dir
121
+        chown -R i2psvc:i2psvc $bdsmail_dir
122 122
         rm -rf $temp_restore_dir
123 123
     fi
124 124
 
@@ -154,7 +154,7 @@ function restore_remote_bdsmail {
154 154
             fi
155 155
             cp -rp $temp_restore_dir/* $bdsmail_dir
156 156
         fi
157
-        chown -R bdsmail:bdsmail $bdsmail_dir
157
+        chown -R i2psvc:i2psvc $bdsmail_dir
158 158
         rm -rf $temp_restore_dir
159 159
     fi
160 160
 
@@ -167,7 +167,6 @@ function remove_bdsmail {
167 167
         systemctl disable bdsmail
168 168
         rm /etc/systemd/system/bdsmail.service
169 169
     fi
170
-    userdel -r bdsmail
171 170
 
172 171
     remove_i2p
173 172
     remove_app bdsmail
@@ -202,8 +201,6 @@ function install_bdsmail {
202 201
     git checkout $BDSMAIL_COMMIT -b $BDSMAIL_COMMIT
203 202
     set_completion_param "bdsmail commit" "$BDSMAIL_COMMIT"
204 203
 
205
-    useradd -d /etc/bdsmail -s /bin/false bdsmail
206
-
207 204
     make GOROOT=/home/go/go${GO_VERSION}
208 205
     if [ ! -f /etc/bdsmail/bin/bdsconfig ]; then
209 206
         echo $'Unable to make bdsmail'
@@ -232,17 +229,17 @@ function install_bdsmail {
232 229
     echo '' >> /etc/systemd/system/bdsmail.service
233 230
     echo '[Service]' >> /etc/systemd/system/bdsmail.service
234 231
     echo 'Type=simple' >> /etc/systemd/system/bdsmail.service
235
-    echo 'User=bdsmail' >> /etc/systemd/system/bdsmail.service
236
-    echo 'Group=bdsmail' >> /etc/systemd/system/bdsmail.service
232
+    echo 'User=i2psvc' >> /etc/systemd/system/bdsmail.service
233
+    echo 'Group=i2psvc' >> /etc/systemd/system/bdsmail.service
237 234
     echo 'WorkingDirectory=/etc/bdsmail' >> /etc/systemd/system/bdsmail.service
238 235
     echo 'ExecStart=/etc/bdsmail/bin/maild /etc/bdsmail/config.ini' >> /etc/systemd/system/bdsmail.service
239 236
     echo 'Restart=always' >> /etc/systemd/system/bdsmail.service
240
-    echo 'Environment="USER=bdsmail"' >> /etc/systemd/system/bdsmail.service
237
+    echo 'Environment="USER=i2psvc"' >> /etc/systemd/system/bdsmail.service
241 238
     echo '' >> /etc/systemd/system/bdsmail.service
242 239
     echo '[Install]' >> /etc/systemd/system/bdsmail.service
243 240
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
244 241
     systemctl enable bdsmail
245
-    chown -R bdsmail:bdsmail /etc/bdsmail
242
+    chown -R i2psvc:i2psvc /etc/bdsmail
246 243
     systemctl start bdsmail
247 244
 
248 245
     echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address