serverbee.strongswan
StrongSwanの役割
テスト済みの環境:
- 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:
- serverbee.strongswan
Letsencrypt証明書を使用したStrongSwanサーバーのプレイブック:
- hosts: server
vars:
strongswan_letsencrypt_enable: true
certbot_certs:
- email: [email protected]
domains:
- vpn.example.com
roles:
- serverbee.strongswan
StrongSwanクライアントのプレイブック:
- hosts:
- server
roles:
- serverbee.strongswan
vars:
strongswan_client: true
strongswan_download_cert: true
- hosts:
- clients
roles:
- serverbee.strongswan
vars:
strongswan_upload_cert: true
やること
- より柔軟性を持たせるために、いくつかの依存関係役割を削除します。
ライセンス
BSD 2-clause "Simplified" ライセンス
著者情報
Vitaly Yakovenko
hybridadmin