CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/test/ldap/samba-ad-setup.sh
Views: 11766
1
#!/bin/bash
2
3
set -e
4
5
info () {
6
echo "[INFO] $@"
7
}
8
9
info "Running setup"
10
11
# Check if samba is setup
12
[ -f /var/lib/samba/.setup ] && info "Already setup..." && exit 0
13
14
info "Provisioning domain controller..."
15
16
info "Given admin password: ${SMB_ADMIN_PASSWORD}"
17
18
rm /etc/samba/smb.conf
19
20
samba-tool domain provision\
21
--server-role=dc\
22
--use-rfc2307\
23
--dns-backend=SAMBA_INTERNAL\
24
--realm=`hostname`\
25
--domain=DEV-AD\
26
--adminpass=${SMB_ADMIN_PASSWORD}\
27
--option='server services = ldap'
28
29
mv /etc/samba/smb.conf /var/lib/samba/private/smb.conf
30
31
touch /var/lib/samba/.setup
32
33