X11vnc + systemd on rocky9

Anyone have luck getting x11vnc running on Rocky 9 as a systemd service? I’ve scoured the web and have not seen an article for this on Rocky, mostly for Ubuntu/Debian.

My goal is to have x11vnc working, even at the login screen.

I’m able to get x11vnc running manually while logged in using the command below:

/usr/bin/x11vnc -passwd 1234 -display :1 -auth /run/user/1000/gdm/Xauthority -forever -bg -shared

However, when setting up the systemd service, the application will not start up

[Unit]
Description=x11vnc server
After=multi-user.target network.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -passwd 1234 -forever -bg -shared -auth guess

[Install]
WantedBy=multi-user.target

If I tweak the ExecStart to include the display, it will throw out an SELinux warning

Jan 25 17:49:56 localhost setroubleshoot[2344]: SELinux is preventing /usr/bin/xauth from append access on the unix_stream_socket unix_stream_socket. For complete SELinux messages run: sealert -l bf083e83-d316-4ca3-998a-9f3c1204c1f0

In my previous Centos7 build, this was the systemd config and worked flawlessly

/usr/bin/x11vnc -inetd -o /var/log/x11vnc.log -display :0 -auth /var/gdm/:0.Xauth -passwd 1234 -forever -bg

I’ve been able to get the systemd service running, however it does not appear to be accepting connections. The service has to be running as the GDM user.

The issue now is something about systemd socket access, I am not sure how to fix. Any help would be great!

Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57
Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57 Unable to establish connection with systemd socket
Jan 27 16:38:57 localhost x11vnc[2128]: 27/01/2023 16:38:57 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Socket operation on non-socket

[Unit]
Description=Start x11vnc server at startup.
After=multi-user.target network.target

[Service]
Type=simple
User=gdm
Group=gdm
ExecStart=/usr/bin/x11vnc -inetd -passwd 1234 -forever -shared -bg -display :0 -auth /run/user/42/gdm/Xauthority


[Install]
WantedBy=multi-user.target