Browse Source

Webmail instructions

Bob Mottram 11 years ago
parent
commit
74c1bd7bc4
1 changed files with 239 additions and 116 deletions
  1. 239
    116
      beaglebone.txt

+ 239
- 116
beaglebone.txt View File

@@ -3,6 +3,7 @@
3 3
 #+EMAIL: bob@robotics.uk.to
4 4
 #+KEYWORDS: freedombox, debian, beaglebone, friendica, email, web server, home server, internet, censorship, surveillance, social network, irc, jabber, chat
5 5
 #+DESCRIPTION: Turn the Beaglebone Black into a personal communications server
6
+#+OPTIONS: ^:nil
6 7
 
7 8
 #+BEGIN_CENTER
8 9
 *How to turn the Beaglebone Black into a FreedomBox-like personal communications server*
@@ -815,124 +816,6 @@ mail_location = maildir:~/Maildir
815 816
 service dovecot restart
816 817
 #+END_SRC
817 818
 
818
-** Mutt email client
819
-
820
-#+BEGIN_VERSE
821
-/I dreamt last night that I was living in a surveillance state. I woke up and… I’m still in a surveillance state./
822
-
823
-#+END_VERSE
824
-
825
-#+BEGIN_SRC: bash
826
-apt-get install mutt lynx abook
827
-exit
828
-mkdir ~/.mutt
829
-echo "text/html; lynx -dump -width=78 -nolist %s | sed ‘s/^ //’; copiousoutput; needsterminal; nametemplate=%s.html" > ~/.mutt/mailcap
830
-#+END_SRC
831
-
832
-Save and exit.
833
-
834
-#+BEGIN_SRC: bash
835
-su
836
-emacs /etc/Muttrc
837
-#+END_SRC
838
-
839
-Append the following:
840
-
841
-#+BEGIN_SRC: bash
842
-set mbox_type=Maildir
843
-set folder="~/Maildir"
844
-set mask="!^\\.[^.]"
845
-set mbox="~/Maildir"
846
-set record="+.Sent"
847
-set postponed="+.Drafts"
848
-set spoolfile="~/Maildir"
849
-auto_view text/x-vcard text/html text/enriched
850
-set editor="emacsclient %s"
851
-
852
-macro index S "<tag-prefix><save-message>=.learn-spam<enter>" "move to learn-spam"
853
-macro pager S "<save-message>=.learn-spam<enter>" "move to learn-spam"
854
-macro index H "<tag-prefix><copy-message>=.learn-ham<enter>" "copy to learn-ham"
855
-macro pager H "<copy-message>=.learn-ham<enter>" "copy to learn-ham"
856
-#+END_SRC
857
-
858
-Save and exit.
859
-
860
-#+BEGIN_SRC: bash
861
-emacs /etc/mail/spamassassin/local.cf
862
-#+END_SRC
863
-
864
-Uncomment *use_bayes*, *bayes_auto_learn*
865
-
866
-Save and exit, then run:
867
-
868
-#+BEGIN_SRC: bash
869
-service spamassassin restart
870
-#+END_SRC
871
-
872
-Now to add an address book:
873
-
874
-#+BEGIN_SRC: bash
875
-emacs ~/.muttrc
876
-#+END_SRC
877
-
878
-Append the following:
879
-
880
-#+BEGIN_SRC: bash
881
-set alias_file=~/.mutt-alias
882
-source ~/.mutt-alias
883
-set query_command= "abook --mutt-query '%s'"
884
-macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
885
-#+END_SRC
886
-
887
-Then save and exit.
888
-
889
-#+BEGIN_SRC: bash
890
-touch ~/.mutt-alias
891
-#+END_SRC
892
-
893
-Finally you can then type *mutt* to get access to your email.  Hence as a fallback, or if you prefer as the primary way of accessing email, you can ssh into the BBB and use the mutt command line email client.  Ssh clients are available for all operating systems, and also you should be reasonably protected from passive surveillance between wherever you are and the BBB (although not between the BBB and the wider internet), which can be useful if you are for example using an Android tablet from a cafe or railway station.
894
-
895
-To use the address book system open an email and then to add the sender to the address list press the A key.  It will ask you for an alias which may be used the next time you want to send a mail.  Alternatively you may just edit the *~/.mutt-alias* file directly to add email addresses.
896
-
897
-Some useful keys to know are:
898
-
899
-| ESC / | Search for text within message contents                 |
900
-| "/"   | Search for text within headers                          |
901
-| *     | Move to the last message                                |
902
-| TAB   | Move to the next unread message                         |
903
-| d     | Delete a message                                        |
904
-| u     | Undelete a mail which is pending deletion               |
905
-| $     | Delete all messages selected and check for new messages |
906
-| a     | Add to the address book                                 |
907
-| m     | Send a new mail                                         |
908
-| S     | Mark a message as spam                                  |
909
-| H     | Mark a message as ham                                   |
910
-
911
-** K9 email client
912
-
913
-#+BEGIN_VERSE
914
-/The surveillance state is robust. It is robust politically, legally, and technically./
915
-
916
-#+END_VERSE
917
-
918
-*** Incoming server settings
919
- * Select settings/account settings
920
- * Select Fetching mail/incoming server
921
- * Enter your username and password
922
- * IMAP server should be your domain name
923
- * Security: SSL/TLS (always)
924
- * Authentication: Plain
925
- * Port: 993
926
-*** Outgoing (SMTP) server settings
927
- * Select settings/account settings
928
- * Select Sending mail/outgoing server
929
- * Set SMTP server to your domain name
930
- * Set Security to SSL/TLS (always)
931
- * Set port to 465
932
-** Webmail
933
-TODO
934 819
 ** Setting up a web site
