# Configuration for {{vpnservice.name}}
config setup

conn %default
        ikelifetime=60m
        keylife=20m
        rekeymargin=3m
        keyingtries=1
        authby=psk
        mobike=no
{% for ipsec_site_connection in vpnservice.ipsec_site_connections%}
conn {{ipsec_site_connection.id}}
    keyexchange={{ipsec_site_connection.ikepolicy.ike_version}}
    left={{ipsec_site_connection.external_ip}}
    leftsubnet={{ipsec_site_connection['local_cidrs']|join(',')}}
    leftid={{ipsec_site_connection.external_ip}}
    leftfirewall=yes
    right={{ipsec_site_connection.peer_address}}
    rightsubnet={{ipsec_site_connection['peer_cidrs']|join(',')}}
    rightid={{ipsec_site_connection.peer_id}}
    auto=route
{% endfor %}
