-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Samba for Kerberos authentication
- Loading branch information
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ dist/ | |
docker-compose.override.yml | ||
# test/conftest.py creates .env files | ||
.env | ||
test/samba.keytab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
samba-tool spn add ldap/samba1.ldap2pg.docker SAMBA1$ | ||
samba-tool spn add ldap/localhost SAMBA1$ | ||
samba-tool spn add ldap/localhost.localdomain SAMBA1$ | ||
|
||
# Get Gateway (field 3) from default route (destination is 0.0.0.0). | ||
gateway_hex="$(grep -E '^\w+\s+00000000' /proc/net/route | cut -f 3)" | ||
gateway_bytes=( # IP is little endian. | ||
$((16#${gateway_hex:6:2})) | ||
$((16#${gateway_hex:4:2})) | ||
$((16#${gateway_hex:2:2})) | ||
$((16#${gateway_hex:0:2})) | ||
) | ||
printf -v gateway "%d.%d.%d.%d" "${gateway_bytes[@]}" | ||
|
||
samba-tool spn add "ldap/$gateway" SAMBA1$ | ||
samba-tool spn list SAMBA1$ | ||
samba-tool domain exportkeytab /test/samba.keytab --principal=Administrator | ||
chown -v "$(stat -c %u:%g "${BASH_SOURCE[0]}")" /test/samba.keytab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[libdefaults] | ||
ticket_lifetime = 24h | ||
renew_lifetime = 7d | ||
forwardable = true | ||
rdns = false | ||
default_realm = BRIDOULOU.FR | ||
default_keytab_name = FILE:test/samba.keytab | ||
|
||
[realms] | ||
BRIDOULOU.FR = { | ||
kdc = samba1.ldap2pg.docker | ||
admin_server = samba1.ldap2pg.docker | ||
} | ||
|
||
[domain_realm] | ||
.ldap2pg.docker = BRIDOULOU.FR | ||
ldap2pg.docker = BRIDOULOU.FR |