Skip to main content

User password

The password of a user. osapi dsl behavior get --name password and osapi dsl behavior method get show the same. Its chain shows each call that its examples make.

Behavior​

Namepassword
DescriptionThe password of a user
Placementnode
Ofuser
Areasecurity
Internalno
APIyes
CLIyes
Nextno
Platformsdebian
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesuser
Used bynone

Methods (1)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
updatewritePUT/api/node/{hostname}/user/{name}/passworduser:writeSet the password of a user

Types (1)​

NAMEINPUTOUTPUT
updateUpdateInput { name*, password, password_hash }Result { name, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.password.<method>
Child spansbehavior.user.<method>, exec chpasswd, exec useradd, exec usermod, exec userdel, exec id, exec dscl
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsname (update)

Method update​

Nameupdate
Verbwrite
DescriptionSet the password of a user
DetailSets the password with chpasswd -e, from its hash on standard input. The controller hashes the password, so the job and NATS have only the hash. Each call makes a new hash, so it always reports changed: true. A user that the host does not have is not found. It runs on the Debian family only, and elsewhere reports skipped.
HTTPPUT
Route/api/node/{hostname}/user/{name}/password
Permissionuser:write
Commandosapi client node user password update
Input typeUpdateInput
Output typeResult

Input (3)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
namestringyespattern ^[a-z_][a-z0-9_-]*$?$, max length 32The user, such as alice
passwordstringnopattern ^[^\r\n]*$, format passwordThe new password, which osapi hashes on the controller. A secret: a reference, secret://<vault>/<key>, or the value.
password_hashstringnoThe sha512-crypt hash of the password, which the controller sets

Output (2)​

FIELDTYPEDESCRIPTION
namestringThe user
changedbooleanWhether the host changed

Examples (1)​

EXAMPLEINPUTOUTPUT
Set a passwordname=osapitest, password=[redacted], password_hash=$6$osapitest$ixskR1vdsZl2JBlRPn/2rqKZK4DltHGVEnTxDn.wN68cQnKpsMNWzH5Hxu6jZgEHWjcnzvFneyk/KHl6bEYtj1name=osapitest, changed=true