Commit graph

69524 commits

Author SHA1 Message Date
Lennart Poettering 73d8041c9a update TODO 2023-12-21 19:15:01 +01:00
Lennart Poettering dd25a95763 test: add minimal integration test coverage for uid0 tool 2023-12-21 19:15:01 +01:00
Lennart Poettering 2118b179ca man: try to improve wording on --slice-inherit docs 2023-12-21 19:15:01 +01:00
Lennart Poettering 2f0b4d578b run/uid0: tint the terminal background color (and add new --background= switch)
This adds a new --background= switch that allows specifiying a
background color for the terminal while the tool runs.

It also teaches the tool when invoked as uid0 to tint the terminal in a
reddish hue when operating as root, and in a yellowish hue when
operating as any other user.

This should highlight nicely when the user is operating with elevated
privileges, or changed privileges.
2023-12-21 19:15:01 +01:00
Lennart Poettering 447bcbfc90 color-util: add helper to convert RGB → HSV
We already have HSV → RGB, add the opposite operation.
2023-12-21 19:15:01 +01:00
Lennart Poettering eee799fa86 color-util: split out HSV color conversion into color-util.[ch] 2023-12-21 19:15:01 +01:00
Lennart Poettering 23d9fcc3c9 ptyfwd: optionally, change ANSI background color of forwarded terminals
As the bytes flow through our terminal forwarder we can color the
background of the terminal with a color of our choices, if that's
desired.

This will later allow us to color the background of the uid0 tool when
running as root with a slightly alarming red color.

This does two things:

1. When an ANSI sequence is seen that resets the background color, it is
   extended to immediately set the color to our choice.
2. When a newline is seen it is immeidately extended to set the
   background color again and clear the current line till the end.

Net effect: all lines written while we forward the ttys will be shown
with the background color of choice.
2023-12-21 19:15:01 +01:00
Lennart Poettering 63e9c38370 terminal-util: add helper that determines terminal default bg color 2023-12-21 19:15:01 +01:00
Lennart Poettering d02d4f83f0 terminal-util: add helper for disabling terminal echo in termios struct 2023-12-21 19:15:01 +01:00
Lennart Poettering b0936baf11 mkosi: don't turn off installation of our PAM snippets
Otherwise we don't get the new PAM snippet for the uid0 PAM stack
installed.
2023-12-21 19:14:43 +01:00
Lennart Poettering 1072d94731 run: optionally set the "ignore-failure" flag for ExecStart= lines 2023-12-21 19:14:43 +01:00
Lennart Poettering 72eb3081b2 run: when invoked as "uid0", expose some sudo-like behaviour
This turns "systemd-run" into a multi-call binary. When invoked under
the name "uid0", then it behaves a bit more like traditional "sudo".
This mostly means defaults appropriuate for that, for example a PAM
stack, interactivity and more.

