4 x 2TB HGST RAID-Z, 100GB Intel DC S3700s for ZIL (over-provisioned at 8GB) on an M1015. In Environments 1 and 2 this was passed to FreeNAS via VT-d.
2 x Samsung FIT USBs for booting OS (either ESXi or FreeNAS)
1 x extra DC S3700 used as ESXi storage for the FreeNAS VM to be installed on in environments 1 and 2 (not used in environment 3).
E1. ESXi + FreeNAS 11 All-in-one.
Setup per my FreeNAS on VMware Guide. Ubuntu VM with Paravirtual is installed as an ESXi guest, on NFS storage backed by ZFS on FreeNAS which has raw access to disks running under the same ESXi hypervisor using virtual networking. FreeNAS given 2 cores and 10GB memory. Guest gets 1GB memory. Guest tested with 1C and 2C.
E2. Nested bhyve + ESXi + FreeNAS 11 All-in-one.
Nested virtualization test. Ubuntu VM with VirtIO is installed as a bhyve guest on FreeNAS which has raw access to disks running under the ESXi Hypervisor. FreeNAS given 4 cores and 12GB memory. Guest gets 1GB memory. Guest tested with 1C and 2C. What is neat about this environment is it could be used as a stepping stone if migrating from environment 1 to environment 3 or vice-versa (I actually tested migrating with success).
E3. bhyve + FreeNAS 11
Ubuntu VM with VirtIO is installed as a bhyve guest on FreeNAS on bare metal. Guest gets 1GB memory. Guest was backed with a ZVOL since that was the only option. Tested wih 1C and 2C.
All environments used FreeNAS 11, E1 and E2 used VMware ESXi 6.5
A reboot of the guest and FreeNAS was performed between each test so as to clear ZFS’s ARC (in memory read cache). The sysbench test files were recreated at the start of each test. The script I used for testing is https://github.com/ahnooie/meta-vps-bench with networking tests removed.
No attempts on tuning were made in any environment. Just used the sensible defaults.
Disclaimer on comparing Apples to Oranges
This is not a business or enterprise level comparison. This test is meant to show how an Ubuntu guest performs in various configurations on the same hardware with constraints of a typical budget home server running a free “hyperconverged” solution–a hypervisor and FreeNAS storage on the same physical box. Not all environments are meant to perform identically…my goal is just to see if the environments perform “good enough” for home use. An obvious example of this is environments using NFS backed storage are going to perform slower than environments with local storage… but it should still at the very least max out a 1Gbps ethernet. This set of tests is designed to benchmark how I would setup each environment given the constraint of one physical box running both the hypervisor and FreeNAS + ZFS as the storage backend. The test is limited to a single guest VM. In the real world dozens, if not hundreds or even thousands of VMs are running simultaneously so advanced hypervisor features like memory deduplication are going to make a big difference. This test made no attempt to benchmark such. This is not an apples to apples test, so be careful what conclusions you derive from it.
CPU 1 and 2 threaded test
I’d say these are equivalent, which probably shows how little overhead there is from the hypervisor these days, though nested virtualization is a bit slower.
CPU 4 threaded test
Good to see that 2 cores actually performs faster than 1 core on a 4 threaded test. Nothing to see here…
Memory Operations Per Second
Horrible performance with nested, but with the hypervisor on bare metal ESXi and bhyve performed identically.
Once again nested virtualization was slow.. other than that neck and neck performance.
OLTP Transactions Per Second
The ESXi environment clearly takes the lead over bhyve, especially as the number of cores / threads started increasing. This is interesting because ESXi outperforms despite an I/O penalty from using NFS so ESXi is more than making up for that somewhere else.
Disk I/O Requests per Second
Clearly there’s an advantage to using local ZFS storage vs NFS. I’m a bit disappointing in the nested virtualization performance since from a storage standpoint it should be equivalent to bare metal FreeNAS, but may be due to the slow memory performance in that environment.
Disk Sequential Read/Write MBps
No surprises, ZFS local storage is going to outperform NFS
Well there you have it. I think it’s safe to say that bhyve is a viable solution for home (although I would like to see more people using it in the wild before considering it robust–I imagine we’ll see more of that now that FreeNAS has a UI for it). For low resource VMs E2 (nested virtualization) is a way to migrate between E1 and E3–but it’s not going to work for high performance VMs because of the memory performance hit.
This guide will install FreeNAS 10 (Corral) under VMware 6.5 ESXi, then via NFS share ZFS backed storage back to VMware. This is an update of my FreeNAS 9.10 on VMware 6.0 Guide.
“Hyperconverged” Design Overview
FreeNAS is installed as a Virtual Machine on the VMware Hypervisor. An LSI HBA in IT Mode is passed to FreeNAS via VT-d Passthrough. A ZFS pool is created on the disks attacked to the HBA. ZFS provides RAID-Z redundancy and an NFS dataset is then shared from FreeNAS and mounted from VMware which is used to provide storage for the remaining guests. Optionally containers and VM guests can run directly on FreeNAS itself using bhyve.
FreeNAS 10 (now called FreeNAS Corral) is a major rewrite over FreeNAS 9.10, the GUI has been overhauled, it has a CLI interface, and an API. I think the best feature is the bhyve hypervisor and docker support. To some degree for a single all-in-one hypervisor+NAS server you may not even need VMware and be able to get away with bhyve and docker.
Like anything new I advise caution against running it in a production environment. I do see quite a few rough edges and a few missing features that are available in FreeNAS 9.10. I imagine we’ll see frequent updates with polishing and features added. A good rule of thumb is to wait until TrueNAS hardware is shipping with the “Corral” version. I think this is the best release of FreeNAS yet, and it is going to be a great platform moving forward!
1. Get Hardware
This is based on my Supermicro X10SDV Build. For drives I used 4 x White Label NAS class HDDs (see ZFS Hard Drive Guide) and two Intel DC S3700s (similar models between S3500 and S3720 should be fine), which often show up for a decent price on Ebay. One SSD will be used to boot VMware and provide the initial data storage and the other used as a ZIL.
Go ahead and plug in the network cables to the IPMI management port, as well as at least one of the normal ethernet ports.
This should work with just about any server class Supermicro board…. first download the Supermicro IPMIView tool (I just enter “Private” for the company). Once installed run “IPMIView20” from the Start Menu (you may need to run it as Administrator).
Scan for IPMI Devices… once it finds your Supermicro server select it and Save.
Login to IPMI using ADMIN / ADMIN (you’ll want to change that obviously).
KVM Console Tab…
Load the VMware ISO file to the Virtual DVD-ROM drive…
Select ISO file, Open Image, select the VMware ISO file which you can download here, and then hit “Plug In”
Hit Delete repeatedly…
Change the boot order, I made the ATEN Virtual CD/DVD the primary boot devices, and my Intel SSD DC S3700 that I’ll install VMware to secondary, and disabled everything else.
Save and Exit, and it should boot the VMware installer ISO.
3. Install VMware ESXi 6.5.0
Install to the Intel SSD Drive.
Once installation is complete “Plug Out” the Virtual ISO file before rebooting.
Once it comes up get the IP address (or set it if you want it to have a static IP which I highly recommend).
4. PCI Passthrough HBA
Go to that address in your browser (I suggest Chrome). Manage, Hardware, PCI Devices, select the LSI HBA card and Enable Passthrough.
5. Setup VMware Storage Network
In the examples below my LAN / VM Network is on 10.2.0.0/16 (255.255.0.0) and my Storage network is on 10.55.0.0/16. You may need to adjust for your network. My storage network is on VLAN 55.
I like to keep my Storage Network separate from my LAN / VM Network. So we’ll create a VM Storage Network portgroup with a VLAN ID of 55.
Networking, Port groups, Add Port Group
Add VM Storage Network with VLAN ID of 55.
(you can choose a different VLAN ID, my storage network is 10.55.0.0/16 so I use “55” to match the network so that I don’t have to remember what VLAN goes to what network, but it doesn’t have to match).
Add a second port group just like it called Storage Network with the same VLAN ID (55).
Add VMKernel NIC
Attach it to the Storage Network and give it an address of 10.55.0.4 with a netmask of 255.255.0.0
You should end up with this…
6. Create a FreeNAS Corral VM
Install it to the DC S3700 Datastore that VMware is installed on.
Add PCI Device and Select your LSI Card.
Add a second NIC for the VM Storage Network. You should have two NICS for FreeNAS, a VM Network and a VM Storage Network and you should set the Adapter Type to VMXNET 3 on both.
I usually give my FreeNAS VM 2 cores, if doing anything heavy (especially if you’ll be running docker images or bhyve under it you may want to increase that count). One rule with VMware is do not give VMs more cores than they need. I usually give each VM one core and only consider more if that particular VM needs more resources. This will reduce the risk of CPU co-stops from occurring. Gabrie van zanten’s How too many vCPUs can negatively affect performance is a good read.
To prevent this, change the Virtual Device Node on the hard drive to SATA controller 0, and SCSI Controller 0 should be LSI Logic SAS
Add CD/DVD Drive, under CD/DVD Media hit Browse to upload and select the FreeNAS Corral ISO file which you can download from FreeNAS.
7. Install FreeNAS VM
Power on the VM…
Select the VMware disk to install to. I should note that if you create two VMDKs you can select them both at this screen and it will create a ZFS boot mirror, if you have an extra hard drive you can create another VMware data store there and put the 2nd vmdk there. This would provide some extra redundancy for the FreeNAS boot pool. In my case I know the DC S3700s are extremely reliable, and if I lost the FreeNAS OS I could just re-import the pool or failover to my secondary FreeNAS server.
Boot via BIOS.
Once FreeNAS is installed reboot and you should get the IP from DHCP on the console (once again I suggest setting this to a static IP).
If you hit that IP with a browser you should have a login screen!
8. Update and Reboot
Before doing anything…. System, Updates, Update and Reboot.
(Note: to get better insight into a task progress head over to the Console and type: task show).
9. Setup SSL Certificate
First, set your hostname, and also create a DNS entry pointing at the FreeNAS IP.
Create Internal CA
Untar the file and click the HobbitonCA.crt to install it, install it to the trusted Root Certificate Authorities. I should note that if someone were to compromise your CA or gain the key they could do a MITM attack on you forging SSL certificates for other sites.
Create a Certificate for FreeNAS
Listen on HTTP+HTTPS and select the Certificate. I also increase the token Lifetime since I religiously lock my workstation when I’m away.
And now SSL is Secured
10. Create Pool
Do you want Performance, Capacity, or Redundancy? Drag the white circle thing where you want on the triangle and FreeNAS will suggest a zpool layout. With 4 disks I chose “Optimal” and it suggested RAID-Z which is what I wanted. Be sure to add the other SSD as a SLOG / ZIL / LOG.
11. Create Users
It’s probably best not to be logging in as root all the time. Create some named users with Administrator access.
12. Create Top Level Dataset
I like to create a top level dataset with a unique name for each FreeNAS server, that way it’s easier to replicate datasets to my other FreeNAS servers and perform recursive tasks (such as snapshots, or replication) on that top level dataset without having to micromanage them. I know you can sometimes do recursive tasks on the entire pool, but oftentimes I want to exclude certain datasets from those tasks (such as if those datasets are being replicated from another server).
Services, Sharing, SMB, set the NetBIOS name and Workgroup and Enable.
Storage, SMB3, Share, to create a new dataset with a Samba Share. Be sure to set the ownership to a user.
14. Setup NFS Share for VMware
I believe at this time VMware and FreeNAS don’t work together on NFSv4, so best to stick to NFSv3 for now.
Mount NFS Store in VMware by going to Storage, Datastores, new datastore, Mount NFS datastore.
I setup automatic recursive snapshots on the top level dataset. I like to do pruning snapshots like this:
every 5 minutes -> keep for 2 hours every hour -> keep for keep for 2 days every day -> keep for 1 week every week -> keep for 4 weeks every 4 weeks -> keep for 12 weeks
And SAMBA has Previous Versions integration with ZFS Snapshots, this is great for letting users restore their own files.
16. ZFS Replication to Backup Server
Before putting anything into production setup automatic backups. Preferably one onsite and one offsite.
Peering, New FreeNAS, and enter the details for your secondary FreeNAS server.
Now you’ll see why I created a top level dataset under the pool….
Storage, Tank3, Replications, New, select the stor2.b3n.org Peer, source dataset is your top level dataset, tank3/ds4, and target dataset is tank4/ds4 on the backup FreeNAS server.
Compression should be FAST over a LAN or BEST over a low WAN.
Go to another menu option and then back to Storage, tank3, Replications, replication_ds4, and Start the replication and check back in a couple hours to make sure it’s working. My first replication attempt hung, so I canceled the task and started it again. I also found that adjusting the peer interval from 1 minute to 5 seconds under Peering may have helped.
16.1 Offsite Backups
It’s also a good idea to have Offsite backups, you could use S3, or a CrashPlan Docker Container, etc.
17. Setup Notifications
You want to be notified when something fails. FreeNAS can be configured to send an email or sent out Pushbullet notifications. Here’s how to setup Pushbullet.
Create or Login to your Pushbullet account. Settings, Account, Create an Access Token
Services, Alerts & Reporting, Add the access key (bottom right) and configure the alerts to send out via Pushbullet.
You can use the Pushbullet Chrome extension or Android/iOS apps to receive alerts.
18. bhyve VMs and Docker Containers under FreeNAS under VMware
Add another Port Group on your VM Network which allows Promiscuous mode, MAC address changes, and Forged transmits. You can connect FreeNAS and any VMs you really trust to this port group.
Power down and edit the FreeNAS VM. Change the VM Network to VM Network Promiscuous
Enable Nested Virtualization, under CPU, Hardware virtualization, [x] Expose hardware assisted virtualization to the guest OS.
After booting back up you should be able to create VMs and Docker Containers in FreeNAS under VMware.
Use at your own risk.
More topics may come later if I ever get around to it.
Living up North in the Winter we have long hours of darkness because of the earth’s tilt away from the sun. This means getting up before the sun rises, and it’s a bit annoying to be jolted awake at 6:00am by an alarm when it’s pitch black outside. Or if I wake up before the alarm goes off, it’s dark, and I can’t tell if I should be going back to sleep or getting ready to get up without consulting a clock.
There are quite a few IoT (Internet of Things) WiFi Light bulbs on the market, the reason I like these is they don’t rely on the vendors software to control them, and they don’t need to connect out to some cloud service on the internet which increases ones surface area to hackers.
Connect to WiFi
When the bulbs are initially turned on they power on and create their own WiFi hotspot, a phone app connects to it and programs it to connect to your WiFi network. As with all IoT devices I suggest having a dedicated IoT WiFi SSID and VLAN to keep them off the main network. They should get an IP address from DHCP, I then give it a static IP assignment with DHCP in pfSense.
Automate with Home Assistant
Next, install Home Assistant (which is a free open source home automation platform) on a server. I spun up an Ubuntu 16.04 VM.
The MagicLight / Flux Bulbs aren’t smart enough to gradually turn on or off, but I used multiple automation tasks to simulate a gradual fade-on over 30 minutes. The example below will gradually make the light brighter. It starts very dim, at 5:15am and stays dim for awhile. This won’t wake me up if I’m still asleep. Then around 5:40am it starts to get brighter at a faster rate until it reaches full brightness at 6:10am.
This wakes me up “naturally” every winter morning. I’m usually awake well before 6 and feel much better than if I had used an alarm.
The light stays on until 8am then it turns off and waits for the next day.
The nice thing about waking up to a gradual light is if I’m already waking up I’ll get up sometime after 5:15am, but if I’m in a deep sleep it won’t wake me up suddenly so I can get a few extra minutes of sleep until around 6am.
Here’s the part I added to configuration.yaml
- platform: flux_led
alias: Office Light 15 at 5:30am
alias: Office Light 65 at 5:40am
alias: Office Light 120 at 5:50am
alias: Office Light 145 at 6:00am
alias: Office Light 165 at 6:05am
alias: Office Light 200 at 6:08am
alias: Office Light 255 at 6:10am
alias: Turn off at 8am
There are also some other things one could do, Home Assistant can also monitor the weather and sunrise times. I could probably spend a little more effort and make the script only activate the bulb if the sun hasn’t risen yet, or I could have the bulb wake me up earlier if there’s a lot of snow so I have more time to shovel. Maybe it could be blue when it’s raining so I know to grab my hat.
My home automation script could definitely use some improvements, but even in it’s present state it’s a big improvement over waking up to an alarm.
When all of your network devices lose access to the internet all at the same time regularly throughout the day, there is not much to blame other than a bad network cable to your Wireless Access Point (AP), or the Access Point itself. It wasn’t the cable. My old Cisco-Linksys E3000’s days were numbered. Skype calls were dropping, Emby videos streams were getting interrupted, websites weren’t loading. As with most technical things, the burden to set things right fell on my shoulders.
It was past time to upgrade to 802.11ac anyway. I use pfSense for my router so all I want is a Wireless AP, I don’t need a combo, so I started my search. I don’t really like researching APs because consumer devices are pretty awful at security, and enterprise devices involve support contracts and enterprise software and sometimes the security is just as bad. But WiFi router recommendations are one of the most frequently asked questions from friends and family, and I’ve never had a good answer …until now. I came across UniFi made by Ubiquiti. These are the wireless AP’s that Linus Torvalds uses. The products appear to be marketed towards Businesses and Enterprises, but the software to run it is free, and pretty much all I need for my home/soho environment can be configured through the web-interface.
UniFi Access Points (AP)
I purchased the UAP-AC-PRO which is their high end model as well as the budget model, the UAP-AC-LITE. There’s also a “Long Range” model which sits in between them, the UAP-AC-LR which I did not get.
The UniFi AP (Wireless Access Point) looks more like a smoke detector than a wireless access point. A typical install is mounting them on the ceiling. Here’s mine mounted on a wall (the circular ring LED is normally blue which is too bright at night, but fortunately it can be turned off).
Power over Ethernet (PoE)
The AP is powered by PoE. This means you don’t need an AC-DC adapter, instead it gets it’s power from the Ethernet cable. This works on standard Cat 5e, Cat6, or Cat6a cable. Normally PoE devices require an expensive PoE capable switch, and I was a bit hesitant of getting into the PoE world, but as long as you buy a single unit and not their bulk pack the UniFi APs usually comes bundled with a PoE injector to get you started.
I had no idea what a PoE injector was, but it turns out to be really simple. It’s a little box with a power cable, and two Ethernet ports, LAN and PoE. Just plug the LAN port into your switch and your AP into the PoE port. Couldn’t be any simpler. Now, if you’re running a fleet of WiFi access points it probably makes sense to get a PoE switch. But for one or two in a house the PoE injector is fine.
Now, there are a couple of different kinds of PoE.
Here’s the difference: Passive PoE is as dumb as an electrical outlet. It just sends power through the Ethernet cable whether you need it or not… and this can damage devices not designed for Passive PoE if you accidentally plug a powered Ethernet cable into them. The much better standard is 802.3af and 802.3at PoE. With this power isn’t provided until the device requests it, which means it’s very safe and you can plug non-PoE devices into PoE ports without blowing them up.
The UAP-AC-PRO uses 802.3af.
The UAP-AC-LITE and UAP-AC-LR products require passive PoE. However, I have seen possible signs that Ubiquiti is switching all their products to the IEEE 802.3af/at standards, so it may be worthwhile waiting for the newer models if you don’t want to spend the extra for the Pro model and can afford to wait.
The UniFi Controller
So, these Access Points don’t run a web-server with a management interface. This is a business/enterprise class solution so it’s meant to be centrally controlled from a single controller. You will need to download the UniFi Controller (which is free). Once it’s running you can access it via web browser or the UniFi App for Android or iOS. The controller can be installed on Windows, Linux, or MacOSX. If you don’t care about collecting stats it doesn’t need to be up and running all the time so it can be run on a workstation, but if you have a server I recommend running it there. I created an Ununtu 16.04 VM called “unifi.b3n.org” I gave it 1GB RAM, 30GB HDD, and 1 core which seems to be plenty.
The install process is straight forward…
Create a file, /etc/apt/sources.list.d.100-ubnt-list
deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti
Go to https://unifi.example.com:8443 (See the bottom of this post for info on setting up a real certificate).
The first time you access it you get Wizard to set it up, after creating an account and such it will have you adopt the UniFi APs on your network. If they’re plugged in it will find them automatically. It not only manages APs but also manages UniFi branded routers, switches, cameras, VoIP devices, etc.
I can see how it would help manage a fleet of wireless equipment across multiple sites. You can see all the devices connected, the AP they’re connected to, signal strength, connection speed, data they’ve used, how they’re authorized to be on the network, VLANs, etc. I’ve hidden a lot of columns in the screenshot below but it gives you an idea of the data you can get on wireless clients.
The UniFi also keeps track of every wireless AP that it has seen. My neighbors seem to have a lot of HP Smart Printers and TVs that need to waste RF spectrum running their own APs for some reason. Cars Have APs? It looks like a lot of cars have their own APs now days? At least I’m guessing these MitsumiE APs are automobiles that have driven by my house.
UniFi Android / iOS App
The Android app is is just as capable (and I presume it is on iPhone as well), I didn’t do a thorough comb through but at a quick glance it appears every screen and configuration setting in the web interface is available in the Android App.
AP Models Comparison
The APs perform well. Since I installed the UniFi we have not had a single wireless connection drop, even if I put the AP power settings at their lowest it has better range than my previous AP. I also setup both APs and my devices had no trouble roaming between the two APs as needed while maintaining connections.
The three main models are:
UAP-AC-LITE – 2×2 MIMO on both bands (budget)
UAP-AC-LR – 3×3 MIMO on 2.4, 2×2 MIMO on 5GHz (middle)
UAP-AC-PRO – 3×3 MIMO on both bands (fastest)
Does 3×3 MIMO make a difference for 2×2 clients? You might get better reception, but probably not a noticeable difference. However, if you do have 3×3 capable clients you should see a benefit going to a 3×3 AP.
UAC-AP-PRO vs UAC-AP-LITE Performance and Coverage with 2×2 Clients
Most wireless clients are only 2×2 MIMO these days, and even though I tend to run the latest hardware I only have 2×2 devices which can connect at a maximum speed of 866.7Mbps. A 3×3 MIMO AP can improve performance of 2×2 MIMO clients because the extra antenna might provide a better signal. That’s the theory anyway.
I can’t really tell a difference between the two routers in my house, in the Android App Wireless Test I get better uploads speeds on the Pro than I do the Lite, which might be due to it’s extra antenna but I don’t see that performance benefit on our laptops when transferring files back and forth between them and my FreeNAS unit.
I do think I get slightly better upload speeds on the Pro model when I’m far away from the AP. This may be due to the extra antenna or it could just be subjective.
As far as real life performance on 5GHz setting the channel width to 80Mhz I get about 50-60Mb/s down and 30-40Mb/s up pretty consistently throughout the house, and that’s with multiple wireless clients connected and a pretty saturated RF spectrum. Here’s an RF Scan at my house… there’s really not a single empty channel even on 5Ghz.
UniFi Managed Switches
Ubiquiti also sells managed switches, ranging from 8 to 48 ports with a variety of PoE options. I’ve been wanting try out managed switches so I picked up their small 8-port. Since I’m running these at home low noise is extremely important. The two switches that fit the bill are the 8-port US-8-60W (with 4 PoE ports) and the 24-port US-24 (without PoE), both of these models are fanless and silent.
The US-24 doesn’t have PoE on it. The US-8-60W has four 802.3af PoE ports. I should note that this switch cannot do passive PoE so it won’t be able to power UniFi’s passive PoE equipment (such as the UAP-AC-LITE).
There are two banks of LEDs, top row is only for the four PoE ports on the right and light up orange if PoE is activated. The bottom row lights up green on gigabit links and orange for 100Mbps links. There’s also a blue/white LED on the far left front of the router that’s off. I do not like blue or white LEDs. Fortunately as soon as I provisioned it the UniFi Controller automatically turned it off based on my site preferences.
After getting a quick primer from a Network Engineer on how VLAN tagging works I decided to start VLAN tagging my network.
Under the UniFi Controller you can setup your VLANs, I programmed all of mine in above. Something that is a bit confusing is there are two Network Purpose types that support VLAN tagging, “Corporate” and “VLAN-Only”. There is no difference between the two, unless you are using the USG (UniFi Security Gateway), which can run a DHCP server for each “Corporate” network type. Since I’m using pfSense instead of the USG I setup mine as vlan-only.
Then it’s fairly trivial to manage the ports, setting up trunking and access ports for certain VLANs. In my case port 2 is my trunk port and goes to my pfSense router. I also ran my Northland Cable connection through the switch so I could get some bandwidth insights.
As always, the UniFi Controller provides some pretty neat insights, it picked up devices not only connected to it but also found devices connected to other switches (notice most of the devices below were found on port 2 which connects up to my VMware vSwitch).
And UniFi provides great statistics and insights into traffic flow on the switch.
Appendix A: Setting an SSL Certificate on the UniFi Controller.
By default the Unifi controller runs on port 8443 with a self-signed SSL certificate. It is ridiculously difficult to set a custom cert… I know how to work with Java keystores but I just couldn’t get the ace.jar Java cert importer to accept my intranet cert. Then I read the CA cert had to be in DER format which also didn’t work…. arrgh. Suddenly it hit me that setting up certs on nginx is easy, it would be much simpler to set up an SSL certificate on an nginx reverse proxy on port 443. I want the UniFi Controller listening on 443 anyway, and even better, I don’t have to touch any UniFi configuration files or certs.
If you’re running an internal CA like I am you can just generate an internal Cert, or if you need a public cert Let’s Encrypt should work just as well. Here’s an example of generating one from FreeNAS.
Export the certificate and key and save them to /etc/nginx/cert.crt and /etc/nginx/cert.key. The configuration is a pretty standard nginx reverse proxy, the only issue I initially ran into was the UniFi controller reported a “WebSocket connection error” warning, so I enabled nginx’s proxy support for WebSockets (which the configuration below takes care of). Other than that it’s a straight forward reverse proxy.
When you request a website, say, b3n.org, your computer needs the IP address. So it sends out packets through your router/firewall, your modem, and out to your ISPs DNS Servers. Your ISP’s DNS server will probably have it cached, if not it queries the authoritative (starting with the Root Name Servers) recursively to find out what the authoritative DNS servers are and then queries those DNS servers. It gets the IP address, and sends it back to your computer. Your computer can then query the server IP for b3n.org. Any latency along this process will result in delays. If you ever type in a url in the address bar and nothing happens for a few hundred milliseconds and then suddenly the website starts to load this is likely the problem.
Is Your DNS Hijacked by Your ISP?
It’s pretty easy for ISPs to hijack DNS queries. A small number of ISPs (Comcast, CenturyLink, Time Warner, Cox, Rogers, Charter, Verizon, Sprint, T-Mobile, Frontier, etc.) have been caught doing exactly that. Want to know why? Advertising revenue. When you misspell a domain some ISPs, instead of returning an NXDOMAIN (does not exist) like any RFC compliant DNS server it will resolve the domain anyway, point it at a page they control, and advertise to you! This is a really bad idea. But there is a way to prevent your ISP from doing this…
Using Google’s Nameservers
If you’re not tech savvy using 184.108.40.206 and 220.127.116.11 is probably better than your ISPs nameservers. It won’t hurt, and will probably help, but it may not help… it’s very trivial for an ISP to route those IPs to their own servers and some do.
Even if your ISP is pure goodness and would never do that, someone could setup a rogue DNS server posing as theirs and intercept all your DNS traffic.
The only solution is to query the Root name servers for authoritative DNS servers and use DNSSEC. Cut out any 3rd party DNS provider and run your own DNS server locally.
Setup an Unbound Server on pfSense
Unbound is a high performance caching DNS server. Unbound queries recursively authoritative DNS servers directly, completely bypassing your ISP. It uses DNSSEC to make sure your queries haven’t been tampered with. And best of all, it caches DNS results locally (like your ISP would) but since it’s on your own network, the cached DNS queries are local!
You can setup a local FreeBSD server and run Unbound on it, but if you’re already using a router like pfSense or OPNsense you can setup an Unbound server in a few clicks.
Open up pfSense, first make sure the forwarder under Services, DNS Forwarder, is disabled. Slowness warning: if you are running a low query lookup network such as on your home network having the forwarder disabled may cause lookups to be slower because you’re having to traverse the DNS servers regularly to get results… this can sometimes take a second or two and result in DNS timeouts while it’s trying to traverse the DNS nameservers. If you find that unbound performance is slow I’d suggest turning on forwarding mode which will use the DNS servers specified in pfSense under system, general setup. In this case I’d recommend pointing them at 18.104.22.168 and 22.214.171.124. If you run with forwarding enabled you should verify that your ISP is not hijacking your DNS results, if they are you should switch ISPs.
Go to Services, DNS Resolver.
Enable the DNS Resolver
Select the Network interfaces that you want Unbound to listen on (do not select ALL, you’ll definitly want to select LAN).
System Domain Local Zone Type: Transparent
Enable DNSSEC Support
Do NOT enable Forwarding Mode
You can also choose to register DHCP addresses in the DNS Resolver which is very handy if you’re using pfSense to manage DHCP.
Under System, General Setup
Make sure all DNS Server fields are empty. DNS Server Override and
Disable DNS Forwarder should be unchecked.
Finally, Under Services, DHCP Server, set your DNS Server to your pfSense’s LAN IP. As your DHCP clients renew their lease they’ll start using pfSense for DNS.
As far as performance if you have low latency to your ISPs DNS you probably won’t notice anything. But if you’re on a high latency connection with 70ms pings like I am, this makes a big difference.
Amazon Lightsail has entered the VPS market, competing directly with DigitalOcean and Vultr. I for one welcome more competition in the $5 cloud server space. I wanted to see how they perform so I spun up 24 cloud servers, 8 for each provider and ran some benchmarks.
$5 Cloud Server Providers Compared
DigitalOcean, Vultr, and Amazon Lightsail offer more expensive plans, but this post is dealing with the low-end $5 plans. Here’s how they compare:
1 CPU Core
20GB HDD (extra block storage @ $0.10/GB/month)
1TB Bandwidth ($0.02/GB overage fee in U.S.).
Best team management – DigitalOcean lets you create multiple-teams and you can add and remove users from those teams.
Ubuntu, FreeBSD, Fedora, Debian, CoreOS, CentOS
1 CPU Core
15GB HDD (extra block storage @ $0.10/GB/month)
1TB Bandwidth ($0.02/GB overage fee in U.S.)
Account sharing – allows you to setup multi-user access.
Floating IPs (currently can’t setup automatically, requires support setup)
Ubuntu, FreeBSD, Fedora, Debian, CoreOS, CentOS, Windows, or any OS with your Custom ISO.
1 CPU Core
20GB HDD (block storage not available)
1TB Bandwidth ($0.09/GB overage fee in U.S.)
3 Free DNS zones (redundancy across TLDs as well).
Amazon Linux or Ubuntu
All three providers have multiple geographic locations worldwide. Vultr has the most locations in the United States, while Amazon has more geographic locations in the world (although only Virginia is available to LightSail at this point in time).
Vultr Global Locations
Amazon Lightsail Global Infrastructure
All providers offer an API. In practice DigitalOcean has been around the longest and thus is more likely to be supported in automation tools (such as Ansible). I expect support for the other APIs to catch up soon.
CPU Test – Calculating Primes
Number of seconds needed to compute prime numbers. On the CPU test Amazon Lightsail consistently outperformed, with Vultr coming in second and DigitalOcean last. CPU1 and CPU2 are 1 and 2 threads respectively calculating primes up to 10,000. CPU4 is a 4-threaded test calculating primes up to 100,000.
Lower is better.
Lower is better.
(I accidentally omitted the memory test from my parser script and didn’t realize it until the last test ran, so this is the average of 4 results per provider)
OLTP (Online transaction processing)
Higher is better.
The OLTP load test simulates a transactional database, in general it measures latency on random inserts, updates, and reads against a MariaDB database. CPU, memory, and storage latency all can effect performance so it’s a good all around indicator. This test measures the number of transactions per second. In this area Vultr outperformed DigitalOcean and Amazon Lightsail in 2 and 4 thread tests, while Lightsail took the lead in the 8-thread test. I don’t know why Lightsail started to perform better under multi-threaded tests, however, my guess is that while Lightsail doesn’t offer the fastest single-threaded storage IOPS it may have better multi-threaded IOPS–but I can’t say for sure without doing some different kinds of tests. DigitalOcean performed the worst in all tests–probably due to it’s slower CPU and memory speed.
Higher is better.
Transactions per second. In random IOPS Vultr provided the best consistent performance, DigitalOcean comes in second place with wide variance, and Lightsail comes in last, but it was by far the most predictable.
Sequential Reads / Writes / Re-writes
Higher is better.
This simply measures sequential read/write speeds on the hard drive. Vultr offers the most consistent high performance, DigitalOcean is all over the place but generally better than Lightsail which comes in last.
Latency (Ping ms) U.S. Locations
Lower is better.
The U.S. latency is all close enough that it doesn’t matter.
Latency (Ping ms) Worldwide Locations
Lower is better.
International Latency, again the results are pretty close.
Download Speed Tests from U.S. Locations
Higher is better.
Downloading data from various locations. It’s really hard to conclude any meaningful analysis from this… the faster peering in New York probably has to do with DigitalOcean and Vultr being located in New York vs Lightsail’s location in Virginia.
Upload Speed Tests to U.S. Locations
Higher is better.
Due to the similarities in the test results I think the bandwidth constraints are on the other side, or at peering.
Download Speed Tests from Worldwide Locations
Higher is better.
Who knows what one could conclude from this, it seems like various providers have different quality peering to different worldwide locations, but there are so many variables it’s hard to say.
Upload Speed Tests to Worldwide Locations
Higher is better.
Similar groupings for the most part.
I spun up 24 x $5 servers, 8 for each VPS provider. I spun up 12 servers yesterday and ran tests, destroyed the VMs, then created 12 new servers today and repeated the tests. All tests were run in the Eastern United States. I chose that region because the only location available currently in Amazon Lightsail is Virginia, so to get as close as I could I deployed Vultr and DigitalOcean servers out of their New York (and New Jersey) data centers. New York is a great place to put a server if you’re trying to provide low latency to the major populations in the United States and Europe without using a CDN.
If the provider had multiple data centers in a region I tried to spread them out.
DigitalOcean – I deployed 4 servers in NYC3, 2 in NYC2, and 2 in NYC1.
Vultr – All 8 servers deployed in their New Jersey data center.
Amazon Lightsail. Deployed in their Virginia location, 2 in each of their four AWS high availability zones.
All the tests I ran are relatively short duration, I did not benchmark sustained loads which may produce different results. My general use case is a web-server or small build server with intermittent workloads. I often spin up servers for a few hours or days and then destroy them once they’re done with their tasks.
The testing scripts I used are available in my GitHub meta-vps-bench repository. The testing scripts are very rudimentary and could be improved. It runs sysbench and speedtest benchmarks. The following commands were run on each server as root:
I tried to stagger starting the tests so that multiple speedtests against the same location had a low risk of occurring at the same time… but it may not always work out that way. I ran all tests twice per server which gives 48 total results (16 for each provider).
This script is for testing. I do NOT recommend running this on production servers.
Looking for a Christmas gift idea for your computer geek? Here’s a short gift guide with a few ideas I think would make great gifts. Unlike a lot of other top gift idea lists written by non-tech people just to make a sale, I’m actually a developer and these are the sort of things that I would enjoy (in fact most of them I own or at the very least had a chance to play with).
Here’s some gifts your geek, hacker, developer, programmer, tech enthusiast, etc. may enjoy:
WiFi RGB LED Light
MagicLight WiFi Smart LED Light Bulb ($). This looks like a normal light-bulb, but it can connect to your WiFi network and be controlled by your SmartPhone, or through home automation software, or Python scripts. This Bulb can change to any color. You can send it HTML Hex Color Codes! If you live up in North Idaho like I do you can program your light to gradually get brighter in the morning to wake you up naturally in the months where the Sun doesn’t rise until late in the day. Or program it to redshift in the evenings before bedtime so the blue light isn’t messing with your circadian rhythm. Or have it turn red as a warning when you’ve left the garage door open after dark! Put a few outside on your house and set them to be certain colors during the Holidays (Red & Green at Christmas, Orange during Halloween, Red, White, and Blue for Independence Day).
Raspberry Pi 3
Raspberry Pi 3 Starter Kit ($$). Every technology enthusiast would enjoy a Raspberry Pi. There are so many projects you could do… build your own weather station, automatic sprinkler system, home automation server, arcade, even a small computer, tiny server, thermometer, etc.
Python Programming for Beginners ($) by Jason Cannon. Yes, the name comes from Monty Python. Python is becoming a well loved language and is growing fast, and is fun to learn and practical. I have been seeing a lot of increase of this language lately. This is one of the best programming languages to learn, even if you’re not a programmer. This book is perfect for someone new to Python or even for someone starting out learning to code for the first time.
MasterKeys Pro L Mechanical Keyboard. ($$$). (This is the latest model, I use an older version of this keyboard at work). If your hacker is on the young side there’s a good chance he has never experienced the joy of typing on a mechanical keyboard and may not even know they exist! Does your keyboard let you press every single key on the keyboard simultaneously and they ALL register? This keyboard does. This keyboard has 3 switch options. Cherry MX Red, Brown, or Blue. I linked to the Cherry MX Brown version but there are several different switch types: Cherry MX Reds have no tactile bump, they are linear so great for FPS or RTS gaming where speed matters. Cherry MX Blues provide an audible click and a tactile bump and are great for typing (unless noise is a concern), Cherry MX Browns provide subtle tactile feedback with no audible click making it a great all-purpose keyboard. The MX browns are my favorite Cherry switch and it’s what I recommend starting with for most people if you don’t know what you want.
I should mention, that by “no audible click” I mean no added click noise. Kris tells me the “silent” Browns and Reds are loud compared to a typical keyboard. The Blues are even louder.
Civilization VI ($$). This game is one of the longest running series, and in my opinion one of the best turn-based strategy games on the market. Your gamer geek can play single-player, or online with friends. Starting out with a single Settler and building cities… what I like about Civilization is the unique ways to win. Most games are about World Domination through force. But in Civilization that is just one of many ways to win. In addition to Domination you can obtain Victory through Culture, Religion, or Science.
Chicory Coffee & Beignet Donuts
Chicory Coffee & Beignet Donuts ($). If you are ever visiting New Orleans you should stop by the Cafe Du Monde (open 24/7) for some Beignet Donuts and Café au lait. But the next best thing is giving the gift of coffee and donuts for those early mornings or late night programming sessions. This is one of my favorite coffee flavors, it has a unique taste and everyone I’ve brewed it for loves it.
YubiKey Neo ($). If your hacker is concerned about security you might consider getting him the YubiKey Neo. It’s a 2nd Factor Authentication device which works with Android (using NFC), Linux, Mac, and Windows. Everyone should be locking down their accounts (Email, Github, etc.) with a Yubikey. Yubico is one of the more reputable companies. Last year a security bug was discovered in the OpenPGP applet and they offered free replacement (including free shipping) for all the affected devices. Their software to work with they key is open source on GitHub. YubiKey supports such a large variety of MFA authentication methods including FIDO U2F, HOTP, TOPT, Yubico OTP, PIV-Compliant SmartCard, HMAC-SHA1 challenge response, etc. It’s really the only authentication device you need. I can authenticate with just about any service and protocol using a single YubiKey.
ESV MacArthur Study Bible Personal Size ($). Of course, it would be remiss of me not to include a gift that has to do with the very reason we celebrate Christmas. From the Creation and Fall of man, the Son of God coming to earth to die on the cross to take the penalty for our sins, and raising from the dead so that anyone who believes in Him will have eternal life. I received this as a gift a few years ago and it’s to date my favorite Bible. I don’t think you’ll find a higher quality Bible at this price point, it’s even Smyth Sewn which surprised me! MacArthur has some of the most scholarly and practical (easy enough for me to understand) Study Bible notes on the market today. His notes are extensive enough to be helpful, yet the personal edition is still small enough to be portable.
Well, that’s my guide for this year. Wishing everyone a Happy Thanksgiving and a Merry Christmas.
The most Frequently Asked Question from my Family, Friends, and FOAFs…
Laptop Buyer: What Kind of Laptop Should I buy? Ben: Get one with an Intel Wireless card
WiFi Cards Matter
The first piece of advice I have is make sure your wireless card is made by Intel. Do not get anything else. You might see other tempting wireless cards for so much less by Dell, Broadcom, Ralink, Killer, Realtek, etc. These WiFi cards might work with most WiFi hotspots, they might work most of the time, but don’t get them. The problem is they aren’t robust. I’ve seen them drop connections randomly, not be able to connect to certain wireless APs, drop out the signal when the Microwave is running, etc. At best case it works fine but later on a driver update might make it worse. It is not worth saving a few bucks to deal with these issues. Pay extra for an Intel branded WiFi Card. It might cost you $20 more and save you months of frustration. You’ll thank me later when your card isn’t disconnecting randomly.
This brings me to the 2nd most Frequently Asked Question….
My Wireless Keeps Disconnecting. Help!
Laptop buyer: So, my wireless signal keeps dropping out. Ben: Did you get an Intel Card like I told you? Laptop buyer:No…. Ben: Were you trying to save money and went too cheap? Laptop buyer:Yes…..
And the 3rd most Frequently Asked Question….
Can You Fix My WiFi Stability?
If Eli can fix it, you can fix it.
You will need to swap out your WiFi card.
If you’re in the situation where you bought a laptop with a flaky WiFi card, it’s easy to fix! Grab an inexpensive Intel 7260 WiFi Card from Amazon. On most laptops the WiFi card is easily accessible from behind the back cover, usually it’s not more work than a memory upgrade. Unplug the antenna connectors from your unstable wireless card, pop it out, and put the new card in and hook it up. Your WiFi connections will now be robust.
I don’t say this because I’m an Intel fan. I just want things to work. Every couple of years I give another brand a try just to make sure my “only Intel” advice is relevant. I’ve had the same experience with non-Intel brands the last 15 years!
Last year I decided to buy a cheap laptop to watch movies on (we don’t have a TV) and it came with a Dell DW 1704 / Broadcom 4314 Wireless Card. I bought it just to see if things had gotten better. They haven’t. This wireless NIC can’t stream a full length movie from my media server without losing the wireless signal several times.
And it’s not just me, earlier this year several of my colleagues bought Dell XPS laptops with Killer Branded WiFi cards. They just don’t work reliably in scenarios that Intel chips do. In their case they couldn’t connect to several APs. In my case the connection would drop several times a day. This was both in Windows 10 and in Linux. And yes, I tried disabling power saving mode on the WiFi adapter.
I’ve had friends and family not be able to even connect to certain APs at all until they swapped out their Broadcom, Killer, or Ralinks for an Intel card. Now, you might get lucky and find another brand that works. To me it’s not worth the hassle.
The next time you buy a computer, get one with an Intel WiFi card.
Phones depreciate in value fast, their useful life is less than their lifespan. Not because old phones don’t work anymore. But because manufacturers stop providing security updates after about 3 years (at best!)
What If I Told You a Hacker Can Take over Your Phone with One Text… And You Don’t Even Have to Open It?
You might be hacked now and not even know it.
Exploits like like this and like this are real. Vulnerabilities have been found in the past and exploited. They will be found in the future and exploited. Some exploits require you to do nothing but receive (not even open, just receive) an SMS message and a hacker can do what he wants with your phone. He can install malware, use your phone to launch a DDoS attack against Krebs on Security, he can spy on you (or your kids if your kids have phones) activating the camera and microphone at will listening in on your conversations and reading every message passing through the device.
The only protection against this is either (1) not have a phone (more secure), or (2) if you must have a phone, keep it up to date constantly (not as foolproof but would block all but the most sophisticated hackers).
One of the big problems with phones is security. For iPhones you get your updates through Apple. For Android things aren’t as clean. The Android OS itself gets security updates, but then it has to trickle down through the manufacturer (who often doesn’t provide an update) and then the carrier you bought the phone from.
Calculating Remaining Life Before You Buy
To calculate the real cost of a phone, find out how long the manufacturer and carrier will support security updates for it. Divide the cost of the phone by the number of months left for security updates and that’s cost of the phone.
monthly cost = cost of phone / remaining life in months
e.g. cost of phone: $500 remaining life for security updates: 29 months monthly-cost: $500/29 = $17.24
Oddly, the price of phones doesn’t usually drop that much after the 1st year even though they have lost 1/3rd of their useful life!
There Are Only Two Options
A lot of phone manufacturers / carriers don’t even provide updates to their phones. They’re unsupported from the moment you bought them!
For the sake of security, I only recommend two phone manufacturers. Google and Apple. Both have a track record of providing timely security updates. Google pushes out a security update every month and Apple doesn’t have a schedule but does a good job getting them out timely. I also only recommend Apple with the caveat that you trust them because it is a proprietary closed source OS. You are trusting them to do the right thing and have decent security.
Google Nexus Devices
Google stopped selling the Nexus, but they still have 2 years of updates left and are reasonably priced on Amazon.
Google Guarantees Security Patches on Nexus devices 3-years from the release date or at least 18 months from when the Google Store last sold the device (whichever is longer).
As of October 2016, here is the cost per month as I calculate it:
Nexus 5X – security updates until October 2018. $332. – 16GB. Ben’s cost over remaining life: $332/24mos = $13.83/mo Nexus 6P – security updates until October 2018. $450 – 32GB. Ben’s cost over remaining life: $450/24mos = $18.75/mo
(If you get a Nexus, note that there are U.S. and International versions of the phone, if you live in the U.S. you’ll want the U.S. version).
Google has not committed to EOL dates on the Pixel line but if it’s similar to Nexus you’re looking at:
Google Pixel – $650 – 32GB – probably until October 2019 Ben’s cost over remaining life: 650/36mos = ~$18.05/mo
Google Pixel XL – $770 – 32GB – probably until October 2019 Ben’s cost over remaining life: 770/36mos ~$21.38/mo
iOS is closed source so I consider it less secure and less open than Android, but they do a pretty decent job at keeping hackers out. Most compromises I hear about are through hooking your iPhone up to a service like iCloud and not the iPhone itself. I used to use an iPhone, but at the time it was the best phone (better than Blackberry). Now that we have Android I don’t see a huge need to use a closed proprietary system. However, it’s always good to have competition.
Here’s a comparison of iPhone models currently getting security updates with a guess of (but not guaranteed) security updates for 3-years.
iPhone 7 Plus – probably until September 2019 Ben’s cost over remaining life: $650/35mos ~$18.57/mo
iPhone 7 Plus – probably until September 2019 Ben’s cost over remaining life: $650/35mos ~$22.00/mo
iPhone 6S – probably until September 2018 iPhone 6 / 6 Plus – probably until September 2017 iPhone 5S / 5C – probably until the next major iOS update
Where Not to Buy a Phone
Mobile carriers typically install a lot of battery sucking bloatware, which can’t be deleted, and often delay pushing out security updates by months, even years, leaving your phone vulnerable to hackers. Not only that some of the extra software installed introduces vulnerabilities.
Also, phones bought from a mobile carrier are usually locked to that carrier so you can’t switch to someone else without purchasing a new phone.
Having an unlocked phone I avoid the main carriers and instead use MVNOs (Mobile Virtual Network Operator). These MVNOs use the same network that Verizon, AT&T, Sprint, and T-Mobile have, but most often for a better price. For great service and prices I like Google Fi (Sprint & T-Mobile Network), Ting (Spring or T-Mobile), and TracFone (Verizon or AT&T) and there are plenty of other MVNO operators to choose from. You can find one that offers the best plan for your situation. Using TracFone (which is a pre-paid service) we pay less than $10/month for a voice/data/text plan for a Nexus 5X on Verizon’s network.
Don’t Save Money with a Used Phone
I used to buy used phones off eBay to save money but now I don’t think it’s a good idea with the recent USB firmware hacks and the amount of malware out there. Used phones are a security risk–you have no idea if a used phone has been compromised, and if it’s been plugged into a compromised USB device that rewrote it’s firmware. Physical security is paramount. To be safe, I always buy my phones new.
Personal Data on Work Phones and Work Data on Personal Phones
Think carefully before using your personal phone for work. If you connect your phone to work email it almost always gives your employer complete control of the device. They can wipe your phone when you leave, track your location, install software on your phone, and have access to all your personal data.
And similarly, if you put your personal information or your personal email account on a work phone your employer has access to that data.
What Phone Do I Have?
Kris and I both use the Nexus 5X. I’ve reviewed the Nexus 5X here. I will likely replace them both when security updates go EOL which will likely be 2018. Pixel phones are bit expensive so I’m hoping they release some new phones on the Nexus line again next year.
Phone Safety Tips
Always use a phone that’s getting regular (monthly) security updates. As soon as the phone goes out of support, get a new phone.
Minimize the number of apps you install. Limit yourself to the official Google Play Store or iOS store and avoid 3rd party stores like the Amazon Store where authors don’t do as good a job at keeping things updated.
Favor installing well known apps with lots of downloads as they’re more likely to be reviewed and have better security practices.
Uninstall apps that you don’t use.
Always buy a new phone.
Don’t use a phone at all.
If you have a Samsung Note 7, you might want to return it before you catch on fire.
So, you want to hide your email from the NSA’s prying eyes? It’s impossible… but here are some steps you can use to make it harder.
This isn’t theoretical. The NSA has and does intercept this traffic.
Common Points of NSA Interception
The NSA has unlimited resources to compromise your communications. You’re not going to stop them. But that doesn’t mean it should be easy. Below are the easy points of NSA interception. In this example of an email from Mom to Ben the NSA can intercept the email at Mom’s ISP, Mom’s email provider, Ben’s email provider, Ben’s ISP, and any internet hop in between.
I’m going to skip over a lot of important stuff, this guide is not intended for security experts or sysadmins of email systems and how to prevent downgrade attacks, etc. This is meant to be a post about what the average American should do to protect their emails.
Step 1. Client to Server TLS Encryption
Ensure your email client (e.g. Thunderbird) or browser is using a TLS connection to the server. If you’re using any major provider like Gmail, Office 365, etc. they will be enforcing TLS. All email providers should be enforcing TLS so if yours is not that’s a good sign you should be switching.
If using webmail your browser should show https, if using Thunderbird you should be using STARTTLS for both inbound and outbound connections.
Note, the entire CA (Certificate Authority) system is broken, the NSA could generate a fraudulent certificate from an amicable CA and do a MITM attack and still intercept the email, but now they have to take some effort to do so. The point is security comes in layers, and we need to start at the basics, we’ll get to more advanced security below.
Step 2. Make sure Your Email Provider is Encrypting Server to Server Traffic
In 2013 Google was outraged after finding out the NSA was intercepting it’s server to server traffic. As a result Google started encrypting all internal traffic between servers (Good for Google). Most major internet providers provide server to server encryption. But the problem is not all ISPs use encryption, so it doesn’t do much good if you send an email from a secure service like Gmail to a small-town ISP that has no security whatsoever. Probably the best way to check is to enter in a recipients email address here: http://checktls.com/ and if their email provider’s MX server’s pass all the test they’re probably secure.
Step 3. PGP Encrypt Your Emails
Now, the NSA can still potentially intercept your emails at rest through a court order, through PRISM, or through hacking into ISPs. Your email should be encrypted not only in transit, but also at rest. The best way to do that is to encrypt it using OpenPGP. This means even if the NSA gets a hold of your email they can’t read it (at least not without spending some serious time and money).
PGP (Pretty Good Privacy) isn’t foolproof. It doesn’t encrypt the metadata (the NSA can still see that you sent me an email, they can see when you sent it and where you were) but it does encrypt the content.
How go you get OpenPGP? Right here: http://openpgp.org/software/ It’s free, open source, and there are plugins for just about everything. It works on Webmail, Thunderbird, Outlook, etc. Check the link above for a complete list but here are two common options:
If you use Thunderbird I suggest Enigmail, and if you use Gmail with the webmail interface Mailvelope is a great plugin.
Here’s a very quick getting started guide for Mailvelope below. If you’re not going to use Mailvelope the concept is pretty much the same nomatter what plugin you choose. You’ll Generate a Public/Private Keypair, obtain the public key of the person you’re sending an email to, and send them en encrypted email.
How to Setup Mailvelope for Gmail and Chrome
Here’s a quick walk-through to set it up. After installing the plugin you should see this icon on the top-right in Chrome. Right-click on it and choose Options.
Next Generate a Key….
I should note that “Password” is traditionally called a Pass Phrase, it should be long, but you don’t ever want to forget it or you won’t be able to read any encrypted messages sent to you. I strongly suggest writing it down and keeping it someplace safe.
Now, to send an encrypted email to me, you’ll need to import my key. Go to “Import Keys” and type in my email address and hit search. You should click on the keyID: 13E708FC. A key will pop up, click on it to import my key.
Now, you can send me an encrypted email. Go to compose a new email in Gmail. You’ll notice a button in the compose menu. Click the button.
Write me a message…
When you receive an encrypted email, it will look like this. Click on it and enter your passphrase to decrypt.
And there you have it. I wouldn’t say this is foolproof…. it doesn’t protect against a lot of other attack vectors…
But I say if the NSA is going to intercept my communications it shouldn’t be easy. I want them to spend some effort and money to do so.