This is a partial answer. See D-Bus authentication and authorization for points that I'm stuck on.
notify-send sends a message over D-Bus. Modern desktop environments launch a D-Bus bus per session and arrange for the programs in the session to find the right bus, generally by setting the environment variable DBUS_SESSION_BUS_ADDRESS. D-Bus supports several ways of connecting to the daemon that centralizes and dispatches messages, including abstract sockets, unix sockets and TCP.
OpenSSH ≥6.7 can forward Unix sockets, but as I write, very few systems are running such a recent version.
You can run a D-Bus daemon that listens over TCP (you can make it listen on multiple addresses, e.g. both TCP and a Unix socket). That may be difficult to arrange if dbus-daemon is launched by your session startup scripts in a way you can't influence.
You can forward the D-Bus abstract socket or named Unix socket over TCP with a tool such as netcat or socat. Here's a proof-of-concept script that sets up forwarding on TCP port 8004.
#!/bin/sh
case $DBUS_SESSION_BUS_ADDRESS in
'') echo 1>&2 "No local D-Bus instance";;
unix:abstract=*,guid=*)
guid=${DBUS_SESSION_BUS_ADDRESS##*[:,]guid=}
guid=${guid%%,*}
socket=${DBUS_SESSION_BUS_ADDRESS##*[:,]abstract=}
socket=ABSTRACT-CONNECT:${socket%%,*}
;;
unix:path=*,guid=*)
guid=${DBUS_SESSION_BUS_ADDRESS##*[:,]guid=}
guid=${guid%%,*}
socket=${DBUS_SESSION_BUS_ADDRESS##*[:,]path=}
socket=UNIX-CONNECT:${socket%%,*}
;;
*) echo 1>&2 "Unsupported DBUS_SESSION_BUS_ADDRESS";;
esac
socat "TCP-LISTEN:8004,reuseaddr,fork,range=127.0.0.1/32" "$socket"
You can now forward this TCP connection over SSH.
ssh -R 8004:localhost:8004 [email protected]
[email protected]$ export DBUS_SESSION_BUS_ADDRESS=tcp:host=127.0.0.1,port=8004
You need to do one more thing: copy the authorization cookie to the remote machine.
rsync -a .dbus-keyrings/org_freedesktop_general [email protected]:.dbus-keyrings/org_freedesktop_general
Beware that unlike the X11 cookie, the D-Bus cookie can change during the lifetime of the server. In fact, in my experiments, it seemed to change at irregular intervals, sometimes after only a few minutes.
Only recent versions of Gnome libraries read the cookie file, as far as I can tell. notify-send does read it on FreeBSD 10.1 with Gnome 3.14 but not on Debian wheezy with Gnome 3.4.