Hooking OpenVPN connection event

A final analysis of this issue and workaround proposal

I went through a serious debug of this issue during the last few hours. I landed on the topic @mrmarkuz cited and from there on this post on StackExchange. I tried sniffing packages going out from the NethServer and found out that

  1. When guacd says Sending Wake-on-LAN packet, and pausing for 15 seconds. a single package is sent out from the NethServer to the correct mac address BUT from some weird reason, another turned on host in the network listening for packages too doesn’t receive anything.
  2. If I run from the NethServer the ether-wake command, not one but two packages are sniffed both on the NethServer itself and on the other host. The (supposed to be) waked host turns on correctly.

It seems, therefore, to be a guacd issue. {No clue why}

Proposed solution/workaround

Since from the NethServer we’re able to catch outgoing (dead?) packets, we can sniff them and resend via ether-wake . I just copy-paste my current [working] configuration.

/usr/local/sbin/guacd_etherwake_wrapper.sh

#!/bin/bash


echo Started guacd etherwake wrapper


while true; do
	TOWAKE=$(tcpdump -c 1 -UlnXi eth0 ether proto 0x0842 or udp port 9 2>/dev/null | sed -nE 's/^.*20:  (ffff|.... ....) (..)(..) (..)(..) (..)(..).*$/\2:\3:\4:\5:\6:\7/p')
	echo Waking $TOWAKE
	ether-wake $TOWAKE
	sleep 10
done

/etc/systemd/system/guacd-etherwake-wrapper.service

[Unit]
Description=Wrap WOL requests made by guacd to etherwake
After=network.target

[Service]
ExecStart=/usr/local/sbin/guacd_etherwake_wrapper.sh
Restart=on-failure
User=root

[Install]
WantedBy=multi-user.target

The script simply listens for etherwake packages. After 1 package is received (-c 1) tcpdump exits and sed cleans the output to the simple mac address. The mac address is passed to ether-wake which is now supposed to wake the PC.

Final notes:

  • The mac address is saved in Guacamole in “UNIX” style (aa:bb:cc:dd:ee:ff)
  • If you need me to change this topic’s title to something more Guacamole-related just let me know

Best,

2 Likes