Commit Graph
48900 Commits
Author SHA1 Message Date
Florian Westphal deff68e718 nspawn: expose container ipv6 address too
Extend nspawn so it can keep track of one ipv4 and one ipv6 address.
2021-01-19 16:22:58 +01:00
Florian Westphal 0e544221c9 firewall-util: add ipv6 support to nftables backend
closely mirrors the existing ipv4 ruleset:
table ip6 io.systemd.nat {
        set masq_saddr {
                type ipv6_addr
                flags interval
        }

        map map_port_ipport {
                type inet_proto . inet_service : ipv6_addr . inet_service
        }

        chain prerouting {
                type nat hook prerouting priority dstnat + 1; policy accept;
                fib daddr type local dnat ip6 addr . port to meta l4proto . th dport map @map_port_ipport
        }

        chain output {
                type nat hook output priority -99; policy accept;
                ip6 daddr != ::1 oif "lo" dnat ip6 addr . port to meta l4proto . th dport map @map_port_ipport
        }

        chain postrouting {
                type nat hook postrouting priority srcnat + 1; policy accept;
                ip6 saddr @masq_saddr masquerade
        }
}

Only difference is the use of ipv6 addresses instead of ipv4 ones.

Currently has no effect: all in-tree callers pass AF_INET exclusively.
Followup patches will make nspawn expose ipv6 too and rework
IPMasquerade option to support both/v4/v6.
2021-01-19 16:22:58 +01:00
Lennart Poettering 656e5aa452 Merge pull request #18181 from poettering/sysext
systemd-sysext as a method of merging simple OS extensions into /usr and /opt
2021-01-19 16:02:58 +01:00
Lennart Poettering a2804e3cd8 Merge pull request #18129 from keszybz/envvars
Allow control characters in environment variable values
2021-01-19 16:02:27 +01:00
Florian Westphal bf108eb942 homed: fix build without p11kit
homectl-pkcs11.c: In function 'identity_add_pkcs11_key_data':
homectl-pkcs11.c:155:13: error: implicit declaration of function 'pkcs11_acquire_certificate' [-Werror=implicit-function-declaration]

Restores the P11KIT compile-time test that was removed in 2289a78473
("homed: move pkcs11 LUKS glue into shared code").
2021-01-19 14:38:39 +01:00
Zbigniew Jędrzejewski-Szmek e9155cd077 systemctl: warn when importing environment variables with control characters
I don't think it is useful to warn about about environemnt variables where the user
explicitly configured some value. If they went through the effort of escaping the cc
to include it in the setting (e.g. Environment="VAR=\efoo"), and we pass this through,
there isn't anything to warn about. This also applies to 'systemctl set-environment',
where the variable name and value are passed as arguments.

The only case where the warning *might* be useful is where the user might be
surprised by the value. This occurs when importing variables from the inherited
environment, i.e. in 'systemctl import-environment'. In not convinced that this is
useful, since the user better control their shell environment anyway.

$ systemctl import-environment
Calling import-environment without a list of variable names is deprecated.
Environment variable $LESS_TERMCAP_mb contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_md contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_me contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_se contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_so contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_ue contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_us contains control characters, importing anyway.
Environment variable $ZZZ contains control characters, importing anyway.
2021-01-19 14:24:51 +01:00
Zbigniew Jędrzejewski-Szmek 30927a2484 Allow control characters in environment variable values
So far, we would allow certain control characters (NL since
b4346b9a77, TAB since 6294aa76d8), but not others. Having
other control characters in environment variable *value* is expected and widely
used, for various prompts like $LESS, $LESS_TERMCAP_*, and other similar
variables. The typical environment exported by bash already contains a dozen or
so such variables, so programs need to handle them.

We handle then correctly too, for example in 'systemctl show-environment',
since 804ee07c13. But we would still disallow setting such variables
by the user, in unit file Environment= and in set-environment/import-environment
operations. This is unexpected and confusing and doesn't help with anything
because such variables are present in the environment through other means.

