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

This commit further refactors existing work to make windows LDAP and … #18021

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

alistanis
Copy link
Contributor

…Certificate services available to other parts of Teleport. In particular, this PR moves the majority of the LDAP and CA services from windows_server.go into the windows package and into a new structure CertificateAuthority

@alistanis alistanis force-pushed the ccooper/refactor-desktop-certificate-generation branch 2 times, most recently from 135ef5a to 7766dcb Compare November 2, 2022 18:18
return sb.String()
}

// ComputerAttributes are the attributes we fetch when discovering
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can probably stay in windows_server.go since they are tailored towards discovering computers for desktop access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point there. That makes sense.

@alistanis alistanis force-pushed the ccooper/refactor-desktop-certificate-generation branch from 7766dcb to 4dde4e3 Compare November 2, 2022 23:19
Comment on lines 30 to 34
func NewCertificateAuthority(clusterName string,
ldapConfig LDAPConfig,
ldapClient *LDAPClient,
ap auth.WindowsDesktopAccessPoint,
log logrus.FieldLogger) *CertificateAuthority {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why not just:

Suggested change
func NewCertificateAuthority(clusterName string,
ldapConfig LDAPConfig,
ldapClient *LDAPClient,
ap auth.WindowsDesktopAccessPoint,
log logrus.FieldLogger) *CertificateAuthority {
func NewCertificateAuthority(cfg CertificateAuthorityConfig) (*CertificateAuthority, error) {
if err := cfg.ValidateAndSetDefault(); err != nil {
return nil, err
}
return CertificateAuthority{cfg: cfg}, nil
}

where clusterName and lc can be part of CertificateAuthorityConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds very reasonable.

@@ -351,6 +364,8 @@ func NewWindowsService(cfg WindowsServiceConfig) (*WindowsService, error) {
s.cfg.Log.Infoln("desktop discovery via LDAP is disabled, set 'base_dn' to enable")
}

s.ca = windows.NewCertificateAuthority(s.clusterName, s.cfg.LDAPConfig, s.lc, s.cfg.AccessPoint, s.cfg.Log)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: What would you cay about renaming NewCertificateAuthority to something like NewStoreClient ?

At first glance ca and NewCertificateAuthority naming is a bit misleading for a reader and indicatate the ca contains some kind of CertificateAuthority object but actually the ca is a windows store client that allows to update ca in that store.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good idea.

@alistanis alistanis force-pushed the ccooper/refactor-desktop-certificate-generation branch 3 times, most recently from a84d1e1 to 70c6fed Compare November 3, 2022 17:38
@alistanis alistanis enabled auto-merge (squash) November 3, 2022 17:50
@alistanis alistanis force-pushed the ccooper/refactor-desktop-certificate-generation branch 5 times, most recently from f9213f7 to a54b6f2 Compare November 4, 2022 12:10
This commit further refactors existing work to make windows LDAP and Certificate services available to other parts of Teleport. In particular, this PR moves the majority of the LDAP and CA services from windows_server.go into the windows package and into a new structure CertificateAuthority
@alistanis alistanis force-pushed the ccooper/refactor-desktop-certificate-generation branch from a54b6f2 to 6771e20 Compare November 4, 2022 13:06
@alistanis alistanis merged commit f8106a2 into master Nov 4, 2022
ibeckermayer pushed a commit that referenced this pull request Dec 29, 2022
This commit further refactors existing work to make windows LDAP and Certificate services available to other parts of Teleport. In particular, this PR moves the majority of the LDAP and CA services from windows_server.go into the windows package and into a new structure CertificateAuthority
ibeckermayer pushed a commit that referenced this pull request Jan 3, 2023
This commit further refactors existing work to make windows LDAP and Certificate services available to other parts of Teleport. In particular, this PR moves the majority of the LDAP and CA services from windows_server.go into the windows package and into a new structure CertificateAuthority
ibeckermayer pushed a commit that referenced this pull request Jan 3, 2023
This commit further refactors existing work to make windows LDAP and Certificate services available to other parts of Teleport. In particular, this PR moves the majority of the LDAP and CA services from windows_server.go into the windows package and into a new structure CertificateAuthority
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants