Accepting request 798045 from home:hgraeber

Implementation of a ws-discovery protocol daemon. Helps to make samba servers more discoverable by windows clients and dolphin 20.04

OBS-URL: https://build.opensuse.org/request/show/798045
OBS-URL: https://build.opensuse.org/package/show/network/wsdd?expand=0&rev=1
This commit is contained in:
Marcus Meissner 2020-04-28 07:53:42 +00:00 committed by Git OBS Bridge
commit b3b9a88e93
12 changed files with 277 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

33
sysconfig.wsdd Normal file
View File

@ -0,0 +1,33 @@
## Path: Network/WSD
## Description: WSD Configuration
## Type: string
## Default: ""
## ServiceRestart:·wsdd
# Windows domain
# If empty use the machines domain
WSDD_DOMAIN=""
## Type: string
## Default: ""
## ServiceRestart:·wsdd
# Windows workgroup.
# If empty use the domain name
WSDD_WORKGROUP=""
## Type: string
## Default: ""
## ServiceRestart:·wsdd
# Hostname
# If empty use the machines hostname
WSDD_HOSTNAME=""
## Type: string
## Default: ""
## ServiceRestart:·wsdd
# If empty use all interfaces, except loopback interfaces
WSDD_INTERFACES=""
## Type: string
## Default: ""
## ServiceRestart:·wsdd
WSDD_ARGS=""

6
wsdapi.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>wsdapi</short>
<description>Web Service Discovery API</description>
<port protocol="tcp" port="5357"/>
</service>

3
wsdd-0.5.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c04852b053b78fd9d5b3e28b49a06f8ee707ccdaf82cc1e449ece031ad494bea
size 16820

31
wsdd-init.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
WSDD_CONFIG=/etc/sysconfig/wsdd
if test -r "${WSDD_CONFIG}"; then
. "${WSDD_CONFIG}"
fi
if [ "${WSDD_DOMAIN}" != "" ]; then
WSDD_DOMAIN="-d \"${WSDD_DOMAIN}\""
fi
if [ "${WSDD_WORKGROUP}" != "" ]; then
WSDD_DOMAIN="-w \"${WSDD_WORKGROUP}\""
fi
if [ "${WSDD_HOSTNAME}" != "" ]; then
WSDD_HOSTNAME="-n \"${WSDD_HOSTNAME}\""
fi
WSDD_INTERFACE_ARGS=""
if [ "${WSDD_INTERFACES}" != "" ]; then
for intf in "${WSDD_INTERFACES[@]}"; do
echo ${intf}
WSDD_INTERFACE_ARGS="${WSDD_INTERFACE_ARGS} -i \"${intf}\""
done
fi
install -o wsdd -g wsdd -p 0700 -d /run/sysconfig
echo "WSDD_ARGS=${WSDD_HOSTNAME} ${WSDD_WORKGROUP} ${WSDD_DOMAIN} ${WSDD_INTERFACE_ARGS} \
${WSDD_ARGS}" >/run/sysconfig/wsdd

9
wsdd-shebang.patch Normal file
View File

@ -0,0 +1,9 @@
diff -up wsdd-0.4/src/wsdd.py.org wsdd-0.4/src/wsdd.py
--- wsdd-0.4/src/wsdd.py.org 2019-11-13 19:04:20.411758390 +0100
+++ wsdd-0.4/src/wsdd.py 2019-11-13 19:03:26.339623059 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
# Implements a target service according to the Web Service Discovery
# specification.

42
wsdd.changes Normal file
View File

@ -0,0 +1,42 @@
-------------------------------------------------------------------
Sun Apr 26 20:24:03 UTC 2020 - Herbert Graeber <herbert@graeber-clan.de>
- Use wsdd for user and group of the ghost directories
-------------------------------------------------------------------
Sun Apr 26 18:19:24 UTC 2020 - Herbert Graeber <herbert@graeber-clan.de>
- Replace wsdd-wrapper by an ExecStartPre script
- Change the "WSD_" variable prefix by "WSDD_"
- Run wsdd as user and group wsdd
- Run wsdd in a chroot folder
- Merge firewall files into one
-------------------------------------------------------------------
Tue Mar 31 16:05:23 UTC 2020 - Herbert Graeber <herbert@graeber-clan.de>
- Update to version 0.5
- Remove unneeded _service file
-------------------------------------------------------------------
Mon Nov 18 19:41:19 UTC 2019 - Herbert Graeber <herbert@graeber-clan.de>
- Remove debug output
- Respect libexecdir in systemd service file
-------------------------------------------------------------------
Fri Nov 15 21:31:43 UTC 2019 - Herbert Graeber <herbert@graeber-clan.de>
- Determine domain, and/or hostname
- Move wssd back to /usr/bin
-------------------------------------------------------------------
Fri Nov 15 20:56:34 UTC 2019 - Herbert Graeber <herbert@graeber-clan.de>
- Reload firewalld services
- Remove fillup_prereq post requires
-------------------------------------------------------------------
Wed Nov 13 18:30:00 UTC 2019 - Herbert Graeber <herbert@graeber-clan.de>
- Initial package