When printing such variables, 'show-environment' escapes all special
characters, so variables with control characters are plainly visible.
In other uses, e.g. 'cat -v' can be used in similar fashion. This would already
need to be done to suppress color codes starting with \[.

Note that we still forbid invalid utf-8 with this patch. (Control characters
are valid, since they are valid 7-bit ascii.) I'm not sure if we should do
that, but since people haven't been actually asking for invalid utf-8, and only
for control characters, and invalid utf-8 causes other issues, I think it's OK
to leave this unchanged.

Fixes #4446, https://gitlab.gnome.org/GNOME/gnome-session/-/issues/45.
2021-01-19 14:18:34 +01:00
Zbigniew Jędrzejewski-Szmek c4899ea427 systemctl: print a warning when trying to import a nonexistent variable
I was quite confused what is happening:
$ XXX=xxx
$ systemctl --user import-environment XXX
$ systemctl --user show-environment | grep XXX
(nothing)

Obviously, 'export XXX' was missing. Without any indication why the
export is not happening, this can be hard to figure out.

Another option would be to error out. But so far we didn't, and doing
that could break some script which optimistically tries to export some
variables, if present.
2021-01-19 14:18:33 +01:00
Luca Boccassi 71ad75f306 sysext: install in /usr/lib/systemd/ for now
This is a brand new binary, and the CI packaging doesn't pick it up,
causing the upstream testrun to fail (sysext is pulled in by the unit).
2021-01-19 13:41:42 +01:00
Lennart Poettering a1fd722b5d meson: bindir is the default install_dir, no need to mention it 2021-01-19 13:41:42 +01:00
Lennart Poettering b5e0c17654 test: improve a log message while building test images 2021-01-19 13:41:42 +01:00
Lennart Poettering dfbbb4f7b0 update TODO 2021-01-19 13:41:42 +01:00
Luca Boccassi 36b95d0440 man: mention SYSEXT_LEVEL in os-release(5) 2021-01-19 13:41:42 +01:00
Luca Boccassi 60bb6caaae sysext: use parse_extension_release and reject extension if not found 2021-01-19 13:41:42 +01:00
Luca Boccassi 6ddd051193 os-release: add support for /usr/lib/extension-release.d/
Add helpers to look for extension-release.$NAME files in
/usr/lib/extension-release.d/ following the same pattern as os-release.
2021-01-19 13:41:42 +01:00
Luca Boccassi 44bb7b0956 sysext: add verity boilerplate 2021-01-19 13:41:42 +01:00
Lennart Poettering d577d4a432 machine-image: properly support searching for images below some --root= path
systemd-sysext supports --root= for everything but the image discovery.
Fix that.
2021-01-19 13:41:42 +01:00
Lennart Poettering 7a87fb6119 man: add man page for systemd-sysext 2021-01-19 13:41:42 +01:00
Lennart Poettering 205e5bcc1c units: add systemd-sysext.service unit for auto-activating extensions at boot
We'll leave this as opt-in (i.e. a unit that must be enabled
explicitly), since this is supposed to be a debug/developer feature
primarily, and thus no be around in regular production systems.
2021-01-19 13:41:42 +01:00
Lennart Poettering 9bca4ae4cd sysext: new tool for managing "system extensions" for /usr/ + /opt/ 2021-01-19 13:41:42 +01:00
Yu Watanabe 7b5ed18779 Merge pull request #18294 from ssahani/net-2
tree wide use ensure_put
2021-01-19 16:46:41 +09:00
Zbigniew Jędrzejewski-Szmek f1fb046a98 Merge pull request #18300 from yuwata/analyze-verify-18252
analyze: resolve executable path if it is relative
2021-01-19 08:41:15 +01:00
Susant Sahani 3c29137626 udev: Use TAKE_PTR 2021-01-19 05:56:40 +01:00
Susant Sahani f5b73a7fa8 udev-rules: Use ordered_hashmap_ensure_put 2021-01-19 05:56:31 +01:00
Susant Sahani 1dfb93210f sysusers: use ordered_hashmap_ensure_put 2021-01-19 05:56:25 +01:00
Yu Watanabe 29d65a4388 Merge pull request #18303 from yuwata/verity-cleanup
veritysetup-generator: drop unused struct and variable
2021-01-19 12:22:55 +09:00
Yu Watanabe 7e2757c42f Merge pull request #18038 from yuwata/meson-split
meson: various cleanups
2021-01-19 12:22:34 +09:00
Yu Watanabe 4c6dd238b8 Merge pull request #18267 from lucaswerkmeister/truncate
Two StandardOutput=truncate:file improvements
2021-01-19 08:47:39 +09:00
Yu Watanabe ceed428305 Merge pull request #18299 from ssahani/ensure-put
More use of hashmap_ensure_put and ordered_hashmap_ensure_put
2021-01-19 08:42:26 +09:00
Yu Watanabe 13a4e9f209 TODO: fix typo 2021-01-19 07:22:48 +09:00
Yu Watanabe 71ce3ba25b veritysetup-generator: drop unused struct and variable
Follow-ups for 08b04ec7e7.

