2

I have a home network with two Macs and a PC running Debian (and possible other distros in the future). I currently have Avahi set up on the Debian PC along with Netatalk, advertising the PC as an iMac.

When I click on the Mac Mini in the Finder sidebar, I see the following: Mac Mini selected in the Finder sidebar The connection is authenticated as my Apple ID, and in addition to the AFP shares there is a button labeled "Share Screen..."

When I click "Share Screen...", a VNC connection to the Mac Mini opens in the first-party macOS VNC client.

When I click on the Debian PC ("Alpha") in the Finder sidebar, I see the following: Debian PC selected in the Finder sidebar The connection is authenticated as the remote local username, and I only see the Netatalk (AFP) shares.

Note that in the past I have used CIFS/SMB shares instead of AFP/Netatalk, and that worked just as well.

In the third-party application Screens, the "Nearby and Remote Computers" shows "Kandinsky" (an older Mac Mini that's actually offline) as well as the current Mac Mini. It's unclear whether or not Screens uses Bonjour (Avahi) in addition to its own handshake service, Screens Connect (which does not support Linux), for "Nearby and Remote Computers", but it seems potentially relevant here. Edovia Screens "Nearby and Remote Computers" showing two local Macs The reason I use Screens is that the authentication protocol for GNOME's default VNC server is not compatible with the first-party macOS VNC client. Or something like that. (This is a known issue.)

Anyway.

When I run the command

$ avahi-browse --all --ignore-local --resolve --terminate

on the Debian PC, the output includes the following:

+ enp3s0 IPv6 Mac Mini    VNC Remote Access    local
+ enp3s0 IPv4 Mac Mini    VNC Remote Access    local
= enp3s0 IPv6 Mac Mini    VNC Remote Access    local
   hostname = [macmini.local]
   address = [192.168.4.63]
   port = [5900]
   txt = []

and

= enp3s0 IPv4 Mac Mini    VNC Remote Access    local
   hostname = [macmini.local]
   address = [192.168.4.63]
   port = [5900]
   txt = []

(My MacBook doesn't show up because it doesn't have Screen Sharing enabled.)

I know I can do the following with dns-sd on my Mac:

% dns-sd -B <type> <domain>

which might give me some useful information, but

% dns-sd -B

doesn't show the Mac Mini, and trying to browse for "VNC Remote Access":

% dns-sd -B "VNC Remote Access"
Browsing for VNC Remote Access._tcp
DNSService call failed -65540

doesn't work, so that seems like a dead end.

To reiterate my question with all this background:

How can I have the Avahi daemon on my Debian PC advertise VNC Remote Access?

While I'm bearish on being able to use the first-party macOS VNC client, I'm bullish on what other possibilities might be opened up if the Debian PC (which presents itself as an iMac) were to present itself as having VNC Remote Access.

My best guess as to the solution is that I would create an Avahi service file, but the Avahi documentation (e.g. the man page for avahi.service(5)) is pretty minimal on that front. The only service I currently have set up is /etc/avahi/services/afp.service, which reads as the following:

$ cat /etc/avahi/services/afp.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">%h</name>
  <service>
   <type>_afpovertcp._tcp</type>
   <port>548</port>
  </service>
  <service>
   <type>_device-info._tcp</type>
   <port>0</port>
   <txt-record>model=iMac</txt-record>
  </service>
  <service>
   <type>_adisk._tcp</type>
   <port>9</port>
   <txt-record>sys=waMa=0,adVF=0x100,adVU=fbdbccf4-6b71-4995-8fa7-ad066939d808</txt-record>
   <txt-record>dk0=adVN=Backups,adVF=0x81</txt-record>
  </service>
</service-group>

Any idea how I might go about creating a corresponding file for VNC?

Or whatever it is I need to do?

2
  • So the problem is how to advertise from a Mac? Commented May 16, 2021 at 15:00
  • No, the problem is how to advertise from Avahi on my Debian PC. Basically I want to see what happens if I spoof the way macOS advertises VNC Remote Access.
    – Elsie Hupp
    Commented May 16, 2021 at 19:02

1 Answer 1

2

I just set this up on my Pi, also running Debian & I hope this helps others doing similar.

On your Debian box, it boils down to creating an vnc.service file in /etc/avahi/services.

You can copy an example from `/usr/share/doc/avahi-daemon/examples; for VNC, it should look like this:

<service-group>
  <name replace-wildcards="yes">%h</name> 
  <service>
    <type>_rfb._tcp</type>
    <port>5900</port>
  </service> 
</service-group>

Once saved, reload Avahi to pick it up with:

sudo systemctl restart avahi-daemon.service

Regarding browsing from your Mac Terminal, the type is '_rfb._tcb' for VNC (see this list of the well-known service types:

dns-sd -B  _rfb._tcp

andy@XXX ~ % dns-sd -B  _rfb._tcp
Browsing for _rfb._tcp
DATE: ---Thu 26 Aug 2021---
14:20:50.925  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
14:20:50.926  Add        3   4 local.               _rfb._tcp.           rpi
14:20:50.926  Add        3   5 local.               _rfb._tcp.           rpi

I prefer to use a GUI, usually Discovery (formerly Bonjour Browser), which is free in the App Store for MAC and iOS too.

3
  • 1
    Hi Andy—thanks for your response! I finally got around to testing it. Adding this service did, in fact, make "Share Screen..." appear in the Finder under my Linux computer. However, I'm still running into the issue of macOS and x11vnc (the VNC server I'm currently using) disagreeing about authentication and encryption. I added a service for _ssh._tcp., though that didn't seem to help. (I am able to connect VNC over SSH using Edovia Screens.) _smb._tcp.and _sftp-ssh._tcp. don't seem applicable.
    – Elsie Hupp
    Commented Oct 18, 2021 at 17:08
  • The only other DNS-SD service I see in Discovery that could potentially help is _companion-link._tcp., which seems to be used by Apple for authentication. I'm going to try digging around in pyatv to see if I can figure out using it on a host (rather than client) device, and I just posted a GitHub Issue asking for pointers.
    – Elsie Hupp
    Commented Oct 18, 2021 at 17:08
  • After doing some digging, it seems like the only option for secure/encrypted VNC through the Finder (and consequently Apple Screen Sharing) is the Apple Remote Desktop protocol, which does not seem to have been reverse-engineered, yet.
    – Elsie Hupp
    Commented Oct 18, 2021 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .