Commit Graph
731 Commits
Author SHA1 Message Date
Lennart Poettering 3b0103aaa5 homed: port worker management to PidRef 2025-02-28 14:18:23 +01:00
Lennart Poettering a147e72add homed: port to notify_recv_with_fds()
Found another implementation of the sd_notify() reception. Modernize it.
2025-02-28 14:18:04 +01:00
Lennart Poettering 9ab703d8e1 terminal-util: change 2nd parameter of terminal_reset_defensive() to flags
let's convert the 2nd argumeng form a boolean to a proper flags
parameter. Doesn't change behaviour in anyway, but is more readable, and
prepares ground for adding more flags soon.
2025-02-27 15:13:15 +01:00
Lennart Poettering 5856e869bb pam_systemd_home: update comment
Follow-up for 563c5511ad, which turned
boolean parameters into flags.
2025-02-26 18:12:08 +01:00
Lennart Poettering 9ef8138946 homework: unify common error handling 2025-02-20 18:13:18 +01:00
Lennart Poettering cfeeaebafe homed: explicitly set access mode of private/public signing key pair
So far we relied that the temporary file logic would create the key
files with 0600 mode, but let's set the access mode explicitly:

1. Tighten private key file access from 0600 to 0400, after all we never
   want to write it again, it's not a mutable file.

2. Relaxed public key file access mode from 0600 to 0444, after all it's
   a public key file, and people should be able to see it if they want
   This is useful for propagating the key onto other systems if needed.
2025-02-20 17:35:12 +01:00
Lennart Poettering 9df18e4bee tree-wide: initialize row/column explicitly before calling sd_json_parse_file()
The variables are error return parameters, i.e. only initialized on some errors,
not all. Let's hence always zero initialize them.
2025-02-20 17:34:36 +01:00
Lennart Poettering 2cf95e5178 homed: return the correct error if an image file is not present when we try to activate it
We already return BUS_ERROR_HOME_ABSENT when we detect the image being
absent before we fork off the homework worker. Let's also return the
same error if the homework process notices the same condition while
actually doing something.

This mostly fixes a race, that the same condition seen at different
points in time results in the same errors.
2025-02-20 17:34:02 +01:00
Lennart Poettering 06d77db6fb homed: make "register" call more friendly
Let's accept full user records (including status and so on) and simply
eat up the parts we don't care about, instead of refusing the whole
record wholesale.

This makes it easier to just copy a user record from one machine and
registering it at another, without stripping the irrelevant parts first.
2025-02-20 16:44:10 +01:00
Lennart Poettering 0e7dd5aa4d homectl: when asking for a user pw for an initial homed account at boot, don't insist on strong password
It's just very annoying during debugging, and also unnecessary.
2025-02-18 09:19:03 +01:00
Lennart Poettering 0680c7e5b4 homectl: don't show --enforce-password-policy= recommendation in first-boot invocation
The hint is not useful, since this is after all invoked as part of the
boot process, and not from an interactive shell, where the user could
directly retry with the changed switch. Hence let's simply suppress the
hint for those cases.
2025-02-18 09:19:03 +01:00
Lennart Poettering 0fe3b0e4e2 homectl: show full list of selected groups as they are added 2025-02-17 15:21:18 +01:00
Lennart Poettering cfe16540c8 homectl: optionally force interactive firstboot query 2025-02-17 15:21:18 +01:00
Lennart Poettering 9e6fbb5a51 homectl: clarify that we pick the default shell if the prompt is skipped 2025-02-17 15:21:18 +01:00
Lennart Poettering 94a2b1cd25 firstboot: add auto-completion to various fields
This adds TAB-based auto-completion to various fields we query from the
user, such as locale, keymap, timezone, group membership.

It makes it a lot easier to quickly iterate through firstboot without
typing too much.
2025-02-17 15:21:18 +01:00
Lennart Poettering b6478aa12f terminal-util: beef up show_menu()
This modernizes the function a bit, and adds some bits:

1. whether to show numbers before entries is now optional, and if they
   are shown they are displayed in grey.

2. a common prefix can now be grayed out (later useful for completion
   support)

3. some variables have been named to clarify their purpose

4. the table display dimensions can now be auto-sized (by specifying
   SIZE_MAX and number of columns and column width)
