PiMail: Affordable, Lightweight and EnergyEfficient Private Email Infrastructure Sufian Hameed, Muhammad Arsal Asif, Farhan Kamal Khan IT Security Labs National University of Computer and Emerging Sciences (NUCES) Pakistan FAST-NUCES Introduction Electronic mail is one of the biggest technologies being used over the internet today. Third party mail service is easier to use (-) Sacrifice of Control and Flexibility. Privacy is major risk Unauthorized Access Inspection during storage or broader gov. surveillance programs of emails is of a major concern to a majority of the users. FAST-NUCES Can Private Mail Servers Help ? Private mail server allows full control over both the server and the emails. Furthermore it gives complete access to mail server’s logs, and access to raw email files in a user’s mail directory. One of the greatest benefit is the possibility to troubleshoot and fix things on your own, instead of requesting a third-party mail service provider. However, Running a private email server for individuals or small scale enterprises can cost from $7 to $15 monthly or more, depending on the configurations FAST-NUCES PiMail Affordable and lightweight mailing server for Individuals and SMEs running on Raspberry Pi. A low cost infrastructure that would cost a one time investment of $35 to purchase Raspberry Pi 2. Low electricity consumption with an email server that can run 24/7/365 for under $5 of electricity per year. FAST-NUCES PiMail Personalized email address like MrX@mydomain.com with an annual recurring cost of domain registration with a registrar like namecheap.com. The ability to connect from anywhere, and read & send email, using a secure IMAP connection on your phone, tablet or computer. Complete control over your personal communication. Emails are stored over PiMail server, and nobody scan them to sell adverts. Smart spam filtering with SpamAssassin. Efficient virus scanning with ClamAV. FAST-NUCES The Raspberry Pi Computer Raspberry Pi is low-cost, low-power and highly portable single board computer. Raspberry Pi is one of the smallest, credit-card sized, single board computer available in the market. It has the highest performance to cost ratio. Raspberry Pi makes it possible to create an affordable, energyefficient and portable miniature private mail server according to the need of individual users or small enterprise.. FAST-NUCES Raspberry Pi 2 - Hardware FAST-NUCES Raspberry Pi 2 – System Software The recommended OS for Raspberry Pi 2 is Raspbian, which is a port of the well-known Linux distribution, Debian. Raspbian is optimized for the ARMv6 and ARMv7 instruction set with hardware floating point support. It is optimized with around 35,000 pre-built packages, for easy installation on Raspberry Pi. With the introduction of ARMv7 core, Raspberry Pi 2 can also run Ubuntu and Pi 2 compatible version of Windows 10 FAST-NUCES PiMail System Design PiMail runs Raspbian OS (a distribution of Debian optimized for the Raspberry Pi hardware) Server runs on top of Raspbian OS (from 16 GB micro SD card) It is a combination of Postfix, SpamAssassin, ClamAV and Dovecot FAST-NUCES PiMail Components Postfix A fast, easy to administer and secure Mail Transfer Agent (MTA) developed by Wietse Venema in 1997 as an alternative to SendMail. SpamAssassin One of the most widely used content-based filter The defense mechanisms include header tests, body phase tests, Bayesian filtering, automatic address whitelist/blacklist, automatic sender reputation system, manual address whitelist/blacklist, collaborative spam identification database, DNS blacklist and character sets. FAST-NUCES PiMail Components (2) ClamAV Open source antivirus toolkit designed for the scanning of emails at the mail gateways. Analyse the mail from the inbound queue using shared libraries of the anti-virus engine. Dovecot Dovecot is a secure IMAP server that provide IMAP functionality to fetch the mail from the mail directory. It is also used to provide simple authentication and security layer (SASL) to validate the identity of a user before he can send or receive an email. FAST-NUCES PiMail Testbed Augmented Raspberry Pi 2 with Postfix MTA, SpamAssassin content filter, ClamAV antivirus and Dovecot IMAP server, and deployed it over the LAN. For all the experiments, we used a desktop machine connected via LAN to send mails with different size and frequencies to PiMail server. FAST-NUCES Evaluation Scenarios We conducted experiments in four different scenarios as follows: S1: In scenario 1 (S1), the SMTP server runs postfix without any spam filter. S2: In scenario 2 (S2) ClamAV is used as an anti-virus with Postfix. S3: In scenario 3 (S3) SpamAssassin is used as a content-based filter with Postfix. S4: In scenario 4 (S4) SpamAssassin is used as a content-based filter and ClamAV is used as an anti-virus with Postfix. FAST-NUCES Evaluation Metrics We run different experiments using the above scenarios to study the impact of: Processing Delays End-to-End Throughput Message Size CPU and Memory Utilizations. FAST-NUCES Processing Delay Settings: Two modes Burst (50 messages to saturate the mail server) 1 second delay b/w two messages (50 messages) 8 KB message size, being the average size of email message [12]. FAST-NUCES Throughput Settings (same as before): Two modes Burst (50 messages to saturate the mail server) 1 second delay b/w two messages (50 messages) 8 KB message size, being the average size of email message [12]. FAST-NUCES Message Size Objectives: Measure how message size effects the processing time and end-toend throughput. Settings: Two message size i.e. 8KB and 64 KB Two modes Burst (50 messages to saturate the mail server) 1 second delay b/w two messages (50 messages) FAST-NUCES Message Size Effect on Processing Time Burst Mode FAST-NUCES 1 sec Delay Message Size Effect on Throughput Burst Mode FAST-NUCES 1 sec Delay CPU and Memory Utilization Objectives: Evaluate CPU and Memory Utilization of PiMail in all four scenarios. Settings: Sent email message of 8 KB every 0.6 seconds. Total evaluation time 480 seconds. This experiment setting is based on email statistics from a big University discussed in [12] FAST-NUCES CPU Utilization Total CPU (%) FAST-NUCES Avg. CPU (%) Memory Utilization Total Memory (%) FAST-NUCES Avg. Memory (%) Processing Delay with Low Email Volume Objectives: Effect of low volume email (without burst) . Settings: 50 emails of 8 KB each Interval of 60 seconds between two messages FAST-NUCES Conclusion We propose PiMail, an affordable, lightweight and energy-efficient private email infrastructure based on Raspberry Pi 2. First extensive study that benchmarks the performance of Raspberry Pi used as a portable and private mail server. Based on the results, we observed: Content-based spam filtering with SpamAssassin is the most resource hungry process. With high volume of emails, PiMail experienced performance bottleneck with SpamAssassin With an interval of 20-30 second, even the most decorated configuration of PiMail (S4) will not exhaust the resources and there will not be any backlogs. PiMail is capable handling a volume of 4000 emails with frequency 3 emails per minute, which is more than enough for individuals and SMEs. FAST-NUCES Bibliography [1] Clamav: Opensource antivirus engine for mail gateway. http://www.clamav.net/. [2] Cost of private mail server. http://jeffreifman.com/how-to-install-yourown-private-e-mail-server-inthe-amazon-cloud-aws/. [3] Dovecot: secure imap server. http://www.dovecot.org/. [4] Postfix mail transfer agent. http://www.postfix.org/. [5] Prism surveillance program. https://en.wikipedia.org/wiki/PRISMsurveillance-program/. [6] Raspberry pi. https://www.raspberrypi.org/. [7] Raspberry pi 2 model b. https://www.raspberrypi.org/products/raspberrypi-2-model-b/. [8] Raspbian os. http://www.raspbian.org/. [9] Spamassassin. http://spamassassin.apache.org/. [10] Windows 10 for raspberry pi. http://www.WindowsOnDevices.com. [11] T.R.P Foundation. About us. https://www.raspberrypi.org/about/. [12] Sufian Hameed, Xiaoming Fu, Nishanth Sastry, and Pan Hui. Fighting spam using social gatekeepers. Networking Science, 2(1-2):28–41, 2013. [13] J. Klensin. Simple mail transfer protocol. the internet society, rfc 5321. The Internet Society, RFC 5321, 2008. FAST-NUCES