Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions lib/auth/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ func getCertRequest(req *GenerateCredentialsRequest) (*certRequest, error) {
csr.ExtraExtensions = append(csr.ExtraExtensions, createUser)
}

if req.AD {
csr.ExtraExtensions = append(csr.ExtraExtensions, pkix.Extension{
Id: tlsca.ADStatusOID,
Value: []byte("AD"),
})
}

if req.ActiveDirectorySID != "" {
adUserMapping, err := asn1.Marshal(SubjectAltName[adSid]{
otherName[adSid]{
Expand Down Expand Up @@ -194,6 +201,9 @@ type GenerateCredentialsRequest struct {
// CRL Distribution Point (CDP). CDPs are required in user certificates
// for RDP, but they can be omitted for certs that are used for LDAP binds.
OmitCDP bool

// AD is true if we're connecting to a domain-joined desktop.
AD bool
}

// GenerateWindowsDesktopCredentials generates a private key / certificate pair for the given
Expand Down
4 changes: 4 additions & 0 deletions lib/srv/desktop/windows_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ func (s *WindowsService) generateUserCert(ctx context.Context, username string,
return s.generateCredentials(ctx, generateCredentialsRequest{
username: username,
domain: desktop.GetDomain(),
ad: !desktop.NonAD(),
ttl: ttl,
activeDirectorySID: activeDirectorySID,
createUser: createUsers,
Expand All @@ -1325,6 +1326,8 @@ type generateCredentialsRequest struct {
username string
// domain is the Windows domain
domain string
// ad is true if we're connecting to a domain-joined desktop
ad bool
// ttl for the certificate
ttl time.Duration
// activeDirectorySID is the SID of the Windows user
Expand Down Expand Up @@ -1356,6 +1359,7 @@ func (s *WindowsService) generateCredentials(ctx context.Context, request genera
CAType: types.UserCA,
Username: request.username,
Domain: request.domain,
AD: request.ad,
TTL: request.ttl,
ClusterName: s.clusterName,
ActiveDirectorySID: request.activeDirectorySID,
Expand Down
3 changes: 3 additions & 0 deletions lib/tlsca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ var (
// JoinAttributesASN1ExtensionOID is an extension that encodes the
// attributes that resulted from the Bot/Agent join process.
JoinAttributesASN1ExtensionOID = asn1.ObjectIdentifier{1, 3, 9999, 2, 21}

// ADStatusOID is an extension OID used to indicate that we're connecting to AD-joined desktop.
ADStatusOID = asn1.ObjectIdentifier{1, 3, 9999, 2, 22}
)

// Device Trust OIDs.
Expand Down
Loading