Fixes: #29199
2023-12-21 19:14:43 +01:00
Lennart Poettering 20f8b345db env-util: add strv_env_assignf() helper 2023-12-21 19:07:29 +01:00
Yu Watanabe 207aafe7e1
Merge pull request #30567 from yuwata/hashmap_isempty
tree-wide: use hashmap_isempty() and friends
2023-12-22 02:36:19 +09:00
Yu Watanabe 187f920713
Merge pull request #30564 from poettering/varlink-log-tweaks
varlink: minor fixes & tweaks
2023-12-22 02:31:09 +09:00
Yu Watanabe 6280da4746
Merge pull request #30563 from poettering/socket-tweaks
two minor tweak to socket-util.c
2023-12-22 02:30:46 +09:00
Yu Watanabe 474536c949 sd-journal: use FOREACH_ARRAY() at one more place 2023-12-22 01:28:44 +09:00
Yu Watanabe 43127aebc7 tree-wide: use hashmap_isempty() and friends 2023-12-22 01:27:09 +09:00
Lennart Poettering 7ff96ce383 varlink: check state rather than flags to determine whether it makes sense to reply
We already checked the flags before, and updated the state accordingly,
hence let's only look at the state afterwards. This allows us to use the
same expressions for all cases where we want to reply automatically to
clients.
2023-12-21 15:28:01 +01:00
Lennart Poettering a13518231a varlink: add an extra assert encoding our assumption that ucred is valid here 2023-12-21 15:27:37 +01:00
Lennart Poettering c931c871aa varlink: never turn method call handler errors into connection errors
Let's make sure method call handlers failing will result in that very
method call failing but not the whole connection. We mostly got that
right, except for "oneway" calls where the method reply is supposed to
be eaten up, but wasn't. Fix that.
2023-12-21 15:25:46 +01:00
Lennart Poettering 6bcc12325b varlink: switch various log calls to the local log helpers
Most code in varlink.c got that right, but some didn't. Fix that.
2023-12-21 15:24:32 +01:00
Lennart Poettering fccad70602 socket-util: remove unnecessary variable 2023-12-21 15:22:16 +01:00
Lennart Poettering 989740ebc4 socket-util: make sure SO_PEERSEC returned string is always NUL terminated
it's not entirely clear to me if the manual NUL termination is
necessary, but let's better be safe than sorry, since this is apparently
up to the LSMs, and I am not sure we can trust them all.

A lot of other code (such as dbus-broker) patches in the NUL byte, hence
let's be rather safe-then-sorry, it's trivial after all.
2023-12-21 15:21:23 +01:00
Lennart Poettering a6076499db dbus-execute: use new exec_context_get_set_login_environment() helper also as backing for dbus property
Note sure why it didn't occur earlier to me, but now that we have this
nice helper to get the effective value of the set_login_environment
field instead of just falling back to "false".

Follow-up for: #30552
2023-12-21 22:06:40 +09:00
Michal Sekletar 3b4cc1437b resolved: actually check authenticated flag of SOA transaction
Fixes #25676
2023-12-21 18:54:21 +09:00
Lennart Poettering d1a5be82ef core: imply SetLoginEnvironment= if PAMName= is set
This geneally makes sense as setting up a PAM session pretty much
defines what a login session is.

In context of #30547 this has the benefit that we can take benefit of
the SetLoginEnvironment= effect without having to set it explicitly,
thus retaining some compat of the uid0 client towards older systemd
service managers.
2023-12-21 10:14:21 +01:00
Yu Watanabe b993e7e72e network: also log drop-in config files
We have already show used drop-in config files in networkctl, but
also showing that in log may be useful.

Closes #30483.
2023-12-21 03:37:17 +09:00
Yu Watanabe 935cf7b3a1
Merge pull request #30548 from yuwata/analyze-check-all-executables
analyze: check all executables
2023-12-21 03:36:35 +09:00
Yu Watanabe 47ac844ee6 network/neighbor: fix log message and comment 2023-12-21 03:33:58 +09:00
Mike Yuan bc9e592c4f systemctl: configure boot loader options only when going through firmware
Fixes #30497
2023-12-21 01:35:55 +09:00
Yu Watanabe c780591bba
Merge pull request #30538 from poettering/ptyfwd-reset-color
ptyfwd: reset colors when we exit the pty forwarding logic
2023-12-21 01:17:00 +09:00
Yu Watanabe 0d1290977d
Merge pull request #30543 from YHNdnzj/execute-cleanup
core/execute: trivial cleanup
2023-12-21 01:16:34 +09:00
Yu Watanabe abf0ccc1c6 analyze-verify: verify all executables
ExecStart= and friends for .service and .socket can be specified
multiple times.
This also checks all commands for .mount and .swap, not only for the
current control command.
2023-12-20 23:56:16 +09:00
Yu Watanabe 5183976cea TEST-65-ANALYZE: only mount /usr if necessary
Follow-up for 8f764b32ea.