2025-02-17 15:21:13 +01:00
Lennart Poettering 8fcd85768b terminal-util: tweak any_key_to_proceed() a bit
1. Make the message a bit more visible, by adding ANSI color. This
   matters in particular during boot, where the message otherwise might
   be overprinted by other output

2. Let's turn off terminal echo so that whatever key is entered is not
   made visible on screen, and we can handle newline and other keys
   reasonably uniformly.
2025-02-17 15:07:38 +01:00
Lennart Poettering abf9e6ede5 homectl: make default area configurable 2025-02-06 09:23:49 +01:00
Lennart Poettering c747c04146 pam: introduce multiple per-user "areas", i.e. "sub-home-directories" of sorts 2025-02-06 09:23:49 +01:00
Matthieu LAURENT e8e778e8ab homectl: fix typo in help text 2025-02-05 17:28:37 +01:00
Daan De Meyer 4ba3530d67 homectl: Fix empty checks 2025-02-03 19:24:31 +01:00
Nick Rosbrook 5dc89b327f tree-wide: remove some spurious newlines
Specifically, remove double newlines, and newlines before '}'.
2025-01-29 16:17:46 +00:00
Lennart Poettering dea3dd6649 homectl: port has_regular_user() + acquire_group_list() to use server-side filtering 2025-01-27 23:51:57 +01:00
Lennart Poettering 7419291670 userdb: move UserDBMatch handling from userdbctl into generic userdb code to allow it to be done server side
This moves around the UserDBMatch handling, moves it out of userdbctl
and into generic userdb code, so that it can be passed to the server
side, to allow server side filtering.

This is preparation for one day allowing complex software to do such
filtering server side, and thus reducing the necessary traffic.

Right now no server side actually knows this, hence care is taken to
downgrade to the userdb varlink API as it was in v257 in case the new
options are not understood. This retains compatibility with any
implementation hence.
2025-01-27 23:51:57 +01:00
Lennart Poettering 1153d2d2cc homed: when setting up an idmapping map foreign UID range on itself
Now that nspawn can run unprivileged off directory trees owned by
the new "foreign" UID range let's make sure homed actually allows
files owned by that range in the home directories.

This is not enough to make nspawn just work in homed home dirs
unfortunately though. that's because homed applies an idmapping, and
nspawn would need to then to take that idmapped mount and apply another
one, and the kernel simply doesn't support stacked idmapped mounts.
There's work ongoing to address that in the kernel.

However, this is a first step, and should be enough to make things just
work should the kernel eventually support stacked idmapped mounts.
2025-01-25 05:31:59 +09:00
Lennart Poettering b0c38476eb homectl: move --umask=/--access-mode= help/man sections
These don't really have much to do about resource mgmt, but are more
about security, hence let's move them away from the resource mgmt
section.
2025-01-24 14:54:37 +01:00
Lennart Poettering cd3730524c man: add some sections to homectl man page
This adds the same sections we already have in the homectl --help blurb
also to the man page.

While we are at it, let's also add a new section for Authentication
related switches.
2025-01-24 14:54:27 +01:00
Lennart Poettering 2b2aebf4dd homectl: add support for configuring tmpfs limits 2025-01-23 22:36:39 +01:00
Lennart Poettering dc5af20b0c tree-wide: always include our own headers with "" rather than <>
We got this almost always right. Fix this for a few outliers.
2025-01-21 17:05:36 +00:00
Lennart Poettering 5cd7b455e0 homectl: add support for creating users with alias names 2025-01-21 09:59:09 +01:00
Lennart Poettering 40fd0e0423 homed: support user record aliases 2025-01-21 09:59:05 +01:00
Lennart Poettering a642f9d2d3 pam_systemd_home: support login with alias names + user names with realms
This in particular makes sure that we normalize the user name and update
it in the PAM session, once we acquire it. This means that if you have a
user with name "a" and alias "b", and the user logs in as "b" they end
up properly with "a" as user name set, as intended by the PAM gods.

Moreover, if you have a user "c" in a ralm "d", they may log in by
specifying "c" or "c@d", with equivalent results.
2025-01-21 09:59:02 +01:00
Lennart Poettering 1fb53bb561 pam_systemd_home: use right field name in error message 2025-01-21 09:58:58 +01:00
Lennart Poettering 8aacf0fee1 user-record: add helper that checks if a provided user name matches a record
This ensures that user names can be specified either in the regular
short syntax or with a realm appended, and both are accepted. (The
latter of course only if the record actually defines a realm)
2025-01-21 09:58:29 +01:00
Lennart Poettering 30de569174 pam: minor coding style tweaks 2025-01-21 09:58:26 +01:00
Lennart Poettering c8127075ae tree-wide: implement generic io.systemd.service Varlink interface in all long-running services
Given we have the generic interface, let's hook it up everywhere.

