christgau / wsdd

A Web Service Discovery host daemon.
MIT License
841 stars 99 forks source link

server name persisting in windows explorer when explorer closed and reopened #51

Closed TerryFage closed 4 years ago

TerryFage commented 4 years ago

On a linux RH/centos 7 based system when wsdd is started the server name/resource/share will appear in windows explorer and can be browsed to add a shared folder on that server or using Add Network Drive a share can be added using the ip.

When you close the explorer instance and reopen it again later the server/share name is not always visible under the Network heading, it does not show in browse, connecting of network drives by ip is still active. The service is still up and running fine, do a restart of wsdd and it will once again appear under Network in windows explorer.

Its a matter of the server name persisting, its about the broadcast when it starts and then windows explorer retaining the connection when it closes and reopens..

Not sure if this is a bug as such or just normal operation

christgau commented 4 years ago

Thanks for your report. This is not the intended behavior.

Which version are you using?

TerryFage commented 4 years ago

Thank you for the attention, using latest, 0.6.1, here is copy of wsdd.service.

[Unit] Description=Web Services Dynamic Discovery host daemon ; Start after the network has been configured After=bootstrap-console.service Wants=network-online.target ; After=network-online.target ; It makes sense to have Samba running when wsdd starts, but is not required ; Wants=smb.service

[Service] Type=simple ; ExecStartPre=/bin/sleep 30 ExecStart=/usr/bin/wsdd -4 -i eth0 -s User=daemon Group=daemon

[Install] WantedBy=multi-user.target

had issues getting to come up in windows explorer on a reboot of the server, this After=bootstrap-console.service resolved that issue, its just once explorer is closed the server sometimes is still there when it is reopened immediatley, but if explorer is closed and not reopend for some minutes it is not., restart the sercice and it reappears

This is on a cento7 based system, SME Server 10, running in as a VM on my lab box, it is not handling DHCP a router is.

TerryFage commented 4 years ago

also iptables setup

TerryFage commented 4 years ago

/etc/rc.d/init.d/masq

Allow for wsdd

/sbin/iptables -A INPUT -p udp --dport 3702 -j ACCEPT
/sbin/iptables -A OUTPUT -p udp --dport 3702 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 3702 -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp --dport 3702 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 5357 -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp --dport 5357 -j ACCEPT

Drop all multicast traffic. Note that anything on from a local network

# will have already been accepted via the local_chk chain.
/sbin/iptables --append INPUT -s 224.0.0.0/4    -j denylog
/sbin/iptables --append INPUT -d 224.0.0.0/4    -j denylog

/sbin/iptables --append OUTPUT -s 224.0.0.0/4   -j denylog
/sbin/iptables --append OUTPUT -d 224.0.0.0/4   -j denylog
TerryFage commented 4 years ago

Issue was closed, inadvertently so

TerryFage commented 4 years ago

should have added, the linux server is running as a VM on proxmox windows 10 is my desktop

christgau commented 4 years ago

Using wsdd in a VM can be a problem if the network configuration is using NAT/masquerading. I don't know what the /etc/rc.d/init.d/masq file is really used for, but it sounds like masquerading is active here. In additon, you state that "Drop all multicast traffic." and the iptables rules look like all multicast traffic is actually dropped. However, I do not understand the comment "Note that anything on from a local network".

In contrast, the host happens to appear after wsdd has been started. This is likely due to the Hello message sent at startup, which is sent via multicast. Thus, outgoing multicast traffic is likely to be allowed.

If NAT is really active here, you are out of luck. Wsdd won't work in such a setup without considerable additional efforts. This is not a limitation or a bug of wsdd but rather an implication of the standard and how Windows checks messages.

TerryFage commented 4 years ago

For you anyone who may care, we changed the masq table to use the multicast IP instead of port numbers, works fine and seems to have overcome persistence in the windows explorer network tab, all other functionality seems present thank you for your attention :

Allow for wsdd

#/sbin/iptables -A INPUT -p udp --dport 3702 -j ACCEPT
#/sbin/iptables -A OUTPUT -p udp --dport 3702 -j ACCEPT

#/sbin/iptables -A INPUT -p tcp --dport 3702 -j ACCEPT
#/sbin/iptables -A OUTPUT -p tcp --dport 3702 -j ACCEPT

#/sbin/iptables -A INPUT -p tcp --dport 5357 -j ACCEPT
#/sbin/iptables -A OUTPUT -p tcp --dport 5357 -j ACCEPT

/sbin/iptables -A INPUT -d 239.255.255.250  -j ACCEPT
/sbin/iptables -A INPUT -s 239.255.255.250  -j ACCEPT
/sbin/iptables -A OUTPUT -d 239.255.255.250  -j ACCEPT
/sbin/iptables -A OUTPUT -s 239.255.255.250  -j ACCEPT

Thanks again