}
testcase_uts() {
- (! systemd-run -p PrivateUsersEx=self -p ProtectHostnameEx=private --wait --pipe -- hostname abc)
- systemd-run -p PrivateUsersEx=self -p ProtectHostnameEx=private -p DelegateNamespaces=uts --wait --pipe -- hostname abc
+ (! systemd-run -p PrivateUsersEx=self -p ProtectHostname=private --wait --pipe -- hostname abc)
+ systemd-run -p PrivateUsersEx=self -p ProtectHostname=private -p DelegateNamespaces=uts --wait --pipe -- hostname abc
}
testcase_implied_private_users_self() {
(! systemd-run --wait -p ProtectHostname=yes hostname foo)
# ProtectHostname=yes can optionally take a hostname.
- systemd-run --wait -p ProtectHostnameEx=yes:hoge \
+ systemd-run --wait -p ProtectHostname=yes:hoge \
-P bash -xec '
test "$(hostname)" = "hoge"
(! hostname foo)
systemd-run --wait -p ProtectHostname=yes -p PrivateMounts=yes \
findmnt --mountpoint /proc/sys/kernel/hostname
+
+ # Check that ProtectHostnameEx=… also works.
+ systemd-run --wait -p ProtectHostnameEx=yes:hoge \
+ -P bash -xec '
+ test "$(hostname)" = "hoge"
+ (! hostname foo)
+ test "$(hostname)" = "hoge"
+ '
}
testcase_private() {
- systemd-run --wait -p ProtectHostnameEx=private \
+ systemd-run --wait -p ProtectHostname=private \
-P bash -xec '
hostname foo
test "$(hostname)" = "foo"
test "$(hostnamectl hostname)" = "$HOSTNAME_FROM_SYSTEMD"
# ProtectHostname=private can optionally take a hostname.
- systemd-run --wait -p ProtectHostnameEx=private:hoge \
+ systemd-run --wait -p ProtectHostname=private:hoge \
-P bash -xec '
test "$(hostname)" = "hoge"
hostname foo
test "$(hostnamectl hostname)" = "$HOSTNAME_FROM_SYSTEMD"
# Verify /proc/sys/kernel/hostname is not bind mounted from host read-only.
- (! systemd-run --wait -p ProtectHostnameEx=private -p PrivateMounts=yes \
+ (! systemd-run --wait -p ProtectHostname=private -p PrivateMounts=yes \
findmnt --mountpoint /proc/sys/kernel/hostname)
}