Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add socket-activated systemd service for discovery #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aleasto
Copy link
Contributor

@aleasto aleasto commented Oct 9, 2024

Introduce a system-wide daemon listening on /run/wsdd.socket, which is managed by systemd.
When a client first connects to the socket the daemon is started. Multiple clients can connect and safely use the API simultaneously.

The service runs in discovery-only mode.

Uses multicast source-port 37020.

@aleasto
Copy link
Contributor Author

aleasto commented Oct 9, 2024

  • Increases the security of services like gvfs which rely discovery mode by integrating with all the security confinement features
  • Allows us to standardize one --source-port
  • Only one daemon per system
  • systemd-specific but non-intrusive

Comment on lines 7 to 11
[Service]
Type=simple
; The service is put into an empty runtime directory chroot,
; i.e. the runtime directory which usually resides under /run
ExecStart=/usr/bin/wsdd --shortlog --chroot=/run/wsdd --source-port=37020 --no-host --discovery
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the same flags from /etc/default/wsdd here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might help in some minor use-cases, I think (including verbosity for debugging, e.g.), so why not. But I propose to use a different environment file.

I also propose to use a different run/chroot directory for the wsdd-discovery service in order to separate it from a regular host instance. Maybe even a different (dynamic) username might be good, although I'm not sure if dynamic users are inherently distinct (due to different namespace) even when sharing the same name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although I'm not sure if dynamic users are inherently distinct (due to different namespace) even when sharing the same name.

They're using the same UID/GID here, so no

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's this?
I've used the same env file but a different variable name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--source-port 37020 could also be set in the environment file instead of hard-coded inthe systemd unit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make that configurable from the environmental file, but it is hardcoded in the firewall configuration anyway...

@aleasto
Copy link
Contributor Author

aleasto commented Oct 11, 2024

TODO: systemctl stop wsdd-discovery hangs if there are processes (gvfsd) listening on /run/wsdd.socket. We should probably close the connection.

@aleasto
Copy link
Contributor Author

aleasto commented Oct 11, 2024

TODO: systemctl stop wsdd-discovery hangs if there are processes (gvfsd) listening on /run/wsdd.socket. We should probably close the connection.

That's #219

Introduce a system-wide daemon listening on /run/wsdd.socket,
which is managed by systemd.
When a client first connects to the socket the daemon is started.
Multiple clients can connect and safely use the API simultaneously.

The service runs in discovery-only mode.

Uses multicast source-port 37020.
Used by the socket-activated discovery daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants