A computer lets you make more mistakes faster than any invention in human history—with the possible exceptions of handguns and tequila. - Mitch Ratcliffe
The internet is a wonderful thing for modern communication. It works by everything on the internet having a numeric address (Its IP address) so that when you want to communicate with a web site, email, another user your computer uses these numeric addresses to do it. So that humans do not have to memorize all these numeric addresses domain names have been set up that humans use and the computer then looks them up to translate them to IP addresses. For example google.com translates to IP address 142.250.178.142.
Each Internet address has 65,535 ports. These ports are used as access points for an IP address. When communicating with an IP address a port or series of ports are chosen. Some of the port numbers are assigned for certain purposes. For example port 80 is used for web site access.
When the internet was set up it IPV4 (Internet Protocol Version 4) became the first stable version accepted. It uses four 8 bit numbers to make up the IP address for a total of 32 bits. This gives 4,294,967,296 different addresses which was considered sufficient in 1983. However as things progressed with the Internet of Things it became clear that it was not enough addresses. So IPV6 was developed and implemented in 2012 which uses eight 16 bit numbers for a total 128 bits. This gives 340,282,366,920,938,463,463,374,607,431,768,211,456 different addresses which is considered sufficient for now. Equipment connected to the internet can use IPV4 or IPV6 or both. For us in this project we will only be considering IPv4 as it is generally simpler.
A client opens a web site in a browser by making a request to the web server which then sends html and javascript to client. The Client interprets that html, javascript in the browser to display the web page.
When communicating with a web site it can use http or https. With HTTP the connection with the web server is in plain text and open to anyone listening. HTTPS is where the connection between the user and the web server is encrypted and much more secure. This requires an SSL certificate on the web server. Any web site which is only http will gain very limited acceptance as it is not considered secure.
There are generally two parts to email a system to download/view/manipulate emails and systems to send emails.
There are two main systems in use POP3 (Post Office Protocol 3) and IMAP (Internet Message Access Protocol). The main differences are that POP3 downloads the emails to a single computer and then removes them from the email server (usually after a period of time). IMAP stores the emails on the server and allows you to view and manipulate them. There are advantages and disadvantages of both.
POP3 - Because POP3 stores the emails on your local computer the emails can be viewed and searched without an internet connection. However they can only be accessed on that one computer.
IMAP – Needs an internet connection to view your emails. However if you are using multiple devices such as phone, PC, laptop then they can be accessed by all the devices with an internet connection.
In this project we are going to use POP3. IMAP should be just as easy to set up but bear in mind as you are storing emails on the server (The Raspberry PI) you may need a lot more storage space and also a good regular backup of the server to avoid losing all your email history.
For sending emails the most used system is SMTP (Simple Mail Transfer Protocol). It is used by the user to send emails to the server and also be servers to send and receive emails.
This is an almost endless topic and changes rapidly as more methods of disrupting email systems are discovered.
It comes down to several areas:
Securing the Server – Any computer connected to the internet is open to attack. Standard security procedures need to be applied which are described elsewhere and not covered by this article.
Securing the email server – This involves making sure that the email server cannot be hi-jacked. This includes stopping it being used to send out spam by hackers. This means limiting who can send emails to authorized users who have correctly identified themselves. This avoids the famous open relay where anyone can use your server to send out their emails. Most email servers provide security but often it needs enabling and configuring.
Securing your Communication with the server – By default the internet communication between you and the server is open and anyone listening can see what is being transmitted. This is not a good idea as passwords and all communications are visible as if you published your emails in the local newspaper. To avoid this there are procedures which when connecting to the email server encrypt the internet communications to and from the server using a Secure Sockets Layer (SSL) certificate. This requires configuring.
Securing the emails – When sending, receiving or storing emails they can be encrypted using a digital ID. You give anyone you want to send you encrypted emails your public key. They can then be encrypted and sent to you. Only you have the private key to de-crypt them. This has the advantage that even if your emails go astray they cannot be read by anyone. This is only really applicable to POP3 where you store your emails. This is not covered in this article but if you search for digital ID you can find many useful resources.