Skip to content

Commit

Permalink
Initial commit of reorg'd docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dguido committed Oct 13, 2016
1 parent 4db428a commit bff7c41
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 193 deletions.
81 changes: 0 additions & 81 deletions ADVANCED.md

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Common Issues

* Check that you're using at least Ansible 2.1
* If installing to a local server, try using a fresh install
* Please review the [FAQ](https://github.com/trailofbits/algo#faq) in the readme
* If installing to a local server, use a fresh install of Ubuntu 16.04
* Please review the [FAQ](https://github.com/trailofbits/algo#faq)

### Coding Guidelines

Expand Down
131 changes: 41 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Algo VPN (short for "Al Gore", the **V**ice **P**resident of **N**etworks everyw

## Features

* Supports only IKEv2
* Supports only a single cipher suite w/ AES GCM, SHA2 HMAC, and P-256 DH
* Generates mobileconfig profiles to auto-configure Apple devices
* Supports only IKEv2 w/ a single cipher suite: AES GCM, SHA2 HMAC, and P-256 DH
* Generates Apple Profiles to auto-configure iOS and macOS devices
* Provides helper scripts to add and remove users
* Blocks ads with a local DNS resolver and HTTP proxy (optional)
* Sets up limited SSH tunnels for each user (optional)
* Based on current versions of Ubuntu and StrongSwan
* Installs to DigitalOcean, Amazon EC2, Google Cloud Engine, or your own server

Expand All @@ -23,120 +23,71 @@ Algo VPN (short for "Al Gore", the **V**ice **P**resident of **N**etworks everyw
* Does not claim to provide anonymity or censorship avoidance
* 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)

## Included Roles

Ansible scripts are organized into roles. The roles used by Algo are described in detail below.

### 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**
* 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)
* **Ad Blocking and Compression HTTP Proxy**
* 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
* **DNS Ad Blocking**
* 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
* **Security Monitoring and Logging**
* 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
* **SSH Tunneling**
* 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

## Usage

### Requirements

* ansible >= 2.1
* python >= 2.6
* [dopy=0.3.5](https://github.com/Wiredcraft/dopy)
* [boto](https://github.com/boto/boto)
* [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)
* [six](https://github.com/JioCloud/python-six)
* SHell or BASH
* libselinux-python (for RedHat based distros)

### Roles and Tags
**Cloud roles:**
- role: cloud-digitalocean, tags: digitalocean
- role: cloud-ec2, tags: ec2
- role: cloud-gce, tags: gce

**Server roles:**
- role: vpn, tags: vpn
- role: dns_adblocking, tags: dns, adblock
- role: proxy, tags: proxy, adblock
- role: logging, tags: logging
- role: security, tags: security
- role: ssh_tunneling, tags: ssh_tunneling

### Cloud Deployment

To install the dependencies on OS X or Linux:
## Initial Setup

The easiest way to get an Algo server running is to let it setup a new virtual machine in the cloud for you.

1. Install the dependencies on OS X or Linux:
```
sudo easy_install pip
sudo pip install -r requirements.txt
```

Open the file `config.cfg` in your favorite text editor. Specify the users you wish to create in the `users` list.

Start the deploy and follow the instructions:

2. Open the file `config.cfg` in your favorite text editor. Specify the users you wish to create in the `users` list.
3. Start the deploy and follow the instructions:
```
./algo
```

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.
That's it! You now have an Algo VPN server on the internet.

### Local Deployment
Note: for local or scripted deployment instructions see the [Advanced Usage](/docs/ADVANCED.md) documentation.

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:
```
sudo apt-get install software-properties-common && sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update && sudo apt-get install ansible
git clone https://github.com/trailofbits/algo
cd algo && ./algo
```
## User Management

### Configuration Files

After Algo finishes setting up the server, you can find all the certificates and configuration files that users will need in the `config` directory. Make sure to adequately secure and transmit these files since many contain private keys.

### User Management
* [adsf].mobileconfig: Apple Configuration Profiles. These are all-in-one configuration files for iOS and macOS devices. Open them to a compatible device to fully configure the VPN. Note that they can be installed via AirDrop.
* asdf
* asdf

If you want to add or delete users, update the `users` list in `config.cfg` and run the command:
### Adding or Removing Users

Algo's own scripts can easily add and remove users from the VPN server.

1. Update the `users` list in your `config.cfg`
2. Run the command:
```
./algo update-users
```

The Algo VPN server now only contains the users listed in the `config.cfg` file.

## SSH Tunneling

If you turned on the optional SSH tunneling role, then local user accounts will be created for each user in `config.cfg`. None of these user accounts will have shell access and their SSH tunneling options are limited. This was done to ensure that users have the least access required to tunnel through the server.

Use the following command to SSH tunnel through the server:

```asdf```

[explain the options]

## FAQ

### Has this been audited?
### Has Algo been audited?

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.
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.

### Why aren't you using Tor?

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/).
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/).

### Why aren't you using Racoon, LibreSwan, or OpenSwan?

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.
Racoon 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.

### Why aren't you using a memory-safe or verified IKE daemon?

Expand All @@ -148,4 +99,4 @@ OpenVPN does not have out-of-the-box client support on any major desktop or mobi

### Why aren't you using Alpine Linux, OpenBSD, or HardenedBSD?

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).
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 or contribute to our BSD support in [this issue](https://github.com/trailofbits/algo/issues/35).
30 changes: 15 additions & 15 deletions algo
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ set -e

digitalocean () {
read -p "
Enter your API Token (https://cloud.digitalocean.com/settings/api/tokens):
Enter your API token (https://cloud.digitalocean.com/settings/api/tokens):
: " -rs do_access_token

read -p "
Enter a valid SSH key name (https://cloud.digitalocean.com/settings/security):
Enter an existing SSH key name (https://cloud.digitalocean.com/settings/security):
: " -r do_ssh_name

read -p "
Expand All @@ -32,9 +32,9 @@ Name the vpn server:
12. Bangalore
Enter the number of your desired region:
[7]: " -r region
region=${region:-7}
region=${region:-7}

case "$region" in
case "$region" in
1) do_region="ams2" ;;
2) do_region="ams3" ;;
3) do_region="fra1" ;;
Expand All @@ -49,22 +49,22 @@ Enter the number of your desired region:
12) do_region="blr1" ;;
esac

ansible-playbook deploy.yml -t digitalocean,vpn -e "do_access_token=$do_access_token do_ssh_name=$do_ssh_name do_server_name=$do_server_name do_region=$do_region"
ansible-playbook deploy.yml -t digitalocean,vpn -e "do_access_token=$do_access_token do_ssh_name=$do_ssh_name do_server_name=$do_server_name do_region=$do_region"

}

ec2 () {
read -p "
Enter your aws_access_key (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html):
: " -rs aws_access_key
[asdf...]: " -rs aws_access_key

read -p "
Enter your aws_secret_key (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html):
: " -rs aws_secret_key
[asdf...]: " -rs aws_secret_key

read -p "
Enter the local path to your SSH public key:
: " -r ssh_public_key
[adsf]: " -r ssh_public_key

read -p "
Name the vpn server:
Expand All @@ -86,7 +86,7 @@ Name the vpn server:
11. sa-east-1 South America (São Paulo)
Enter the number of your desired region:
[1]: " -r aws_region
aws_region=${aws_region:-1}
aws_region=${aws_region:-1}

case "$aws_region" in
1) region="us-east-1" ;;
Expand Down Expand Up @@ -155,7 +155,7 @@ Please choose the number of your zone. Press enter for default (#8) zone.
13) zone="asia-east1-c" ;;
esac

ansible-playbook deploy.yml -t gce,vpn -e "credentials_file=$credentials_file server_name=$server_name ssh_public_key=$ssh_public_key zone=$zone"
ansible-playbook deploy.yml -t gce,vpn -e "credentials_file=$credentials_file server_name=$server_name ssh_public_key=$ssh_public_key zone=$zone"

}

Expand All @@ -173,7 +173,7 @@ What user should we use to login on the server? (ignore if you're deploying to l
Enter the public IP address of your server: (IMPORTANT! This IP is used to verify the certificate)
: " -r IP_subject

ansible-playbook deploy.yml -t local,vpn -e "server_ip=$server_ip server_user=$server_user IP_subject_alt_name=$IP_subject"
ansible-playbook deploy.yml -t local,vpn -e "server_ip=$server_ip server_user=$server_user IP_subject_alt_name=$IP_subject"
}

algo_provisioning () {
Expand All @@ -184,7 +184,7 @@ algo_provisioning () {
3. Google Compute Engine
4. Install to existing Ubuntu server
Enter the number of your desired provider
Enter the number of your desired provider
: "

read -r N
Expand All @@ -198,12 +198,12 @@ Enter the number of your desired provider
esac

}

user_management () {
ansible-playbook users.yml
}

case "$1" in
update-users) user_management ;;
*) algo_provisioning ;;
update-users) user_management ;;
*) algo_provisioning ;;
esac
3 changes: 1 addition & 2 deletions config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ users:
- dan
- jack

# If you're using auditd for monitoring, add an email address to send logs
# Add an email address to send logs if you're using auditd for monitoring,
auditd_action_mail_acct: [email protected]

### Advanced users only below this line ###
Expand All @@ -15,7 +15,6 @@ easyrsa_ca_expire: 3650
easyrsa_cert_expire: 3650
easyrsa_p12_export_password: vpnpws


# If True re-init all existing certificates. (True or False)
easyrsa_reinit_existent: False

Expand Down
1 change: 0 additions & 1 deletion deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@
handlers:
- name: reload eth0
shell: sh -c 'ifdown eth0; ip addr flush dev eth0; ifup eth0'

Loading

0 comments on commit bff7c41

Please sign in to comment.