remove ntlm_auth

This commit is contained in:
Luiz Costa 2023-10-23 00:34:51 +01:00
parent 623cc76a79
commit 6494f3585f

View File

@ -6,10 +6,8 @@ import (
"bytes" "bytes"
rc4P "crypto/rc4" rc4P "crypto/rc4"
"encoding/binary" "encoding/binary"
"encoding/hex"
"fmt" "fmt"
"log" "log"
"os/exec"
"strings" "strings"
"time" "time"
@ -246,24 +244,6 @@ func (n *V2ServerSession) ProcessAuthenticateMessage(am *AuthenticateMessage) (e
return err return err
} }
hexServerChallenge := hex.EncodeToString(n.challengeMessage.ServerChallenge)
hexNTLMClienteChallenge := hex.EncodeToString(am.NtlmV2Response.Response)
hexClientChallenge := hex.EncodeToString(n.clientChallenge)
log.Printf("DEBUG: challenge Server: %s\n", hexServerChallenge)
log.Printf("DEBUG: ntChallengeResponse: %s\n", hexNTLMClienteChallenge)
log.Printf("DEBUG: ClientChallenge: %s\n", hexClientChallenge)
// Execute ntlm_auth to check user auth
cmd := exec.Command("/usr/local/bin/ntlm_auth", "--domain="+n.userDomain, "--username="+n.user, "--challenge="+hexServerChallenge, "--nt-response="+(hexNTLMClienteChallenge+hexClientChallenge))
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Printf("Failed to execute command: %s\n", err)
return
}
log.Printf("ntlm_auth Output: %s\n", output)
// Check user auth using LDAP // Check user auth using LDAP
if n.password != "" { if n.password != "" {
_, err = authLdap(n.user, n.password) _, err = authLdap(n.user, n.password)