Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:vpn:openconnect:client [2020/11/28 08:10] – [1. Preparation] vgaetera | docs:guide-user:services:vpn:openconnect:client [2024/10/17 17:46] – [2. Key management] andrewz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== OpenConnect client ====== | ====== OpenConnect client ====== | ||
| - | {{section> | + | {{section> |
| ===== Introduction ===== | ===== Introduction ===== | ||
| Line 9: | Line 9: | ||
| {{section> | {{section> | ||
| - | ===== Instructions | + | ===== Command-line instructions |
| ==== 1. Preparation ==== | ==== 1. Preparation ==== | ||
| - | Install the packages | + | Install the required |
| - | Fetch [[docs: | + | Specify configuration parameters for VPN client. |
| <code bash> | <code bash> | ||
| # Install packages | # Install packages | ||
| opkg update | opkg update | ||
| - | opkg install openconnect | + | opkg install openconnect |
| # Configuration parameters | # Configuration parameters | ||
| - | OC_IF=" | + | VPN_IF=" |
| - | OC_SERV="SERVER_NAME_OR_IP_ADDRESS" | + | VPN_SERV="SERVER_ADDRESS" |
| - | OC_PORT=" | + | VPN_PORT=" |
| - | OC_HASH=" | + | VPN_USER=" |
| - | OC_USER=" | + | VPN_PASS=" |
| - | OC_PASS=" | + | |
| </ | </ | ||
| - | ==== 2. Firewall | + | ==== 2. Key management |
| - | Consider | + | Run the code below directly on the VPN server if you can or [[docs: |
| <code bash> | <code bash> | ||
| - | # Configure firewall | + | # Generate certificate hash |
| - | uci rename firewall.@zone[0]="lan" | + | VPN_CERT="server-cert.pem" |
| - | uci rename firewall.@zone[1]=" | + | VPN_HASH="pin-sha256:$(openssl x509 -in ${VPN_CERT} -pubkey -noout \ |
| - | uci del_list firewall.wan.network="${OC_IF}" | + | | openssl pkey -pubin -outform der \ |
| - | uci add_list firewall.wan.network=" | + | | openssl dgst -sha256 -binary \ |
| - | uci commit firewall | + | | openssl enc -base64)" |
| - | / | + | |
| </ | </ | ||
| - | ==== 3. Network ==== | + | Alternatively, |
| + | |||
| + | < | ||
| + | daemon.notice netifd: vpn (3443): Certificate from VPN server " | ||
| + | daemon.notice netifd: vpn (3443): Reason: unable to get local issuer certificate | ||
| + | daemon.notice netifd: vpn (3443): To trust this server in future, perhaps add this to your command line: | ||
| + | daemon.notice netifd: vpn (3443): | ||
| + | daemon.notice netifd: vpn (3443): SSL connection failure | ||
| + | </ | ||
| + | |||
| + | Copy the complete string shown __after__ '' | ||
| + | |||
| + | ==== 3. Firewall ==== | ||
| + | {{section> | ||
| + | |||
| + | ==== 4. Network ==== | ||
| Set up VPN interface. | Set up VPN interface. | ||
| <code bash> | <code bash> | ||
| # Configure network | # Configure network | ||
| - | uci -q delete network.${OC_IF} | + | uci -q delete network.${VPN_IF} |
| - | uci set network.${OC_IF}=" | + | uci set network.${VPN_IF}=" |
| - | uci set network.${OC_IF}.proto=" | + | uci set network.${VPN_IF}.proto=" |
| - | uci set network.${OC_IF}.server=" | + | uci set network.${VPN_IF}.server=" |
| - | uci set network.${OC_IF}.port=" | + | uci set network.${VPN_IF}.port=" |
| - | uci set network.${OC_IF}.serverhash="${OC_HASH}" | + | uci set network.${VPN_IF}.username="${VPN_USER}" |
| - | uci set network.${OC_IF}.username="${OC_USER}" | + | uci set network.${VPN_IF}.password="${VPN_PASS}" |
| - | uci set network.${OC_IF}.password="${OC_PASS}" | + | uci set network.${VPN_IF}.serverhash="${VPN_HASH}" |
| uci commit network | uci commit network | ||
| - | / | + | service |
| </ | </ | ||
| + | |||
| + | See all available OpenConnect protocol options [[docs: | ||
| + | |||
| + | Disable [[docs: | ||
| + | |||
| + | ===== Web-based configuration ===== | ||
| + | |||
| + | Web-based configuration is available through [[: | ||
| + | |||
| + | <code bash> | ||
| + | # Install packages | ||
| + | opkg update | ||
| + | opkg install luci-proto-openconnect | ||
| + | service rpcd restart | ||
| + | </ | ||
| + | |||
| + | Navigate to **LuCI -> Network -> Interfaces** to configure OpenConnect client. | ||
| + | |||
| + | Currently not all the options can be set through Luci, so manual changes in ''/ | ||
| + | |||
| + | \\ | ||
| ===== Testing ===== | ===== Testing ===== | ||
| Line 66: | Line 99: | ||
| <code bash> | <code bash> | ||
| # Restart services | # Restart services | ||
| - | / | + | service |
| # Log and status | # Log and status | ||
| Line 74: | Line 107: | ||
| pgrep -f -a openconnect | pgrep -f -a openconnect | ||
| ip address show; ip route show table all | ip address show; ip route show table all | ||
| - | ip rule show; ip -6 rule show; iptables-save; | + | ip rule show; ip -6 rule show; nft list ruleset |
| # Persistent configuration | # Persistent configuration | ||