Otherwise, we fail to umount several directories on shutdown.
---
[   15.684430] systemd[1]: Failed unmounting tmp-root-proc.mount.
[   15.689379] systemd[1]: Failed unmounting tmp-root-run.mount.
[   15.710572] systemd[1]: Failed unmounting tmp-root-sys-fs-cgroup.mount.
[   15.913953] systemd[1]: Failed unmounting tmp-root-dev.mount.
[   15.924603] systemd[1]: Failed unmounting tmp-root-sys.mount.
[   15.938207] systemd[1]: Failed unmounting tmp-root.mount.
[   15.952395] systemd[1]: Failed unmounting tmp.mount.
2023-12-20 23:56:16 +09:00
Lennart Poettering 518c4f0488 ptyfwd: make sure pty_forward_free() follows our usual semantics regarding NULL 2023-12-20 15:49:59 +01:00
Lennart Poettering e7d2b00e0d ptyfwd: reset colors when we exit the pty forwarding logic
Just in case there was still a color set, make sure to reset things.
2023-12-20 15:49:09 +01:00
Yu Watanabe 760e7a3cb1
Merge pull request #30537 from poettering/run-arg-service-type-fix
run: arg_service_type is not supposed to be allocated from heap
2023-12-20 23:46:11 +09:00
Yu Watanabe 63d0491bbc
Merge pull request #30536 from yuwata/network-bridge-vlan-debugging-logs
network/bridge-vlan: add debugging logs and documentation update
2023-12-20 23:46:01 +09:00
Mike Yuan e03975b90f
core/execute: use assertion for _done function
As per our usual coding style.
2023-12-20 21:56:49 +08:00
Mike Yuan a7774a8ccb
core/execute: remove unneeded brackets
I did not merge the if-s, since I think it's easier to read
in the current form with those long socketpair() calls.
2023-12-20 21:52:59 +08:00
Daan De Meyer 929f41c652 bootctl: update/list/remove all instances of systemd-boot in /EFI/BOOT
systemd-boot might be installed in /EFI/BOOT under more names than
just /EFI/BOOT/BOOTX64.efi. The prime example is shim which loads
its second stage binary from /EFI/BOOT/grubx64.efi. To accomodate
use cases where systemd-boot is installed as /EFI/BOOT/grubx64.efi,
let's always check the entire /EFI/BOOT directory for binaries that
identify as systemd-boot and list/update/remove those as well.

Let's keep this somewhat generic though and not install ourselves as
grubx64.efi since that would mean having to check for shim which is
a can of worms we probably don't want to open.
2023-12-20 13:56:02 +01:00
Franck Bui 3553fddb1e rules: set up tty permissions and group for /dev/hvc* nodes
Before b4bf9007cb, the permissions and group of the hypervisor consoles were
set by agetty(8).
2023-12-20 21:01:05 +09:00
Yu Watanabe 8f876e8d98
Merge pull request #30525 from YHNdnzj/networkctl-mask
networkctl: introduce verb mask and unmask
2023-12-20 21:00:36 +09:00
Lennart Poettering e132be4642 run: underline section titles in --help as we usually do 2023-12-20 12:14:24 +01:00
Lennart Poettering 4b5baf7514 run: arg_service_type is not supposed to be allocated from heap 2023-12-20 12:13:18 +01:00
Yu Watanabe 1e67047f99 network/bridge-vlan: add debugging logs about set or removed VLAN IDs
Addresses https://github.com/systemd/systemd/pull/29987#issuecomment-1863937968.
2023-12-20 19:47:08 +09:00
Yu Watanabe 03a46b5eca man,NEWS: mention that all previously assigned VLAN IDs are cleared
Addresses https://github.com/systemd/systemd/pull/29987#issuecomment-1863934902.
2023-12-20 19:22:53 +09:00
Yu Watanabe b9e6e92510 man: fix indentation 2023-12-20 19:21:11 +09:00
Yu Watanabe 89cc97d30d
Merge pull request #30534 from yuwata/man-page-update-and-fix-typo
Man page update and fix typo
2023-12-20 18:43:32 +09:00