2018-03-11 11:17:12,512 DEBG 'start-script' stdout output:
Options error: --proto tcp is ambiguous in this context. Please specify --proto tcp-server or --proto tcp-client
Use --help for more information.
2018-03-11 11:17:12,513 DEBG 'start-script' stdout output:
[info] OpenVPN started
2018-03-11 11:17:12,513 DEBG 'start-script' stdout output:
[debug] Waiting for valid IP address from tunnel...
...
...
...
OpenVPN no longer allow "tcp" as a "proto" option. This first block of code is selecting the correct protocol based on the ovpn config with some nested ifs to cover configs without the proto being declared.
export VPN_PROTOCOL=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^proto\s)[^\r\n]+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PROTOCOL}" ]]; then
echo "[info] VPN_PROTOCOL defined as '${VPN_PROTOCOL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
export VPN_PROTOCOL=$(echo "${vpn_remote_line}" | grep -P -o -m 1 'udp|tcp-client|tcp$' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PROTOCOL}" ]]; then
echo "[info] VPN_PROTOCOL defined as '${VPN_PROTOCOL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] VPN_PROTOCOL not found in ${VPN_CONFIG}, assuming udp" | ts '%Y-%m-%d %H:%M:%.S'
export VPN_PROTOCOL="udp"
fi
fi
Then this block overrides the VPN_PROTOCOL to "tcp" if "tcp-client" is selected. I assume tcp-client is not a valid protocol in iptables so this block protects against an iptables protocol error.
# required for use in iptables
if [[ "${VPN_PROTOCOL}" == "tcp-client" ]]; then
export VPN_PROTOCOL="tcp"
fi
We therefore have a conflict...unless of course, I've misunderstood this code.
OpenVPN no longer allow "tcp" as a "proto" option. This first block of code is selecting the correct protocol based on the ovpn config with some nested ifs to cover configs without the proto being declared.
Then this block overrides the VPN_PROTOCOL to "tcp" if "tcp-client" is selected. I assume tcp-client is not a valid protocol in iptables so this block protects against an iptables protocol error.
We therefore have a conflict...unless of course, I've misunderstood this code.