Web lists-archives.com

Re: [Samba] ldb*, -H, multiple source?




On Tue, 14 Nov 2017 17:31:15 +0100
Marco Gaiarin via samba <samba@xxxxxxxxxxxxxxx> wrote:

> 
> There's some sintyax available to use, with ldb* tools, multiple
> ''server'', eg use multiple '-H', or write server in a roud-robin
> style?
> 
> Thanks.
> 

No, there is no way built into samba-tool to do what you are asking,
you will have to script something around samba-tool, something like
this:

#!/bin/bash

### Get DNS domain
DNSDOMAIN=$(hostname -d)
# Find DCs FQDN
DCS=$(host -t SRV "_ldap._tcp.${DNSDOMAIN}." | awk '{print $NF}')
# Exit if no DCs found
if [ -z "${DCS}" ]; then
    echo "Could not find an AD DC."
    exit 1
fi
# Use whichever DC is found first
DC=$(echo "$DCS" | head -n 1)
# This removes the trailing dot
DC="${DC::-1}"

echo "Use this DC: $DC"

exit 0

Rowland

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba