hybridadmin.strongswan

StrongSwanの役割

CI

テスト済みの環境:

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

この役割は、swanctl.confスタイルの構文を使用しています(5.7.0以降のセクション参照)。

変数

一般的な設定
  • strongswan_swanctl_settings: [必須]: swanctl.confのすべての設定を設定します。
StrongSwan(サーバー|クライアント)の設定:
  • strongswan_swanctl_config_dir: [オプション, デフォルト: /etc/strongswan/swanctl]: StrongSwan swanctl.confファイルがあるディレクトリ
  • strongswan_swanctl_config_file: [オプション, デフォルト: {{ strongswan_swanctl_config_dir }}/swanctl.conf]: StrongSwan swanctl設定ファイルの名前
  • strongswan_letsencrypt_enable: [オプション, デフォルト: true]: Let's EncryptでStrongSwanサーバーの証明書を準備します
  • strongswan_firewalld_enable: [オプション, デフォルト: true]: StrongSwanサーバーのために必要なすべてのファイアウォールルールを設定します
  • strongswan_client: [オプション, デフォルト: false]: クライアントにStrongSwanをインストールして設定します
  • strongswan_download_cert: [オプション, デフォルト: false]: サーバーホストからStrongSwan証明書をダウンロードします。strongswan_letsencrypt_enable = trueと一緒に使用する必要があります
  • strongswan_upload_cert: [オプション, デフォルト: false]: クライアントにStrongSwan証明書をアップロードします。strongswan_letsencrypt_enable = trueと一緒に使用する必要があります

依存関係

  • geerlingguy.certbot

変数

StrongSwanサーバーのホスト変数:

# 最初の証明書を生成するためにのみ下の変数を有効にします
certbot_create_if_missing: yes

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

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

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

プレイブックの例

PKI証明書を使用したStrongSwanサーバーのプレイブック:

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

Letsencrypt証明書を使用したStrongSwanサーバーのプレイブック:

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

StrongSwanクライアントのプレイブック:

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

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

すること

  1. より柔軟性を持たせるためにいくつかの依存関係の役割を削除します。

ライセンス

BSD 2条項 "簡易" ライセンス

著者情報

hybridadmin

プロジェクトについて

Role to configure a strongSwan IPSec VPN server.

インストール
ansible-galaxy install hybridadmin.strongswan
ライセンス
Unknown
ダウンロード
348
所有者
Windows/Linux enthusiast and lover of all things automation #devops #ansible #docker #powershell