|
@@ -431,92 +431,6 @@ function select_user {
|
431
|
431
|
fi
|
432
|
432
|
}
|
433
|
433
|
|
434
|
|
-function email_extra_domains {
|
435
|
|
- email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
|
436
|
|
-
|
437
|
|
- data=$(tempfile 2>/dev/null)
|
438
|
|
- trap "rm -f $data" 0 1 2 5 15
|
439
|
|
- dialog --title $"Email Domains" \
|
440
|
|
- --backtitle $"Freedombone Control Panel" \
|
441
|
|
- --inputbox $"Enter the list of email domains to use, separated by semicolons" 8 60 2>$data
|
442
|
|
- sel=$?
|
443
|
|
- case $sel in
|
444
|
|
- 0)
|
445
|
|
- emailhostnames=$(<$data)
|
446
|
|
- if [ ${#emailhostnames} -gt 2 ]; then
|
447
|
|
- if [[ "$emailhostnames" == *"."* ]]; then
|
448
|
|
- if [[ "$emailhostnames" != *" "* ]]; then
|
449
|
|
- sed -i "s|dc_other_hostnames=.*|dc_other_hostnames='$emailhostnames'|g" /etc/exim4/update-exim4.conf.conf
|
450
|
|
- update-exim4.conf
|
451
|
|
- dpkg-reconfigure --frontend noninteractive exim4-config
|
452
|
|
- systemctl restart saslauthd
|
453
|
|
- dialog --title $"Email Domains" \
|
454
|
|
- --backtitle $"Freedombone Control Panel" \
|
455
|
|
- --msgbox $"Email domains were changed" 6 50
|
456
|
|
- else
|
457
|
|
- dialog --title $"Email Domains not set" \
|
458
|
|
- --backtitle $"Freedombone Control Panel" \
|
459
|
|
- --msgbox $"There should be no spaces in the list" 6 50
|
460
|
|
- fi
|
461
|
|
- fi
|
462
|
|
- fi
|
463
|
|
- ;;
|
464
|
|
- esac
|
465
|
|
-}
|
466
|
|
-
|
467
|
|
-function email_smtp_proxy {
|
468
|
|
- MUTTRC_FILE=/home/$ADMIN_USER/.muttrc
|
469
|
|
- if [ ! -f $MUTTRC_FILE ]; then
|
470
|
|
- return
|
471
|
|
- fi
|
472
|
|
-
|
473
|
|
- data=$(tempfile 2>/dev/null)
|
474
|
|
- trap "rm -f $data" 0 1 2 5 15
|
475
|
|
- dialog --backtitle $"Freedombone Control Panel" \
|
476
|
|
- --title $"SMTP Proxy for $ADMIN_USER" \
|
477
|
|
- --form $"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below." 14 75 6 \
|
478
|
|
- $"Enable proxy:" 1 1 "$SMTP_PROXY_ENABLE" 1 24 5 5 \
|
479
|
|
- $"Protocol (smtp/smtps):" 2 1 "$SMTP_PROXY_PROTOCOL" 2 24 5 5 \
|
480
|
|
- $"ISP mail server:" 3 1 "$SMTP_PROXY_SERVER" 3 24 40 10000 \
|
481
|
|
- $"Port:" 4 1 "$SMTP_PROXY_PORT" 4 24 5 5 \
|
482
|
|
- $"Username:" 5 1 "$SMTP_PROXY_USERNAME" 5 24 40 10000 \
|
483
|
|
- $"Password:" 6 1 "$SMTP_PROXY_PASSWORD" 6 24 40 10000 \
|
484
|
|
- 2> $data
|
485
|
|
- sel=$?
|
486
|
|
- case $sel in
|
487
|
|
- 1) return;;
|
488
|
|
- 255) return;;
|
489
|
|
- esac
|
490
|
|
- SMTP_PROXY_ENABLE=$(cat $data | sed -n 1p)
|
491
|
|
- SMTP_PROXY_PROTOCOL=$(cat $data | sed -n 2p)
|
492
|
|
- SMTP_PROXY_SERVER=$(cat $data | sed -n 3p)
|
493
|
|
- SMTP_PROXY_PORT=$(cat $data | sed -n 4p)
|
494
|
|
- SMTP_PROXY_USERNAME=$(cat $data | sed -n 5p)
|
495
|
|
- SMTP_PROXY_PASSWORD=$(cat $data | sed -n 6p)
|
496
|
|
-
|
497
|
|
- # change muttrc
|
498
|
|
- if [ $SMTP_PROXY_ENABLE != $'no' ]; then
|
499
|
|
- if ! grep "set smtp_url" $MUTTRC_FILE; then
|
500
|
|
- echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
|
501
|
|
- else
|
502
|
|
- sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
|
503
|
|
- fi
|
504
|
|
- sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
|
505
|
|
- else
|
506
|
|
- if grep "set smtp_url" $MUTTRC_FILE; then
|
507
|
|
- sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
|
508
|
|
- fi
|
509
|
|
- fi
|
510
|
|
-
|
511
|
|
- # save settings within the main configuration file
|
512
|
|
- write_config_param "SMTP_PROXY_ENABLE" "$SMTP_PROXY_ENABLE"
|
513
|
|
- write_config_param "SMTP_PROXY_PROTOCOL" "$SMTP_PROXY_PROTOCOL"
|
514
|
|
- write_config_param "SMTP_PROXY_SERVER" "$SMTP_PROXY_SERVER"
|
515
|
|
- write_config_param "SMTP_PROXY_PORT" "$SMTP_PROXY_PORT"
|
516
|
|
- write_config_param "SMTP_PROXY_USERNAME" "$SMTP_PROXY_USERNAME"
|
517
|
|
- write_config_param "SMTP_PROXY_PASSWORD" "$SMTP_PROXY_PASSWORD"
|
518
|
|
-}
|
519
|
|
-
|
520
|
434
|
function delete_user {
|
521
|
435
|
select_user
|
522
|
436
|
if [ ! $SELECTED_USERNAME ]; then
|
|
@@ -1605,6 +1519,92 @@ function show_firewall {
|
1605
|
1519
|
any_key
|
1606
|
1520
|
}
|
1607
|
1521
|
|
|
1522
|
+function email_extra_domains {
|
|
1523
|
+ email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
|
|
1524
|
+
|
|
1525
|
+ data=$(tempfile 2>/dev/null)
|
|
1526
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
1527
|
+ dialog --title $"Email Domains" \
|
|
1528
|
+ --backtitle $"Freedombone Control Panel" \
|
|
1529
|
+ --inputbox $"Enter the list of email domains to use, separated by semicolons" 8 60 2>$data
|
|
1530
|
+ sel=$?
|
|
1531
|
+ case $sel in
|
|
1532
|
+ 0)
|
|
1533
|
+ emailhostnames=$(<$data)
|
|
1534
|
+ if [ ${#emailhostnames} -gt 2 ]; then
|
|
1535
|
+ if [[ "$emailhostnames" == *"."* ]]; then
|
|
1536
|
+ if [[ "$emailhostnames" != *" "* ]]; then
|
|
1537
|
+ sed -i "s|dc_other_hostnames=.*|dc_other_hostnames='$emailhostnames'|g" /etc/exim4/update-exim4.conf.conf
|
|
1538
|
+ update-exim4.conf
|
|
1539
|
+ dpkg-reconfigure --frontend noninteractive exim4-config
|
|
1540
|
+ systemctl restart saslauthd
|
|
1541
|
+ dialog --title $"Email Domains" \
|
|
1542
|
+ --backtitle $"Freedombone Control Panel" \
|
|
1543
|
+ --msgbox $"Email domains were changed" 6 50
|
|
1544
|
+ else
|
|
1545
|
+ dialog --title $"Email Domains not set" \
|
|
1546
|
+ --backtitle $"Freedombone Control Panel" \
|
|
1547
|
+ --msgbox $"There should be no spaces in the list" 6 50
|
|
1548
|
+ fi
|
|
1549
|
+ fi
|
|
1550
|
+ fi
|
|
1551
|
+ ;;
|
|
1552
|
+ esac
|
|
1553
|
+}
|
|
1554
|
+
|
|
1555
|
+function email_smtp_proxy {
|
|
1556
|
+ MUTTRC_FILE=/home/$ADMIN_USER/.muttrc
|
|
1557
|
+ if [ ! -f $MUTTRC_FILE ]; then
|
|
1558
|
+ return
|
|
1559
|
+ fi
|
|
1560
|
+
|
|
1561
|
+ data=$(tempfile 2>/dev/null)
|
|
1562
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
1563
|
+ dialog --backtitle $"Freedombone Control Panel" \
|
|
1564
|
+ --title $"SMTP Proxy for $ADMIN_USER" \
|
|
1565
|
+ --form $"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below." 14 75 6 \
|
|
1566
|
+ $"Enable proxy:" 1 1 "$SMTP_PROXY_ENABLE" 1 24 5 5 \
|
|
1567
|
+ $"Protocol (smtp/smtps):" 2 1 "$SMTP_PROXY_PROTOCOL" 2 24 5 5 \
|
|
1568
|
+ $"ISP mail server:" 3 1 "$SMTP_PROXY_SERVER" 3 24 40 10000 \
|
|
1569
|
+ $"Port:" 4 1 "$SMTP_PROXY_PORT" 4 24 5 5 \
|
|
1570
|
+ $"Username:" 5 1 "$SMTP_PROXY_USERNAME" 5 24 40 10000 \
|
|
1571
|
+ $"Password:" 6 1 "$SMTP_PROXY_PASSWORD" 6 24 40 10000 \
|
|
1572
|
+ 2> $data
|
|
1573
|
+ sel=$?
|
|
1574
|
+ case $sel in
|
|
1575
|
+ 1) return;;
|
|
1576
|
+ 255) return;;
|
|
1577
|
+ esac
|
|
1578
|
+ SMTP_PROXY_ENABLE=$(cat $data | sed -n 1p)
|
|
1579
|
+ SMTP_PROXY_PROTOCOL=$(cat $data | sed -n 2p)
|
|
1580
|
+ SMTP_PROXY_SERVER=$(cat $data | sed -n 3p)
|
|
1581
|
+ SMTP_PROXY_PORT=$(cat $data | sed -n 4p)
|
|
1582
|
+ SMTP_PROXY_USERNAME=$(cat $data | sed -n 5p)
|
|
1583
|
+ SMTP_PROXY_PASSWORD=$(cat $data | sed -n 6p)
|
|
1584
|
+
|
|
1585
|
+ # change muttrc
|
|
1586
|
+ if [ $SMTP_PROXY_ENABLE != $'no' ]; then
|
|
1587
|
+ if ! grep "set smtp_url" $MUTTRC_FILE; then
|
|
1588
|
+ echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
|
|
1589
|
+ else
|
|
1590
|
+ sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
|
|
1591
|
+ fi
|
|
1592
|
+ sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
|
|
1593
|
+ else
|
|
1594
|
+ if grep "set smtp_url" $MUTTRC_FILE; then
|
|
1595
|
+ sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
|
|
1596
|
+ fi
|
|
1597
|
+ fi
|
|
1598
|
+
|
|
1599
|
+ # save settings within the main configuration file
|
|
1600
|
+ write_config_param "SMTP_PROXY_ENABLE" "$SMTP_PROXY_ENABLE"
|
|
1601
|
+ write_config_param "SMTP_PROXY_PROTOCOL" "$SMTP_PROXY_PROTOCOL"
|
|
1602
|
+ write_config_param "SMTP_PROXY_SERVER" "$SMTP_PROXY_SERVER"
|
|
1603
|
+ write_config_param "SMTP_PROXY_PORT" "$SMTP_PROXY_PORT"
|
|
1604
|
+ write_config_param "SMTP_PROXY_USERNAME" "$SMTP_PROXY_USERNAME"
|
|
1605
|
+ write_config_param "SMTP_PROXY_PASSWORD" "$SMTP_PROXY_PASSWORD"
|
|
1606
|
+}
|
|
1607
|
+
|
1608
|
1608
|
function menu_backup_restore {
|
1609
|
1609
|
while true
|
1610
|
1610
|
do
|
|
@@ -1651,14 +1651,16 @@ function menu_email {
|
1651
|
1651
|
data=$(tempfile 2>/dev/null)
|
1652
|
1652
|
trap "rm -f $data" 0 1 2 5 15
|
1653
|
1653
|
dialog --backtitle $"Freedombone Control Panel" \
|
1654
|
|
- --title $"Email Filtering Rules" \
|
1655
|
|
- --radiolist $"Choose an operation:" 13 70 6 \
|
|
1654
|
+ --title $"Email Menu" \
|
|
1655
|
+ --radiolist $"Choose an operation:" 15 70 8 \
|
1656
|
1656
|
1 $"Add a user to a mailing list" off \
|
1657
|
1657
|
2 $"Remove a user from a mailing list" off \
|
1658
|
1658
|
3 $"Add an email rule" off \
|
1659
|
1659
|
4 $"Block/Unblock an email address" off \
|
1660
|
1660
|
5 $"Block/Unblock email with subject text" off \
|
1661
|
|
- 6 $"Back to main menu" on 2> $data
|
|
1661
|
+ 6 $"Outgoing Email Proxy" off \
|
|
1662
|
+ 7 $"Extra email domains" off \
|
|
1663
|
+ 8 $"Back to main menu" on 2> $data
|
1662
|
1664
|
sel=$?
|
1663
|
1665
|
case $sel in
|
1664
|
1666
|
1) break;;
|
|
@@ -1670,7 +1672,9 @@ function menu_email {
|
1670
|
1672
|
3) email_rule;;
|
1671
|
1673
|
4) block_unblock_email;;
|
1672
|
1674
|
5) block_unblock_subject;;
|
1673
|
|
- 6) break;;
|
|
1675
|
+ 6) email_smtp_proxy;;
|
|
1676
|
+ 7) email_extra_domains;;
|
|
1677
|
+ 8) break;;
|
1674
|
1678
|
esac
|
1675
|
1679
|
done
|
1676
|
1680
|
}
|
|
@@ -1801,7 +1805,7 @@ function menu_top_level {
|
1801
|
1805
|
trap "rm -f $data" 0 1 2 5 15
|
1802
|
1806
|
dialog --backtitle $"Freedombone Control Panel" \
|
1803
|
1807
|
--title $"Control Panel" \
|
1804
|
|
- --radiolist $"Choose an operation:" 29 70 22 \
|
|
1808
|
+ --radiolist $"Choose an operation:" 27 70 20 \
|
1805
|
1809
|
1 $"About this system" off \
|
1806
|
1810
|
2 $"Backup and Restore" off \
|
1807
|
1811
|
3 $"Show Firewall" off \
|
|
@@ -1811,18 +1815,16 @@ function menu_top_level {
|
1811
|
1815
|
7 $"Logging on/off" off \
|
1812
|
1816
|
8 $"Ping enable/disable" off \
|
1813
|
1817
|
9 $"Manage Users" off \
|
1814
|
|
- 10 $"Email Filtering Rules" off \
|
1815
|
|
- 11 $"Outgoing Email Proxy" off \
|
1816
|
|
- 12 $"Extra email domains" off \
|
1817
|
|
- 13 $"Security Settings" off \
|
1818
|
|
- 14 $"Set the main repository (repo mirrors)" off \
|
1819
|
|
- 15 $"Change the name of this system" off \
|
1820
|
|
- 16 $"Set a static local IP address" off \
|
1821
|
|
- 17 $"Wifi menu" off \
|
1822
|
|
- 18 $"Check for updates" off \
|
1823
|
|
- 19 $"Power off the system" off \
|
1824
|
|
- 20 $"Restart the system" off \
|
1825
|
|
- 21 $"Exit" on 2> $data
|
|
1818
|
+ 10 $"Email Menu" off \
|
|
1819
|
+ 11 $"Security Settings" off \
|
|
1820
|
+ 12 $"Set the main repository (repo mirrors)" off \
|
|
1821
|
+ 13 $"Change the name of this system" off \
|
|
1822
|
+ 14 $"Set a static local IP address" off \
|
|
1823
|
+ 15 $"Wifi menu" off \
|
|
1824
|
+ 16 $"Check for updates" off \
|
|
1825
|
+ 17 $"Power off the system" off \
|
|
1826
|
+ 18 $"Restart the system" off \
|
|
1827
|
+ 19 $"Exit" on 2> $data
|
1826
|
1828
|
sel=$?
|
1827
|
1829
|
case $sel in
|
1828
|
1830
|
1) exit 1;;
|
|
@@ -1839,17 +1841,15 @@ function menu_top_level {
|
1839
|
1841
|
8) ping_enable_disable;;
|
1840
|
1842
|
9) menu_users;;
|
1841
|
1843
|
10) menu_email;;
|
1842
|
|
- 11) email_smtp_proxy;;
|
1843
|
|
- 12) email_extra_domains;;
|
1844
|
|
- 13) security_settings;;
|
1845
|
|
- 14) set_main_repo;;
|
1846
|
|
- 15) change_system_name;;
|
1847
|
|
- 16) set_static_IP;;
|
1848
|
|
- 17) menu_wifi;;
|
1849
|
|
- 18) check_for_updates;;
|
1850
|
|
- 19) shut_down_system;;
|
1851
|
|
- 20) restart_system;;
|
1852
|
|
- 21) break;;
|
|
1844
|
+ 11) security_settings;;
|
|
1845
|
+ 12) set_main_repo;;
|
|
1846
|
+ 13) change_system_name;;
|
|
1847
|
+ 14) set_static_IP;;
|
|
1848
|
+ 15) menu_wifi;;
|
|
1849
|
+ 16) check_for_updates;;
|
|
1850
|
+ 17) shut_down_system;;
|
|
1851
|
+ 18) restart_system;;
|
|
1852
|
+ 19) break;;
|
1853
|
1853
|
esac
|
1854
|
1854
|
done
|
1855
|
1855
|
}
|