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
| Name | password |
| Description | The password of a user |
| Placement | node |
| Of | user |
| Area | security |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | debian |
| Sudo | none |
| Runs | none |
| Writes | none |
| Keeps state | no |
| Uses | user |
| Used by | none |
Methods (1)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|---|---|---|---|---|
| update | write | PUT | /api/node/{hostname}/user/{name}/password | user:write | Set the password of a user |
Types (1)
| NAME | INPUT | OUTPUT |
|---|---|---|
| update | UpdateInput { name*, password, password_hash } | Result { name, changed } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| Span | behavior.password.<method> |
| Child spans | behavior.user.<method>, exec chpasswd, exec useradd, exec usermod, exec userdel, exec id, exec dscl |
| Metrics | osapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total |
| Attributes | osapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed |
| Recorded inputs | name (update) |
Method update
| Name | update |
| Verb | write |
| Description | Set the password of a user |
| Detail | Sets 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. |
| HTTP | PUT |
| Route | /api/node/{hostname}/user/{name}/password |
| Permission | user:write |
| Command | osapi client node user password update |
| Input type | UpdateInput |
| Output type | Result |
Input (3)
| FIELD | TYPE | REQUIRED | CONSTRAINTS | DESCRIPTION |
|---|---|---|---|---|
| name | string | yes | pattern ^[a-z_][a-z0-9_-]*$?$, max length 32 | The user, such as alice |
| password | string | no | pattern ^[^\r\n]*$, format password | The new password, which osapi hashes on the controller. A secret: a reference, secret://<vault>/<key>, or the value. |
| password_hash | string | no | The sha512-crypt hash of the password, which the controller sets |
Output (2)
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
| name | string | The user |
| changed | boolean | Whether the host changed |
Examples (1)
| EXAMPLE | INPUT | OUTPUT |
|---|---|---|
| Set a password | name=osapitest, password=[redacted], password_hash=$6$osapitest$ixskR1vdsZl2JBlRPn/2rqKZK4DltHGVEnTxDn.wN68cQnKpsMNWzH5Hxu6jZgEHWjcnzvFneyk/KHl6bEYtj1 | name=osapitest, changed=true |