I've setup WireGuard with LibreELEC and it works good, even with a Rsp1 can handle traffic for a full HD movie without issues. The only problem that I found with the setup is that "Host = IP of the WireGuard server" - must be an IP not a hostname, it will not be resolved and no error is shown, just the traffic will not work... but my server does not have a 100% static IP so I used DDNS... anyway a quick solution is to have a script at startup that resolves the IP, writes it to the config file, resolves the connection name and finally starts the VPN connection.
This script will replace "your_hostname_to_server" string from wireguard.config.original into wireguard.config (so .original needs to be a complete config file except that instead of the server ip will have "your_hostname_to_server" which will be replaced
#!/bin/bash
#wait 10s for network... any ideas on how to fix this? :/
sleep 10
#resolve hostname to ip and save it in config file
SERVER_HOST="your_hostname_to_server"
SERVER_IP=$(getent hosts $SERVER_HOST | awk '{ print $1 }')
echo "Server host: $SERVER_HOST"
echo "Resolved server ip: $SERVER_IP"
sed "s/$SERVER_HOST/$SERVER_IP/g" /storage/.config/wireguard/wireguard.config.original > /storage/.config/wireguard/wireguard.config
#wait 1 sec for network name to be available
sleep 1
#list connections and select the one with Wireguard in name/description
VPN_CONNECTION_NAME=$(connmanctl services | grep 'WireGuard' | awk -F' ' '{print $NF}')
echo "VPN connection name: $VPN_CONNECTION_NAME"
#connect to VPN
connmanctl connect $VPN_CONNECTION_NAME
Display More
To disconnect another script is used
#!/bin/bash
#list connections and select the one with Wireguard in description
VPN_CONNECTION_NAME=$(connmanctl services | grep 'WireGuard' | awk -F' ' '{print $NF}')
echo "VPN connection name: $VPN_CONNECTION_NAME"
#connect to VPN
connmanctl disconnect $VPN_CONNECTION_NAME
Finally in wireguard.service file instead of connect/disconnect commands, the scripts are called
ExecStart=/usr/bin/connmanctl connect vpn_service_name_goes_here
ExecStop=/usr/bin/connmanctl disconnect vpn_service_name_goes_here
changed to
ExecStart=/storage/.config/wireguard/connectVPN.sh
ExecStop=/storage/.config/wireguard/disconnectVPN.sh
In this case the scripts are in '/storage/.config/wireguard/' for sure there is a better place, but just to make it work, it's ok
Finally this is a quick & dirty solution to this Connman issue... by the way, anyone has any info on how to report a bug to Connman? I just found "You can report bugs at - 01.org JIRA" - but it seems that is a closed jira project and an account is needed to report the bug and an account can't be created by anyone new..
Any suggestions or a better solution would be greatly appreciated