Browse Source

i2p firewall for smtp

Bob Mottram 7 years ago
parent
commit
6444469967
1 changed files with 11 additions and 3 deletions
  1. 11
    3
      src/freedombone-app-bdsmail

+ 11
- 3
src/freedombone-app-bdsmail View File

@@ -36,6 +36,8 @@ SHOW_ON_ABOUT=1
36 36
 BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
37 37
 BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
38 38
 BDSMAIL_DIR=/etc/bdsmail
39
+I2P_SAM_PORT=7656
40
+I2P_SMTP_PORT=2525
39 41
 
40 42
 bdsmail=(MY_USERNAME)
41 43
 
@@ -205,6 +207,9 @@ function remove_bdsmail {
205 207
         rm /etc/systemd/system/bdsmail.service
206 208
     fi
207 209
 
210
+    firewall_remove $I2P_SAM_PORT
211
+    firewall_remove $I2P_SMTP_PORT
212
+
208 213
     for d in /home/*/ ; do
209 214
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
210 215
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
@@ -277,9 +282,9 @@ function install_bdsmail {
277 282
     # create configuration file
278 283
     $BDSMAIL_DIR/bin/bdsconfig > $BDSMAIL_DIR/config.ini
279 284
     echo '[maild]' > $BDSMAIL_DIR/config.ini
280
-    echo 'i2paddr = 127.0.0.1:7656' >> $BDSMAIL_DIR/config.ini
285
+    echo "i2paddr = 127.0.0.1:$I2P_SAM_PORT" >> $BDSMAIL_DIR/config.ini
281 286
     echo 'i2pkeyfile = bdsmail-privkey.dat' >> $BDSMAIL_DIR/config.ini
282
-    echo 'bindmail = 127.0.0.1:2525' >> $BDSMAIL_DIR/config.ini
287
+    echo "bindmail = 127.0.0.1:$I2P_SMTP_PORT" >> $BDSMAIL_DIR/config.ini
283 288
     echo 'bindweb = 127.0.0.1:8489' >> $BDSMAIL_DIR/config.ini
284 289
     echo 'domain = localhost' >> $BDSMAIL_DIR/config.ini
285 290
     echo 'maildir = mail' >> $BDSMAIL_DIR/config.ini
@@ -352,7 +357,7 @@ function install_bdsmail {
352 357
     # Create mutt configuration
353 358
     mkdir /etc/skel/.mutt
354 359
     echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
355
-    echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
360
+    echo "set smtp_url=smtp://127.0.0.1:$I2P_SMTP_PORT/" >> /etc/skel/.mutt/bdsmail
356 361
     echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
357 362
     echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
358 363
     echo "set spoolfile=~/Maildir/i2p" >> /etc/skel/.mutt/bdsmail
@@ -385,6 +390,9 @@ function install_bdsmail {
385 390
             exit 638762424;;
386 391
     esac
387 392
 
393
+    firewall_add i2psam $I2P_SAM_PORT
394
+    firewall_add i2psmtp $I2P_SMTP_PORT
395
+
388 396
     APP_INSTALLED=1
389 397
 }
390 398