mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
Resolve incorrect handling of rhost in pam (#3171)
This commit is contained in:
parent
1b58e4169a
commit
ea1fcf59e5
|
@ -107,7 +107,8 @@ pub enum PamAuthRequest {
|
||||||
pub struct PamServiceInfo {
|
pub struct PamServiceInfo {
|
||||||
pub service: String,
|
pub service: String,
|
||||||
pub tty: String,
|
pub tty: String,
|
||||||
pub rhost: String,
|
// Only set if it really is a remote host?
|
||||||
|
pub rhost: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
@ -144,7 +145,10 @@ impl ClientRequest {
|
||||||
ClientRequest::NssGroupByName(id) => format!("NssGroupByName({})", id),
|
ClientRequest::NssGroupByName(id) => format!("NssGroupByName({})", id),
|
||||||
ClientRequest::PamAuthenticateInit { account_id, info } => format!(
|
ClientRequest::PamAuthenticateInit { account_id, info } => format!(
|
||||||
"PamAuthenticateInit{{ account_id={} tty={} pam_secvice{} rhost={} }}",
|
"PamAuthenticateInit{{ account_id={} tty={} pam_secvice{} rhost={} }}",
|
||||||
account_id, info.service, info.tty, info.rhost
|
account_id,
|
||||||
|
info.service,
|
||||||
|
info.tty,
|
||||||
|
info.rhost.as_deref().unwrap_or("")
|
||||||
),
|
),
|
||||||
ClientRequest::PamAuthenticateStep(_) => "PamAuthenticateStep".to_string(),
|
ClientRequest::PamAuthenticateStep(_) => "PamAuthenticateStep".to_string(),
|
||||||
ClientRequest::PamAccountAllowed(id) => {
|
ClientRequest::PamAccountAllowed(id) => {
|
||||||
|
|
|
@ -256,7 +256,7 @@ impl PamHandle {
|
||||||
tracing::debug!(?maybe_tty, ?maybe_rhost, ?maybe_service);
|
tracing::debug!(?maybe_tty, ?maybe_rhost, ?maybe_service);
|
||||||
|
|
||||||
match (maybe_tty, maybe_rhost, maybe_service) {
|
match (maybe_tty, maybe_rhost, maybe_service) {
|
||||||
(Some(tty), Some(rhost), Some(service)) => Ok(PamServiceInfo {
|
(Some(tty), rhost, Some(service)) => Ok(PamServiceInfo {
|
||||||
service,
|
service,
|
||||||
tty,
|
tty,
|
||||||
rhost,
|
rhost,
|
||||||
|
|
|
@ -68,7 +68,7 @@ async fn main() -> ExitCode {
|
||||||
info: PamServiceInfo {
|
info: PamServiceInfo {
|
||||||
service: "kanidm-unix".to_string(),
|
service: "kanidm-unix".to_string(),
|
||||||
tty: "/dev/null".to_string(),
|
tty: "/dev/null".to_string(),
|
||||||
rhost: "localhost".to_string(),
|
rhost: None,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ impl Resolver {
|
||||||
let pam_info = PamServiceInfo {
|
let pam_info = PamServiceInfo {
|
||||||
service: "kanidm-unix-test".to_string(),
|
service: "kanidm-unix-test".to_string(),
|
||||||
tty: "/dev/null".to_string(),
|
tty: "/dev/null".to_string(),
|
||||||
rhost: "localhost".to_string(),
|
rhost: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut auth_session = match self
|
let mut auth_session = match self
|
||||||
|
|
Loading…
Reference in a new issue