Skip to content

Add Namespaces setting - #798

Merged
plfiorini merged 2 commits into
sddm:developfrom
orivej:setns
Mar 4, 2018
Merged

plfiorini merged 2 commits into
sddm:developfrom
orivej:setns

Conversation

@orivej

@orivej orivej commented Mar 14, 2017 •

Copy link
Copy Markdown
Contributor

This option holds a comma-separated list of paths bound to Linux network
namespaces to enter with setns() before starting the user session.

The main intention is to let user sessions start in a protected network
namespace, while the display server remains in the initial network namespace to
talk to udev, and udev remains in the initial network namespace to talk to
systemd.

[ChangeLog][General] Add "Namespaces" setting under "General" to enter specified
Linux namespaces before starting the user session


In my case, user sessions run in a network namespace with only OpenVPN-created network interfaces for consistent quality of the internet, sidestepping arbitrary deficiencies of various internet provides I happen to use and ensuring that user applications will not connect to the internet directly while OpenVPN connection is down (e.g. it is reconnecting).

To check this functionality, either run sudo ip netns add mynet and configure sddm with

[General]
Namespaces=/run/netns/mynet

or use Namespaces=/proc/1/ns/net as a no-op.

@orivej

orivej commented Dec 12, 2017

Copy link
Copy Markdown
Contributor Author

I have rebased this on the current develop. I have been using sddm with this patch all this time (my setup would not work without it), but it seems there is no demand from other users…

@plfiorini plfiorini added this to the 0.18 milestone Dec 13, 2017
}
}

// enter Linux namespaces

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this block of code is linux specific, should be wrapped in a #ifdef Q_OS_LINUX

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does SDDM support or plans to support other OSs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FreeBSD users might be interested in using SDDM but personally I'm not working on that goal.

qCritical("open(%s) failed: %s", qPrintable(ns), strerror(errno));
exit(Auth::HELPER_OTHER_ERROR);
}
if (setns(fd, 0) != 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not an expert of namespaces but shouldn't the second argument be CLONE_NEWNET?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I documented that Namespaces= joins network namespaces, but wrote the code that allows to join any kind of namespace. I do not see any benefits from this limitation, so I'd rather update the documentation.

Comment thread data/man/sddm.conf.rst.in Outdated
with setns() before starting the user session. For example, to enter
network namespace `mynet` created with `ip netns add mynet`, the value
might be `/run/netns/mynet`.
Default value is empty.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add something along the line of "This setting is relevant only on Linux, it is completely ignored on other operating systems".

I know it is redundant but it's clearer

This option holds a comma-separated list of paths bound to Linux namespaces to
enter with setns() before starting the user session.

The main intention is to let user sessions start in a protected network
namespace, while the display server remains in the initial network namespace to
talk to udev, and udev remains in the initial network namespace to talk to
systemd.

[ChangeLog][General] Add "Namespaces" setting under "General" to enter specified
Linux namespaces before starting the user session
@orivej

orivej commented Dec 14, 2017 •

Copy link
Copy Markdown
Contributor Author

Updated. (Tested by rebuilding and restarting.)

@plfiorini
plfiorini merged commit 628dfcc into sddm:develop Mar 4, 2018
@orivej

orivej commented Mar 4, 2018

Copy link
Copy Markdown
Contributor Author

Thank you!

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.

2 participants