RexOps / RexOps/Rex

Account bumps password set time, even when it doesnt

Open
#1,510 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

The 'account' function always bumps the password set time, even when it doesnt change anything.

Consider this simple config

    account 'mp',
        ensure => 'present',
        uid    => 1001,
        shell  => '/bin/false',
        home   => '/home/mp',
        create_home => 1,
        crypt_password => '!'; # disabled login
    account 'dc',
        ensure => 'present',
        uid    => 1002,
        shell  => '/bin/false',
        home   => '/home/dc',
        create_home => 1,
        crypt_password => '!'; # disabled login

Then i run rex ( i have etckeeper installed )

git diff /etc/shadow
diff --git a/shadow b/shadow
index 02e510e..2b472fe 100644
--- a/shadow
+++ b/shadow
@@ -22,7 +22,7 @@ systemd-network:*:18496:0:99999:7:::
 mp:!:18876:0:99999:7:::
-dc:!:18876:0:99999:7:::
+mp:!:18911:0:99999:7:::
+dc:!:18911:0:99999:7:::

Run rex again, then...

root@batou:/etc# git diff /etc/shadow
diff --git a/shadow b/shadow
index 02e510e..1053301 100644
--- a/shadow
+++ b/shadow
-mp:!:18876:0:99999:7:::
-dc:!:18876:0:99999:7:::
+mp:!:18912:0:99999:7:::
+dc:!:18912:0:99999:7:::

The "date of last password change" field changes (per man shadow)

I dont think that field should change if the password doesnt change.

YMMV on that. I can see how someone could make an argument that it should.

How to reproduce it

Create a user and run rex over and over. Diff the shadow files

Expected behavior

I dont think that field should change if the password doesnt change. Or perhaps be controllable.

Circumstances

  • Rex version: (R)?ex 1.13.4
  • Perl version: 5.32.0
  • OS running rex: Debian bookworm/sid
  • OS managed by rex: Debian bookworm/sid
  • How rex was installed: cpanm Rex

Debug log

Is this really needed?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Rex's account function and reproduce the issue with the two account definitions shown, running Rex repeatedly while diffing /etc/shadow. Trace how the crypt_password value is handled and identify the existing account-management tests, if present. Done means an unchanged password no longer updates the shadow file's last-password-change date, or the behavior is explicitly controllable.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.