serverbee.strongswan
StrongSwan Role
Tested On:
- Ubuntu: 18.04 and 20.04
- CentOS: 7 and 8
- Debian: 9 and 10
This role uses a configuration style similar to swanctl.conf (starting from version 5.7.0).
Variables
General
strongswan_swanctl_settings
: [required]: All settings for swanctl.conf must be set here.
StrongSwan (server|clients) Settings:
strongswan_swanctl_config_dir
: [optional, default:/etc/strongswan/swanctl
]: Directory for the StrongSwan swanctl.conf file.strongswan_swanctl_config_file
: [optional, default:{{ strongswan_swanctl_config_dir }}/swanctl.conf
]: Name of the swanctl configuration file.strongswan_letsencrypt_enable
: [optional, default:true
]: Use Let's Encrypt to prepare the StrongSwan server certificate.strongswan_firewalld_enable
: [optional, default:true
]: Create necessary firewall rules for the StrongSwan server.strongswan_client
: [optional, default:false
]: Set up StrongSwan on client machines.strongswan_download_cert
: [optional, default:false
]: Download the StrongSwan certificate from the server. Use withstrongswan_letsencrypt_enable = true
.strongswan_upload_cert
: [optional, default:false
]: Upload the StrongSwan certificate to clients. Use withstrongswan_letsencrypt_enable = true
.
Dependencies
geerlingguy.certbot
Host Variables for StrongSwan Server:
# Enable this variable for the first certificate generation
certbot_create_if_missing: yes
certbot_certs:
- email: [email protected]
domains:
- "{{ inventory_hostname }}"
certbot_create_standalone_stop_services: []
# Set the StrongSwan swanctl configuration
# https://wiki.strongswan.org/projects/strongswan/wiki/UsableExamples
strongswan_swanctl_settings:
connections:
ikev2-eap:
version: 2
rekey_time: 0s
fragmentation: yes
proposals: aes192gcm16-aes128gcm16-prfsha256-ecp256-ecp521,aes192-sha256-modp3072,default
encap: yes
pools: primary-pool-ipv4
dpd_delay: 30s
local-1:
certs: cert.pem
id: myid
remote-1:
auth: eap-dynamic
eap_id: "%any"
children:
ikev2-eap:
local_ts: 0.0.0.0/0,::/0
rekey_time: 0s
dpd_action: clear
esp_proposals = aes192gcm16-aes128gcm16-prfsha256-ecp256-modp3072,aes192-sha256-ecp256-modp3072,default
pools:
primary-pool-ipv4:
addrs: 192.168.252.0/24
secrets:
eap-user:
id: user
secret: Ar3e73tTnp02
Host Variables for carol.strongswan.org:
strongswan_swanctl_settings:
connections:
home:
encap: yes
vips: 0.0.0.0
remote_addrs: moon.strongswan.org
version: 2
children:
home:
remote_ts: 0.0.0.0/0,::/0
start_action: none
local:
auth: eap-aka
eap_id: carol
remote:
auth: pubkey
id: moon.strongswan.org
secrets:
eap-carol:
id: carol
secret: Ar3etTnp
Playbook Examples
StrongSwan Server with PKI Certificates Playbook:
- hosts: server
vars:
strongswan_letsencrypt_enable: false
roles:
- serverbee.strongswan
StrongSwan Server with LetsEncrypt Certificates Playbook:
- hosts: server
vars:
strongswan_letsencrypt_enable: true
certbot_certs:
- email: [email protected]
domains:
- vpn.example.com
roles:
- serverbee.strongswan
StrongSwan Clients Playbook:
- hosts:
- server
roles:
- serverbee.strongswan
vars:
strongswan_client: true
strongswan_download_cert: true
- hosts:
- clients
roles:
- serverbee.strongswan
vars:
strongswan_upload_cert: true
Todo
- Remove some dependencies to allow for more flexibility.
License
BSD 2-clause "Simplified" license.
Author Information
Vitaly Yakovenko
hybridadmin
Informazioni sul progetto
Role to configure a strongSwan IPSec VPN server.
Installa
ansible-galaxy install serverbee.strongswan
Licenza
Unknown
Download
252
Proprietario