hybridadmin.strongswan

StrongSwan Rolle

CI

Getestet auf:

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

Diese Rolle verwendet eine swanctl.conf-ähnliche Syntax (seit Version 5.7.0).

Variablen

Allgemein
  • strongswan_swanctl_settings: [erforderlich]: Alle Einstellungen für swanctl.conf festlegen
StrongSwan (Server|Clients) Einstellungen:
  • strongswan_swanctl_config_dir: [optional, standard: /etc/strongswan/swanctl]: Verzeichnis, das die StrongSwan swanctl.conf enthält
  • strongswan_swanctl_config_file: [optional, standard: {{ strongswan_swanctl_config_dir }}/swanctl.conf]: Der Name der StrongSwan swanctl Konfigurationsdatei
  • strongswan_letsencrypt_enable: [optional, standard: true]: StrongSwan Serverzertifikat mit Let'sEncrypt vorbereiten
  • strongswan_firewalld_enable: [optional, standard true]: Alle erforderlichen Firewall-Regeln für den StrongSwan Server festlegen
  • strongswan_client: [optional, standard false]: StrongSwan auf Clients installieren und konfigurieren
  • strongswan_download_cert: [optional, standard false]: StrongSwan-Zertifikat vom Server herunterladen. Sollte mit strongswan_letsencrypt_enable = true verwendet werden
  • strongswan_upload_cert: [optional, standard false]: StrongSwan-Zertifikat zu Clients hochladen. Sollte mit strongswan_letsencrypt_enable = true verwendet werden

Abhängigkeiten

  • geerlingguy.certbot

Variablen

Host-Variablen für StrongSwan Server:

# Aktivieren Sie die folgende Variable nur für die erste Zertifikatserstellung
certbot_create_if_missing: yes

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

certbot_create_standalone_stop_services: []
# StrongSwan swanctl Konfiguration festlegen
# 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-Variablen für 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

Beispiele für Playbooks

StrongSwan Server mit PKI-Zertifikaten:

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

StrongSwan Server mit Letsencrypt-Zertifikaten:

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

StrongSwan Clients Playbook:

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

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

Todo

  1. Einige Abhängigkeitsrollen entfernen, um mehr Flexibilität zu erreichen.

Lizenz

BSD 2-Klausel "Vereinfachte" Lizenz

Autor Informationen

hybridadmin

Über das Projekt

Role to configure a strongSwan IPSec VPN server.

Installieren
ansible-galaxy install hybridadmin.strongswan
GitHub Repository
Lizenz
Unknown
Downloads
348
Besitzer
Windows/Linux enthusiast and lover of all things automation #devops #ansible #docker #powershell