Commit Graph

46681 Commits

Author SHA1 Message Date
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
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
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
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
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
d562667f7d userdb: fix typo
Follow-up for 523121d543.
2023-12-20 15:12:10 +09:00
Mike Yuan
28bb29cbb4 networkctl: introduce verb mask and unmask
Suggested in https://github.com/systemd/systemd/pull/29928#discussion_r1386626565
2023-12-20 12:46:46 +08:00
Mike Yuan
7ce6a0960f networkctl-config-file: check for masked config before editing/showing 2023-12-20 12:46:46 +08:00
Mike Yuan
078fad363e networkctl-config-file: split out reload_daemons 2023-12-20 12:46:46 +08:00
Mike Yuan
c5f51d5f3f networkctl-cat: insert a newline between different config files 2023-12-20 12:46:45 +08:00
Mike Yuan
15fde154f8 networkctl: split out networkctl-config-file.[ch] 2023-12-20 12:46:43 +08:00
Mike Yuan
2886cadc72 shared/install: use RET_GATHER more 2023-12-20 12:44:50 +08:00
Yu Watanabe
e2ceb696d6 Merge pull request #30493 from teknoraver/main
Add verbose output on unit start #5717
2023-12-20 13:42:59 +09:00
Lennart Poettering
1a424b0721 varlink: these two errors where added to the spec, we aren't squatting the namespace anymore
4443c57f1e
2023-12-20 12:22:05 +08:00
Yu Watanabe
5d889f3ab8 signal-util: align table 2023-12-20 03:07:46 +09:00
Yu Watanabe
97df9fa065 time-util: make usleep_safe() return earlier if 0 is passed 2023-12-20 03:07:46 +09:00
Daan De Meyer
a412a1b92a test: Skip various tests when /sys is not mounted
When running tests in a container, /sys might not be mounted, so
let's make sure we skip tests that depend on /sys in this case.
2023-12-19 16:38:57 +01:00