From c82bc1a1f933a9d56532777d88fd8e08243482da Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 1 Feb 2019 09:30:50 +0100 Subject: [PATCH] depend on pam-auth, use pam for root login Please use username "root@pam" for login via GUI. --- Cargo.toml | 2 ++ debian/control | 2 +- src/api2/access.rs | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 06005e88..f86a9153 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,5 @@ endian_trait = "0.6" walkdir = "2" md5 = "0.6" base64 = "0.10" +pam-sys = "0.5" +pam-auth = "0.5" \ No newline at end of file diff --git a/debian/control b/debian/control index 0a9d9fcb..6839b876 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: proxmox-backup Section: admin Priority: optional Maintainer: Proxmox Support Team -Build-Depends: debhelper (>= 10), +Build-Depends: debhelper (>= 10), libpam0g-dev Standards-Version: 3.9.5 Homepage: https://www.proxmox.com diff --git a/src/api2/access.rs b/src/api2/access.rs index 6e52d24f..ff700e27 100644 --- a/src/api2/access.rs +++ b/src/api2/access.rs @@ -12,7 +12,10 @@ use serde_json::{json, Value}; 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(()); }