-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi guys,
I'm using the sspi crate with the Negotiate provider via Negotiate::new_client(...)
, and I noticed that the tokens generated through initialize_security_context are not encapsulated in a valid SPNEGO ASN.1 blob.
For example, in Wireshark, I expected to see the typical SPNEGO header (with OID 1.3.6.1.5.5.2) along with mechTypes
but the resulting buffer only contains the raw NTLMSSP token (NTLMSSP\\0 ...)
.
Am I doing something wrong here? Just to clarify, this is being used in a DCE/RPC authentication context. And sorry if it's a silly question, since I'm just starting to use this library, I'm trying to understand it more precisely.
pub fn new(
domain: &str,
user: &str,
pass: &str,
protection: Protection,
) -> Result<Self> {
let identity = AuthIdentity {
username: Username::parse(&format!("{domain}\\{user}"))?,
password: pass.to_owned().into(),
};
let config = NegotiateConfig::new(
Box::new(NtlmConfig::default()),
Some("ntlm,kerberos,!pku2u".to_string()),
"".to_string(),
);
let mut negotiate = Negotiate::new_client(config)?;
let creds = Credentials::AuthIdentity(identity.clone());
let mut cred_handle = negotiate
.acquire_credentials_handle()
.with_credential_use(CredentialUse::Outbound)
.with_auth_data(&creds)
.execute(&mut negotiate)?
.credentials_handle;
let mut out = vec![SecurityBuffer::new(Vec::new(), BufferType::Token)];
let mut builder = negotiate
.initialize_security_context()
.with_credentials_handle(&mut cred_handle)
.with_context_requirements(ClientRequestFlags::CONFIDENTIALITY)
.with_target_data_representation(DataRepresentation::Native)
.with_output(&mut out);
negotiate.initialize_security_context_impl(&mut builder)?
.resolve_with_default_network_client()?;
Ok(Self {
provider: AuthProvider::Negotiate(negotiate),
auth_type: RpcAuthType::Spnego,
auth_level: match protection {
Protection::Privacy => RpcAuthLevel::Privacy,
Protection::Integrity => RpcAuthLevel::Integrity,
Protection::Connect => RpcAuthLevel::Connect,
},
ctx_id: 0,
pending_token: out[0].buffer.clone(),
})

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working