algo/README.md

138 lines
8.9 KiB
Markdown
Raw Normal View History

2016-08-27 22:48:23 +00:00
# Algo VPN
2016-07-30 16:59:46 +00:00
[![Slack Status](https://empireslacking.herokuapp.com/badge.svg)](https://empireslacking.herokuapp.com)
2016-08-27 22:48:23 +00:00
Algo VPN (short for "Al Gore", the **V**ice **P**resident of **N**etworks everywhere for [inventing the Internet](https://www.youtube.com/watch?v=BnFJ8cHAlco)) is a set of Ansible scripts that simplifies the setup of a personal IPSEC VPN. It contains the most secure defaults available, works with common cloud providers, and does not require client software on most devices.
2016-07-30 16:59:46 +00:00
## Features
* Supports only IKEv2
2016-08-16 03:32:44 +00:00
* Supports only a single cipher suite w/ AES GCM, SHA2 HMAC, and P-256 DH
2016-07-30 16:59:46 +00:00
* Generates mobileconfig profiles to auto-configure Apple devices
* Provides helper scripts to add and remove users
* Blocks ads with a local DNS resolver and HTTP proxy (optional)
2016-07-30 17:52:53 +00:00
* Based on current versions of Ubuntu and StrongSwan
2016-08-16 03:32:44 +00:00
* Installs to DigitalOcean, Amazon EC2, Google Cloud Engine, or your own server
2016-07-30 16:59:46 +00:00
## Anti-features
2016-07-30 22:20:01 +00:00
* Does not support legacy cipher suites or protocols like L2TP, IKEv1, or RSA
* Does not install Tor, OpenVPN, or other risky servers
2016-07-31 05:17:11 +00:00
* Does not depend on the security of [TLS](https://tools.ietf.org/html/rfc7457)
2016-07-30 16:59:46 +00:00
* Does not require client software on most platforms
* Does not claim to provide anonymity or censorship avoidance
2016-07-30 18:03:49 +00:00
* Does not claim to protect you from the [FSB](https://en.wikipedia.org/wiki/Federal_Security_Service), [MSS](https://en.wikipedia.org/wiki/Ministry_of_State_Security_(China)), [DGSE](https://en.wikipedia.org/wiki/Directorate-General_for_External_Security), or [FSM](https://en.wikipedia.org/wiki/Flying_Spaghetti_Monster)
2016-07-30 16:59:46 +00:00
2016-08-27 22:48:23 +00:00
## Included Roles
2016-08-27 23:00:10 +00:00
Ansible scripts are organized into roles. The roles used by Algo are described in detail below.
2016-08-27 22:48:23 +00:00
### Required Roles
* **Common**
* Installs several required packages and software updates, then reboots if necessary
* Configures network interfaces and enables packet forwarding on them
* **VPN**
* Installs [StrongSwan](https://www.strongswan.org/), enables AppArmor, limits CPU and memory access, and drops user privileges
* Builds a Certificate Authority (CA) with [easy-rsa-ipsec](https://github.com/ValdikSS/easy-rsa-ipsec) and creates one client certificate per user
* Bundles the appropriate certificates into Apple mobileconfig profiles for each user
### Optional Roles
* **Security Enhancements**
2016-08-27 23:00:10 +00:00
* Enables [unattended-upgrades](https://help.ubuntu.com/community/AutomaticSecurityUpdates) to ensure available patches are always applied
* Modify operating system features like core dumps, kernel parameters, and SUID binaries to limit possible attacks
* Modifies SSH to use only modern ciphers and a seccomp sandbox, and restricts access to many legacy and unwanted features, like X11 forwarding and SFTP
* Configures IPtables to block traffic that might pose a risk to VPN users, such as [SMB/CIFS](https://medium.com/@ValdikSS/deanonymizing-windows-users-and-capturing-microsoft-and-vpn-accounts-f7e53fe73834)
2016-08-27 22:48:23 +00:00
* **Ad Blocking and Compression HTTP Proxy**
2016-08-27 23:00:10 +00:00
* Installs [Privoxy](https://www.privoxy.org/) with an ad blocking ruleset
* Installs Apache with [mod_pagespeed](http://modpagespeed.com/) as an HTTP proxy
* Constrains Privoxy and Apache with AppArmor and cgroups CPU and memory limitations
2016-08-27 22:48:23 +00:00
* **DNS Ad Blocking**
2016-08-27 23:00:10 +00:00
* Install the [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) local resolver with a blacklist for advertising domains
* Constrains dnsmasq with AppArmor and cgroups CPU and memory limitations
2016-08-27 22:48:23 +00:00
* **Security Monitoring and Logging**
2016-08-27 23:00:10 +00:00
* Configures [auditd](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html) and rsyslog to log data useful for investigating security incidents
* Emails aggregated Logs to a configured address on a regular basis
2016-08-27 22:48:23 +00:00
* **SSH Tunneling**
2016-08-27 23:00:10 +00:00
* Adds a restricted `algo` group to SSH with no shell access and limited forwarding options
* Creates one limited, local account per user and an SSH public key for each
2016-08-27 22:48:23 +00:00
## Usage
### Requirements
2016-07-30 16:59:46 +00:00
2016-08-23 06:00:32 +00:00
* ansible >= 2.1
2016-07-30 18:03:49 +00:00
* python >= 2.6
* [dopy=0.3.5](https://github.com/Wiredcraft/dopy)
2016-08-11 19:36:36 +00:00
* [boto](https://github.com/boto/boto)
2016-08-14 11:10:57 +00:00
* [azure >= 0.7.1](https://github.com/Azure/azure-sdk-for-python)
* [apache-libcloud](https://github.com/apache/libcloud)
* [libcloud](https://curl.haxx.se/docs/caextract.html) (for Mac OS)
2016-08-14 17:03:23 +00:00
* [six](https://github.com/JioCloud/python-six)
2016-08-04 18:05:07 +00:00
* SHell or BASH
2016-08-10 17:22:34 +00:00
* libselinux-python (for RedHat based distros)
2016-07-28 17:18:08 +00:00
2016-08-18 18:15:15 +00:00
### Cloud Deployment
2016-08-11 20:54:29 +00:00
To install the dependencies on OS X or Linux:
2016-08-10 17:22:34 +00:00
```
sudo easy_install pip
2016-08-20 11:23:06 +00:00
sudo pip install -r requirements.txt
2016-08-10 17:22:34 +00:00
```
2016-08-11 21:25:54 +00:00
Open the file `config.cfg` in your favorite text editor. Specify the users you wish to create in the `users` list.
2016-08-10 17:24:36 +00:00
Start the deploy and follow the instructions:
2016-08-01 15:51:52 +00:00
```
2016-08-11 21:25:54 +00:00
./algo
2016-08-01 15:51:52 +00:00
```
2016-08-18 08:36:36 +00:00
When the process is done, you can find `.mobileconfig` files and certificates in the `configs` directory. Send the `.mobileconfig` profile to users with Apple devices. Note that profile installation is supported over AirDrop. Do not send the mobileconfig file over plaintext (e.g., e-mail) since it contains the keys to access the VPN. For those using other clients, like Windows or Android, securely send them the X.509 certificates for the server and their user.
2016-08-18 18:15:15 +00:00
### Local Deployment
2016-08-18 08:36:36 +00:00
2016-08-18 18:15:15 +00:00
It is possible to download Algo to your own Ubuntu server and run the scripts locally. You need to install ansible to run Algo on Ubuntu. Installing ansible via pip requires pulling in a lot of dependencies, including a full compiler suite. It is easier to use apt, however, Ubuntu 16.04 only comes with ansible 2.0.0.2. Therefore, to use apt you must use the ansible PPA and using a PPA requires installing `software-properties-common`. tl;dr:
2016-08-18 08:36:36 +00:00
```
sudo apt-get install software-properties-common && sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update && sudo apt-get install ansible
2016-08-18 19:13:18 +00:00
git clone https://github.com/trailofbits/algo
2016-08-18 18:15:15 +00:00
cd algo && ./algo
2016-08-18 08:36:36 +00:00
```
2016-08-04 18:05:07 +00:00
### User Management
2016-08-11 20:54:29 +00:00
If you want to add or delete users, update the `users` list in `config.cfg` and run the command:
2016-08-01 15:51:52 +00:00
```
2016-08-11 21:25:54 +00:00
./algo update-users
2016-08-01 15:51:52 +00:00
```
2016-07-30 16:59:46 +00:00
## FAQ
### Has this been audited?
2016-07-30 21:51:13 +00:00
No. This project is under active development. We're happy to [accept and fix issues](https://github.com/trailofbits/algo/issues) as they are identified. Use algo at your own risk.
2016-07-30 16:59:46 +00:00
### Why aren't you using Tor?
2016-08-03 00:56:08 +00:00
The goal of this project is not to provide anonymity, but to ensure confidentiality of network traffic while traveling. Tor introduces new risks that are unsuitable for Algo's intended users. Namely, with algo, users are in control over the gateway routing their traffic. With Tor, users are at the mercy of [actively](https://www.securityweek2016.tu-darmstadt.de/fileadmin/user_upload/Group_securityweek2016/pets2016/10_honions-sanatinia.pdf) [malicious](https://chloe.re/2015/06/20/a-month-with-badonions/) [exit](https://community.fireeye.com/people/archit.mehta/blog/2014/11/18/onionduke-apt-malware-distributed-via-malicious-tor-exit-node) [nodes](https://www.wired.com/2010/06/wikileaks-documents/).
2016-07-31 18:49:31 +00:00
### Why aren't you using Racoon, LibreSwan, or OpenSwan?
2016-08-03 00:56:08 +00:00
Raccoon does not support IKEv2. Racoon2 supports IKEv2 but is not actively maintained. When we looked, the documentation for StrongSwan was better than the corresponding documentation for LibreSwan or OpenSwan. StrongSwan also has the benefit of a from-scratch rewrite to support IKEv2. I consider such rewrites a positive step when supporting a major new protocol version.
2016-07-31 18:49:31 +00:00
### Why aren't you using a memory-safe or verified IKE daemon?
2016-08-22 17:26:00 +00:00
I would, but I don't know of any [suitable ones](https://github.com/trailofbits/algo/issues/68). If you're in the position to fund the development of such a project, [contact us](mailto:info@trailofbits.com). We would be interested in leading such an effort. At the very least, I plan to make modifications to StrongSwan and the environment it's deployed in that prevent or significantly complicate exploitation of any latent issues.
2016-08-01 04:01:54 +00:00
### Why aren't you using OpenVPN?
2016-09-18 10:10:38 +00:00
OpenVPN does not have out-of-the-box client support on any major desktop or mobile operating system. This introduces user experience issues and requires the user to [update](https://www.exploit-db.com/exploits/34037/) and [maintain](https://www.exploit-db.com/exploits/20485/) the software themselves. OpenVPN depends on the security of [TLS](https://tools.ietf.org/html/rfc7457), both the [protocol](http://arstechnica.com/security/2016/08/new-attack-can-pluck-secrets-from-1-of-https-traffic-affects-top-sites/) and its [implementations](http://arstechnica.com/security/2014/04/confirmed-nasty-heartbleed-bug-exposes-openvpn-private-keys-too/), and we simply trust the server less due to past [security](https://github.com/ValdikSS/openvpn-fix-dns-leak-plugin/blob/master/README.md) [incidents](https://www.exploit-db.com/exploits/34879/).
2016-08-03 01:15:30 +00:00
### Why aren't you using Alpine Linux, OpenBSD, or HardenedBSD?
2016-08-03 01:15:30 +00:00
Alpine Linux is not supported out-of-the-box by any major cloud provider. We are interested in supporting Free, Open, and HardenedBSD. Follow along on our progress in [this issue](https://github.com/trailofbits/algo/issues/35).