crazy-max / docker-samba

Samba Docker image
MIT License
478 stars 49 forks source link

Add ZeroConf Service Discovery #1

Open crazy-max opened 3 years ago

crazy-max commented 3 years ago

As this image drops support for legacy protocols including NetBIOS, WINS, and Samba port 139 for security purposes, for Windows clients, Samba won't be shown under network browsing. We could use mDNS and DNS-SD with Samba using Avahi daemon for that but it only works on Linux and OSX machines afaik.

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">%h</name>
 <service>
   <type>_smb._tcp</type>
   <port>445</port>
 </service>
 <service>
   <type>_device-info._tcp</type>
   <port>0</port>
   <txt-record>model=RackMac</txt-record>
 </service>
 <service>
   <type>_adisk._tcp</type>
   <txt-record>sys=waMa=0,adVF=0x100</txt-record>
   <txt-record>dk0=adVN=TimeMachine,adVF=0x82</txt-record>
 </service>
</service-group>
Erriez commented 2 years ago

The Samba server automatic network discovery can be added with:

wsdd and avahi don't have a relation to Samba. For example, the avahi configuration below can make a Samba server and SSH server available in Nautilus:

image

Windows Explorer:

Windows Explorer

Avahi smb.service

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">%h</name>
 <service>
   <type>_smb._tcp</type>
   <port>445</port>
 </service>
</service-group>

My proposal is to create two separate wsdd and avahi containers which can be launched via docker-compose.yml, for example in my forked dperson/samba: https://github.com/Erriez/docker-samba/blob/master/docker-compose.yml

crazy-max commented 2 years ago

My proposal is to create two separate wsdd and avahi containers which can be launched via docker-compose.yml, for example in my forked dperson/samba: https://github.com/Erriez/docker-samba/blob/master/docker-compose.yml

Yes indeed, the idea is to have sidecar containers to handle that.

Erriez commented 2 years ago

Do you have a preference to choose an existing well-maintained and easy to configure wsdd and avahi image?

https://hub.docker.com/search?q=avahi&type=image https://hub.docker.com/search?q=wsdd&type=image

itrich commented 2 years ago

I have added these two containers, which announces the host successfully in both worlds, Windows and *nix/OSX.

  wsdd:
    image: jonasped/wsdd
    container_name: wsdd
    network_mode: host
    restart: unless-stopped
  avahi:
    image: ydkn/avahi
    container_name: avahi
    network_mode: host
    volumes:
      - "./data/avahi/services:/etc/avahi/services"
    restart: unless-stopped

Should we add this as a seperate example docker-compose file? I'd be happy to open a pull request.

crazy-max commented 1 year ago

@itrich Sure contribs welcomed!

crazy-max commented 1 year ago

@itrich Opened https://github.com/crazy-max/docker-samba/pull/86 if you're interested to try it.

Sharpiro commented 10 months ago

It looks like @crazy-max added support for service discovery in #86, but I enabled it and it doesn't seem to work. I've tested with a few different clients and nothing appears.

Edit:

It actually is appearing in my VLC SMB clients, but not Nautilus for some reason. I'm using Raspberry Pi 5 with Ubuntu 23.10.