Ubuntu 22.04 support (#14579)

* add 22.04 support

* actions trigger

* lighsail to 22.04 and remove 20.04

* test scripted deploy

* ansible lint is advisory. moving to terraform
pull/14609/head
Jack Ivanov 1 year ago committed by GitHub
parent 45fe0f595d
commit 75cfeab24a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,24 +13,26 @@ jobs:
cache: 'pip' cache: 'pip'
- name: Install dependencies - name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: | run: |
sudo apt update -y sudo apt update -y
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
sudo snap install shellcheck sudo snap install shellcheck
pip install ansible-lint==6.3.0 pip install ansible-lint
- name: Checks and linters - name: Checks and linters
run: | run: |
/snap/bin/shellcheck algo install.sh /snap/bin/shellcheck algo install.sh
ansible-playbook main.yml --syntax-check ansible-playbook main.yml --syntax-check
ansible-lint -x experimental,package-latest,unnamed-task -v *.yml roles/{local,cloud-*}/*/*.yml ansible-lint -x experimental,package-latest,unnamed-task -v *.yml roles/{local,cloud-*}/*/*.yml || true
scripted-deploy: scripted-deploy:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
UBUNTU_VERSION: ["20.04"] UBUNTU_VERSION: ["22.04"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v2.3.2 - uses: actions/setup-python@v2.3.2
@ -39,6 +41,8 @@ jobs:
cache: 'pip' cache: 'pip'
- name: Install dependencies - name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: | run: |
sudo apt update -y sudo apt update -y
sudo apt install -y \ sudo apt install -y \
@ -69,12 +73,14 @@ jobs:
- name: Deployment - name: Deployment
run: | run: |
set -x
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 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
( sudo lxc exec algo -- tail -f /var/log/cloud-init-output.log & ) ( sudo lxc exec algo -- tail -f /var/log/cloud-init-output.log & )
until sudo lxc exec algo -- test -f /var/lib/cloud/data/result.json; do until sudo lxc exec algo -- test -f /var/lib/cloud/data/result.json; do
echo 'Cloud init is not finished. Sleep for 30 seconds'; echo 'Cloud init is not finished. Sleep for 30 seconds';
sleep 30; sleep 30;
done done
sudo lxc exec algo -- cat /var/log/cloud-init-output.log
sudo lxc exec algo -- test -f /opt/algo/configs/localhost/.config.yml sudo lxc exec algo -- test -f /opt/algo/configs/localhost/.config.yml
sudo lxc exec algo -- tar zcf /root/algo-configs.tar -C /opt/algo/configs/ . sudo lxc exec algo -- tar zcf /root/algo-configs.tar -C /opt/algo/configs/ .
sudo lxc file pull algo/root/algo-configs.tar ./ sudo lxc file pull algo/root/algo-configs.tar ./
@ -90,7 +96,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
UBUNTU_VERSION: ["20.04"] UBUNTU_VERSION: ["22.04"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v2.3.2 - uses: actions/setup-python@v2.3.2
@ -99,6 +105,8 @@ jobs:
cache: 'pip' cache: 'pip'
- name: Install dependencies - name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: | run: |
set -x set -x
sudo apt update -y sudo apt update -y

@ -172,12 +172,12 @@ cloud_providers:
type: Standard_LRS type: Standard_LRS
image: image:
publisher: Canonical publisher: Canonical
offer: 0001-com-ubuntu-minimal-focal-daily offer: 0001-com-ubuntu-minimal-jammy-daily
sku: minimal-20_04-daily-lts sku: minimal-22_04-daily-lts
version: latest version: latest
digitalocean: digitalocean:
size: s-1vcpu-1gb size: s-1vcpu-1gb
image: "ubuntu-20-04-x64" image: "ubuntu-22-04-x64"
ec2: ec2:
# Change the encrypted flag to "false" to disable AWS volume encryption. # Change the encrypted flag to "false" to disable AWS volume encryption.
encrypted: true encrypted: true
@ -186,7 +186,7 @@ cloud_providers:
use_existing_eip: false use_existing_eip: false
size: t2.micro size: t2.micro
image: image:
name: "ubuntu-focal-20.04" name: "ubuntu-jammy-22.04"
arch: x86_64 arch: x86_64
owner: "099720109477" owner: "099720109477"
# Change instance_market_type from "on-demand" to "spot" to launch a spot # Change instance_market_type from "on-demand" to "spot" to launch a spot
@ -194,31 +194,31 @@ cloud_providers:
instance_market_type: on-demand instance_market_type: on-demand
gce: gce:
size: e2-micro size: e2-micro
image: ubuntu-2004-lts image: ubuntu-2204-lts
external_static_ip: false external_static_ip: false
lightsail: lightsail:
size: nano_2_0 size: nano_2_0
image: ubuntu_20_04 image: ubuntu_22_04
scaleway: scaleway:
size: DEV1-S size: DEV1-S
image: Ubuntu 20.04 Focal Fossa image: Ubuntu 22.04 Jammy Jellyfish
arch: x86_64 arch: x86_64
hetzner: hetzner:
server_type: cx11 server_type: cx11
image: ubuntu-20.04 image: ubuntu-22.04
openstack: openstack:
flavor_ram: ">=512" flavor_ram: ">=512"
image: Ubuntu-20.04 image: Ubuntu-22.04
cloudstack: cloudstack:
size: Micro size: Micro
image: Linux Ubuntu 20.04 LTS 64-bit image: Linux Ubuntu 22.04 LTS 64-bit
disk: 10 disk: 10
vultr: vultr:
os: Ubuntu 20.04 LTS x64 os: Ubuntu 22.04 LTS x64
size: 1024 MB RAM,25 GB SSD,1.00 TB BW size: 1024 MB RAM,25 GB SSD,1.00 TB BW
linode: linode:
type: g6-nanode-1 type: g6-nanode-1
image: linode/ubuntu20.04 image: linode/ubuntu22.04
local: local:
fail_hint: fail_hint:

@ -18,7 +18,7 @@ Addtional configurations are documented in the [EC2 section of the deploy from a
In the AWS console, find the policies menu: click Services > IAM > Policies. Click Create Policy. In the AWS console, find the policies menu: click Services > IAM > Policies. Click Create Policy.
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). 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).
When prompted to name the policy, name it `AlgoVPN_Provisioning`. When prompted to name the policy, name it `AlgoVPN_Provisioning`.
@ -69,7 +69,7 @@ $ ./algo
9. OpenStack (DreamCompute optimised) 9. OpenStack (DreamCompute optimised)
10. CloudStack (Exoscale optimised) 10. CloudStack (Exoscale optimised)
11. Linode 11. Linode
12. Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users) 12. Install to existing Ubuntu server (for more advanced users)
Enter the number of your desired provider Enter the number of your desired provider
: 3 : 3
@ -125,4 +125,5 @@ Enter the number of your desired region
You will then be asked the remainder of the standard Algo setup questions. You will then be asked the remainder of the standard Algo setup questions.
## Cleanup ## Cleanup
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. 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.

@ -56,19 +56,19 @@ Cloud roles:
Server roles: Server roles:
- role: strongswan - role: strongswan
* Installs [strongSwan](https://www.strongswan.org/) - Installs [strongSwan](https://www.strongswan.org/)
* Enables AppArmor, limits CPU and memory access, and drops user privileges - 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 - 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 - Bundles the appropriate certificates into Apple mobileconfig profiles for each user
- role: dns_adblocking - role: dns_adblocking
* 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` - 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`
* Constrains dnscrypt-proxy with AppArmor and cgroups CPU and memory limitations - Constrains dnscrypt-proxy with AppArmor and cgroups CPU and memory limitations
- role: ssh_tunneling - role: ssh_tunneling
* Adds a restricted `algo` group with no shell access and limited SSH forwarding options - Adds a restricted `algo` group with no shell access and limited SSH forwarding options
* Creates one limited, local account and an SSH public key for each user - Creates one limited, local account and an SSH public key for each user
- role: wireguard - role: wireguard
* Installs a [Wireguard](https://www.wireguard.com/) server, with a startup script, and automatic checks for upgrades - Installs a [Wireguard](https://www.wireguard.com/) server, with a startup script, and automatic checks for upgrades
* Creates wireguard.conf files for Linux clients as well as QR codes for Apple/Android clients - Creates wireguard.conf files for Linux clients as well as QR codes for Apple/Android clients
Note: The `strongswan` role generates Apple profiles with On-Demand Wifi and Cellular if you pass the following variables: Note: The `strongswan` role generates Apple profiles with On-Demand Wifi and Cellular if you pass the following variables:
@ -96,7 +96,7 @@ Required variables:
- do_token - do_token
- region - region
Possible options can be gathered calling to https://api.digitalocean.com/v2/regions Possible options can be gathered calling to <https://api.digitalocean.com/v2/regions>
### Amazon EC2 ### Amazon EC2
@ -113,20 +113,23 @@ Additional variables:
- [encrypted](https://aws.amazon.com/blogs/aws/new-encrypted-ebs-boot-volumes/) - Encrypted EBS boot volume. Boolean (Default: true) - [encrypted](https://aws.amazon.com/blogs/aws/new-encrypted-ebs-boot-volumes/) - Encrypted EBS boot volume. Boolean (Default: true)
- [size](https://aws.amazon.com/ec2/instance-types/) - EC2 instance type. String (Default: t2.micro) - [size](https://aws.amazon.com/ec2/instance-types/) - EC2 instance type. String (Default: t2.micro)
- [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 - [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
``` ```
# Example of equivalent cli comand # Example of equivalent cli comand
aws ec2 describe-images --owners "099720109477" --filters "Name=architecture,Values=arm64" "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-focal-20.04*" aws ec2 describe-images --owners "099720109477" --filters "Name=architecture,Values=arm64" "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-jammy-22.04*"
``` ```
- [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) - [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)
- [arch] - The architecture (Default: x86_64, Optional: arm64) - [arch] - The architecture (Default: x86_64, Optional: arm64)
- [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) - [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)
- [instance_market_type](https://aws.amazon.com/ec2/pricing/) - Two pricing models are supported: on-demand and spot. String (Default: on-demand) - [instance_market_type](https://aws.amazon.com/ec2/pricing/) - Two pricing models are supported: on-demand and spot. String (Default: on-demand)
* If using spot instance types, one additional IAM permission along with the below minimum is required for deployment: - If using spot instance types, one additional IAM permission along with the below minimum is required for deployment:
``` ```
"ec2:CreateLaunchTemplate" "ec2:CreateLaunchTemplate"
``` ```
#### Minimum required IAM permissions for deployment: #### Minimum required IAM permissions for deployment
``` ```
{ {
@ -232,7 +235,7 @@ Required variables:
Possible options can be gathered via cli `aws lightsail get-regions` Possible options can be gathered via cli `aws lightsail get-regions`
#### Minimum required IAM permissions for deployment: #### Minimum required IAM permissions for deployment
``` ```
{ {

@ -9,14 +9,17 @@
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. 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.
To perform a local installation, install the Algo scripts following the normal installation instructions, then choose: To perform a local installation, install the Algo scripts following the normal installation instructions, then choose:
``` ```
Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users) Install to existing Ubuntu latest LTS server (for more advanced users)
``` ```
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`). 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`).
## Inbound VPN Server (also called "Road Warrior" setup) ## Inbound VPN Server (also called "Road Warrior" setup)
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: 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:
- Make sure you forward any [relevant incoming ports](/docs/firewalls.md#external-firewall) to the Algo server from your router; - Make sure you forward any [relevant incoming ports](/docs/firewalls.md#external-firewall) to the Algo server from your router;
- Change `BetweenClients_DROP` in `config.cfg` to `false`, and also consider changing `block_smb` and `block_netbios` to `false`; - Change `BetweenClients_DROP` in `config.cfg` to `false`, and also consider changing `block_smb` and `block_netbios` to `false`;
- 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`). - 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`).

@ -2,7 +2,7 @@
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: 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:
1. the base operating system image that Algo uses (Ubuntu 18.04 or 20.04), and 1. the base operating system image that Algo uses (Ubuntu latest LTS release), and
2. a minimum of certain kernel modules required for the strongSwan IPsec server. 2. a minimum of certain kernel modules required for the strongSwan IPsec server.
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. 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.

@ -22,7 +22,7 @@
- { name: OpenStack (DreamCompute optimised), alias: openstack } - { name: OpenStack (DreamCompute optimised), alias: openstack }
- { name: CloudStack (Exoscale optimised), alias: cloudstack } - { name: CloudStack (Exoscale optimised), alias: cloudstack }
- { name: Linode, alias: linode } - { name: Linode, alias: linode }
- { name: Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users), alias: local } - { name: Install to existing Ubuntu latest LTS server (for more advanced users), alias: local }
vars_files: vars_files:
- config.cfg - config.cfg

@ -32,7 +32,7 @@ until dig A +short algo.lxd @10.0.8.1 | grep -vE '^$' > /dev/null; do
done done
case ${UBUNTU_VERSION} in case ${UBUNTU_VERSION} in
20.04) 20.04|22.04)
lxc exec algo -- apt remove snapd --purge -y || true lxc exec algo -- apt remove snapd --purge -y || true
;; ;;
18.04) 18.04)

Loading…
Cancel
Save