Skip to content

Commit

Permalink
Add HOSTIP variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mattymo committed Apr 5, 2018
1 parent d0bc49d commit b688961
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A well documented, tried and tested Samba Active Directory Domain Controller tha
## Environment variables for quick start
* `DOMAIN` defaults to `SAMDOM.LOCAL` and should be set to your domain
* `DOMAINPASS` should be set to your administrator password, be it existing or new. This can be removed from the environment after the first setup run.
* `HOSTIP` can be set to the IP you want to advertise.
* `JOIN` defaults to `false` and means the container will provision a new domain. Set this to `true` to join an existing domain.
* `JOINSITE` is optional and can be set to a site name when joining a domain, otherwise the default site will be used.
* `DNSFORWARDER` is optional and if an IP such as `192.168.0.1` is supplied will forward all DNS requests samba can't resolve to that DNS server
Expand Down Expand Up @@ -194,6 +195,7 @@ docker run -t -i \
-e "DOMAIN=SAMDOM.LOCAL" \
-e "DOMAINPASS=ThisIsMyAdminPassword" \
-e "DNSFORWARDER=192.168.3.1" \
-e "HOSTIP=192.168.3.222" \
-p 192.168.3.222:53:53 \
-p 192.168.3.222:53:53/udp \
-p 192.168.3.222:88:88 \
Expand Down
10 changes: 9 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ appSetup () {
NOCOMPLEXITY=${NOCOMPLEXITY:-false}
INSECURELDAP=${INSECURELDAP:-false}
DNSFORWARDER=${DNSFORWARDER:-NONE}
HOSTIP=${HOSTIP:-NONE}

LDOMAIN=${DOMAIN,,}
UDOMAIN=${DOMAIN^^}
Expand All @@ -26,6 +27,13 @@ appSetup () {
sleep 30
fi

# Set host ip option
if [[ "$HOSTIP" != "NONE" ]]; then
HOSTIP_OPTION="--host-ip=$HOSTIP"
else
HOSTIP_OPTION=""
fi

# Set up samba
mv /etc/krb5.conf /etc/krb5.conf.orig
echo "[libdefaults]" > /etc/krb5.conf
Expand All @@ -42,7 +50,7 @@ appSetup () {
samba-tool domain join ${LDOMAIN} DC -U"${URDOMAIN}\administrator" --password="${DOMAINPASS}" --dns-backend=SAMBA_INTERNAL --site=${JOINSITE}
fi
else
samba-tool domain provision --use-rfc2307 --domain=${URDOMAIN} --realm=${UDOMAIN} --server-role=dc --dns-backend=SAMBA_INTERNAL --adminpass=${DOMAINPASS}
samba-tool domain provision --use-rfc2307 --domain=${URDOMAIN} --realm=${UDOMAIN} --server-role=dc --dns-backend=SAMBA_INTERNAL --adminpass=${DOMAINPASS} ${HOSTIP_OPTION}
if [[ ${NOCOMPLEXITY,,} == "true" ]]; then
samba-tool domain passwordsettings set --complexity=off
samba-tool domain passwordsettings set --history-length=0
Expand Down

0 comments on commit b688961

Please sign in to comment.