Very nice script!
I did have one problem, caused by having zsh as my login shell. When running /etc/network/if-up.d/reverse_ssh_tunnel, it would fail with an error like zsh:1: no matches found: *:14224:localhost:22.
To fix the problem I simply added a -c /bin/sh flag to the su command.