Skip to content

[Merged by Bors] - Kerberos AD backend #254

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

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4d57778
Initial prototype of Kerberos AD backend
nightkr Mar 17, 2023
f51ba19
Drop gdb leftovers
nightkr Mar 17, 2023
af2efb4
Remove keylogging leftovers
nightkr Mar 17, 2023
b10b6d1
Use GSSAPI bind to authenticate to AD LDAP
nightkr Mar 20, 2023
dbabf97
Cache AD credentials
nightkr Mar 20, 2023
6c6b09a
Make AD password cache location configurable
nightkr Mar 20, 2023
b129829
The service principals should conflict anyway, no need to worry about…
nightkr Mar 20, 2023
5bcc0d8
Document concurrency principle for cache...
nightkr Mar 20, 2023
b14977c
Document that the ADDC FQDN must match
nightkr Mar 20, 2023
10116ca
Add AD to documentation
nightkr Mar 20, 2023
889e0a1
Generate random AD passwords
nightkr Mar 20, 2023
0362519
Unparse principal names properly rather than using string concatenation
nightkr Mar 20, 2023
ba33ff3
Allow users to set custom user/schema root DNs
nightkr Mar 20, 2023
c4f44c0
Maybe yamllint prefers this?
nightkr Mar 20, 2023
aacb1f4
Update CRD
nightkr Mar 20, 2023
17efc29
Provision SPN and set supported encryption types
nightkr Mar 21, 2023
e098340
Split Kerberos provisioning backends into separate modules
nightkr Mar 30, 2023
e303631
Don't unwrap AD init result
nightkr Mar 30, 2023
b25995d
Add TLS verification for AD LDAP
nightkr Mar 31, 2023
b07bf4e
Refactoring
nightkr Mar 31, 2023
642402d
Factor out AD credential cache
nightkr Mar 31, 2023
215b1f1
Oops, forgot to actually include the credential cache files
nightkr Mar 31, 2023
e270fa2
Factor out AD user creation a bit
nightkr Mar 31, 2023
383a516
Merge branch 'main' into feature/kerberos-ad
nightkr Apr 3, 2023
9b73456
Mention in docs that AD is supported
nightkr Apr 3, 2023
8d28a9d
Reenable MIT krb test, use test ns in secretclass names
nightkr Apr 3, 2023
792c0b7
Another smidge of error handling
nightkr Apr 3, 2023
bcc6208
Document new krb5 additions
nightkr Apr 17, 2023
e720a84
Try to clarify test instructions a bit
nightkr Apr 17, 2023
64ea3b1
Merge branch 'main' into feature/kerberos-ad
nightkr Apr 17, 2023
9295004
Use __ as the AD cache separator
nightkr Apr 17, 2023
0fb41a6
Merge remote-tracking branch 'origin/main' into feature/kerberos-ad
sbernauer May 17, 2023
77c0c05
Document that AD requires a TLS CA
nightkr May 19, 2023
723898c
Disable kerberos-ad test by default
nightkr May 19, 2023
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
544 changes: 359 additions & 185 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.clang.cc.lib}/lib/clang/${pkgs.lib.getVersion pkgs.clang.cc}/include";
};
libgssapi-sys = attrs: {
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ (pkgs.enableDebugging pkgs.krb5) ];
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.clang.cc.lib}/lib/clang/${pkgs.lib.getVersion pkgs.clang.cc}/include";
};
};
}
, meta ? pkgs.lib.importJSON ./nix/meta.json
Expand Down
37 changes: 37 additions & 0 deletions deploy/helm/secret-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,44 @@ spec:
oneOf:
- required:
- mit
- required:
- activeDirectory
properties:
activeDirectory:
properties:
ldapServer:
type: string
ldapTlsCaSecret:
description: SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace
properties:
name:
description: name is unique within a namespace to reference a secret resource.
type: string
namespace:
description: namespace defines the space within which the secret name must be unique.
type: string
type: object
passwordCacheSecret:
description: SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace
properties:
name:
description: name is unique within a namespace to reference a secret resource.
type: string
namespace:
description: namespace defines the space within which the secret name must be unique.
type: string
type: object
schemaDistinguishedName:
type: string
userDistinguishedName:
type: string
required:
- ldapServer
- ldapTlsCaSecret
- passwordCacheSecret
- schemaDistinguishedName
- userDistinguishedName
type: object
mit:
properties:
kadminServer:
Expand Down
22 changes: 21 additions & 1 deletion docs/modules/secret-operator/pages/secretclass.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:

