* chore: bump follow-redirects to >=1.16.0 * chore: bump @xmldom/xmldom to >=0.8.12 * chore: bump serialize-javascript to >=7.0.5 * chore: bump picomatch to 2.3.2 / 4.0.4 * chore: bump flatted to >=3.4.2 * chore: bump undici to >=7.24.0 * chore: bump svgo to >=4.0.1 * chore: bump minimatch to 3.1.3 / 5.1.8 * build(deps): bump i18next-http-backend in /services/idp Bumps [i18next-http-backend](https://github.com/i18next/i18next-http-backend) from 2.7.3 to 3.0.5. - [Changelog](https://github.com/i18next/i18next-http-backend/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/i18next-http-backend/compare/v2.7.3...v3.0.5) --- updated-dependencies: - dependency-name: i18next-http-backend dependency-version: 3.0.5 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump amd64/alpine from 3.23.3 to 3.23.4 in /ocis/docker Bumps amd64/alpine from 3.23.3 to 3.23.4. --- updated-dependencies: - dependency-name: amd64/alpine dependency-version: 3.23.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump actions/setup-node from 6.3.0 to 6.4.0 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/53b83947a5a98c8d113130e565377fae1a50d02f...48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 6.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump actions/setup-go from 6.3.0 to 6.4.0 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v6.3.0...4a3601121dd01d1626a1e23e37211e3254c1c06c) --- updated-dependencies: - dependency-name: actions/setup-go dependency-version: 6.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump aquasecurity/trivy-action from 0.35.0 to 0.36.0 Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.35.0 to 0.36.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/57a97c7e7821a5776cebc9bb87c984fa69cba8f1...ed142fd0673e97e23eac54620cfb913e5ce36c25) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-version: 0.36.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump docker/build-push-action from 7.0.0 to 7.1.0 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 7.0.0 to 7.1.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/d08e5c354a6adb9ed34480a06d141179aa583294...bcafcacb16a39f128d818304e6c9c0c18556b85f) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-version: 7.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump softprops/action-gh-release from 2.6.1 to 3.0.0 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.6.1 to 3.0.0. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/153bb8e04406b158c6c84fc1615b65b24149a1fe...b4309332981a82ec1c5618f44dd2e27cc8bfbfda) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: 3.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: lock file regenerate * chore: bump Azure/go-ntlmssp to v0.1.1 --------- Signed-off-by: dependabot[bot] <support@github.com>
58 lines
1.7 KiB
Go
58 lines
1.7 KiB
Go
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
// Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx,
|
|
// implementation hints from http://davenport.sourceforge.net/ntlm.html .
|
|
// This package only implements authentication, no key exchange or encryption. It
|
|
// only supports Unicode (UTF16LE) encoding of protocol strings, no OEM encoding.
|
|
// This package implements NTLMv2.
|
|
package ntlmssp
|
|
|
|
import (
|
|
"crypto/hmac"
|
|
"crypto/md5"
|
|
"strings"
|
|
|
|
"github.com/Azure/go-ntlmssp/internal/md4"
|
|
)
|
|
|
|
func getNtlmV2Hash(password, username, domain string) []byte {
|
|
return getNtlmV2Hashed(getNtlmHash(password), username, domain)
|
|
}
|
|
|
|
func getNtlmV2Hashed(ntlmHash []byte, username, domain string) []byte {
|
|
return hmacMd5(ntlmHash, toUnicode(strings.ToUpper(username)+domain))
|
|
}
|
|
|
|
func getNtlmHash(password string) []byte {
|
|
hash := md4.New()
|
|
hash.Write(toUnicode(password))
|
|
return hash.Sum(nil)
|
|
}
|
|
|
|
func computeNtlmV2Response(ntlmV2Hash, serverChallenge, clientChallenge,
|
|
timestamp, targetInfo []byte,
|
|
) []byte {
|
|
temp := []byte{1, 1, 0, 0, 0, 0, 0, 0}
|
|
temp = append(temp, timestamp...)
|
|
temp = append(temp, clientChallenge...)
|
|
temp = append(temp, 0, 0, 0, 0)
|
|
temp = append(temp, targetInfo...)
|
|
temp = append(temp, 0, 0, 0, 0)
|
|
|
|
NTProofStr := hmacMd5(ntlmV2Hash, serverChallenge, temp)
|
|
return append(NTProofStr, temp...)
|
|
}
|
|
|
|
func computeLmV2Response(ntlmV2Hash, serverChallenge, clientChallenge []byte) []byte {
|
|
return append(hmacMd5(ntlmV2Hash, serverChallenge, clientChallenge), clientChallenge...)
|
|
}
|
|
|
|
func hmacMd5(key []byte, data ...[]byte) []byte {
|
|
mac := hmac.New(md5.New, key)
|
|
for _, d := range data {
|
|
mac.Write(d)
|
|
}
|
|
return mac.Sum(nil)
|
|
}
|