Browse Source

Merge pull request #1 from mattymo/hostip

Add HOSTIP variable
Fmstrat 7 years ago
parent
commit
2c49caaff7
2 changed files with 11 additions and 1 deletions
  1. 2 0
      README.md
  2. 9 1
      init.sh

+ 2 - 0
README.md

@@ -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
@@ -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 \

+ 9 - 1
init.sh

@@ -13,6 +13,7 @@ appSetup () {
 	NOCOMPLEXITY=${NOCOMPLEXITY:-false}
 	INSECURELDAP=${INSECURELDAP:-false}
 	DNSFORWARDER=${DNSFORWARDER:-NONE}
+	HOSTIP=${HOSTIP:-NONE}
 	
 	LDOMAIN=${DOMAIN,,}
 	UDOMAIN=${DOMAIN^^}
@@ -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
@@ -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