depend on pam-auth, use pam for root login

Please use username "root@pam" for login via GUI.
This commit is contained in:
Dietmar Maurer 2019-02-01 09:30:50 +01:00
parent a154a8e8a4
commit c82bc1a1f9
3 changed files with 7 additions and 2 deletions

View File

@ -34,3 +34,5 @@ endian_trait = "0.6"
walkdir = "2" walkdir = "2"
md5 = "0.6" md5 = "0.6"
base64 = "0.10" base64 = "0.10"
pam-sys = "0.5"
pam-auth = "0.5"

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: proxmox-backup
Section: admin Section: admin
Priority: optional Priority: optional
Maintainer: Proxmox Support Team <support@proxmox.com> Maintainer: Proxmox Support Team <support@proxmox.com>
Build-Depends: debhelper (>= 10), Build-Depends: debhelper (>= 10), libpam0g-dev
Standards-Version: 3.9.5 Standards-Version: 3.9.5
Homepage: https://www.proxmox.com Homepage: https://www.proxmox.com

View File

@ -12,7 +12,10 @@ use serde_json::{json, Value};
fn authenticate_user(username: &str, password: &str) -> Result<(), Error> { fn authenticate_user(username: &str, password: &str) -> Result<(), Error> {
if username == "root@pam" && password == "test" { if username == "root@pam" {
let mut auth = pam_auth::Authenticator::new("common-auth").unwrap();
auth.set_credentials("root", password);
auth.authenticate()?;
return Ok(()); return Ok(());
} }