Changed everything to use /etc/master.passwd, require bcrypt passwd for new users
my @sysusers;
my @allsysusers;
-open PASSWD, "$etc/passwd";
+open PASSWD, "$etc/master.passwd";
while (<PASSWD>) {
- my ($username, undef, $uid, $gid, $gecos, $home, $shell) = split(/:/);
+ my ($username, undef, $uid, $gid, $class, $change, $expire, $gecos, $home, $shell) = split(/:/);
push(@allsysusers, $username);
next unless $gecos =~ /^\[AG\]/; # Skip non-AG-managed users
push(@sysusers, $username);
}
close PASSWD;
-# Check to see what there is in /etc/passwd that should be removed.
+# Check to see what there is in /etc/master.passwd that should be removed.
my @deletes;
for my $sysuser (@sysusers) {
unless (grep { $_ eq $sysuser } @agusers) {
for my $add (@updates,@adds) {
my $agu = AwesomeGrid::User->load($add);
+ unless (exists $agu->{'passwd-bcrypt'}) {
+ print "$agu->{username} does not have a bcrypt password! Not adding user!\n";
+ next;
+ }
printf PASSWD "%s:%s:%d:%d::0:0:[AG]:%s:%s\n",
$agu->{username}, $agu->{'passwd-bcrypt'},