Creates a Kerberos keytab file for a selected realm. The Kerberos KDC and administrator credentials must be provided by the administrator.

IMPORTANT: Only MIT Kerberos (krb5) is supported. Heimdal and Active Directory are not supported.
IMPORTANT: Only MIT Kerberos (krb5) and Active Directory are currently supported. Heimdal is not supported.

Principals will be created dynamically if they do not already exist.

Expand All @@ -81,6 +81,19 @@ spec:
admin:
mit:
kadminServer: krb5-kdc
# or...
activeDirectory:
# ldapServer must match the AD Domain Controller's FQDN or GSSAPI authn will fail
# You may need to set AD as your fallback DNS resolver in your Kube DNS Corefile
ldapServer: addc.example.com
ldapTlsCaSecret:
namespace: default
name: secret-operator-ad-ca
passwordCacheSecret:
Copy link
Member

Choose a reason for hiding this comment

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

Can we please also document

          ldapTlsCaSecret:
            # namespace: default
            name: secret-operator-ad-ca

Also that we will always use ldaps and the Secret needs the key ca.crt

Copy link
Member Author

Choose a reason for hiding this comment

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

namespace: default
name: secret-operator-ad-passwords
userDistinguishedName: CN=Users,DC=sble,DC=test
schemaDistinguishedName: CN=Schema,CN=Configuration,DC=sble,DC=test
adminKeytabSecret:
namespace: default
name: secret-provisioner-keytab
Expand All @@ -90,7 +103,14 @@ spec:
`kerberosKeytab`:: Declares that the `kerberosKeytab` backend is used.
`kerberosKeytab.realmName`:: The name of the Kerberos realm. This should be provided by the Kerberos administrator.
`kerberosKeytab.kdc`:: The hostname of the Kerberos Key Distribution Center (KDC). This should be provided by the Kerberos administrator.
`kerberosKeytab.admin.mit`:: Credentials should be provisioned in a MIT Kerberos Admin Server.
`kerberosKeytab.admin.mit.kadminServer`:: The hostname of the Kerberos Admin Server. This should be provided by the Kerberos administrator.
`kerberosKeytab.admin.activeDirectory`:: Credentials should be provisioned in a Microsoft Active Directory domain.
`kerberosKeytab.admin.activeDirectory.ldapServer`:: An AD LDAP server, such as the AD Domain Controller. This _must_ match the server's FQDN, or GSSAPI authentication will fail.
`kerberosKeytab.admin.activeDirectory.ldapTlsCaSecret`:: Reference (`name` and `namespace`) to a K8s `Secret` object containing the TLS CA (in `ca.crt`) that the LDAP server's certificate should be authenticated against.
`kerberosKeytab.admin.activeDirectory.passwordCacheSecret`:: Reference (`name` and `namespace`) to a K8s `Secret` object where workload passwords will be stored. This _must not_ be accessible to end users.
`kerberosKeytab.admin.activeDirectory.userDistinguishedName`:: The root Distinguished Name (DN) where service accounts should be provisioned, typically `CN=Users,{domain_dn}`.
`kerberosKeytab.admin.activeDirectory.schemaDistinguishedName`:: The root Distinguished Name (DN) for AD-managed schemas, typically `CN=Schema,CN=Configuration,{domain_dn}`.
`kerberosKeytab.adminKeytabSecret`:: Reference (`name` and `namespace`) to a K8s `Secret` object where a keytab with administrative privileges is stored in the key `keytab`.
`kerberosKeytab.adminPrincipal`:: The name of the Kerberos principal to be used by the Secret Operator. This should be provided by the Kerberos administrator. The credentials for this principal must be stored in the keytab (`adminKeytabSecret`).

Expand Down
8 changes: 7 additions & 1 deletion rust/krb5-provision-keytab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ krb5 = { path = "../krb5" }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
snafu = "0.7.4"
tokio = { version = "1.25.0", features = ["io-util", "process"] }
tokio = { version = "1.25.0", features = ["io-util", "process", "rt-multi-thread", "macros"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
ldap3 = { version = "0.11.1", default-features = false, features = ["gssapi", "tls"] }
byteorder = "1.4.3"
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.27.1" }
rand = "0.8.5"
native-tls = "0.2.11"
futures = "0.3.28"
Loading