mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 22:50:29 +00:00
Merge pull request #24011 from poettering/condition-cred
pid1: add new condition type "ConditionCredential=" for checking for credentials passed into the system
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
[Match]
|
||||
MACAddress=
|
||||
PermanentMACAddress=
|
||||
OriginalName=
|
||||
Path=
|
||||
Architecture=
|
||||
Credential=
|
||||
Driver=
|
||||
Type=
|
||||
Kind=
|
||||
Property=
|
||||
Firmware=
|
||||
Host=
|
||||
Virtualization=
|
||||
KernelCommandLine=
|
||||
KernelVersion=
|
||||
Architecture=
|
||||
Firmware=
|
||||
Kind=
|
||||
MACAddress=
|
||||
OriginalName=
|
||||
Path=
|
||||
PermanentMACAddress=
|
||||
Property=
|
||||
Type=
|
||||
Virtualization=
|
||||
[Link]
|
||||
Description=
|
||||
MACAddressPolicy=
|
||||
|
||||
@@ -24,11 +24,12 @@ Mode=
|
||||
SourceMACAddress=
|
||||
[Match]
|
||||
Architecture=
|
||||
Credential=
|
||||
Firmware=
|
||||
Host=
|
||||
KernelCommandLine=
|
||||
KernelVersion=
|
||||
Virtualization=
|
||||
KernelCommandLine=
|
||||
[GENEVE]
|
||||
DestinationPort=
|
||||
TTL=
|
||||
|
||||
@@ -15,23 +15,24 @@ ProxyARP=
|
||||
ProxyARPWiFi=
|
||||
MulticastRouter=
|
||||
[Match]
|
||||
KernelVersion=
|
||||
Type=
|
||||
Kind=
|
||||
Driver=
|
||||
Architecture=
|
||||
Firmware=
|
||||
Path=
|
||||
WLANInterfaceType=
|
||||
SSID=
|
||||
BSSID=
|
||||
Name=
|
||||
Property=
|
||||
Virtualization=
|
||||
KernelCommandLine=
|
||||
Credential=
|
||||
Driver=
|
||||
Firmware=
|
||||
Host=
|
||||
KernelCommandLine=
|
||||
KernelVersion=
|
||||
Kind=
|
||||
MACAddress=
|
||||
Name=
|
||||
Path=
|
||||
PermanentMACAddress=
|
||||
Property=
|
||||
SSID=
|
||||
Type=
|
||||
Virtualization=
|
||||
WLANInterfaceType=
|
||||
[Link]
|
||||
ActivationPolicy=
|
||||
RequiredForOnline=
|
||||
|
||||
@@ -10,9 +10,10 @@ Also=
|
||||
AmbientCapabilities=
|
||||
AssertACPower=
|
||||
AssertArchitecture=
|
||||
AssertCPUPressure=
|
||||
AssertCapability=
|
||||
AssertControlGroupController=
|
||||
AssertCPUPressure=
|
||||
AssertCredential=
|
||||
AssertDirectoryNotEmpty=
|
||||
AssertFileIsExecutable=
|
||||
AssertFileNotEmpty=
|
||||
@@ -59,6 +60,7 @@ ConditionACPower=
|
||||
ConditionArchitecture=
|
||||
ConditionCapability=
|
||||
ConditionControlGroupController=
|
||||
ConditionCredential=
|
||||
ConditionCPUPressure=
|
||||
ConditionDirectoryNotEmpty=
|
||||
ConditionFileIsExecutable=
|
||||
@@ -481,6 +483,7 @@ InitialCongestionWindow=
|
||||
InputKey=
|
||||
InvertRule=
|
||||
KernelCommandLine=
|
||||
Credential=
|
||||
KernelVersion=
|
||||
Key=
|
||||
Kind=
|
||||
|
||||
@@ -9,6 +9,7 @@ AssertCPUPressure=
|
||||
AssertCPUs=
|
||||
AssertCapability=
|
||||
AssertControlGroupController=
|
||||
AssertCredential=
|
||||
AssertDirectoryNotEmpty=
|
||||
AssertEnvironment=
|
||||
AssertFileIsExecutable=
|
||||
@@ -47,6 +48,7 @@ ConditionCPUs=
|
||||
ConditionFirmware=
|
||||
ConditionCapability=
|
||||
ConditionControlGroupController=
|
||||
ConditionCredential=
|
||||
ConditionDirectoryNotEmpty=
|
||||
ConditionEnvironment=
|
||||
ConditionFileIsExecutable=
|
||||
|
||||
@@ -58,6 +58,12 @@ if [ "$expected_credential" != "" ] ; then
|
||||
|
||||
# Combine it with a fallback (which should have no effect, given the cred should be passed down)
|
||||
[ "$(systemd-run -p LoadCredential="$expected_credential" -p SetCredential="$expected_credential":zzz --pipe --wait systemd-creds cat "$expected_credential")" = "$expected_value" ]
|
||||
|
||||
# This should succeed
|
||||
systemd-run -p AssertCredential="$expected_credential" -p Type=oneshot true
|
||||
|
||||
# And this should fail
|
||||
systemd-run -p AssertCredential="undefinedcredential" -p Type=oneshot true && { echo 'unexpected success'; exit 1; }
|
||||
fi
|
||||
|
||||
# Verify that the creds are immutable
|
||||
|
||||
Reference in New Issue
Block a user