1
wsdd.conf Normal file
View File

@ -0,0 +1 @@
d /run/wsdd 0755 wsdd wsdd

19
wsdd.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=Web Services Dynamic Discovery host daemon
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
AmbientCapabilities=CAP_SYS_CHROOT
PermissionsStartOnly=true
Environment= WSDD_ARGS=-p
ExecStartPre=/usr/lib/wsdd/wsdd-init.sh
EnvironmentFile=-/run/sysconfig/wsdd
ExecStart=/usr/sbin/wsdd --shortlog -c /run/wsdd $WSDD_ARGS
ExecStartPost=/usr/bin/rm /run/sysconfig/wsdd
User=wsdd
Group=wsdd
[Install]
WantedBy=multi-user.target

102
wsdd.spec Normal file
View File

@ -0,0 +1,102 @@
#
# spec file for package wsdd
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: wsdd
Version: 0.5
Release: 0
Summary: A Web Service Discovery host daemon
License: MIT
Url: https://github.com/christgau/wsdd
BuildArch: noarch
Source: https://github.com/christgau/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.xz
Source1: %{name}-init.sh
Source2: %{name}.service
Source3: %{name}.xml
Source4: sysconfig.%{name}
Source5: %{name}.conf
Patch1: %{name}-shebang.patch
BuildRequires: python3
BuildRequires: firewall-macros
Requires: sysconfig
Supplements: samba
Supplements: samba-ad-dc
%description
wsdd implements a Web Service Discovery host daemon. This enables (Samba) hosts,
like your local NAS device, to be found by Web Service Discovery Clients like Windows.
Since NetBIOS discovery is not supported by Windows anymore, wsdd makes hosts to
appear in Windows again using the Web Service Discovery method. This is beneficial
for devices running Samba, like NAS or file sharing servers on your local network.
%prep
%setup -q
%patch1 -p1
%build
%install
install -m 755 -D src/wsdd.py %{buildroot}%{_sbindir}/%{name}
install -m 644 -D man/wsdd.1 %{buildroot}/%{_mandir}/man1/wsdd.1
install -m 755 -D %{SOURCE1} %{buildroot}%{_libexecdir}/wsdd/wsdd-init.sh
install -m 644 -D %{SOURCE2} %{buildroot}%{_unitdir}/wsdd.service
install -m 644 -D %{SOURCE3} %{buildroot}%{_libexecdir}/firewalld/services/wsdd.xml
install -m 644 -D %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.wsdd
install -m 755 -d %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
mkdir -p %{buildroot}/usr/lib/tmpfiles.d/
install -m 644 %{SOURCE5} %{buildroot}/usr/lib/tmpfiles.d/
mkdir -p %{buildroot}/run/wsdd
mkdir -p %{buildroot}/var/lib/wsdd
%pre
getent group wsdd >/dev/null || %{_sbindir}/groupadd -r wsdd
getent passwd wsdd >/dev/null || %{_sbindir}/useradd -r -g wsdd -c "User for wsdd" -s /sbin/nologin -d /run/wsdd wsdd
%service_add_pre wsdd.service
%post
%{fillup_only}
%service_add_post wsdd.service
%tmpfiles_create /usr/lib/tmpfiles.d/wsdd.conf
%firewalld_reload
%preun
%service_del_preun wsdd.service
%postun
%service_del_postun wsdd.service
%files
%license LICENCE
%doc README.md
%{_sbindir}/%{name}
%{_mandir}/man1/wsdd.1.gz
%{_sbindir}/rc%{name}
%{_unitdir}/wsdd.service
%{_libexecdir}/wsdd
%dir /usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/wsdd.conf
%dir %{_libexecdir}/firewalld
%dir %{_libexecdir}/firewalld/services
%{_libexecdir}/firewalld/services/wsdd.xml
%{_fillupdir}/sysconfig.%{name}
%dir %attr(0755,wsdd,wsdd) %ghost /run/sysconfig
%attr(0644,wsdd,wsdd) %ghost /run/sysconfig/wsdd
%dir %attr(0755,wsdd,wsdd) %ghost /run/wsdd
%changelog

7
wsdd.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>wsdd</short>
<description>Web Service Discovery</description>
<port protocol="tcp" port="5357"/>
<port protocol="udp" port="3702"/>
</service>