This doesnt bother with the Reload() call usually, since that's more
involved, but hooks up the other relevant functions where applicable.
2025-01-18 23:24:29 +01:00
Mike Yuan 70923ed358 meson: enable -Wzero-as-null-pointer-constant
Support for C added in gcc 15:
https://github.com/gcc-mirror/gcc/commit/236c0829ee21a179c81b83f0d7f112ca23c47a4d
2025-01-16 02:26:56 +01:00
Mike Yuan 347eb8fbe3 tree-wide: remove unnecessary gcc >= 7 version check
Our baseline is gcc 8.4.
2025-01-16 02:26:56 +01:00
Mike Yuan e3d37628aa shared/bus-util: move bus_message_hash_ops to bus-message-util 2025-01-13 16:24:44 +01:00
Eaterminer 6cffdcd590 homectl: fix minor spelling mistake (#35963) 2025-01-11 14:17:05 +09:00
Lennart Poettering d66894a7a5 ask-password-api: add new "hup_fd" field to AskPasswordReq
This new field allows specification of an fd on which the password
prompt logic will look for POLLHUP events for, and if seen will abort
the query.

The usecase for this is that when we query for a pw on behalf of a
Varlink client we can abort the query automatically if the client dies.
2025-01-02 16:38:44 +01:00
Lennart Poettering c4a02a526d ask-password-api: move timeout into AskPasswordRequest structure too 2025-01-02 16:38:25 +01:00
Lennart Poettering 72068d9d25 ask-password-api: move tty_fd into AskPasswordRequest structure, too 2025-01-02 16:38:12 +01:00
Mike Yuan c415a4816c tree-wide: drop inclusion of linux/memfd.h
We carry our own definitions in missing_mman.h, and otherwise
sys/mman.h is employed. Let's drop the unneeded detection/inclusion
of linux/memfd.h hence.
2024-12-24 16:56:21 +01:00
Lennart Poettering 4d98709cb2 memfd-util: introduce memfd_new_full() helper
This is just like memfd_new(), but allows fine grained control of the
sealing flags.

This switches over all uses of memfd_new() where we actually want
sealing to use memfd_new_full().

This then allows use to use memfd_new() for two further calls, where we
previously used the more lowlevel memfd_create_wrapper().
2024-12-17 18:26:15 +01:00
Lennart Poettering a87a9625f8 tree-wide: drop acquire_data_fd_full() helper
Let's drop support systems lacking memfds, i.e. pre kernel 3.17 systems.
This allows us to drastically simplify the "data fd" concept, so far
that we can remove it entirely.

This replaces acquire_data_fd() with a specialized call to
memfd_new_and_seal(), not that memfds can be the only implementation of
the concept.
2024-12-17 18:26:15 +01:00
Zbigniew Jędrzejewski-Szmek fd409ff0e0 various: set info on varlink server object
The values that were previously hardcoded in sd-varlink.c are now defined
in new varlink_set_info_systemd() and that function is called everywhere
where we create a server.
2024-12-10 10:51:56 +01:00
Mike Yuan e2f82f6151 various: check meson feature flag early
Prompted by https://github.com/systemd/systemd/pull/35110#discussion_r1835885340
2024-11-13 08:21:33 +09:00
Lennart Poettering 56933f2073 uid-classification: properly classify *all* container UIDs
A bit confusingly CONTAINER_UID_BASE_MAX is just the maximum *base* UID
for a container. Thus, with the usual 64K UID assignments, the last
actual container UID is CONTAINER_UID_BASE_MAX+0xFFFF.

To make this less confusing define CONTAINER_UID_MIN/MAX that add the
missing extra space.

Also adjust two uses where this was mishandled so far, due to this
confusion.

With this change the UID ranges we default to should properly match what
is documented on https://systemd.io/UIDS-GIDS/.
2024-11-08 23:18:39 +00:00
Ronan Pigott f4092cb974 pam: quiet a spurious debug message
This singular debug message gets printed even if debug is not enabled.
Quiet this message when debug is not enabled for consistency.
2024-11-02 22:47:17 +09:00