#+KEYWORDS: freedombox, debian, beaglebone, red matrix, email, web server, home server, internet, censorship, surveillance, social network, irc, jabber
#+DESCRIPTION: Turn the Beaglebone Black into a personal communications server
After the system has installed a README file will be generated which contains passwords and some brief advice on using the installed systems. You can read this with the following commands:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
emacs ~/README
#+END_SRC
You should transfer any passwords to a password manager such as [[http://www.keepassx.org/][KeepassX]] and then delete them from the README file. To save the file after removing passwords use *CTRL-x CTRL-s*.
To exit you can either just close the terminal or use *CTRL-x CTRL-c* followed by the *exit* command.
To improve ssh security you can generate an ssh key pair on your system and then upload the public key to the Freedombone.
On your local machine:
#+BEGIN_SRC bash
ssh-keygen
#+END_SRC
For extra security you may also want to add a passphrase to the ssh private key. You can show the generated public key with:
#+BEGIN_SRC bash
cat ~/.ssh/id_rsa.pub
#+END_SRC
Copy the contents of *~/.ssh/id_rsa* and *~/.ssh/id_rsa.pub* to you password manager, together with the private key password if you created one.
ssh to the Freedombone and edit the authorized keys:
#+BEGIN_SRC bash
ssh username@domain -p 2222
emacs ~/.ssh/authorized_keys
#+END_SRC
Now copy and paste the contents of *id_rsa.pub* into the authorized_keys file. Save the file and exit. Open another terminal window and try logging in again and you should notice that you are no longer asked for a password, because the ssh key is used instead.
There are advantages and disadvantages to using ssh keys for logins. The advantage is that this is much more secure than a memorised password, but the disadvantage is that you need to carry your ssh keys around and be able to install them on any computer of mobile device that you use. In high security or hostile infosec environments it may not be possible to carry or use USB thumb drives containing your keys and so memorised passwords may be the only available choice.
If you wish to only use ssh keys then log in to the Freedombone and edit */etc/ssh/sshd_config*, then change *PasswordAuthentication* to "no", save and run *service ssh restart*. Any subsequent attempts to log in via a password will then be denied.
Port 465 is used for SMTP and this is supposedly deprecated for secure email. However, using TLS from the start of the communications seems far more secure than starting off with insecure communications and then trying to upgrade it with a command to begin TLS, as happens with STARTTLS. There are [[https://www.eff.org/deeplinks/2014/11/starttls-downgrade-attacks][possible attacks against STARTTLS]] in which the command to begin secure communications is removed or overwritten which could then result in email being transferred in plain text over the internet and be readable by third parties.
If you didn't use existing GPG keys during the Freedombone installation then you'll need to add a password to your newly generated private key. This is highly recommended. Go through the following sequence of commands to ssh into the Freedombone and then change your GPG password.
#+BEGIN_SRC bash
ssh username@domainname -p 2222
gpg --edit-key username@domain
passwd
save
quit
exit
#+END_SRC
Having a password on your GPG key will prevent someone from reading your email /even if your server gets lost or stolen/ or if someone else has physical access to it. Make the password something long and unlikely to be guessable or vulnerable to a brute force [[http://en.wikipedia.org/wiki/Dictionary_attack][dictionary attack]].
** Publishing your GPG public key
If you havn't already then you should publish your GPG public key so that others can find it.
#+BEGIN_SRC bash
ssh username@domainname -p 2222
gpg --send-keys username@domainname
exit
#+END_SRC
** Mutt email client
Mutt is a terminal based email client which comes already installed onto the Freedombone. To access it you'll need to access it via ssh with:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
#+END_SRC
If you're using Windows there is an ssh client called putty, on Linux just open a terminal and enter the above command with your username and domain name. On Android you can use the ConnectBot app with the hostname *username@domain:2222*
Once you have logged in via ssh then just type *mutt*. Like most terminal programs mutt is quite easy once you've learned the main keys.
Some useful keys to know are:
| "/" | Search for text within headers |
| * | Move to the last message |
| TAB | Move to the next unread message |
| d | Delete a message |
| u | Undelete a mail which is pending deletion |
| $ | Delete all messages selected and check for new messages |
To use the address book system open an email by pressing the enter key on it 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.
One of the most common things which you might wish to do is to send an email. To do this first press /m/ to create a new message. Enter the address to send to and the subject, then after a few seconds the Emacs editor will appear with a blank document. Type your email then press /CTRL-x CTRL-s/ to save it and /CTRL-x CTRL-c/ to exit. You will then see a summary of the email to be sent out. Press /y/ to send it and then enter your GPG key passphrase (the one you gave when creating a PGP/GPG key). The purpose of that is to add a signature which is a strong proof that the email was written by you and not by someone else.
When reading emails you will initially need to enter your GPG password. It will be retained in RAM for a while afterwards.
** Thunderbird
Another common way in which you may want to access email is via Thunderbird. This may be especially useful if you're trying to convert former Windows users who may previously have been using some version of Outlook.
The following instructions should be carried out on the client machines (laptop, etc), not on the BBB itself.
*** Initial setup
Install *Thunderbird* and *Enigmail*. How you do this just depends upon your distro and software manager or "app store".
* Incoming: IMAP, mydomainname.com, 993, SSL/TLS, Normal Password
* Outgoing: SMTP, mydomainname.com, 465, SSL/TLS, Normal Password
* Username: myusername
Click *Done*.
Click *Get Certificate* and make sure "*permanently store this exception*" is selected", then click *Store Security Exception*.
From OpenPGP setup select "*Yes, I would like the wizard to get me started*". If the wizard doesn't start automatically then "setup wizard" can be selected from OpenPGP on the menu bar.
Select "*Yes, I want to sign all of my email*"
Select "*No, I will create per-recipient rules*"
Select "*yes*" to change default settings.
*** Import your GPG keys
On the Freedombone export your GPG public and private keys.
Select "*I have existing public and private keys*".
Select your public and private GPG exported key files.
Select the account which you want to use and click *Next*, *Next* and *Finish*.
Remove your exported key files, both on your laptop/desktop and also on the Freedombone.
#+BEGIN_SRC bash
shred -zu ~/public_key.gpg
shred -zu ~/private_key.gpg
#+END_SRC
*** Using for the first time
Click on the Thunderbird menu, which looks like three horizontal bars on the right hand side.
Hover over *preferences* and then *Account settings*.
Select *OpenPGP Security* and make sure that *use PGP/MIME by default* is ticked. This will enable you to sign/encrypt attachments, HTML bodies and UTF-8 without any problems.
Select *Synchronization & Storage*.
Make sure that *Keep messages for this account on this computer* is unticked, then click *Ok*.
Click on *Inbox*. Depending upon how much email you have it may take a while to import the subject lines.
Note that when sending an email for the first time you will also need to accept the SSL certificate.
Get into the habit of using email encryption and encourage others to do so. Remember that you may not think that your emails are very interesting but the Surveillance State is highly interested in them and will be actively trying to data mine your private life looking for "suspicious" patterns, regardless of whether you are guilty of any crime or not.
*** Making folders visible
By default you won't be able to see any folders which you may have created earlier using the /mailinglistrule/ script. To make folders visible select:
*Menu*, hover over *Preferences*, select *Account Settings*, select *Server Settings* then click on the *Advanced* button.
Make sure that "*show only subscribed folders*" is not checked. Then click the *ok* buttons. Folders will be re-scanned, which may take some time depending upon how much email you have, but your folders will then appear.
** K9 Android client
*NOTE*: Currently the K9 email client will not work with the Freedombone since it doesn't support PGP/MIME encoding. However, there is development work taking place on that feature and it is hoped that K9 may be usable in the near future.
*** Incoming server settings
* Select settings/account settings
* Select Fetching mail/incoming server
* Enter your username and password
* IMAP server should be your domain name
* Security: SSL/TLS (always)
* Authentication: Plain
* Port: 993
*** Outgoing (SMTP) server settings
* Select settings/account settings
* Select Sending mail/outgoing server
* Set SMTP server to your domain name
* Set Security to SSL/TLS (always)
* Set port to 465
* Set authentication to PLAIN
* Enter your username and password
* Accept the SSL certificate
*** Folders
To view any new folders which you may have created using the /mailinglistrule/ script from your inbox press the *K9 icon* at the top left to access folders, then press the *menu button* and select *refresh folder list*.
If your folder still doesn't show up then press the *menu button*, select *show folders* and select *all folders*.
The subject tag should be the word or phrase which appears within the brackets in the subject line of emails from the mailing list. The mailing list name should be something short so that it is readable within the left side column of the mutt email client, and contain no spaces. You can also use the *freedombone-rmlist* if you wish not to show a particular list within Mutt.
The group name should be something short so that it is readable within the left side column of the mutt email client, and not contain any spaces. You can also use the *freedombone-rmemail* command to remove an email address rule.
If you want to set up a public mailing list then when installing the system remember to set the *PUBLIC_MAILING_LIST* variable within *freedombone.cfg* to the name of your list. The name should have no spaces in it. Public mailing lists are unencrypted so anyone will be able to read the contents, including non subscribers.
To subscribe to your list send a cleartext email to:
#+BEGIN_SRC bash
mymailinglistname+subscribe@domainname
#+END_SRC
Tip: When using the Mutt email client if you want to send an email in cleartext then press *p* (for PGP) on the sending screen and select *clear*. Unsecure email is treated as being the exception rather than the default.
Within a browser go to your owncloud domain, then create an administrator account. The username and password can be anything, and ideally should be generated from a password manager.
You will also need to enter database details:
| Owncloud database user | owncloudadmin |
| Owncloud database password | See the [[Readme]] file |
| Owncloud database name | owncloud |
After creating an administrator account then create a user account via the Users dropdown menu entry on the right hand side and log the details in a password manager. Give the user a quota suitable for the size of your microSD card or other storage.
Log out from the administrator account and then log back in as the user you just created.
** On Android
Within F-droid search for *owncloud* and install the client. Also install *CalDAV Sync Adapter*.
Open the owncloud app and enter your owncloud domain name (including the https prefix) and login details for the user you created.
Open the calendar app (S planner) and under *settings* select *Calendars* then *Add account* then *CalDAV Sync Adapter*. Enter your owncloud username and password and the following URL:
An easy way to play music on any mobile device in your home is to use the DLNA service. Copy your music into a directory called "/Music/" on a USB thumb drive and then insert it into from socket on the Beaglebone.
ssh into the system with:
#+BEGIN_SRC bash
ssh myusername@mydomain.com -p 2222
#+END_SRC
Then mount the USB drive with:
#+BEGIN_SRC bash
su
attach-music
#+END_SRC
The system will scan the Music directory, which could take a while if there are thousands of files, but you don't need to do anything further with the Beaglebone other than perhaps to log out by typing *exit* a couple of times.
If you have an Android device then go to F-Droid (if you don't already have it installed then it can be [[https://f-droid.org/][downloaded here]]) and search for *ControlDLNA*. On running the app you should see a red Debian icon which you can press on, then you may need to select "local". After a few seconds the list of albums or tracks should then appear and you can browse and play them.
The DLNA service will only work within your local home network, and isn't remotely accessible from other locations via the internet. That can be both a good and a bad thing. Another consideration is that there are no access controls on DLNA services, so any music or videos on the USB drive will be playable by anyone within your home network. If you need to restrict access to certain files then it may be better to use the music player within Owncloud.
** With Owncloud
The main advantage of playing music via Owncloud is that you can do that from anywhere - not only within your home network.
By default a music player is installed into Owncloud, so all you need to do is to visit your Owncloud web site, select the *music* directory and then upload some music files. Afterwards you can select the *music icon* from the top left drop down menu and albums will then appear which can be played. If you want to share music with other users then you can select the *share* option from within the files view to make the tracks available.
| DB Password | See the MariaDB password in the [[Readme]] file |
| Administrator nickname | Your username |
| Administrator password | See the [[Readme]] file |
| Subscribe to announcements | ticked |
| Site profile | Community |
When the install is complete you will see a lot of warnings but just ignore those and navigate to your microblog domain and you can then complete the configuration via the *Admin* section on the header bar. Some recommended admin settings are:
| Site settings | Text limit 140, Dupe Limit 60000 |
You will need to have a non self-signed SSL certificate in order to use Red Matrix. Put the public certificate in */etc/ssl/certs/yourredmatrixdomainname.crt* and the private certificate in */etc/ssl/private/yourredmatrixdomainname.key*. If there is an intermediate certificate needed (such as with StartSSL) then this will need to be concatenated onto the end of the crt file, like this:
Then change ssl_certificate to */etc/ssl/certs/yourredmatrixdomainname.bundle.crt* within */etc/nginx/sites-available/yourredmatrixdomainname*
** Initial install
Visit the URL of your Red Matrix site and you should be taken through the rest of the installation procedure. Note that this may take a few minutes so don't be concerned if it looks as if it has crashed - just leave it running.
When installation is complete you can register a new user.
IRC is useful for multi-user chat. The classic use case is for software development where many engineers might need to coordinate their activities, but it's also useful for meetings, parties and general socialising.
Jitsi is the recommended communications client for desktop or laptop systems, since it includes the /off the record/ (OTR) feature which provides some additional security beyond the usual SSL certificates.
Jitsi can be downloaded from https://jitsi.org
On your desktop/laptop open Jitsi and select *Options* from the *Tools* menu.
Click *Add* to add a new user, then enter the Jabber ID which you previously specified with /prosodyctl/ when setting up the XMPP server. Close and then you should notice that your status is "Online" (or if not then you should be able to set it to online).
From the *File* menu you can add contacts, then select the chat icon to begin a chat. Click on the lock icon on the right hand side and this will initiate an authentication procedure in which you can specify a question and answer to verify the identity of the person you're communicating with. Once authentication is complete then you'll be chating using OTR, which provides an additional layer of security.
When opening Jitsi initially you will get a certificate warning for your domain name (assuming that you're using a self-signed certificate). If this happens then select *View Certificate* and enable the checkbox to trust the certificate, then select *Continue Anyway*. Once you've done this then the certificate warning will not appear again unless you reinstall Jitsi or use a different computer.
You can also [[https://www.youtube.com/watch?v=vgx7VSrDGjk][see this video]] as an example of using OTR.
*** Using with Ubuntu
The default XMPP client in Ubuntu is Empathy. Using Empathy isn't as secure as using Jitsi, since it doesn't include the /off the record/ feature, but since it's the default it's what many users will have easy access to.
Open *System Settings* and select *Online Accounts*, *Add account* and then *Jabber*.
Enter your username (username@domainname) and password.
Click on *Advanced* and make sure that *Encryption required* and *Ignore SSL certificate errors* are checked. Ignoring the certificate errors will allow you to use the self-signed certificate created earlier. Then click *Done* and set your Jabber account and Empathy to *On*.
*** Using with Android
Install [[https://f-droid.org/][F-Droid]]
Search for and install Xabber.
Add an account and enter your Jabber/XMPP ID and password.
From the menu select *Settings* then *Security* then *OTR mode*. Set the mode to *Required*.
Make sure that *Check server certificate* is not checked.
Go back to the initial screen and then using the menu you can add contacts and begin chatting. Both parties will need to go through the off-the-record question and answer verification before the chat can begin, but that only needs to be done once for each person you're chatting with.
Tox is an encrypted peer-to-peer messaging system and so should work without Freedombone. It uses a system of nodes which act as a sort of directory service allowing users to find and connect to each other. The Tox node ID on the Freedombone can be found within the README within your home directory. If you have other users connect to your node then you will be able to continue chatting even when no other nodes are available.
Click on "add new" to add a new server and enter the default domain name for the Freedombone, your username (which can be anything) and the VoIP server password which can be found in the README file on the Freedombone. Accept the self-signed SSL certificate. You are now ready to chat.
/Note: if you don't know the default domain name and you did a full installation then it will be the same as the wiki domain name./
*** Using with Android
Install [[https://f-droid.org/][F-Droid]]
Search for and install Plumble.
Press the plus button to add a Mumble server.
Enter a label (which can be any name you choose for the server), the default domain name of the Freedombone, your username (which can also be anything) and the VoIP server password which can be found in the README file on the Freedombone.
Selecting the server by pressing on it then connects you to the server so that you can chat with other connected users.
/Note: if you don't know the default domain name and you did a full installation then it will be the same as the wiki domain name./