Skip to content

Commit 4ecec2d

Browse files
Merged in trailofbits/master (trailofbits#14558)
2 parents 4321212 + 1c80cd2 commit 4ecec2d

14 files changed

+121
-49
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ docs
1212
.env
1313
logo.png
1414
tests
15+
CHANGELOG.md
16+
PULL_REQUEST_TEMPLATE.md
17+
Vagrantfile
18+
Makefile

.github/workflows/docker-image.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v2
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v4
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
tags: |
35+
# set latest tag for master branch
36+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v4
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/main.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,26 @@ jobs:
1313
cache: 'pip'
1414

1515
- name: Install dependencies
16+
env:
17+
DEBIAN_FRONTEND: noninteractive
1618
run: |
1719
sudo apt update -y
1820
python -m pip install --upgrade pip
1921
pip install -r requirements.txt
2022
sudo snap install shellcheck
21-
pip install ansible-lint==6.3.0
23+
pip install ansible-lint
2224
2325
- name: Checks and linters
2426
run: |
2527
/snap/bin/shellcheck algo install.sh
2628
ansible-playbook main.yml --syntax-check
27-
ansible-lint -x experimental,package-latest,unnamed-task -v *.yml roles/{local,cloud-*}/*/*.yml
29+
ansible-lint -x experimental,package-latest,unnamed-task -v *.yml roles/{local,cloud-*}/*/*.yml || true
2830
2931
scripted-deploy:
3032
runs-on: ubuntu-20.04
3133
strategy:
3234
matrix:
33-
UBUNTU_VERSION: ["20.04"]
35+
UBUNTU_VERSION: ["22.04"]
3436
steps:
3537
- uses: actions/checkout@v3
3638
- uses: actions/setup-python@v2.3.2
@@ -39,6 +41,8 @@ jobs:
3941
cache: 'pip'
4042

4143
- name: Install dependencies
44+
env:
45+
DEBIAN_FRONTEND: noninteractive
4246
run: |
4347
sudo apt update -y
4448
sudo apt install -y \
@@ -69,12 +73,14 @@ jobs:
6973
7074
- name: Deployment
7175
run: |
76+
set -x
7277
until sudo lxc exec algo -- test -f /var/log/cloud-init-output.log; do echo 'Log file not found, Sleep for 3 seconds'; sleep 3; done
7378
( sudo lxc exec algo -- tail -f /var/log/cloud-init-output.log & )
7479
until sudo lxc exec algo -- test -f /var/lib/cloud/data/result.json; do
7580
echo 'Cloud init is not finished. Sleep for 30 seconds';
7681
sleep 30;
7782
done
83+
sudo lxc exec algo -- cat /var/log/cloud-init-output.log
7884
sudo lxc exec algo -- test -f /opt/algo/configs/localhost/.config.yml
7985
sudo lxc exec algo -- tar zcf /root/algo-configs.tar -C /opt/algo/configs/ .
8086
sudo lxc file pull algo/root/algo-configs.tar ./
@@ -90,7 +96,7 @@ jobs:
9096
runs-on: ubuntu-20.04
9197
strategy:
9298
matrix:
93-
UBUNTU_VERSION: ["20.04"]
99+
UBUNTU_VERSION: ["22.04"]
94100
steps:
95101
- uses: actions/checkout@v3
96102
- uses: actions/setup-python@v2.3.2
@@ -99,6 +105,8 @@ jobs:
99105
cache: 'pip'
100106

101107
- name: Install dependencies
108+
env:
109+
DEBIAN_FRONTEND: noninteractive
102110
run: |
103111
set -x
104112
sudo apt update -y

algo-docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ usage() {
1111
retcode="${1:-0}"
1212
echo "To run algo from Docker:"
1313
echo ""
14-
echo "docker run --cap-drop=all -it -v <path to configurations>:"${DATA_DIR}" trailofbits/algo:latest"
14+
echo "docker run --cap-drop=all -it -v <path to configurations>:"${DATA_DIR}" ghcr.io/trailofbits/algo:latest"
1515
echo ""
1616
exit ${retcode}
1717
}

config.cfg

+12-12
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ cloud_providers:
172172
type: Standard_LRS
173173
image:
174174
publisher: Canonical
175-
offer: 0001-com-ubuntu-minimal-focal-daily
176-
sku: minimal-20_04-daily-lts
175+
offer: 0001-com-ubuntu-minimal-jammy-daily
176+
sku: minimal-22_04-daily-lts
177177
version: latest
178178
digitalocean:
179179
size: s-1vcpu-1gb
180-
image: "ubuntu-20-04-x64"
180+
image: "ubuntu-22-04-x64"
181181
ec2:
182182
# Change the encrypted flag to "false" to disable AWS volume encryption.
183183
encrypted: true
@@ -186,39 +186,39 @@ cloud_providers:
186186
use_existing_eip: false
187187
size: t2.micro
188188
image:
189-
name: "ubuntu-focal-20.04"
189+
name: "ubuntu-jammy-22.04"
190190
arch: x86_64
191191
owner: "099720109477"
192192
# Change instance_market_type from "on-demand" to "spot" to launch a spot
193193
# instance. See deploy-from-ansible.md for spot's additional IAM permission
194194
instance_market_type: on-demand
195195
gce:
196196
size: e2-micro
197-
image: ubuntu-2004-lts
197+
image: ubuntu-2204-lts
198198
external_static_ip: false
199199
lightsail:
200200
size: nano_2_0
201-
image: ubuntu_20_04
201+
image: ubuntu_22_04
202202
scaleway:
203203
size: DEV1-S
204-
image: Ubuntu 20.04 Focal Fossa
204+
image: Ubuntu 22.04 Jammy Jellyfish
205205
arch: x86_64
206206
hetzner:
207207
server_type: cx11
208-
image: ubuntu-20.04
208+
image: ubuntu-22.04
209209
openstack:
210210
flavor_ram: ">=512"
211-
image: Ubuntu-20.04
211+
image: Ubuntu-22.04
212212
cloudstack:
213213
size: Micro
214-
image: Linux Ubuntu 20.04 LTS 64-bit
214+
image: Linux Ubuntu 22.04 LTS 64-bit
215215
disk: 10
216216
vultr:
217-
os: Ubuntu 20.04 LTS x64
217+
os: Ubuntu 22.04 LTS x64
218218
size: 1024 MB RAM,25 GB SSD,1.00 TB BW
219219
linode:
220220
type: g6-nanode-1
221-
image: linode/ubuntu20.04
221+
image: linode/ubuntu22.04
222222
local:
223223

224224
fail_hint:

docs/cloud-amazon-ec2.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Addtional configurations are documented in the [EC2 section of the deploy from a
1818

1919
In the AWS console, find the policies menu: click Services > IAM > Policies. Click Create Policy.
2020

21-
Here, you have the policy editor. Switch to the JSON tab and copy-paste over the existing empty policy with [the minimum required AWS policy needed for Algo deployment](https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md#minimum-required-iam-permissions-for-deployment).
21+
Here, you have the policy editor. Switch to the JSON tab and copy-paste over the existing empty policy with [the minimum required AWS policy needed for Algo deployment](https://github.com/trailofbits/algo/blob/master/docs/deploy-from-ansible.md#minimum-required-iam-permissions-for-deployment).
2222

2323
When prompted to name the policy, name it `AlgoVPN_Provisioning`.
2424

@@ -69,7 +69,7 @@ $ ./algo
6969
9. OpenStack (DreamCompute optimised)
7070
10. CloudStack (Exoscale optimised)
7171
11. Linode
72-
12. Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users)
72+
12. Install to existing Ubuntu server (for more advanced users)
7373
7474
Enter the number of your desired provider
7575
: 3
@@ -125,4 +125,5 @@ Enter the number of your desired region
125125
You will then be asked the remainder of the standard Algo setup questions.
126126

127127
## Cleanup
128+
128129
If you've installed Algo onto EC2 multiple times, your AWS account may become cluttered with unused or deleted resources e.g. instances, VPCs, subnets, etc. This may cause future installs to fail. The easiest way to clean up after you're done with a server is to go to "CloudFormation" from the console and delete the CloudFormation stack associated with that server. Please note that unless you've enabled termination protection on your instance, deleting the stack this way will delete your instance without warning, so be sure you are deleting the correct stack.

docs/deploy-from-ansible.md

+19-16
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ Cloud roles:
5656
Server roles:
5757

5858
- role: strongswan
59-
* Installs [strongSwan](https://www.strongswan.org/)
60-
* Enables AppArmor, limits CPU and memory access, and drops user privileges
61-
* Builds a Certificate Authority (CA) with [easy-rsa-ipsec](https://github.com/ValdikSS/easy-rsa-ipsec) and creates one client certificate per user
62-
* Bundles the appropriate certificates into Apple mobileconfig profiles for each user
59+
- Installs [strongSwan](https://www.strongswan.org/)
60+
- Enables AppArmor, limits CPU and memory access, and drops user privileges
61+
- Builds a Certificate Authority (CA) with [easy-rsa-ipsec](https://github.com/ValdikSS/easy-rsa-ipsec) and creates one client certificate per user
62+
- Bundles the appropriate certificates into Apple mobileconfig profiles for each user
6363
- role: dns_adblocking
64-
* Installs DNS encryption through [dnscrypt-proxy](https://github.com/jedisct1/dnscrypt-proxy) with blacklists to be updated daily from `adblock_lists` in `config.cfg` - note this will occur even if `dns_encryption` in `config.cfg` is set to `false`
65-
* Constrains dnscrypt-proxy with AppArmor and cgroups CPU and memory limitations
64+
- Installs DNS encryption through [dnscrypt-proxy](https://github.com/jedisct1/dnscrypt-proxy) with blacklists to be updated daily from `adblock_lists` in `config.cfg` - note this will occur even if `dns_encryption` in `config.cfg` is set to `false`
65+
- Constrains dnscrypt-proxy with AppArmor and cgroups CPU and memory limitations
6666
- role: ssh_tunneling
67-
* Adds a restricted `algo` group with no shell access and limited SSH forwarding options
68-
* Creates one limited, local account and an SSH public key for each user
67+
- Adds a restricted `algo` group with no shell access and limited SSH forwarding options
68+
- Creates one limited, local account and an SSH public key for each user
6969
- role: wireguard
70-
* Installs a [Wireguard](https://www.wireguard.com/) server, with a startup script, and automatic checks for upgrades
71-
* Creates wireguard.conf files for Linux clients as well as QR codes for Apple/Android clients
70+
- Installs a [Wireguard](https://www.wireguard.com/) server, with a startup script, and automatic checks for upgrades
71+
- Creates wireguard.conf files for Linux clients as well as QR codes for Apple/Android clients
7272

7373
Note: The `strongswan` role generates Apple profiles with On-Demand Wifi and Cellular if you pass the following variables:
7474

@@ -96,7 +96,7 @@ Required variables:
9696
- do_token
9797
- region
9898

99-
Possible options can be gathered calling to https://api.digitalocean.com/v2/regions
99+
Possible options can be gathered calling to <https://api.digitalocean.com/v2/regions>
100100

101101
### Amazon EC2
102102

@@ -113,20 +113,23 @@ Additional variables:
113113
- [encrypted](https://aws.amazon.com/blogs/aws/new-encrypted-ebs-boot-volumes/) - Encrypted EBS boot volume. Boolean (Default: true)
114114
- [size](https://aws.amazon.com/ec2/instance-types/) - EC2 instance type. String (Default: t2.micro)
115115
- [image](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html) - AMI `describe-images` search parameters to find the OS for the hosted image. Each OS and architecture has a unique AMI-ID. The OS owner, for example [Ubuntu](https://cloud-images.ubuntu.com/locator/ec2/), updates these images often. If parameters below result in multiple results, the most recent AMI-ID is chosen
116+
116117
```
117118
# Example of equivalent cli comand
118-
aws ec2 describe-images --owners "099720109477" --filters "Name=architecture,Values=arm64" "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-focal-20.04*"
119+
aws ec2 describe-images --owners "099720109477" --filters "Name=architecture,Values=arm64" "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-jammy-22.04*"
119120
```
121+
120122
- [owners] - The operating system owner id. Default is [Canonical](https://help.ubuntu.com/community/EC2StartersGuide#Official_Ubuntu_Cloud_Guest_Amazon_Machine_Images_.28AMIs.29) (Default: 099720109477)
121123
- [arch] - The architecture (Default: x86_64, Optional: arm64)
122-
- [name] - The wildcard string to filter available ami names. Algo appends this name with the string "-\*64-server-\*", and prepends with "ubuntu/images/hvm-ssd/" (Default: ubuntu-focal-20.04)
124+
- [name] - The wildcard string to filter available ami names. Algo appends this name with the string "-\*64-server-\*", and prepends with "ubuntu/images/hvm-ssd/" (Default: Ubuntu latest LTS)
123125
- [instance_market_type](https://aws.amazon.com/ec2/pricing/) - Two pricing models are supported: on-demand and spot. String (Default: on-demand)
124-
* If using spot instance types, one additional IAM permission along with the below minimum is required for deployment:
126+
- If using spot instance types, one additional IAM permission along with the below minimum is required for deployment:
127+
125128
```
126129
"ec2:CreateLaunchTemplate"
127130
```
128131
129-
#### Minimum required IAM permissions for deployment:
132+
#### Minimum required IAM permissions for deployment
130133
131134
```
132135
{
@@ -232,7 +235,7 @@ Required variables:
232235
233236
Possible options can be gathered via cli `aws lightsail get-regions`
234237
235-
#### Minimum required IAM permissions for deployment:
238+
#### Minimum required IAM permissions for deployment
236239
237240
```
238241
{

docs/deploy-from-docker.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,36 @@ While it is not possible to run your Algo server from within a Docker container,
1313
2. Create a local directory to hold your VPN configs (e.g. `C:\Users\trailofbits\Documents\VPNs\`)
1414
3. Create a local copy of [config.cfg](https://github.com/trailofbits/algo/blob/master/config.cfg), with required modifications (e.g. `C:\Users\trailofbits\Documents\VPNs\config.cfg`)
1515
4. Run the Docker container, mounting your configurations appropriately (assuming the container is named `trailofbits/algo` with a tag `latest`):
16-
- From Windows:
16+
17+
- From Windows:
18+
1719
```powershell
1820
C:\Users\trailofbits> docker run --cap-drop=all -it \
1921
-v C:\Users\trailofbits\Documents\VPNs:/data \
20-
trailofbits/algo:latest
22+
ghcr.io/trailofbits/algo:latest
2123
```
22-
- From Linux:
24+
25+
- From Linux:
26+
2327
```bash
2428
$ docker run --cap-drop=all -it \
2529
-v /home/trailofbits/Documents/VPNs:/data \
26-
trailofbits/algo:latest
30+
ghcr.io/trailofbits/algo:latest
2731
```
32+
2833
5. When it exits, you'll be left with a fully populated `configs` directory, containing all appropriate configuration data for your clients, and for future server management
2934

3035
### Providing Additional Files
36+
3137
If you need to provide additional files -- like authorization files for Google Cloud Project -- you can simply specify an additional `-v` parameter, and provide the appropriate path when prompted by `algo`.
3238

3339
For example, you can specify `-v C:\Users\trailofbits\Documents\VPNs\gce_auth.json:/algo/gce_auth.json`, making the local path to your credentials JSON file `/algo/gce_auth.json`.
3440

3541
### Scripted deployment
42+
3643
Ansible variables (see [Deployment from Ansible](deploy-from-ansible.md)) can be passed via `ALGO_ARGS` environment variable.
3744
_The leading `-e` (or `--extra-vars`) is required_, e.g.
45+
3846
```bash
3947
$ ALGO_ARGS="-e
4048
provider=digitalocean
@@ -50,19 +58,20 @@ $ ALGO_ARGS="-e
5058
$ docker run --cap-drop=all -it \
5159
-e "ALGO_ARGS=$ALGO_ARGS" \
5260
-v /home/trailofbits/Documents/VPNs:/data \
53-
trailofbits/algo:latest
61+
ghcr.io/trailofbits/algo:latest
5462
```
5563

5664
## Managing an Algo Server with Docker
5765

5866
Even though the container itself is transient, because you've persisted the configuration data, you can use the same Docker image to manage your Algo server. This is done by setting the environment variable `ALGO_ARGS`.
5967

6068
If you want to use Algo to update the users on an existing server, specify `-e "ALGO_ARGS=update-users"` in your `docker run` command:
69+
6170
```powershell
6271
$ docker run --cap-drop=all -it \
6372
-e "ALGO_ARGS=update-users" \
6473
-v C:\Users\trailofbits\Documents\VPNs:/data \
65-
trailofbits/algo:latest
74+
ghcr.io/trailofbits/algo:latest
6675
```
6776

6877
## GNU Makefile for Docker

docs/deploy-to-ubuntu.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
You can use Algo to configure a pre-existing server as an AlgoVPN rather than using it to create and configure a new server on a supported cloud provider. This is referred to as a **local** installation rather than a **cloud** deployment. If you're new to Algo or unfamiliar with Linux you'll find a cloud deployment to be easier.
1010

1111
To perform a local installation, install the Algo scripts following the normal installation instructions, then choose:
12+
1213
```
13-
Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users)
14+
Install to existing Ubuntu latest LTS server (for more advanced users)
1415
```
16+
1517
Make sure your target server is running an unmodified copy of the operating system version specified. The target can be the same system where you've installed the Algo scripts, or a remote system that you are able to access as root via SSH without needing to enter the SSH key passphrase (such as when using `ssh-agent`).
1618

1719
## Inbound VPN Server (also called "Road Warrior" setup)
1820

1921
Some may find it useful to set up an Algo server on an Ubuntu box on your home LAN, with the intention of being able to securely access your LAN and any resources on it when you're traveling elsewhere (the ["road warrior" setup](https://en.wikipedia.org/wiki/Road_warrior_(computing))). A few tips if you're doing so:
22+
2023
- Make sure you forward any [relevant incoming ports](/docs/firewalls.md#external-firewall) to the Algo server from your router;
2124
- Change `BetweenClients_DROP` in `config.cfg` to `false`, and also consider changing `block_smb` and `block_netbios` to `false`;
2225
- If you want to use a DNS server on your LAN to resolve local domain names properly (e.g. a Pi-hole), set the `dns_encryption` flag in `config.cfg` to `false`, and change `dns_servers` to the local DNS server IP (i.e. `192.168.1.2`).

docs/deploy-to-unsupported-cloud.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Algo officially supports the [cloud providers listed here](https://github.com/trailofbits/algo/blob/master/README.md#deploy-the-algo-server). If you want to deploy Algo on another virtual hosting provider, that provider must support:
44

5-
1. the base operating system image that Algo uses (Ubuntu 18.04 or 20.04), and
5+
1. the base operating system image that Algo uses (Ubuntu latest LTS release), and
66
2. a minimum of certain kernel modules required for the strongSwan IPsec server.
77

88
Please see the [Required Kernel Modules](https://wiki.strongswan.org/projects/strongswan/wiki/KernelModules) documentation from strongSwan for a list of the specific required modules and a script to check for them. As a first step, we recommend running their shell script to determine initial compatibility with your new hosting provider.

docs/faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
## Has Algo been audited?
1919

20-
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. If you find a security issue of any severity, please [contact us on Slack](https://empireslacking.herokuapp.com).
20+
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. If you find a security issue of any severity, please [contact us on Slack](https://slack.empirehacking.nyc).
2121

2222
## What's the current status of WireGuard?
2323

0 commit comments

Comments
 (0)