]> git.proxmox.com Git - pve-container.git/commitdiff
use better regex for detecting pre crypt()'d passwords
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 21 Jun 2018 12:14:27 +0000 (14:14 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 21 Aug 2018 08:02:27 +0000 (10:02 +0200)
this means we also have to adapt some tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/LXC/Setup/Base.pm
src/test/run_setup_tests.pl
src/test/test-debian-009/etc/shadow.exp
src/test/test-debian-014/etc/shadow.exp

index 964d8d57d55730c5de44a219cfef62f0132fd5d7..9b1cf124ecac80c09b5e835e10e8162e5bf6a82b 100644 (file)
@@ -354,7 +354,7 @@ sub set_user_password {
     my $shadow = "/etc/shadow";
     
     if (defined($opt_password)) {
-       if ($opt_password !~ m/^\$/) {
+       if ($opt_password !~ m/^\$(?:1|2[axy]?|5|6)\$[a-zA-Z0-9.\/]{1,16}\$[a-zA-Z0-9.\/]+$/) {
            my $time = substr (Digest::SHA::sha1_base64 (time), 0, 8);
            $opt_password = crypt(encode("utf8", $opt_password), "\$1\$$time\$");
        };
index bae94e8194d49baa44e762e280188740808cb1e0..678ff0f7e8c783c78f6c095f5215f8a3dfb260d6 100755 (executable)
@@ -50,7 +50,7 @@ sub run_test {
        # run tests twice, to make sure scripts are idempotent
        
        srand(0);
-       $lxc_setup->post_create_hook('$TEST$ABCDEF','ssh-rsa ABCDEFG ABC@DEF');
+       $lxc_setup->post_create_hook('$5$SALT$PASS','ssh-rsa ABCDEFG ABC@DEF');
 
        my @testfiles = qw(/etc/hostname
                           /etc/hosts
index 34768b5ddb1d710a1382dcb6a00b4f59c14c321b..03c43ace44c10e34b932d0c5e624973b0a5d8d14 100644 (file)
@@ -1,4 +1,4 @@
-root:$TEST$ABCDEF:@DAYS@:0:99999:7:::
+root:$5$SALT$PASS:@DAYS@:0:99999:7:::
 daemon:*:15908:0:99999:7:::
 bin:*:15908:0:99999:7:::
 sys:*:15908:0:99999:7:::
index 34768b5ddb1d710a1382dcb6a00b4f59c14c321b..03c43ace44c10e34b932d0c5e624973b0a5d8d14 100644 (file)
@@ -1,4 +1,4 @@
-root:$TEST$ABCDEF:@DAYS@:0:99999:7:::
+root:$5$SALT$PASS:@DAYS@:0:99999:7:::
 daemon:*:15908:0:99999:7:::
 bin:*:15908:0:99999:7:::
 sys:*:15908:0:99999:7:::