freedombone/doc/EN/usage.org

503 lines
26 KiB
Org Mode
Raw Normal View History

2014-10-25 20:09:46 +02:00
#+TITLE:
#+AUTHOR: Bob Mottram
#+EMAIL: bob@robotics.uk.to
#+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
#+OPTIONS: ^:nil
#+BEGIN_CENTER
[[./images/logo.png]]
#+END_CENTER
2014-10-27 23:46:55 +01:00
| [[file:index.html][Home]] | [[Readme]] | [[Using Email]] | [[Mailing List]] | [[Syncing to the Cloud]] | [[Play Music]] | [[Microblogging]] | [[Social Network]] | [[Chat Services]] |
2014-10-26 00:10:49 +02:00
2014-10-26 09:54:57 +01:00
* Readme
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.
2014-12-08 19:43:32 +01:00
* Improving ssh security
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.
2014-10-25 23:32:36 +02:00
* Using Email
** A technical note about email transport security
2014-11-11 22:14:26 +01:00
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.
2014-10-25 23:32:36 +02:00
** Add a password to your GPG key
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 |
| a | Add to the address book |
| m | Send a new mail |
| ESC-m | Mark all messages as having been read |
| S | Mark a message as spam |
| H | Mark a message as ham |
| CTRL-b | Toggle side bar on/off |
| CTRL-n | Next mailbox (on side bar) |
| CTRL-p | Previous mailbox (on side bar) |
| CTRL-o | Open mailbox (on side bar) |
2015-04-09 00:38:27 +02:00
| r | Reply to an email |
| L | Reply to a mailing list email |
2014-10-25 23:32:36 +02:00
| ] | Expand or collapse all threads |
| [ | Expand of collapse the current thread |
| CTRL-k | Import a PGP/GPG public key |
| q | Quit |
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".
Open Thinderbird
Select "*Skip this and use existing email*"
Enter your name, email address (myusername@mydomainname.com) and the password for your user (the one from [[Add a user]]).
You'll get a message saying "/Thunderbird failed to find the settings/"
The settings should be as follows, substituting /mydomainname.com/ for your domain name and /myusername/ for the username given previously in [[Add a user]].
* 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.
#+BEGIN_SRC bash
2014-10-27 23:42:59 +01:00
ssh username@domainname -p 2222
gpg --list-keys username@domainname
2014-10-25 23:32:36 +02:00
gpg --output ~/public_key.gpg --armor --export KEY_ID
gpg --output ~/private_key.gpg --armor --export-secret-key KEY_ID
#+END_SRC
On your laptop or desktop you can import the keys with:
#+BEGIN_SRC bash
scp -P 2222 username@domain:/home/username/*.gpg ~/
#+END_SRC
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*.
2014-10-25 20:09:46 +02:00
2014-10-26 00:19:14 +02:00
** Subscribing to mailing lists
To subscribe to a mailing list log in as your user (i.e. not the root user).
2014-10-26 00:19:14 +02:00
#+BEGIN_SRC bash
ssh username@domainname -p 2222
2015-04-09 00:33:05 +02:00
freedombone-addlist -l <mailing list name> -s <subject tag> -e <list email address>
2014-10-26 00:19:14 +02:00
exit
#+END_SRC
2015-04-05 14:17:33 +02:00
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.
2014-10-26 00:23:26 +02:00
** Adding email addresses to a group/folder
Similar to adding mailing list folders you can also add specified email addresses into a group/folder.
2014-10-26 00:23:26 +02:00
#+BEGIN_SRC bash
ssh username@domainname -p 2222
freedombone-addemail -e <email address> -g <group name>
2014-10-26 00:23:26 +02:00
exit
#+END_SRC
2015-04-05 14:17:33 +02:00
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.
2014-10-26 00:19:14 +02:00
** Ignoring incoming emails
It is possible to ignore incoming emails if they are from a particular email address or if the subject line contains particular text.
#+BEGIN_SRC bash
ssh username@domainname -p 2222
freedombone-ignore -e baduser@baddomain
exit
#+END_SRC
Or:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
freedombone-ignore -t "make $$$ now!"
exit
#+END_SRC
You can also reverse this by using the *freedombone-unignore* command with the same options.
2014-10-26 09:29:31 +01:00
* Mailing List
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.
2014-10-26 10:32:30 +01:00
* Syncing to the Cloud
** Initial install
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 and under *settings* add a CalDav account with the url:
#+BEGIN_SRC bash
https://myownclouddomain/remote.php/caldav/principals/myowncloudusername
#+END_SRC
You will also be prompted to enter login details. Your Android and Owncloud calendars should now be synchronised.
** On Linux
Open your software center and search for "owncloud client". Enter your owncloud domain name (with the https prefix) and login details.
You can now drag files into the *~/owncloud* directory and they will automatically sync to your server. It's that easy.
2014-10-25 20:09:46 +02:00
* Play Music
** With the DLNA service
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.
2014-10-25 23:32:36 +02:00
* Microblogging
2014-10-26 11:25:45 +01:00
** Initial configuration
To set up your microblog go to:
#+BEGIN_SRC bash
https://yourmicroblogdomainname/install.php
#+END_SRC
and enter the following settings:
| Server SSL | enable |
| Hostname | localhost |
| Type | MySql/MariaDB |
| Name | gnusocial |
| DB username | root |
| 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 |
| User settings | Bio limit 1000 |
| Access settings | /Invite only/ ticked |
2014-10-25 23:32:36 +02:00
* Social Network
2014-10-26 11:51:56 +01:00
** Certificates
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:
#+BEGIN_SRC bash
cat /etc/ssl/certs/yourredmatrixdomainname.crt /etc/ssl/chains/startssl-sub.class1.server.ca.pem >
/etc/ssl/certs/yourredmatrixdomainname.bundle.crt
#+END_SRC
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.
2014-10-25 23:32:36 +02:00
* Chat Services
2014-10-26 12:16:30 +01:00
** IRC
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.
2014-10-26 16:26:32 +01:00
*** Irssi
2014-10-26 12:16:30 +01:00
If you are using the [[http://www.irssi.org][irssi]] IRC client then you can use the following commands to connect to your IRC server.
#+BEGIN_SRC bash
/server add -auto -ssl yourdomainname 6697
/connect yourdomainname
/join freedombone
#+END_SRC
2014-10-26 16:26:32 +01:00
*** XChat
If you are using the XChat client:
Within the network list click, *Add* and enter your domain name then click *Edit*.
Select the entry within the servers box, then enter *mydomainname/6697* and press *Enter*.
Uncheck *use global user information*.
Enter first and second nicknames and check *auto connect to this network on startup*.
Check *use SSL* and *accept invalid SSL certificate*.
Enter *#freedombone* as the channel name.
Click *close* and then *connect*.
2014-10-26 12:16:30 +01:00
** XMPP/Jabber
2014-10-27 23:29:38 +01:00
*** Managing users
To add a user:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
su
2015-04-05 14:38:01 +02:00
freedombone-addxmpp -e newusername@newdomainname
2014-10-27 23:29:38 +01:00
exit
exit
#+END_SRC
To change a user password:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
su
2015-04-05 15:12:47 +02:00
freedombone-xmpp-pass -e username@domainname
2014-10-27 23:29:38 +01:00
exit
exit
#+END_SRC
To remove a user:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
su
2015-04-05 15:12:47 +02:00
freedombone-rmxmpp -e username@domainname
2014-10-27 23:29:38 +01:00
exit
exit
#+END_SRC
Report the status of the XMPP server:
#+BEGIN_SRC bash
ssh username@domainname -p 2222
su
prosodyctl status
exit
exit
#+END_SRC
*** Using with Jitsi
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.
** VoIP (Voice chat)
*** Using with Ubuntu
Within the software center search for "mumble" and install the client then run it. Skip through the audio setup wizard.
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./