This also drops unnecessary inclusion.

Fixes CID#1443889.
2021-01-19 07:21:57 +09:00
Yu Watanabe 024e9084c1 meson: move several definitions related libsystemd to src/libsystemd/meson.build 2021-01-19 07:06:32 +09:00
Yu Watanabe 40dbce36df meson: use static_libsystemd_pic 2021-01-19 07:06:32 +09:00
Yu Watanabe a0e150b2f4 meson: add missing license header 2021-01-19 07:06:32 +09:00
Yu Watanabe e025c9dfe3 meson: move test or fuzzer definitions to relevant meson.build in subdirectories 2021-01-19 07:06:32 +09:00
Yu Watanabe b5c34d6bf1 meson: drop unused variable 2021-01-19 07:06:32 +09:00
Yu Watanabe 04e7ada0d7 meson: drop unnecessary files from test definitions 2021-01-19 07:06:32 +09:00
Yu Watanabe 74b28f2b36 meson: drop unnecessary libraries from journal related tests 2021-01-19 07:06:32 +09:00
Yu Watanabe 8d40961c3c meson: slightly disentangle code dependencies
But, still sd-id128 is used in src/basic.
2021-01-19 07:06:32 +09:00
Yu Watanabe b61016f207 meson: sort inclusion of meson.build files in subdirectories 2021-01-19 07:06:32 +09:00
Yu Watanabe 529642936b meson: move libjournal_core definition to src/journal/meson.build 2021-01-19 07:06:32 +09:00
Yu Watanabe 3976f372ae meson: move libudev related definitions to src/libudev/meson.build
Also, this makes libudev.so built in build directory.
2021-01-19 07:06:32 +09:00
Yu Watanabe f6fe732ff3 meson: move and gather find_program() 2021-01-19 07:06:32 +09:00
Yu Watanabe 73e994f291 meson: drop redundant source files in executable() 2021-01-19 07:06:32 +09:00
Yu Watanabe 0275e918af meson: move source file list for systemd-xdg-autostart-generator and its tests 2021-01-19 07:06:32 +09:00
Yu Watanabe f98df767e1 meson: move source file list for busctl 2021-01-19 07:06:32 +09:00
Yu Watanabe 2ad279cfa4 meson: move source file list for systemd-cryptenroll 2021-01-19 07:06:32 +09:00
Yu Watanabe b4d1892aac meson: move source file list for systemd-cryptsetup 2021-01-19 07:06:32 +09:00
Yu Watanabe 18b49798a6 meson: show standalone-binaries setting in the summary 2021-01-19 07:06:32 +09:00
Yu Watanabe d33b0daa6c meson: use condition argument in test definition 2021-01-19 07:06:32 +09:00