935 820
 
936 821
 #+BEGIN_VERSE
@@ -1212,6 +1095,244 @@ chmod +x makecert
1212 1095
 Enter some trivial password for the key file.  The password will be removed as part of the makecert script.  Note that leaving a password on the key file would mean that after a power cycle the apache server will not be able to boot properly (it would wait indefinitely for a password to be manually entered) and would look as if it had crashed.
1213 1096
 
1214 1097
 If all has gone well then there should be no warnings or errors after you run the service restart command.  After that you should enable ports 80 (HTTP) and 443 (HTTPS) on your internet router/firewall, such that they are redirected to the BBB.
1098
+
1099
+** Accessing your Email
1100
+*** Mutt email client
1101
+
1102
+#+BEGIN_VERSE
1103
+/I dreamt last night that I was living in a surveillance state. I woke up and… I’m still in a surveillance state./
1104
+
1105
+-- Conrad Kramer
1106
+#+END_VERSE
1107
+
1108
+#+BEGIN_SRC: bash
1109
+apt-get install mutt lynx abook
1110
+exit
1111
+mkdir ~/.mutt
1112
+echo "text/html; lynx -dump -width=78 -nolist %s | sed ‘s/^ //’; copiousoutput; needsterminal; nametemplate=%s.html" > ~/.mutt/mailcap
1113
+#+END_SRC
1114
+
1115
+Save and exit.
1116
+
1117
+#+BEGIN_SRC: bash
1118
+su
1119
+emacs /etc/Muttrc
1120
+#+END_SRC
1121
+
1122
+Append the following:
1123
+
1124
+#+BEGIN_SRC: bash
1125
+set mbox_type=Maildir
1126
+set folder="~/Maildir"
1127
+set mask="!^\\.[^.]"
1128
+set mbox="~/Maildir"
1129
+set record="+.Sent"
1130
+set postponed="+.Drafts"
1131
+set spoolfile="~/Maildir"
1132
+auto_view text/x-vcard text/html text/enriched
1133
+set editor="emacsclient %s"
1134
+
1135
+macro index S "<tag-prefix><save-message>=.learn-spam<enter>" "move to learn-spam"
1136
+macro pager S "<save-message>=.learn-spam<enter>" "move to learn-spam"
1137
+macro index H "<tag-prefix><copy-message>=.learn-ham<enter>" "copy to learn-ham"
1138
+macro pager H "<copy-message>=.learn-ham<enter>" "copy to learn-ham"
1139
+#+END_SRC
1140
+
1141
+Save and exit.
1142
+
1143
+#+BEGIN_SRC: bash
1144
+emacs /etc/mail/spamassassin/local.cf
1145
+#+END_SRC
1146
+
1147
+Uncomment *use_bayes*, *bayes_auto_learn*
1148
+
1149
+Save and exit, then run:
1150
+
1151
+#+BEGIN_SRC: bash
1152
+service spamassassin restart
1153
+#+END_SRC
1154
+
1155
+Now to add an address book:
1156
+
1157
+#+BEGIN_SRC: bash
1158
+emacs ~/.muttrc
1159
+#+END_SRC
1160
+
1161
+Append the following:
1162
+
1163
+#+BEGIN_SRC: bash
1164
+set alias_file=~/.mutt-alias
1165
+source ~/.mutt-alias
1166
+set query_command= "abook --mutt-query '%s'"
1167
+macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
1168
+#+END_SRC
1169
+
1170
+Then save and exit.
1171
+
1172
+#+BEGIN_SRC: bash
1173
+touch ~/.mutt-alias
1174
+#+END_SRC
1175
+
1176
+Finally you can then type *mutt* to get access to your email.  Hence as a fallback, or if you prefer as the primary way of accessing email, you can ssh into the BBB and use the mutt command line email client.  Ssh clients are available for all operating systems, and also you should be reasonably protected from passive surveillance between wherever you are and the BBB (although not between the BBB and the wider internet), which can be useful if you are for example using an Android tablet from a cafe or railway station.
1177
+
1178
+To use the address book system open an email and then to add the sender to the address list press the A key.  It will ask you for an alias which may be used the next time you want to send a mail.  Alternatively you may just edit the *~/.mutt-alias* file directly to add email addresses.
1179
+
1180
+Some useful keys to know are:
1181
+
1182
+| ESC / | Search for text within message contents                 |
1183
+| "/"   | Search for text within headers                          |
1184
+| *     | Move to the last message                                |
1185
+| TAB   | Move to the next unread message                         |
1186
+| d     | Delete a message                                        |
1187
+| u     | Undelete a mail which is pending deletion               |
1188
+| $     | Delete all messages selected and check for new messages |
1189
+| a     | Add to the address book                                 |
1190
+| m     | Send a new mail                                         |
1191
+| S     | Mark a message as spam                                  |
1192
+| H     | Mark a message as ham                                   |
1193
+
1194
+*** K9 Android client
1195
+
1196
+#+BEGIN_VERSE
1197
+/The surveillance state is robust. It is robust politically, legally, and technically./
1198
+
1199
+-- Bruce Schneier
1200
+#+END_VERSE
1201
+
1202
+**** Incoming server settings
1203
+ * Select settings/account settings
1204
+ * Select Fetching mail/incoming server
1205
+ * Enter your username and password
1206
+ * IMAP server should be your domain name
1207
+ * Security: SSL/TLS (always)
1208
+ * Authentication: Plain
1209
+ * Port: 993
1210
+**** Outgoing (SMTP) server settings
1211
+ * Select settings/account settings
1212
+ * Select Sending mail/outgoing server
1213
+ * Set SMTP server to your domain name
1214
+ * Set Security to SSL/TLS (always)
1215
+ * Set port to 465
1216
+*** Webmail
1217
+
1218
+#+BEGIN_VERSE
1219
+/Most of the information extracted is "content", such as recordings of phone calls or the substance of email messages./
1220
+
1221
+-- From a 2013 Guardian article on GCHQ/NSA bulk internet data interception.
1222
+#+END_VERSE
1223
+
1224
+Install dependencies.
1225
+
1226
+#+BEGIN_SRC: bash
1227
+apt-get install libapache2-mod-authz-unixgroup
1228
+#+END_SRC
1229
+
1230
+Create a mysql database, specifying a password which should be a long random string generated with a password manager such as KeepassX.
1231
+
1232
+#+BEGIN_SRC: bash
1233
+mysql -u root -p
1234
+create database roundcubemail;
1235
+CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'roundcubepassword';
1236
+GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
1237
+quit
1238
+#+END_SRC
1239
+
1240
+Download roundcube.
1241
+
1242
+#+BEGIN_SRC: bash
1243
+cd /tmp
1244
+wget http://freedombone.uk.to/roundcubemail.tar.gz
1245
+#+END_SRC
1246
+
1247
+Verify it.
1248
+
1249
+#+BEGIN_SRC: bash
1250
+md5sum roundcubemail.tar.gz
1251
+1b1b4056f5fe3903124229427a3bbd1f
1252
+#+END_SRC
1253
+
1254
+Extract the files.
1255
+
1256
+#+BEGIN_SRC: bash
1257
+tar -xzvf roundcubemail.tar.gz
1258
+export HOSTNAME=mydomainname.com
1259
+cp -r roundcubemail-* /var/www/$HOSTNAME/htdocs/mail
1260
+chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/temp
1261
+chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/logs
1262
+rm /var/www/$HOSTNAME/htdocs/mail/.htaccess
1263
+#+END_SRC
1264
+
1265
+Edit your web site configuration.
1266
+
1267
+#+BEGIN_SRC: bash
1268
+emacs /etc/apache2/sites-available/$HOSTNAME
1269
+#+END_SRC
1270
+
1271
+Within the 80 VirtualHost section add the following:
1272
+
1273
+#+BEGIN_SRC: bash
1274
+  <Directory /var/www/mydomainname.com/htdocs/mail>
1275
+    deny from all
1276
+  </Directory>
1277
+#+END_SRC
1278
+
1279
+Within the 443 VirtualHost section add the following:
1280
+
1281
+#+BEGIN_SRC: bash
1282
+  <Directory /var/www/mydomainname.com/htdocs/mail>
1283
+    Options Indexes FollowSymLinks MultiViews
1284
+    AllowOverride All
1285
+    Order allow,deny
1286
+    allow from all
1287
+  </Directory>
1288
+#+END_SRC
1289
+
1290
+Save and exit, then restart Apache.
1291
+
1292
+#+BEGIN_SRC: bash
1293
+service apache2 restart
1294
+#+END_SRC
1295
+
1296
+Now with a browser visit https://mydomainname.com/mail/installer.  Scroll down and click "next".  Give your webmail site a product name.
1297
+
1298
+The *spellcheck_engine* option being limited to Google is slightly concerning in terms of privacy and security, but seems not to be implemented.
1299
+
1300
+Change the *database password* to the password you gave when creating the MySql database above.
1301
+
1302
+Set *smtp_port* to 465.
1303
+
1304
+Click *create config*
1305
+
1306
+Click download to download the file.
1307
+
1308
+In a terminal on your local machine (not logged into the BBB):
1309
+
1310
+#+BEGIN_SRC: bash
1311
+cd ~/Downloads
1312
+scp config.inc.php myusername@mydomainname.com:/home/myusername
1313
+#+END_SRC
1314
+
1315
+Then in a terminal ssh'd into the BBB:
1316
+
1317
+#+BEGIN_SRC: bash
1318
+mv /home/myusername/config.inc.php /var/www/$HOSTNAME/htdocs/mail/config
1319
+chmod 755 /var/www/$HOSTNAME/htdocs/mail/config/config.inc.php
1320
+#+END_SRC
1321
+
1322
+Click *continue*.
1323
+
1324
+Click *initialize database*.
1325
+
1326
+Under *Test SMTP config* you can use a [[mailinator.com]] address to check that mail can be sent.
1327
+
1328
+Now we can delete the installer.
1329
+
1330
+#+BEGIN_SRC: bash
1331
+rm -rf /var/www/$HOSTNAME/htdocs/mail/installer
1332
+#+END_SRC
1333
+
1334
+Now with a browser navigate to https://mydomainname.com/mail and log in.
1335
+
1215 1336
 ** Install a Blog
1216 1337
 
1217 1338
 #+BEGIN_VERSE