Claude 1
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
# Default remote access VPN settings
|
||||
sophos_default_remote_vpn_port: 443
|
||||
sophos_default_remote_vpn_encryption: "aes256"
|
||||
sophos_default_remote_vpn_hash: "sha256"
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# ============================================================================
|
||||
# Sophos Remote Access VPN Role - Main Tasks
|
||||
# ============================================================================
|
||||
|
||||
- name: Display remote access VPN configuration overview
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "======================================"
|
||||
- "Configuring Remote Access VPN"
|
||||
- "======================================"
|
||||
- "Firewall: {{ inventory_hostname }}"
|
||||
- "Type: {{ sophos_remote_access_vpn.type | default('Not configured') }}"
|
||||
tags: ['always']
|
||||
when: sophos_remote_access_vpn is defined
|
||||
|
||||
- name: Skip remote access VPN configuration (not defined)
|
||||
ansible.builtin.debug:
|
||||
msg: "No remote access VPN configuration defined for {{ inventory_hostname }}"
|
||||
when: sophos_remote_access_vpn is not defined
|
||||
tags: ['always']
|
||||
|
||||
- name: Configure remote access VPN
|
||||
ansible.builtin.uri:
|
||||
url: "https://{{ sophos_mgmt_host }}:{{ sophos_mgmt_port }}/webconsole/APIController"
|
||||
method: POST
|
||||
validate_certs: "{{ sophos_validate_certs }}"
|
||||
headers:
|
||||
Content-Type: "application/x-www-form-urlencoded"
|
||||
body: "reqxml={{ lookup('template', 'remote_access_vpn.json.j2') | urlencode }}"
|
||||
status_code: [200, 201]
|
||||
timeout: "{{ sophos_api_timeout }}"
|
||||
register: remote_vpn_result
|
||||
no_log: "{{ sophos_no_log_sensitive }}"
|
||||
when: sophos_remote_access_vpn is defined
|
||||
changed_when: "'successful' in remote_vpn_result.content | lower"
|
||||
tags: ['vpn', 'remote-access']
|
||||
|
||||
- name: Remote access VPN configuration completed
|
||||
ansible.builtin.debug:
|
||||
msg: "Remote access VPN configured successfully"
|
||||
when: sophos_remote_access_vpn is defined
|
||||
tags: ['always']
|
||||
@@ -0,0 +1,63 @@
|
||||
<Request>
|
||||
<Login>
|
||||
<Username>{{ sophos_api_username }}</Username>
|
||||
<Password>{{ sophos_api_password }}</Password>
|
||||
</Login>
|
||||
<Set operation="update">
|
||||
<RemoteAccessVPN>
|
||||
<Name>{{ sophos_remote_access_vpn.name | default('Remote-Access-VPN') }}</Name>
|
||||
<Status>{{ 'Enable' if sophos_remote_access_vpn.enabled | default(true) else 'Disable' }}</Status>
|
||||
<Type>{{ sophos_remote_access_vpn.type | upper }}</Type>
|
||||
|
||||
<!-- Connection Settings -->
|
||||
<ListeningPort>{{ sophos_remote_access_vpn.listening_port | default(443) }}</ListeningPort>
|
||||
<ListeningInterface>{{ sophos_remote_access_vpn.listening_interface }}</ListeningInterface>
|
||||
|
||||
<!-- Authentication -->
|
||||
<AuthenticationMethod>{{ sophos_remote_access_vpn.authentication_method | default('local') }}</AuthenticationMethod>
|
||||
<UserGroups>
|
||||
{% for group in sophos_remote_access_vpn.user_groups %}
|
||||
<Group>{{ group }}</Group>
|
||||
{% endfor %}
|
||||
</UserGroups>
|
||||
|
||||
<!-- IP Address Pool -->
|
||||
<AddressPool>
|
||||
<Network>{{ sophos_remote_access_vpn.address_pool.network }}</Network>
|
||||
<Netmask>{{ sophos_remote_access_vpn.address_pool.netmask }}</Netmask>
|
||||
<StartIP>{{ sophos_remote_access_vpn.address_pool.start_ip }}</StartIP>
|
||||
<EndIP>{{ sophos_remote_access_vpn.address_pool.end_ip }}</EndIP>
|
||||
</AddressPool>
|
||||
|
||||
<!-- DNS Settings -->
|
||||
<DNSServers>
|
||||
{% for dns in sophos_remote_access_vpn.dns_servers %}
|
||||
<Server>{{ dns }}</Server>
|
||||
{% endfor %}
|
||||
</DNSServers>
|
||||
|
||||
<!-- Tunnel Mode -->
|
||||
<TunnelMode>{{ sophos_remote_access_vpn.tunnel_mode | default('split') }}</TunnelMode>
|
||||
{% if sophos_remote_access_vpn.tunnel_mode | default('split') == 'split' %}
|
||||
<TunnelNetworks>
|
||||
{% for network in sophos_remote_access_vpn.tunnel_networks | default([]) %}
|
||||
<Network>{{ network }}</Network>
|
||||
{% endfor %}
|
||||
</TunnelNetworks>
|
||||
{% endif %}
|
||||
|
||||
<!-- Encryption -->
|
||||
<Encryption>{{ sophos_remote_access_vpn.encryption | default('aes256') }}</Encryption>
|
||||
<Hash>{{ sophos_remote_access_vpn.hash | default('sha256') }}</Hash>
|
||||
|
||||
<!-- Timeouts -->
|
||||
<IdleTimeout>{{ sophos_remote_access_vpn.idle_timeout | default(1800) }}</IdleTimeout>
|
||||
<SessionTimeout>{{ sophos_remote_access_vpn.session_timeout | default(43200) }}</SessionTimeout>
|
||||
|
||||
<!-- Advanced Settings -->
|
||||
<MaxConnections>{{ sophos_remote_access_vpn.max_concurrent_connections | default(50) }}</MaxConnections>
|
||||
<Compression>{{ 'Enable' if sophos_remote_access_vpn.enable_compression | default(true) else 'Disable' }}</Compression>
|
||||
<BlockLANAccess>{{ 'Enable' if sophos_remote_access_vpn.block_lan_access | default(true) else 'Disable' }}</BlockLANAccess>
|
||||
</RemoteAccessVPN>
|
||||
</Set>
|
||||
</Request>
|
||||
Reference in New Issue
Block a user