|
@@ -1,6 +1,20 @@
|
1
|
1
|
#!/bin/bash
|
2
|
2
|
# Freedombone install script intended for use with Debian Jessie
|
3
|
|
-
|
|
3
|
+#
|
|
4
|
+# Note on dynamic dns
|
|
5
|
+# ===================
|
|
6
|
+#
|
|
7
|
+# I'm not particularly trying to promote freedns.afraid.org
|
|
8
|
+# as a service, it just happens to be a dynamic DNS system which
|
|
9
|
+# provides free (as in beer) accounts, and I'm trying to make the
|
|
10
|
+# process of setting up a working server as trivial as possible.
|
|
11
|
+# Other dynamic DNS systems are available, and if you're using
|
|
12
|
+# something different then comment out the section within
|
|
13
|
+# argument check and the call to dynamic_dns_freedns.
|
|
14
|
+#
|
|
15
|
+# Prerequisites
|
|
16
|
+# =============
|
|
17
|
+#
|
4
|
18
|
# cd ~/
|
5
|
19
|
# wget http://freedombone.uk.to/debian-jessie-console-armhf-2014-08-13.tar.xz
|
6
|
20
|
#
|
|
@@ -47,6 +61,7 @@
|
47
|
61
|
|
48
|
62
|
DOMAIN_NAME=$1
|
49
|
63
|
MY_USERNAME=$2
|
|
64
|
+FREEDNS_SUBDOMAIN_CODE=$3
|
50
|
65
|
|
51
|
66
|
SSH_PORT=2222
|
52
|
67
|
KERNEL_VERSION="v3.15.10-bone7"
|
|
@@ -77,6 +92,10 @@ function argument_checks {
|
77
|
92
|
echo "Please specify your username"
|
78
|
93
|
exit
|
79
|
94
|
fi
|
|
95
|
+ if [ ! $FREEDNS_SUBDOMAIN_CODE ]; then
|
|
96
|
+ echo "Please specify the freedns subdomain code. To find it from https://freedns.afraid.org select 'Dynamic DNS', then 'quick cron example' and copy the code located between '?' and '=='."
|
|
97
|
+ exit
|
|
98
|
+ fi
|
80
|
99
|
}
|
81
|
100
|
|
82
|
101
|
function change_login_message {
|
|
@@ -662,10 +681,13 @@ function configure_email {
|
662
|
681
|
}
|
663
|
682
|
|
664
|
683
|
function spam_filtering {
|
|
684
|
+ # NOTE: spamassassin installation currently doesn't work, sa-compile fails with a make error 23/09/2014
|
665
|
685
|
if grep -Fxq "spam_filtering" $COMPLETION_FILE; then
|
666
|
686
|
return
|
667
|
687
|
fi
|
668
|
|
- apt-get -y install spamassassin
|
|
688
|
+ apt-get -y --force-yes install exim4-daemon-heavy
|
|
689
|
+ apt-get -y --force-yes install spamassassin
|
|
690
|
+ sa-update -v
|
669
|
691
|
sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/spamassassin
|
670
|
692
|
sed -i 's/# spamd_address = 127.0.0.1 783/spamd_address = 127.0.0.1 783/g' /etc/exim4/exim4.conf.template
|
671
|
693
|
# This configuration is based on https://wiki.debian.org/DebianSpamAssassin
|
|
@@ -755,7 +777,7 @@ function configure_imap {
|
755
|
777
|
if grep -Fxq "configure_imap" $COMPLETION_FILE; then
|
756
|
778
|
return
|
757
|
779
|
fi
|
758
|
|
- apt-get -y install dovecot-common dovecot-imapd
|
|
780
|
+ apt-get -y --force-yes install dovecot-common dovecot-imapd
|
759
|
781
|
makecert dovecot
|
760
|
782
|
chown root:dovecot /etc/ssl/certs/dovecot.crt
|
761
|
783
|
chown root:dovecot /etc/ssl/private/dovecot.key
|
|
@@ -788,7 +810,7 @@ function email_client {
|
788
|
810
|
if grep -Fxq "email_client" $COMPLETION_FILE; then
|
789
|
811
|
return
|
790
|
812
|
fi
|
791
|
|
- apt-get -y install mutt-patched lynx abook
|
|
813
|
+ apt-get -y --force-yes install mutt-patched lynx abook
|
792
|
814
|
if [ ! -d /home/$MY_USERNAME/.mutt ]; then
|
793
|
815
|
mkdir /home/$MY_USERNAME/.mutt
|
794
|
816
|
fi
|
|
@@ -957,6 +979,24 @@ function folders_for_email_addresses {
|
957
|
979
|
echo 'folders_for_email_addresses' >> $COMPLETION_FILE
|
958
|
980
|
}
|
959
|
981
|
|
|
982
|
+function dynamic_dns_freedns {
|
|
983
|
+ if grep -Fxq "dynamic_dns_freedns" $COMPLETION_FILE; then
|
|
984
|
+ return
|
|
985
|
+ fi
|
|
986
|
+
|
|
987
|
+ echo '#!/bin/bash' > /usr/bin/dynamicdns
|
|
988
|
+ echo '# subdomain name 1' >> /usr/bin/dynamicdns
|
|
989
|
+ echo "wget -O - https://freedns.afraid.org/dynamic/update.php?$FREEDNS_SUBDOMAIN_CODE== >> /dev/null 2>&1" >> /usr/bin/dynamicdns
|
|
990
|
+ echo '# add any other subdomains below' >> /usr/bin/dynamicdns
|
|
991
|
+ chmod 600 /usr/bin/dynamicdns
|
|
992
|
+ chmod +x /usr/bin/dynamicdns
|
|
993
|
+
|
|
994
|
+ if ! grep -q "dynamicdns" /etc/crontab; then
|
|
995
|
+ sed -i '/# m h dom mon dow user command/a\*/5 * * * * root /usr/bin/timeout 240 /usr/bin/dynamicdns' /etc/crontab
|
|
996
|
+ fi
|
|
997
|
+ echo 'dynamic_dns_freedns' >> $COMPLETION_FILE
|
|
998
|
+}
|
|
999
|
+
|
960
|
1000
|
function install_final {
|
961
|
1001
|
if grep -Fxq "install_final" $COMPLETION_FILE; then
|
962
|
1002
|
return
|
|
@@ -998,5 +1038,6 @@ email_client
|
998
|
1038
|
configure_firewall_for_email
|
999
|
1039
|
folders_for_mailing_lists
|
1000
|
1040
|
folders_for_email_addresses
|
|
1041
|
+dynamic_dns_freedns
|
1001
|
1042
|
install_final
|
1002
|
1043
|
echo 'Freedombone installation is complete'
|