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

Fix scheme for DialURL ldap connection #3677

Merged
merged 1 commit into from
Aug 6, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ jobs:
DEX_ETCD_ENDPOINTS: http://localhost:${{ job.services.etcd.ports[2379] }}

DEX_LDAP_HOST: localhost
DEX_LDAP_PORT: 389
DEX_LDAP_TLS_PORT: 636
DEX_LDAP_PORT: 3890
DEX_LDAP_TLS_PORT: 6360

DEX_KEYSTONE_URL: http://localhost:${{ job.services.keystone.ports[5000] }}
DEX_KEYSTONE_ADMIN_URL: http://localhost:${{ job.services.keystone.ports[35357] }}
Expand Down
6 changes: 3 additions & 3 deletions connector/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ func (c *ldapConnector) do(_ context.Context, f func(c *ldap.Conn) error) error

switch {
case c.InsecureNoSSL:
u := url.URL{Scheme: "ldap://", Host: c.Host}
u := url.URL{Scheme: "ldap", Host: c.Host}
conn, err = ldap.DialURL(u.String())
case c.StartTLS:
u := url.URL{Scheme: "ldap://", Host: c.Host}
u := url.URL{Scheme: "ldap", Host: c.Host}
conn, err = ldap.DialURL(u.String())
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
Expand All @@ -334,7 +334,7 @@ func (c *ldapConnector) do(_ context.Context, f func(c *ldap.Conn) error) error
return fmt.Errorf("start TLS failed: %v", err)
}
default:
u := url.URL{Scheme: "ldaps://", Host: c.Host}
u := url.URL{Scheme: "ldaps", Host: c.Host}
conn, err = ldap.DialURL(u.String(), ldap.DialWithTLSConfig(c.tlsConfig))
}
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ services:
LDAP_TLS: "true"
LDAP_TLS_VERIFY_CLIENT: try
ports:
- 389:389
- 636:636
- 3890:389
- 6360:636
volumes:
- ./connector/ldap/testdata/certs:/container/service/slapd/assets/certs
- ./connector/ldap/testdata/schema.ldif:/container/service/slapd/assets/config/bootstrap/ldif/99-schema.ldif