hybridadmin.strongswan
Rol de StrongSwan
Probado en:
- Ubuntu 18.04 y 20.04
- CentOS 7 y 8
- Debian 9 y 10
Este rol utiliza una sintaxis estilo swanctl.conf (haciendo referencia a secciones, desde la versión 5.7.0).
Variables
Generales
strongswan_swanctl_settings
: [requerido]: Establece todos los ajustes para swanctl.conf
Ajustes de StrongSwan (servidor|clientes):
strongswan_swanctl_config_dir
: [opcional, por defecto:/etc/strongswan/swanctl
]: Directorio que contiene swanctl.conf de StrongSwanstrongswan_swanctl_config_file
: [opcional, por defecto:{{ strongswan_swanctl_config_dir }}/swanctl.conf
]: Nombre del archivo de configuración swanctl de StrongSwanstrongswan_letsencrypt_enable
: [opcional, por defecto:true
]: Prepara el certificado del servidor StrongSwan con Let's Encryptstrongswan_firewalld_enable
: [opcional, por defectotrue
]: Establece todas las reglas de firewall necesarias para el servidor StrongSwanstrongswan_client
: [opcional, por defectofalse
]: Instala y configura StrongSwan en los clientesstrongswan_download_cert
: [opcional, por defectofalse
]: Descarga el certificado de StrongSwan desde el servidor. Debe usarse constrongswan_letsencrypt_enable
=true
strongswan_upload_cert
: [opcional, por defectofalse
]: Sube el certificado de StrongSwan a los clientes. Debe usarse constrongswan_letsencrypt_enable
=true
Dependencias
- geerlingguy.certbot
Variables
Variables de Host para Servidor StrongSwan:
# Habilita la variable a continuación solo para la generación del primer certificado
certbot_create_if_missing: yes
certbot_certs:
- email: [email protected]
domains:
- "{{ inventory_hostname }}"
certbot_create_standalone_stop_services: []
# Establecer la configuración de StrongSwan swanctl
# 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
Variables de Host para 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
Ejemplos de Playbook
Playbook de servidor StrongSwan con certificados PKI:
- hosts: server
vars:
strongswan_letsencrypt_enable: false
roles:
- hybridadmin.strongswan
Playbook de servidor StrongSwan con certificados Letsencrypt:
- hosts: server
vars:
strongswan_letsencrypt_enable: true
certbot_certs:
- email: [email protected]
domains:
- vpn.example.com
roles:
- hybridadmin.strongswan
Playbook de clientes StrongSwan:
- hosts:
- server
roles:
- hybridadmin.strongswan
vars:
strongswan_client: true
strongswan_download_cert: true
- hosts:
- clients
roles:
- hybridadmin.strongswan
vars:
strongswan_upload_cert: true
Tareas Pendientes
- Eliminar algunos roles de dependencias para lograr más flexibilidad.
Licencia
Licencia BSD de 2 cláusulas "Simplificada"
Información del Autor
hybridadmin
Acerca del proyecto
Role to configure a strongSwan IPSec VPN server.
Instalar
ansible-galaxy install hybridadmin.strongswan
Licencia
Unknown
Descargas
348
Propietario
Windows/Linux enthusiast and lover of all things automation #devops #ansible #docker #powershell