hybridadmin.strongswan

Rola StrongSwan

CI

Testowane na:

  • Ubuntu 18.04 i 20.04
  • CentOS 7 i 8
  • Debian 9 i 10

Ta rola używa składni w stylu swanctl.conf (od 5.7.0).

Zmienne

Ogólne
  • strongswan_swanctl_settings: [wymagane]: Ustaw wszystkie ustawienia dla swanctl.conf
Ustawienia StrongSwan (serwer|klienci):
  • strongswan_swanctl_config_dir: [opcjonalne, domyślnie: /etc/strongswan/swanctl]: Katalog, który zawiera swanctl.conf StrongSwan
  • strongswan_swanctl_config_file: [opcjonalne, domyślnie: {{ strongswan_swanctl_config_dir }}/swanctl.conf]: Nazwa pliku konfiguracyjnego swanctl StrongSwan
  • strongswan_letsencrypt_enable: [opcjonalne, domyślnie: true]: Przygotuj certyfikat serwera StrongSwan z Let'sEncrypt
  • strongswan_firewalld_enable: [opcjonalne, domyślnie true]: Ustaw wszystkie potrzebne zasady zapory dla serwera StrongSwan
  • strongswan_client: [opcjonalne, domyślnie false]: Zainstaluj i skonfiguruj StrongSwan na klientach
  • strongswan_download_cert: [opcjonalne, domyślnie false]: Pobierz certyfikat StrongSwan z hosta serwera. Powinno być używane z strongswan_letsencrypt_enable = true
  • strongswan_upload_cert: [opcjonalne, domyślnie false]: Prześlij certyfikat StrongSwan do klientów. Powinno być używane z strongswan_letsencrypt_enable = true

Zależności

  • geerlingguy.certbot

Zmienne

Zmienne hosta dla serwera StrongSwan:

# Włącz powyższą zmienną tylko do generowania pierwszego certyfikatu
certbot_create_if_missing: yes

certbot_certs:
  - email: [email protected]
    domains:
      - "{{ inventory_hostname }}"

certbot_create_standalone_stop_services: []
# Ustawienia konfiguracyjne 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

Zmienne hosta dla 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

Przykłady playbooków

Playbook serwera StrongSwan z certyfikatami PKI:

- hosts: server
  vars:
    strongswan_letsencrypt_enable: false
  roles:
    - hybridadmin.strongswan

Playbook serwera StrongSwan z certyfikatami Letsencrypt:

- hosts: server
  vars:
    strongswan_letsencrypt_enable: true
    certbot_certs:
      - email: [email protected]
        domains:
          - vpn.example.com
  roles:
    - hybridadmin.strongswan

Playbook klientów StrongSwan:

- hosts:
    - server
  roles:
    - hybridadmin.strongswan
  vars:
    strongswan_client: true
    strongswan_download_cert: true

- hosts:
    - clients
  roles:
    - hybridadmin.strongswan
  vars:
    strongswan_upload_cert: true

Do zrobienia

  1. Usuń niektóre role zależności, aby osiągnąć większą elastyczność.

Licencja

Licencja BSD 2 klauzul "Uproszczona"

Informacje o autorze

hybridadmin

O projekcie

Role to configure a strongSwan IPSec VPN server.

Zainstaluj
ansible-galaxy install hybridadmin.strongswan
Licencja
Unknown
Pobrania
348
Właściciel
Windows/Linux enthusiast and lover of all things automation #devops #ansible #docker #powershell