use new PVE::Tools::encrypt_pw, bump version to 5.0-3

This commit is contained in:
Dietmar Maurer 2017-03-30 17:54:38 +02:00
parent 972859d115
commit 63358f40b3
5 changed files with 12 additions and 17 deletions

View File

@ -1,6 +1,6 @@
VERSION=5.0
PACKAGE=libpve-access-control
PKGREL=2
PKGREL=3
DESTDIR=
PREFIX=/usr

View File

@ -66,7 +66,7 @@ sub store_password {
my $cmd = ['usermod'];
my $epw = PVE::Auth::Plugin::encrypt_pw($password);
my $epw = PVE::Tools::encrypt_pw($password);
push @$cmd, '-p', $epw, $username;

View File

@ -3,6 +3,7 @@ package PVE::Auth::PVE;
use strict;
use warnings;
use PVE::Tools;
use PVE::Auth::Plugin;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file);
@ -92,7 +93,7 @@ sub store_password {
lock_shadow_config(sub {
my $shadow_cfg = cfs_read_file($shadowconfigfile);
my $epw = PVE::Auth::Plugin::encrypt_pw($password);
my $epw = PVE::Tools::encrypt_pw($password);
$shadow_cfg->{users}->{$username}->{shadow} = $epw;
cfs_write_file($shadowconfigfile, $shadow_cfg);
});

View File

@ -130,20 +130,6 @@ sub parse_tfa_config {
return $res;
}
my $salt_starter = time();
sub encrypt_pw {
my ($pw) = @_;
$salt_starter++;
my $salt = substr(Digest::SHA::sha1_base64(time() + $salt_starter + $$), 0, 8);
# crypt does not want '+' in salt (see 'man crypt')
$salt =~ s/\+/X/g;
return crypt(encode("utf8", $pw), "\$5\$$salt\$");
}
my $defaultData = {
propertyList => {
type => { description => "Realm type." },

View File

@ -1,3 +1,11 @@
libpve-access-control (5.0-3) unstable; urgency=medium
* use new PVE::OTP class from pve-common
* use new PVE::Tools::encrypt_pw from pve-common
-- Proxmox Support Team <support@proxmox.com> Thu, 30 Mar 2017 17:45:55 +0200
libpve-access-control (5.0-2) unstable; urgency=medium
* encrypt_pw: avoid '+' for crypt salt