Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced logging for client #213

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/client/twofa/twofa.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func doCertRequest(signer crypto.Signer, client *http.Client, userName string,
return nil, fmt.Errorf("invalid certType requested '%s'", certType)

}
logger.Debugf(3, "doCertReques: publicKey='%s'", serializedPubkey)
var urlPostfix string
// addgroups only makes sense for x509 plain .. maybe set as a check insetad of dropping?
if certType == "x509" && addGroups {
Expand All @@ -103,8 +104,9 @@ func doCertRequest(signer crypto.Signer, client *http.Client, userName string,

func doCertRequestInternal(client *http.Client,
targetURL, filedata string,
userAgentString string, logger log.Logger) ([]byte, error) {
userAgentString string, logger log.DebugLogger) ([]byte, error) {

logger.Debugf(3, "doCertRequestInternal: top")
req, err := createKeyBodyRequest("POST", targetURL, filedata)
if err != nil {
return nil, err
Expand Down Expand Up @@ -189,6 +191,7 @@ func authenticateUser(
client *http.Client,
userAgentString string,
logger log.DebugLogger) (err error) {
logger.Debugf(3, "authenticateUser: top")
if client == nil {
return fmt.Errorf("http client is nil")
}
Expand Down Expand Up @@ -216,6 +219,15 @@ func authenticateUser(
return err
}
defer loginResp.Body.Close()
if loginResp.TLS != nil {
logger.Debugf(4, "LoginResp: proto:%s tlsVer:%x", loginResp.Proto, loginResp.TLS.Version)
for _, cert := range loginResp.TLS.VerifiedChains[0] {
logger.Debugf(5, "LoginRespr: Subject: %s issuer: %s",
cert.Subject.String(), cert.Issuer.String())
}
} else {
logger.Printf("No TLS on authentication connection")
}
if loginResp.StatusCode != 200 {
if loginResp.StatusCode == http.StatusUnauthorized {
return fmt.Errorf("Unauthorized reponse from server. Check username and/or password")
Expand Down
Loading