Instalando o Samba 4
Instalando o Samba 4
Instalando o Samba 4
What's up folks, here I show you how to install and configuring the Samba 4 working as PDC and how
to configure the BDC as well, I shall use the BIND_DLZ as backend. I going to cover the Sysvol
replication but it's only a workaround as (Samba AD currently doesn't provide support for SysVol
replication.) as we cannot forget we need to configure the backup and restore too. Let's roll up our
sleeves and start to work.
NOTE: I shall work with the samba 4 4.2.2 the current stable today: 04/05/2015
NOTE: If you use Bind as Backend for your Samba AD, it must not run chroot, because it must be able
to live access files and databases from your Samba installation.
Debian Jessie
IP: 192.168.25.100/24
name: samba1
domain: douglas.lan
Debian Jessie
IP: 192.168.25.101/24
name: samba2
domain: douglas.lan
We shall need to install some packets and configure some environment variables in order to work with
our system properly therefore I've created a script to configure such things the web link is follows:
http://wiki.douglasqsantos.com.br/doku.php/confinicialjessie_en fell free to change it as needed.
Note: The repositories in the script are from Brazil that is the most fast to me, so fell free to change
for your country.
After download the script need to convert it from dos to unix as follows
dos2unix ConfInicialJessie.sh
chmod +x ConfInicialJessie.sh
./ConfInicialJessie.sh
export DEBIAN_PRIORITY=critical
export DEBIAN_FRONTEND=noninteractive
Now we need to install some prerequisites that will able the samba4 works properly.
Now we need to enable the acl,user_xattr and barrier support in the / partition or another one that we
need the samba works such as /var or /srv.
vim /etc/fstab
[...]
/dev/mapper/VolGroup-lv_root / ext4
defaults,acl,user_xattr,barrier=1 1 1
Now we need to remount the partitions with the changes or reboot the server to get the newest
changes.
mount -o remount /
mount -o remount /var
The Debian Jessie is different from both CentOS 6 or Debian Wheezy if we try to get the information
about the acl or xattr the system will return nothing about it let's try.
As we saw the acl is built-in in the kernel what's why we got nothing with the mount command.
cd /usr
touch test.txt
getfattr -d test.txt
# file: test.txt
user.test="test"
Now let's access the directory that will storage the samba sources
cd /usr/src
wget -c http://ftp.samba.org/pub/samba/stable/samba-4.2.2.tar.gz
cd samba-4.2.2
make
make install
echo "export
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X
11:/usr/local/samba/sbin:/usr/local/samba/bin">> /root/.bashrc
source /root/.bashrc
cd /usr/src
apt-get source bind9
cd bind9-*
Now we need to change the variables enable support to kerberos and dlopen as follows
vim debian/rules
[...]
./configure --prefix=/usr \
--mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--sysconfdir=/etc/bind \
--localstatedir=/var \
--enable-threads \
--enable-largefile \
--with-libtool \
--enable-shared \
--enable-static \
--with-openssl=/usr \
--with-gssapi=/usr \
--with-gnu-ld \
--with-geoip=/usr \
--with-atf=no \
--enable-ipv6 \
--enable-rrl \
--enable-filter-aaaa \
--with-libxml2 \
--with-gssapi=/usr/include/gssapi \
--with-dlopen=yes \
--with-dlz-ldap=yes \
--with-dlz-filesystem=yes \
$(EXTRA_FEATURES)
dpkg-buildpackage
cd ..
dpkg -i *.deb
mkdir /var/cache/bind/{data,dynamic}
chown -R bind:bind /var/cache/bind/
chmod -R 775 /var/cache/bind/dynamic
cp /etc/bind/named.conf.options /etc/bind/named.conf.options.old
vim /etc/bind/named.conf.options
#/etc/bind/named.conf.options
options {
listen-on port 53 { 127.0.0.1; 192.168.25.0/24; };
listen-on-v6 port 53 { ::1; };
directory "/var/cache/bind";
dump-file "/var/cache/bind/data/cache_dump.db";
statistics-file "/var/cache/bind/data/named_stats.txt";
memstatistics-file "/var/cache/bind/data/named_mem_stats.txt";
allow-query { 192.168.25.0/24; 127.0.0.1/32; };
allow-update { 127.0.0.1/32; };
allow-recursion { 192.168.25.0/24; 127.0.0.1/32; };
forwarders { 8.8.8.8; 8.8.4.4; };
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Dynamic keys */
managed-keys-directory "/var/cache/bind/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
Now we need do modify the named.conf and add the configuration file for samba
vim /etc/bind/named.conf
[...]
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
include "/usr/local/samba/private/named.conf";
vim /etc/resolv.conf
domain douglas.lan
search douglas.lan
nameserver 192.168.25.100
Now we need to provisioning our domain, let's check the options available
Provision a domain.
Options:
-h, --help show this help message and exit
--interactive Ask for names
--domain=DOMAIN set domain
--domain-guid=GUID set domainguid (otherwise random)
--domain-sid=SID set domainsid (otherwise random)
--ntds-guid=GUID set NTDS object GUID (otherwise random)
--invocationid=GUID set invocationid (otherwise random)
--host-name=HOSTNAME set hostname
--host-ip=IPADDRESS set IPv4 ipaddress
--host-ip6=IP6ADDRESS
set IPv6 ipaddress
Version Options:
-V, --version Display version number
If you got some error and need to do the provisioning again execute the follow commands and run the
provisioning again.
rm -rf /usr/local/samba/etc
rm -rf /usr/local/samba/private
rm -rf /usr/local/samba/var/locks/sysvol
Now we need to change the samba configuration, but first we need to make a copy of smb.conf
cp -Rfa /usr/local/samba/etc/smb.conf{,.bkp}
vim /usr/local/samba/etc/smb.conf
# Global parameters
[global]
workgroup = DOUGLAS
realm = douglas.lan
netbios name = SAMBA1
server role = active directory domain controller
server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
### RPC ###
rpc_server:tcpip = no
rpc_daemon:spoolssd = embedded
rpc_server:spoolss = embedded
rpc_server:winreg = embedded
rpc_server:ntsvcs = embedded
rpc_server:eventlog = embedded
rpc_server:srvsvc = embedded
rpc_server:svcctl = embedded
rpc_server:default = external
### IDMAP ###
idmap_ldb:use rfc2307 = yes
[netlogon]
path = /usr/local/samba/var/locks/sysvol/lab.lan/scripts
read only = No
[sysvol]
path = /usr/local/samba/var/locks/sysvol
read only = No
Now we need to create the directory that will store the samba log files
mkdir -p /var/log/samba
ln -s /usr/local/samba/private/dns.keytab /etc/krb5.keytab
/usr/local/samba/sbin/samba
smbclient --version
Version 4.2.2
Server Comment
--------- -------
Workgroup Master
--------- -------
Server Comment
--------- -------
Workgroup Master
--------- -------
testparm
Load smb config files from /usr/local/samba/etc/smb.conf
Processing section "[netlogon]"
Processing section "[sysvol]"
Loaded services file OK.
Server role: ROLE_ACTIVE_DIRECTORY_DC
# Global parameters
[global]
workgroup = DOUGLAS
realm = douglas.lan
server role = active directory domain controller
passdb backend = samba_dsdb
log file = /var/log/samba/smbd.log
max log size = 50
load printers = No
printcap name = /dev/null
disable spoolss = Yes
template shell = /bin/bash
winbind enum users = Yes
winbind enum groups = Yes
winbind use default domain = Yes
winbind nss info = rfc2307
server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
winbindd:use external pipes = true
full_audit:priority = notice
full_audit:facility = local5
full_audit:prefix = %U|%I|%m|%S
full_audit:failure = none
full_audit:success = rmdir mkdir open write rename unlink
recycle:keeptree = yes
recycle:exclude = *.tmp *.TMP *.temp *.TEMP ~*
recycle:repository = Recycle
idmap config lab:range = 500-40000
idmap config lab:schema_mode = rfc2307
idmap config lab:backend = ad
idmap config *:range = 70001-80000
idmap_ldb:use rfc2307 = yes
rpc_server:default = external
rpc_server:svcctl = embedded
rpc_server:srvsvc = embedded
rpc_server:eventlog = embedded
rpc_server:ntsvcs = embedded
rpc_server:winreg = embedded
rpc_server:spoolss = embedded
rpc_daemon:spoolssd = embedded
rpc_server:tcpip = no
idmap config * : backend = tdb
printing = bsd
delete veto files = Yes
veto files = /*.mp3/*.wav/*.exe/*.cmd/*.adm/*.inf/*.ini/*.pif
map archive = No
map readonly = no
store dos attributes = Yes
dos filemode = Yes
vfs objects = recycle full_audit
[netlogon]
path = /usr/local/samba/var/locks/sysvol/douglas.lan/scripts
read only = No
[sysvol]
path = /usr/local/samba/var/locks/sysvol
read only = No
nslookup douglas.lan
Server: 127.0.0.1
Address: 127.0.0.1#53
Douglas Quintiliano dos Santos - http://wiki.douglasqsantos.com.br/
Last
update:
installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie http://wiki.douglasqsantos.com.br/doku.php/installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie
2016/02/23
12:44
Name: douglas.lan
Address: 192.168.25.100
cp -Rfa /etc/krb5.conf{,.bkp}
rm -rf /etc/krb5.conf
vim /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = DOUGLAS.LAN
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
kinit administrator@DOUGLAS.LAN
administrator@DOUGLAS.LAN's Password:
klist
Credentials cache: FILE:/tmp/krb5cc_0
Principal: administrator@DOUGLAS.LAN
NOTE: If you try to access the samba share using the kerberos kicket and try to use localhost rather
than the samba1 you will get the follow error
As we can see the server was not found in kerberos database, whether we check the klist
klist
Credentials cache: FILE:/tmp/krb5cc_0
Principal: administrator@DOUGLAS.LAN
Now we need to install and configure the NTP service to have the clock accurate
cp -Rfa /etc/ntp.conf{,.bkp}
vim /etc/ntp.conf
#/etc/ntp.conf
server 127.127.1.0
fudge 127.127.1.0 stratum 10
server a.ntp.br iburst prefer
server b.ntp.br iburst prefer
server c.ntp.br iburst prefer
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/
restrict default kod nomodify notrap nopeer mssntp
restrict 127.0.0.1
restrict a.ntp.br mask 255.255.255.255 nomodify notrap nopeer noquery
restrict b.ntp.br mask 255.255.255.255 nomodify notrap nopeer noquery
restrict c.ntp.br mask 255.255.255.255 nomodify notrap nopeer noquery
ntpq -p 127.0.0.1
remote refid st t when poll reach delay offset
jitter
============================================================================
==
LOCAL(0) .LOCL. 10 l 101 64 6 0.000 0.000
0.002
+a.ntp.br 200.160.7.186 2 u 29 64 5 13.397 -19.867
9.921
*b.ntp.br 200.20.186.76 2 u 26 64 7 18.728 -22.845
7.553
+c.ntp.br 200.160.7.186 2 u 30 64 7 38.183 -24.685
8.156
vim /etc/init.d/samba
#! /bin/sh
#
# Start/stops the Samba daemon (samba).
# Adapted from the Samba 3 packages.
#
PIDDIR=/usr/local/samba/var/run
SAMBAPID=$PIDDIR/samba.pid
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Samba 4 daemon" "samba"
# Make sure we have our PIDDIR, even if it's on a tmpfs
install -o root -g root -m 755 -d $PIDDIR
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping Samba 4 daemon" "samba"
log_end_msg 0
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: /etc/init.d/samba {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
chmod +x /etc/init.d/samba
insserv -f -v samba
Now let's stop the samba service to run a test with our new script
killall samba
/etc/init.d/samba start
[ ok ] Starting samba (via systemctl): samba.service.
Server Comment
--------- -------
Workgroup Master
--------- -------
sysvol Disk
IPC$ IPC IPC Service (Samba 4.2.2)
Domain=[DOUGLAS] OS=[Windows 6.1] Server=[Samba 4.2.2]
Server Comment
--------- -------
Workgroup Master
--------- -------
Now we need to create some symbolic links to enable winbind to work properly as follows for system
working in 32 bits
ln -s /usr/local/samba/lib/libnss_winbind.so /usr/lib/libnss_winbind.so
ln -s /usr/local/samba/lib/libnss_winbind.so.2 /usr/lib/libnss_winbind.so.2
ldconfig
Now we need to create some symbolic links to enable winbind to work properly as follows for system
working in 64 bits
ln -s /usr/local/samba/lib/libnss_winbind.so.2 /usr/lib/x86_64-linux-
gnu/libnss_winbind.so
ln -s /usr/lib/x86_64-linux-gnu/libnss_winbind.so /usr/lib/x86_64-linux-
gnu/libnss_winbind.so.2
ldconfig
vim /etc/nsswitch.conf
[...]
passwd: compat winbind
[...]
group: compat winbind
If you need to get the RSAT(Admin pack) get in the follow web links:
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
wbinfo -u
Administrator
Guest
krbtgt
dns-samba1
samba_dnsupdate --verbose
IPs: ['192.168.25.100']
Looking for DNS entry A samba1.douglas.lan 192.168.25.100 as
samba1.douglas.lan.
Looking for DNS entry A douglas.lan 192.168.25.100 as douglas.lan.
Looking for DNS entry SRV _ldap._tcp.douglas.lan samba1.douglas.lan 389 as
_ldap._tcp.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV _ldap._tcp.douglas.lan
samba1.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.dc._msdcs.douglas.lan
samba1.douglas.lan 389 as _ldap._tcp.dc._msdcs.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV
_ldap._tcp.dc._msdcs.douglas.lan samba1.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.9eac9ae0-2e73-4c8c-
b78e-9554cb9eadee.domains._msdcs.douglas.lan samba1.douglas.lan 389 as
_ldap._tcp.9eac9ae0-2e73-4c8c-b78e-9554cb9eadee.domains._msdcs.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV
_ldap._tcp.9eac9ae0-2e73-4c8c-b78e-9554cb9eadee.domains._msdcs.douglas.lan
samba1.douglas.lan 389
Looking for DNS entry SRV _kerberos._tcp.douglas.lan samba1.douglas.lan 88
as _kerberos._tcp.douglas.lan.
Checking 0 100 88 samba1.douglas.lan. against SRV _kerberos._tcp.douglas.lan
samba1.douglas.lan 88
Looking for DNS entry SRV _kerberos._udp.douglas.lan samba1.douglas.lan 88
as _kerberos._udp.douglas.lan.
Checking 0 100 88 samba1.douglas.lan. against SRV _kerberos._udp.douglas.lan
samba1.douglas.lan 88
Looking for DNS entry SRV _kerberos._tcp.dc._msdcs.douglas.lan
samba1.douglas.lan 88 as _kerberos._tcp.dc._msdcs.douglas.lan.
Checking 0 100 88 samba1.douglas.lan. against SRV
_kerberos._tcp.dc._msdcs.douglas.lan samba1.douglas.lan 88
Looking for DNS entry SRV _kpasswd._tcp.douglas.lan samba1.douglas.lan 464
as _kpasswd._tcp.douglas.lan.
Checking 0 100 464 samba1.douglas.lan. against SRV _kpasswd._tcp.douglas.lan
samba1.douglas.lan 464
Looking for DNS entry SRV _kpasswd._udp.douglas.lan samba1.douglas.lan 464
as _kpasswd._udp.douglas.lan.
Checking 0 100 464 samba1.douglas.lan. against SRV _kpasswd._udp.douglas.lan
samba1.douglas.lan 464
Looking for DNS entry CNAME d6a2ff47-5541-4197-
b729-3fb4b82e5b42._msdcs.douglas.lan samba1.douglas.lan as
d6a2ff47-5541-4197-b729-3fb4b82e5b42._msdcs.douglas.lan.
Looking for DNS entry SRV _ldap._tcp.Default-First-Site-
Name._sites.douglas.lan samba1.douglas.lan 389 as _ldap._tcp.Default-First-
Site-Name._sites.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV _ldap._tcp.Default-First-
Site-Name._sites.douglas.lan samba1.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.Default-First-Site-
Name._sites.dc._msdcs.douglas.lan samba1.douglas.lan 389 as
_ldap._tcp.Default-First-Site-Name._sites.dc._msdcs.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV _ldap._tcp.Default-First-
Site-Name._sites.dc._msdcs.douglas.lan samba1.douglas.lan 389
Looking for DNS entry SRV _kerberos._tcp.Default-First-Site-
Name._sites.douglas.lan samba1.douglas.lan 88 as _kerberos._tcp.Default-
First-Site-Name._sites.douglas.lan.
Checking 0 100 88 samba1.douglas.lan. against SRV _kerberos._tcp.Default-
First-Site-Name._sites.douglas.lan samba1.douglas.lan 88
Looking for DNS entry SRV _kerberos._tcp.Default-First-Site-
Name._sites.dc._msdcs.douglas.lan samba1.douglas.lan 88 as
_kerberos._tcp.Default-First-Site-Name._sites.dc._msdcs.douglas.lan.
Checking 0 100 88 samba1.douglas.lan. against SRV _kerberos._tcp.Default-
First-Site-Name._sites.dc._msdcs.douglas.lan samba1.douglas.lan 88
Looking for DNS entry SRV _ldap._tcp.pdc._msdcs.douglas.lan
samba1.douglas.lan 389 as _ldap._tcp.pdc._msdcs.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV
_ldap._tcp.pdc._msdcs.douglas.lan samba1.douglas.lan 389
Looking for DNS entry A gc._msdcs.douglas.lan 192.168.25.100 as
gc._msdcs.douglas.lan.
Looking for DNS entry SRV _gc._tcp.douglas.lan samba1.douglas.lan 3268 as
_gc._tcp.douglas.lan.
Checking 0 100 3268 samba1.douglas.lan. against SRV _gc._tcp.douglas.lan
samba1.douglas.lan 3268
Looking for DNS entry SRV _ldap._tcp.gc._msdcs.douglas.lan
http://wiki.douglasqsantos.com.br/ Printed on 2016/05/25 08:14
Installing and configuring Samba 4 as Master/Slave with Bind9 DLZ and Sysvol Replication on Debian Jessie
2016/05/25 08:14 25/103
(Ongoing)
samba1.douglas.lan 3268 as _ldap._tcp.gc._msdcs.douglas.lan.
Checking 0 100 3268 samba1.douglas.lan. against SRV
_ldap._tcp.gc._msdcs.douglas.lan samba1.douglas.lan 3268
Looking for DNS entry SRV _gc._tcp.Default-First-Site-
Name._sites.douglas.lan samba1.douglas.lan 3268 as _gc._tcp.Default-First-
Site-Name._sites.douglas.lan.
Checking 0 100 3268 samba1.douglas.lan. against SRV _gc._tcp.Default-First-
Site-Name._sites.douglas.lan samba1.douglas.lan 3268
Looking for DNS entry SRV _ldap._tcp.Default-First-Site-
Name._sites.gc._msdcs.douglas.lan samba1.douglas.lan 3268 as
_ldap._tcp.Default-First-Site-Name._sites.gc._msdcs.douglas.lan.
Checking 0 100 3268 samba1.douglas.lan. against SRV _ldap._tcp.Default-
First-Site-Name._sites.gc._msdcs.douglas.lan samba1.douglas.lan 3268
Looking for DNS entry A DomainDnsZones.douglas.lan 192.168.25.100 as
DomainDnsZones.douglas.lan.
Looking for DNS entry SRV _ldap._tcp.DomainDnsZones.douglas.lan
samba1.douglas.lan 389 as _ldap._tcp.DomainDnsZones.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV
_ldap._tcp.DomainDnsZones.douglas.lan samba1.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.Default-First-Site-
Name._sites.DomainDnsZones.douglas.lan samba1.douglas.lan 389 as
_ldap._tcp.Default-First-Site-Name._sites.DomainDnsZones.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV _ldap._tcp.Default-First-
Site-Name._sites.DomainDnsZones.douglas.lan samba1.douglas.lan 389
Looking for DNS entry A ForestDnsZones.douglas.lan 192.168.25.100 as
ForestDnsZones.douglas.lan.
Looking for DNS entry SRV _ldap._tcp.ForestDnsZones.douglas.lan
samba1.douglas.lan 389 as _ldap._tcp.ForestDnsZones.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV
_ldap._tcp.ForestDnsZones.douglas.lan samba1.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.Default-First-Site-
Name._sites.ForestDnsZones.douglas.lan samba1.douglas.lan 389 as
_ldap._tcp.Default-First-Site-Name._sites.ForestDnsZones.douglas.lan.
Checking 0 100 389 samba1.douglas.lan. against SRV _ldap._tcp.Default-First-
Site-Name._sites.ForestDnsZones.douglas.lan samba1.douglas.lan 389
No DNS updates needed
Note: I'm trying to discovery how to fix the (SPNEGO(gssapi_krb5) creating NEG_TOKEN_INIT failed:
NT_STATUS_INVALID_PARAMETER) but so far I have no answer yet, I've sent an email to Andrew
Tridge of Samba project as soon he answer me I'm going to post the fix.
dig -x 192.168.25.100
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;100.25.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
100.25.168.192.in-addr.arpa. 900 IN PTR samba1.douglas.lan.
;; AUTHORITY SECTION:
25.168.192.in-addr.arpa. 3600 IN NS samba1.douglas.lan.
;; ADDITIONAL SECTION:
samba1.douglas.lan. 900 IN A 192.168.25.100
host 192.168.25.100
100.25.168.192.in-addr.arpa domain name pointer samba1.douglas.lan.
Now we need to update all the records to make sure that everything is working as needed
;; UPDATE SECTION:
_kerberos._tcp.dc._msdcs.douglas.lan. 900 IN SRV 0 100 88
samba1.douglas.lan.
samba1.douglas.lan.
host -t A samba1.douglas.lan
samba1.douglas.lan has address 192.168.25.100
klist -k
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- -----------------------------------------------------------------------
---
1 DNS/samba1.douglas.lan@DOUGLAS.LAN
1 dns-samba1@DOUGLAS.LAN
1 DNS/samba1.douglas.lan@DOUGLAS.LAN
1 dns-samba1@DOUGLAS.LAN
1 DNS/samba1.douglas.lan@DOUGLAS.LAN
1 dns-samba1@DOUGLAS.LAN
1 DNS/samba1.douglas.lan@DOUGLAS.LAN
1 dns-samba1@DOUGLAS.LAN
1 DNS/samba1.douglas.lan@DOUGLAS.LAN
1 dns-samba1@DOUGLAS.LAN
PAM Configuration
Now we need to configure the PAM, here I'll allow only users from group it-admin to login in the PDC.
The group it-admin need to be create in Samba and need to get a valid shell.
Now we need to create a symbolic link from samba security directory to default security directory in
the System, Here I'm using the 64 bit system that's why we need to use the /lib/x86_64-linux-gnu
otherwise we need to create to another directory. If you don't know where is stored the another
libraries of PAM do a search about “pam_umask.so” and put the symbolic link there.
Let's start configuring the common-auth that controls authentication settings common to all services.
vim /etc/pam.d/common-auth
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
Let's configure the common-account that controls authorization settings common to all services.
vim /etc/pam.d/common-account
#
# /etc/pam.d/common-account - authorization settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authorization modules that define
# the central access policy for use on the system. The default is to
Let's configure the common-session that controls session related modules common to all services
vim /etc/pam.d/common-session
#
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of sessions of *any* kind (both interactive and
# non-interactive).
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
Let's configure the sshd that controls configuration for the Secure Shell service
vim /etc/pam.d/sshd
# PAM configuration for the Secure Shell service
Let's configure the login that controls configuration for shadow 'login' service
vim /etc/pam.d/login
#
# The PAM configuration file for the Shadow `login' service
#
# SELinux needs to be the first session rule. This ensures that any
# lingering context has been cleared. Without out this it is possible
# that a module could execute code in the wrong domain.
Now let's configure the sudo to enable the it-admin group work as root user.
visudo
[...]
"%DOUGLAS\it-admin" ALL=(ALL) ALL
Now we need to restart the server to reload all the new configurations
reboot
After the reboot we can try logon in with douglas.q.santos or logon with root and change to another
user as follows
root@samba1:~# su - douglas.q.santos
Now let's back to root user and let's check the winbind connection.
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
wbinfo -u
Administrator
Guest
krbtgt
dns-samba1
douglas.q.santos
ssh douglas.q.santos@192.168.25.100 -p 22
douglas.q.santos@192.168.25.100's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
DOUGLAS\douglas.q.santos@samba1:~$ sudo -i
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
tail -f /var/log/auth.log
Jun 7 11:33:39 samba1 sshd[1426]: pam_succeed_if(sshd:account): requirement
"user ingroup sudo" not met by user "DOUGLAS\douglas.q.santos"
Everything is ok so far.
Samba 4 Backup
The backup script is not installed when we run the command make install therefore we need to copy
it to some location like /bin
cp /usr/src/samba-4.2.2/source4/scripting/bin/samba_backup /usr/sbin
vim /usr/sbin/samba_backup
[...]
FROMWHERE=/usr/local/samba
WHERE=/usr/local/backups
[...]
DAYS=15
Above we have:
Now we need to create the directory that will store the backups
mkdir /usr/local/backups
/usr/sbin/samba_backup
After the script finish the task we will get something like bellow.
ls -l /usr/local/backups
total 12164
-rw-r--r-- 1 root staff 1310 Jun 11 10:35 etc.2015-06-11.tar.bz2
-rw-r--r-- 1 root staff 12447369 Jun 11 10:35
samba4_private.2015-06-11.tar.bz2
-rw-r--r-- 1 root staff 546 Jun 11 10:35 sysvol.2015-06-11.tar.bz2
etc.{Timestamp}.tar.bz2
samba4_private.{Timestamp}.tar.bz2
sysvol.{Timestamp}.tar.bz2
crontab -e
0 2 * * * /usr/sbin/samba_backup
Samba 4 Restore
Note:
The backup and restore must be from the same version of samba in another words from 4.2.2
to 4.2.2
The restore must be executed in a machine with the same name and ip of the backup was
created.
It's best practice always restore a backup in the same OS like from Debian to Debian. (I try to
backup from a CentOS and restore in a Debian and it doesn't work).
Always after the restore is a good advice test all shares, permissions and stuffs like take to
make sure that everything is ok to work before to put in production.
If the system got a crash you need first of all is reconfigure all samba server and restore the
backup considering all the another things above.
Before restore the samba we need to assure that the samba is down.
/etc/init.d/samba stop
rm -rf /usr/local/samba/etc
rm -rf /usr/local/samba/private
rm -rf /usr/local/samba/var/locks/sysvol
Now we need to restore the samba, let's access the backup directory and extract the files.
cd /usr/local/backups
tar -jxf etc.2015-06-11.tar.bz2 -C /usr/local/samba
tar -jxf samba4_private.2015-06-11.tar.bz2 -C /usr/local/samba
tar -jxf sysvol.2015-06-11.tar.bz2 -C /usr/local/samba
Now we need to rename the files with extension *.ldb.bak in the directory private to *.ldb
If you are using the BIND_DLZ as backend we need to fix the hard links
samba_upgradedns --dns-backend=BIND9_DLZ
/etc/init.d/samba start
wbinfo -u
Administrator
Guest
wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
it-admin
Here select Internet Protocol Version 4 (TCP/IPv4) and select Properties here we need to
put the Preferred DNS server as: 192.168.25.100
Now we need to put the user as: administrator and its password and Select OK if everything is
Now Click OK we will get another message box with a warning about that we need to restart the
machine to apply the changes and click OK and Close
After restart choose Switch User the (right arrow into a circle). In the username put:
douglas\administrator and put its password and Enter
How to Install Admin Tools On Windows 8 – (Remote Server Administration Tools – RSAT)
After that we will get the DNS Manager we can manager the dns records here instead of via
Shell.
Creating Shares
The creating of samba shares is more easier than in the samba 3 in my point of view, we can create
the share and managing them via Windows.
Note: We must be the owner of the directory or must belong of the group owner to display or
managing the permissions.
Let's enable the administrator of domain to managing the shares via Windows.
vim /usr/local/samba/etc/smb.conf
[...]
[Demo]
path = /srv/samba/Demo/
read only = no
mkdir -p /srv/samba/Demo/
Now in the Windows with a user that belongs of Domain Admins group here I shall use administrator
Now with the right click in Computer Management select Connect to another computer…
Now in Another computer put: 192.168.25.100 and click OK
Now browser until System Tools/Shared Folders/Share and select our new share called Demo
Now in the tab Share Permissions. Here we can configure who will be able to access the share.
Now in the tab Security we can managing who will be able to read/execute/modify the files and
folders.
Roaming Profile
mkdir -p /srv/samba/Profiles/
vim /usr/local/samba/etc/smb.conf
[...]
[Profiles]
path = /srv/samba/Profiles/
read only = no
After that:
Apply
OK
OK
OK
Now select OK
Now we can logon with that user and check if the profile was created in:
/srv/samba/Profiles/
After login with the user douglas.q.santos we shall get something like bellow.
ls -l /srv/samba/Profiles
total 8
drwxrwx---+ 2 DOUGLAS\douglas.q.santos users 4096 Jun 11 16:44
Logon Script
Note: Here I will use the user douglas.q.santos and this user need to has the permission to access the
share or belongs to a groups that has the permission
vim /usr/local/samba/var/locks/sysvol/douglas.lan/scripts/sharedemo.bat
net use x: \\samba1.douglas.lan\Demo
chmod +x /usr/local/samba/var/locks/sysvol/douglas.lan/scripts/sharedemo.bat
unix2dos /usr/local/samba/var/locks/sysvol/douglas.lan/scripts/sharedemo.bat
Now let's logon with the user douglas.q.santos, after the login we will get something like below.
Configuração do SLAVE
Agora vamos ajustar o fstab para que ele de suporte a acl,user_xattr e barrier eu vou habilitar isso na
partição / se você tiver várias partições é bom habilitar em todas que você queira habilitar os
compartilhamentos.
vim /etc/fstab
[...]
/dev/mapper/VolGroup-lv_root / ext4
defaults,acl,user_xattr,barrier=1 1 1
mount -o remount /
Agora vamos obter o samba vamos acessar o diretório que vai armazenar os fontes
cd /usr/src
wget -c http://ftp.samba.org/pub/samba/stable/samba-4.1.3.tar.gz
cd samba-4.1.3
make
make install
Agora vamos acertar a PATH do usuário root no caso dele estar utilizando o shell Bash
echo "export
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X
11:/usr/local/samba/sbin:/usr/local/samba/bin">> /root/.bashrc
source /root/.bashrc
Agora vamos acertar a PATH do usuário root no caso dele estar utilizando o shell zsh
echo "export
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X
11:/usr/local/samba/sbin:/usr/local/samba/bin">> /root/.zshrc
source /root/.zshrc
Agora vamos ajustar o resolv.conf ele vai utilizar o nome do nosso domínio e o ip do pdc.
vim /etc/resolv.conf
domain douglas.lan
search douglas.lan
nameserver 192.168.0.25
Agora vamos ajustar a interface de rede para utilizar o nosso novo DNS
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
BROADCAST="192.168.0.255"
DNS1="192.168.0.26"
GATEWAY="192.168.0.1"
IPADDR="192.168.0.25"
NETMASK="255.255.255.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
vim /etc/named.conf
//named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.0.0/24; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { 192.168.0.0/24; localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
/*Arquivo de configuração do samba4 que informa a localização do bind_dlz */
include "/usr/local/samba/private/named.conf";
vim /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = DOUGLAS.LAN
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes
[appdefaults]
pam = {
kinit administrator
Password for administrator@DOUGLAS.LAN:
Warning: Your password will expire in 41 days on Mon Oct 7 12:02:11 2013
Partition[CN=Configuration,DC=douglas,DC=lan] objects[402/1625]
linked_values[0/0]
Partition[CN=Configuration,DC=douglas,DC=lan] objects[804/1625]
linked_values[0/0]
Partition[CN=Configuration,DC=douglas,DC=lan] objects[1206/1625]
linked_values[0/0]
Partition[CN=Configuration,DC=douglas,DC=lan] objects[1608/1625]
linked_values[0/0]
Partition[CN=Configuration,DC=douglas,DC=lan] objects[1625/1625]
linked_values[28/0]
Replicating critical objects from the base DN of the domain
Partition[DC=douglas,DC=lan] objects[98/98] linked_values[25/0]
Partition[DC=douglas,DC=lan] objects[375/277] linked_values[26/0]
Done with always replicated NC (base, config, schema)
Replicating DC=DomainDnsZones,DC=douglas,DC=lan
Partition[DC=DomainDnsZones,DC=douglas,DC=lan] objects[40/40]
linked_values[0/0]
Replicating DC=ForestDnsZones,DC=douglas,DC=lan
Partition[DC=ForestDnsZones,DC=douglas,DC=lan] objects[18/18]
linked_values[0/0]
Partition[DC=ForestDnsZones,DC=douglas,DC=lan] objects[36/18]
linked_values[0/0]
Committing SAM database
Sending DsReplicateUpdateRefs for all the replicated partitions
Setting isSynchronized and dsServiceName
Setting up secrets database
Joined domain DOUGLAS (SID S-1-5-21-2011945809-1847694634-1467046014) as a
DC
vim /etc/init.d/samba
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the Samba smbd daemon \
# used to provide SMB network services.
#
# pidfile: /var/run/samba/smbd.pid
# config: /etc/samba/smb.conf
if [ -f /etc/sysconfig/samba ]; then
. /etc/sysconfig/samba
fi
RETVAL=0
start() {
KIND="SMB"
echo -n $"Starting $KIND services: "
/usr/local/samba/sbin/samba
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /usr/local/samba/var/lock/smb || \
RETVAL=1
return $RETVAL
}
stop() {
KIND="SMB"
echo -n $"Shutting down $KIND services: "
killproc smbd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /usr/local/samba/var/lock/smb
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading smb.conf file: "
rhstatus() {
status -l smb smbd
return $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/smb ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
exit 2
esac
exit $?
Agora vamos dar permissão para o nosso script e vamos inserir ele na incialização
chmod +x /etc/init.d/samba
chkconfig --add samba
/etc/init.d/named start
/etc/init.d/samba start
smbclient --version
Version 4.1.3
Server Comment
--------- -------
Workgroup Master
--------- -------
testparm
Load smb config files from /usr/local/samba/etc/smb.conf
rlimit_max: increasing rlimit_max (4096) to minimum Windows limit (16384)
Processing section "[netlogon]"
Processing section "[sysvol]"
Loaded services file OK.
Server role: ROLE_ACTIVE_DIRECTORY_DC
Press enter to see a dump of your service definitions
[global]
workgroup = DOUGLAS
realm = douglas.lan
server role = active directory domain controller
passdb backend = samba_dsdb
server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
rpc_server:tcpip = no
rpc_daemon:spoolssd = embedded
rpc_server:spoolss = embedded
rpc_server:winreg = embedded
rpc_server:ntsvcs = embedded
rpc_server:eventlog = embedded
rpc_server:srvsvc = embedded
[netlogon]
path = /usr/local/samba/var/locks/sysvol/douglas.lan/scripts
read only = No
[sysvol]
path = /usr/local/samba/var/locks/sysvol
read only = No
vim /etc/security/limits.conf
#colocar no final do arquivo
root hard nofile 131072
root soft nofile 65536
mioutente hard nofile 32768
mioutente soft nofile 16384
nslookup douglas.lan
Server: 192.168.0.25
Address: 192.168.0.25#53
Name: douglas.lan
Address: 192.168.0.25
Name: douglas.lan
Address: 192.168.0.26
mv /etc/krb5.conf /etc/krb5.conf.old
Vamos criar um link para o sistema reconhecer o arquivo de configuração do samba como default
vim /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = DOUGLAS.LAN
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
ln -s /usr/local/samba/private/dns.keytab /etc/krb5.keytab
Agora vamos ajustar a configuração do samba para que ele consiga mapear via winbind
vim /usr/local/samba/etc/smb.conf
[global]
workgroup = DOUGLAS
realm = douglas.lan
netbios name = NODO2
server role = active directory domain controller
passdb backend = samba_dsdb
server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
rpc_server:tcpip = no
rpc_daemon:spoolssd = embedded
rpc_server:spoolss = embedded
rpc_server:winreg = embedded
rpc_server:ntsvcs = embedded
rpc_server:eventlog = embedded
rpc_server:srvsvc = embedded
rpc_server:svcctl = embedded
rpc_server:default = external
#IDMAP
idmap_ldb:use rfc2307 = yes
idmap config * : backend = tdb
idmap config *:range = 70001-80000
idmap config DOUGLAS:backend = ad
idmap config DOUGLAS:schema_mode = rfc2307
[netlogon]
path = /usr/local/samba/var/locks/sysvol/douglas.lan/scripts
read only = No
[sysvol]
path = /usr/local/samba/var/locks/sysvol
read only = No
mkdir -p /var/log/samba
Agora precisamos ajustar as bibliotecas do winbind para os sistemas de 32bits precisamos fazer da
seguinte forma
ln -s /usr/local/samba/lib/libnss_winbind.so /lib
ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2
ldconfig
ln -s /usr/local/samba/lib/libnss_winbind.so /lib64
ln -s /lib64/libnss_winbind.so /lib64/libnss_winbind.so.2
ldconfig
vim /etc/nsswitch.conf
[...]
passwd: files winbind
[...]
group: files winbind
kinit administrator
Password for administrator@DOUGLAS.LAN:
Warning: Your password will expire in 41 days on Mon Oct 7 12:02:11 2013
klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: administrator@DOUGLAS.LAN
cp /etc/ntp.conf /etc/ntp.conf.old
vim /etc/ntp.conf
server 127.127.1.0
/etc/init.d/ntpd start
ntpq -p 127.0.0.1
remote refid st t when poll reach delay offset
jitter
============================================================================
==
LOCAL(0) .LOCL. 10 l - 64 1 0.000 0.000
0.000
a.ntp.br .INIT. 16 u - 64 0 0.000 0.000
0.000
a.st1.ntp.br .INIT. 16 u - 64 0 0.000 0.000
0.000
roma.coe.ufrj.b .INIT. 16 u - 64 0 0.000 0.000
0.000
ntpdate -u a.ntp.br
http://www.microsoft.com/download/details.aspx?id=28972 (Windows 8)
http://www.microsoft.com/downloads/details.aspx?FamilyId=9FF6E897-23CE-4A36-B7FC-D5206
5DE9960&displaylang=en (Vista)
http://www.microsoft.com/downloads/details.aspx?FamilyID=7D2F6AD7-656B-4313-A005-4E344
E43997D&displaylang=en (Windows 7)
http://www.microsoft.com/en-us/download/details.aspx?id=6315 (Windows XP/Server 2003)
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
ti-admin
wbinfo -u
Administrator
Guest
krbtgt
dns-nodo1
douglas.santos
samba_dnsupdate --verbose
IPs: ['192.168.0.26']
Skipping PDC entry (SRV _ldap._tcp.pdc._msdcs.${DNSDOMAIN}
${HOSTNAME} 389) as we are not a PDC
Skipping PDC entry (SRV _ldap._tcp.pdc._msdcs.${DNSFOREST}
${HOSTNAME} 389) as we are not a PDC
Looking for DNS entry A douglas.lan 192.168.0.26 as douglas.lan.
http://wiki.douglasqsantos.com.br/ Printed on 2016/05/25 08:14
Installing and configuring Samba 4 as Master/Slave with Bind9 DLZ and Sysvol Replication on Debian Jessie
2016/05/25 08:14 77/103
(Ongoing)
Looking for DNS entry A nodo2.douglas.lan 192.168.0.26 as nodo2.douglas.lan.
Looking for DNS entry A gc._msdcs.douglas.lan 192.168.0.26 as
gc._msdcs.douglas.lan.
Looking for DNS entry CNAME ccc206ae-bc66-4a4e-
a282-06aa4613cadd._msdcs.douglas.lan nodo2.douglas.lan as ccc206ae-
bc66-4a4e-a282-06aa4613cadd._msdcs.douglas.lan.
Looking for DNS entry SRV _kpasswd._tcp.douglas.lan nodo2.douglas.lan 464 as
_kpasswd._tcp.douglas.lan.
Checking 0 100 464 nodo2.douglas.lan. against SRV _kpasswd._tcp.douglas.lan
nodo2.douglas.lan 464
Looking for DNS entry SRV _kpasswd._udp.douglas.lan nodo2.douglas.lan 464 as
_kpasswd._udp.douglas.lan.
Checking 0 100 464 nodo1.douglas.lan. against SRV _kpasswd._udp.douglas.lan
nodo2.douglas.lan 464
Checking 0 100 464 nodo2.douglas.lan. against SRV _kpasswd._udp.douglas.lan
nodo2.douglas.lan 464
Looking for DNS entry SRV _kerberos._tcp.douglas.lan nodo2.douglas.lan 88 as
_kerberos._tcp.douglas.lan.
Checking 0 100 88 nodo1.douglas.lan. against SRV _kerberos._tcp.douglas.lan
nodo2.douglas.lan 88
Checking 0 100 88 nodo2.douglas.lan. against SRV _kerberos._tcp.douglas.lan
nodo2.douglas.lan 88
Looking for DNS entry SRV _kerberos._tcp.dc._msdcs.douglas.lan
nodo2.douglas.lan 88 as _kerberos._tcp.dc._msdcs.douglas.lan.
Checking 0 100 88 nodo2.douglas.lan. against SRV
_kerberos._tcp.dc._msdcs.douglas.lan nodo2.douglas.lan 88
Looking for DNS entry SRV _kerberos._tcp.default-first-site-
name._sites.douglas.lan nodo2.douglas.lan 88 as _kerberos._tcp.default-
first-site-name._sites.douglas.lan.
Checking 0 100 88 nodo1.douglas.lan. against SRV _kerberos._tcp.default-
first-site-name._sites.douglas.lan nodo2.douglas.lan 88
Checking 0 100 88 nodo2.douglas.lan. against SRV _kerberos._tcp.default-
first-site-name._sites.douglas.lan nodo2.douglas.lan 88
Looking for DNS entry SRV _kerberos._tcp.default-first-site-
name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 88 as
_kerberos._tcp.default-first-site-name._sites.dc._msdcs.douglas.lan.
Checking 0 100 88 nodo1.douglas.lan. against SRV _kerberos._tcp.default-
first-site-name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 88
Checking 0 100 88 nodo2.douglas.lan. against SRV _kerberos._tcp.default-
first-site-name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 88
Looking for DNS entry SRV _kerberos._udp.douglas.lan nodo2.douglas.lan 88 as
_kerberos._udp.douglas.lan.
Checking 0 100 88 nodo1.douglas.lan. against SRV _kerberos._udp.douglas.lan
nodo2.douglas.lan 88
Checking 0 100 88 nodo2.douglas.lan. against SRV _kerberos._udp.douglas.lan
nodo2.douglas.lan 88
Looking for DNS entry SRV _ldap._tcp.douglas.lan nodo2.douglas.lan 389 as
_ldap._tcp.douglas.lan.
Checking 0 100 389 nodo2.douglas.lan. against SRV _ldap._tcp.douglas.lan
nodo2.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.dc._msdcs.douglas.lan nodo2.douglas.lan
389 as _ldap._tcp.dc._msdcs.douglas.lan.
Checking 0 100 389 nodo1.douglas.lan. against SRV
_ldap._tcp.dc._msdcs.douglas.lan nodo2.douglas.lan 389
Checking 0 100 389 nodo2.douglas.lan. against SRV
_ldap._tcp.dc._msdcs.douglas.lan nodo2.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.gc._msdcs.douglas.lan nodo2.douglas.lan
3268 as _ldap._tcp.gc._msdcs.douglas.lan.
Checking 0 100 3268 nodo2.douglas.lan. against SRV
_ldap._tcp.gc._msdcs.douglas.lan nodo2.douglas.lan 3268
Looking for DNS entry SRV _ldap._tcp.default-first-site-
name._sites.douglas.lan nodo2.douglas.lan 389 as _ldap._tcp.default-first-
site-name._sites.douglas.lan.
Checking 0 100 389 nodo1.douglas.lan. against SRV _ldap._tcp.default-first-
site-name._sites.douglas.lan nodo2.douglas.lan 389
Checking 0 100 389 nodo2.douglas.lan. against SRV _ldap._tcp.default-first-
site-name._sites.douglas.lan nodo2.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.default-first-site-
name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 389 as
_ldap._tcp.default-first-site-name._sites.dc._msdcs.douglas.lan.
Checking 0 100 389 nodo1.douglas.lan. against SRV _ldap._tcp.default-first-
site-name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 389
Checking 0 100 389 nodo2.douglas.lan. against SRV _ldap._tcp.default-first-
site-name._sites.dc._msdcs.douglas.lan nodo2.douglas.lan 389
Looking for DNS entry SRV _ldap._tcp.default-first-site-
name._sites.gc._msdcs.douglas.lan nodo2.douglas.lan 3268 as
_ldap._tcp.default-first-site-name._sites.gc._msdcs.douglas.lan.
Checking 0 100 3268 nodo2.douglas.lan. against SRV _ldap._tcp.default-first-
site-name._sites.gc._msdcs.douglas.lan nodo2.douglas.lan 3268
Looking for DNS entry SRV
_ldap._tcp.15cf6198-7655-4ba1-9563-2682bf9b6483.domains._msdcs.douglas.lan
nodo2.douglas.lan 389 as
_ldap._tcp.15cf6198-7655-4ba1-9563-2682bf9b6483.domains._msdcs.douglas.lan.
Checking 0 100 389 nodo2.douglas.lan. against SRV
_ldap._tcp.15cf6198-7655-4ba1-9563-2682bf9b6483.domains._msdcs.douglas.lan
nodo2.douglas.lan 389
Looking for DNS entry SRV _gc._tcp.douglas.lan nodo2.douglas.lan 3268 as
_gc._tcp.douglas.lan.
Checking 0 100 3268 nodo2.douglas.lan. against SRV _gc._tcp.douglas.lan
nodo2.douglas.lan 3268
Looking for DNS entry SRV _gc._tcp.default-first-site-
name._sites.douglas.lan nodo2.douglas.lan 3268 as _gc._tcp.default-first-
site-name._sites.douglas.lan.
Checking 0 100 3268 nodo1.douglas.lan. against SRV _gc._tcp.default-first-
site-name._sites.douglas.lan nodo2.douglas.lan 3268
Checking 0 100 3268 nodo2.douglas.lan. against SRV _gc._tcp.default-first-
site-name._sites.douglas.lan nodo2.douglas.lan 3268
No DNS updates needed
host -t A nodo2.douglas.lan
nodo2.douglas.lan has address 192.168.0.26
klist -k
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- -----------------------------------------------------------------------
---
1 DNS/nodo2.douglas.lan@DOUGLAS.LAN
1 dns-nodo2@DOUGLAS.LAN
1 DNS/nodo2.douglas.lan@DOUGLAS.LAN
1 dns-nodo2@DOUGLAS.LAN
1 DNS/nodo2.douglas.lan@DOUGLAS.LAN
1 dns-nodo2@DOUGLAS.LAN
1 DNS/nodo2.douglas.lan@DOUGLAS.LAN
1 dns-nodo2@DOUGLAS.LAN
1 DNS/nodo2.douglas.lan@DOUGLAS.LAN
klist -e
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: administrator@DOUGLAS.LAN
# record 2
dn: CN=NTDS Settings,CN=NODO2,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=douglas,DC=lan
objectGUID: ccc206ae-bc66-4a4e-a282-06aa4613cadd
# returned 2 records
# 2 entries
# 0 referrals
CN=Schema,CN=Configuration,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ Mon Aug 26 19:01:06 2013 BRT was successful
0 consecutive failure(s).
Last success @ Mon Aug 26 19:01:06 2013 BRT
DC=DomainDnsZones,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Douglas Quintiliano dos Santos - http://wiki.douglasqsantos.com.br/
Last
update:
installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie http://wiki.douglasqsantos.com.br/doku.php/installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie
2016/02/23
12:44
CN=Configuration,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ Mon Aug 26 19:01:06 2013 BRT was successful
0 consecutive failure(s).
Last success @ Mon Aug 26 19:01:06 2013 BRT
DC=ForestDnsZones,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ Mon Aug 26 19:01:06 2013 BRT was successful
0 consecutive failure(s).
Last success @ Mon Aug 26 19:01:06 2013 BRT
DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ Mon Aug 26 19:01:07 2013 BRT was successful
0 consecutive failure(s).
Last success @ Mon Aug 26 19:01:07 2013 BRT
CN=Schema,CN=Configuration,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ NTTIME(0) was successful
0 consecutive failure(s).
Last success @ NTTIME(0)
DC=DomainDnsZones,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ NTTIME(0) was successful
0 consecutive failure(s).
Last success @ NTTIME(0)
CN=Configuration,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ NTTIME(0) was successful
0 consecutive failure(s).
Last success @ NTTIME(0)
DC=ForestDnsZones,DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
http://wiki.douglasqsantos.com.br/ Printed on 2016/05/25 08:14
Installing and configuring Samba 4 as Master/Slave with Bind9 DLZ and Sysvol Replication on Debian Jessie
2016/05/25 08:14 85/103
(Ongoing)
Last attempt @ NTTIME(0) was successful
0 consecutive failure(s).
Last success @ NTTIME(0)
DC=douglas,DC=lan
Default-First-Site-Name\NODO1 via RPC
DSA object GUID: eae04ba1-3ca2-4ec6-b08c-4962ca4f04b4
Last attempt @ NTTIME(0) was successful
0 consecutive failure(s).
Last success @ NTTIME(0)
Connection --
Connection name: d6fcfc72-89b0-4f4c-88c2-bf887510b6af
Enabled : TRUE
Server DNS name : nodo1.douglas.lan
Server DN name : CN=NTDS Settings,CN=NODO1,CN=Servers,CN=Default-First-
Site-Name,CN=Sites,CN=Configuration,DC=douglas,DC=lan
TransportType: RPC
options: 0x00000001
Warning: No NC replicated for Connection!
Agora vamos a configuração da PAM, com isso vamos poder autenticar os usuários do domínio no
Linux eu vou deixar habilitado somente o grupo do root e o ti-admin que terá que ser criado no AD
para autenticar no Linux e obter um shell.
Vamos criar um link para a biblioteca de autenticação do winbind que foi compilada para sistemas
64bits
ln -sf /usr/local/samba/lib/security/pam_winbind.so
/lib64/security/pam_winbind.so
Vamos criar um link para a biblioteca de autenticação do winbind que foi compilada para sistemas
32bits
ln -sf /usr/local/samba/lib/security/pam_winbind.so
/lib/security/pam_winbind.so
Vamos alterar o system-auth para que quando o usuário for logar no sistema seja criado o diretório
home dele com o conteúdo do diretório /etc/skel
vim /etc/pam.d/system-auth
#%PAM-1.0
vim /etc/pam.d/login
#%PAM-1.0
auth sufficient pam_winbind.so
auth [user_unknown=ignore success=ok ignore=ignore default=bad]
pam_securetty.so
auth include system-auth
vim /etc/pam.d/sshd
#%PAM-1.0
auth sufficient pam_winbind.so
auth include system-auth
Como esse servidor é uma replica do pdc devemos já ter os usuários e grupos somente vamos
consultar eles
wbinfo -u
Administrator
Guest
krbtgt
dns-nodo1
douglas.santos
wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
ti-admin
reboot
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
Eu já estou com o meu usuário douglas.santos e ele pertence ao grupo ti-admin agora vamos testar a
conexão via ssh
ssh douglas.santos@192.168.0.26
douglas.santos@192.168.0.26's password:
Creating directory '/home/DOUGLAS/douglas.santos'.
[19:08:04] DOUGLAS\douglas.santos@nodo2 [~] $
tail -f /var/log/secure
Aug 26 19:08:03 nodo2 sshd[1222]: pam_winbind(sshd:auth): getting password
(0x00000000)
Aug 26 19:08:03 nodo2 sshd[1222]: pam_winbind(sshd:auth): user
'douglas.santos' granted access
Aug 26 19:08:03 nodo2 sshd[1222]: pam_succeed_if(sshd:account): requirement
"user ingroup root" not met by user "DOUGLAS\douglas.santos"
Aug 26 19:08:04 nodo2 sshd[1222]: pam_winbind(sshd:account): user
'DOUGLAS\douglas.santos' granted access
Aug 26 19:08:04 nodo2 sshd[1222]: pam_succeed_if(sshd:account): requirement
"user ingroup ti-admin" was met by user "DOUGLAS\douglas.santos"
Aug 26 19:08:04 nodo2 sshd[1222]: Accepted password for douglas.santos from
192.168.0.130 port 48754 ssh2
Aug 26 19:08:04 nodo2 sshd[1222]: pam_unix(sshd:session): session opened for
user DOUGLAS\douglas.santos by (uid=0)
Replicação do Sysvol
Aqui eu vou abordar como é recomendado pela equipe do samba pra efetuar a replicação do sysvol
que por enquanto não é automática.
vim /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
only_from = 192.168.0.0/24
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
Agora vamos criar o nosso arquivo de configuração do rsync.conf que vai conter o compartilhamento
do sysvol
vim /etc/rsyncd.conf
[SysVol]
path = /usr/local/samba/var/locks/sysvol/
comment = Samba Sysvol Share
uid = root
gid = root
read only = yes
auth users = sysvol-replication
secrets file = /usr/local/samba/etc/rsyncd.secret
Note que ali vamos utilizar um usuário e uma senha agora vamos criar o arquivo contendo a senha
vim /usr/local/samba/etc/rsyncd.secret
sysvol-replication:pa$$w0rd
Agora vamos ajustar as permissões do arquivo senão o rsync não vai liberar o compartilhamento
/etc/init.d/xinetd restart
du -sh /usr/local/samba/var/locks/sysvol
100K /usr/local/samba/var/locks/sysvol
du -sh /usr/local/samba/var/locks/sysvol
12K /usr/local/samba/var/locks/sysvol
Agora vamos criar o arquivo contendo a senha para acessar o servidor master
vim /usr/local/samba/etc/rsync-sysvol.secret
pa$$w0rd
Note que não tivemos erro nenhum com isso podemos omitir agora a opção –dry-run
du -sh /usr/local/samba/var/locks/sysvol
100K /usr/local/samba/var/locks/sysvol
du -sh /usr/local/samba/var/locks/sysvol
100K /usr/local/samba/var/locks/sysvol
Agora vamos deixar uma rotina no crontab do servidor slave para sempre efetuar o sincronismo
crontab -e
*/5 * * * * rsync -XAavz --delete-after --password-
file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-
replication@192.168.0.25/SysVol/ /usr/local/samba/var/locks/sysvol
Esse sincronismo pode ser feito para todos os DCs menos para o PDC.
ou configuração.
Vamos instalar as dependências para ele poder fazer parte do domínio samba 4
chkconfig nmb on
chkconfig smb on
chkconfig winbind on
vim /etc/resolv.conf
domain douglas.lan
search douglas.lan
nameserver 192.168.0.25
nameserver 192.168.0.26
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
BROADCAST="192.168.0.255"
DNS1="192.168.0.25"
DNS2="192.168.0.26"
GATEWAY="192.168.0.1"
IPADDR="192.168.0.27"
NETMASK="255.255.255.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
Agora vamos ajustar o horário do servidor pois como vamos trabalhar com winbind e kerberos não
podemos ter diferença de horario
ntpdate -u a.ntp.br
vim /etc/krb5.conf
[libdefaults]
default_realm = DOUGLAS.LAN
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true
v4_instance_resolve = false
v4_name_convert = {
host = {
rcmd = host
ftp = ftp
}
plain = {
something = something-else
}
}
fcc-mit-ticketflags = true
[realms]
DOUGLAS.LAN = {
kdc = 192.168.0.25
kdc = 192.168.0.26
admin_server = 192.168.0.25:749
default_server = 192.168.0.25
}
[domain_realm]
.douglas.lan=DOUGLAS.LAN
douglas.lan=DOUGLAS.LAN
[login]
krb4_convert = true
krb4_get_tickets = false
[kdc]
profile = /etc/krb5kdc/kdc.conf
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
[logging]
default = file:/var/log/krb5libs.log
kdc = file:/var/log/krb5kdc.log
admin_server = file:/var/log/kadmind.log
vim /etc/security/limits.conf
Douglas Quintiliano dos Santos - http://wiki.douglasqsantos.com.br/
Last
update:
installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie http://wiki.douglasqsantos.com.br/doku.php/installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie
2016/02/23
12:44
[...]
#colocar no final do arquivo
root hard nofile 131072
root soft nofile 65536
mioutente hard nofile 32768
mioutente soft nofile 16384
vim /etc/samba/smb.conf
[global]
workgroup = DOUGLAS
security = ADS
realm = DOUGLAS.LAN
netbios name = CENTOS
encrypt passwords = yes
idmap config * : backend = tdb
idmap config * : range = 10000-30000
idmap config DOUGLAS:backend = ad
idmap config DOUGLAS:schema_mode = rfc2307
auth methods = winbind
winbind nss info = rfc2307
winbind trusted domains only = no
winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes
template shell = /bin/bash
vim /etc/nsswitch.conf
[...]
passwd: files winbind
shadow: files
group: files winbind
/etc/init.d/nmb start
/etc/init.d/smb start
/etc/init.d/winbind start
Vamos ajustar para que quando o usuário faça login seja criado o seu diretório home
vim /etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
Agora vamos ajustar o login utilizando o winbind aqui eu liberei somente o grupo root e o ti-admin
para efetuar login em máquinas Linux
vim /etc/pam.d/login
#%PAM-1.0
auth sufficient pam_winbind.so
auth [user_unknown=ignore success=ok ignore=ignore default=bad]
pam_securetty.so
auth include system-auth
Agora vamos ajustar o acesso via ssh utilizando o winbind aqui eu liberei somente o grupo root e o ti-
admin para efetuar login em máquinas Linux
vim /etc/pam.d/sshd
#%PAM-1.0
auth sufficient pam_winbind.so
auth include system-auth
kinit administrator
Password for administrator@DOUGLAS.LAN:
Warning: Your password will expire in 41 days on Mon Oct 7 12:02:11 2013
klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: administrator@DOUGLAS.LAN
/etc/init.d/nmb restart
/etc/init.d/smb restart
/etc/init.d/winbind restart
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
wbinfo -u
douglas.santos
administrator
dns-nodo1
krbtgt
guest
wbinfo -g
allowed rodc password replication group
enterprise read-only domain controllers
denied rodc password replication group
ti-admin
read-only domain controllers
group policy creator owners
ras and ias servers
domain controllers
enterprise admins
domain computers
cert publishers
dnsupdateproxy
domain admins
domain guests
schema admins
domain users
dnsadmins
ssh douglas.santos@192.168.0.27
douglas.santos@192.168.0.27's password:
Creating directory '/home/DOUGLAS/douglas.santos'.
[10:40:01] douglas.santos@centos [~] $
tail -f /var/log/secure
Aug 27 10:38:55 centos sshd[13906]: pam_winbind(sshd:auth): getting password
(0x00000000)
Aug 27 10:38:56 centos sshd[13906]: pam_winbind(sshd:auth): user
'douglas.santos' granted access
export DEBIAN_PRIORITY=critical
export DEBIAN_FRONTEND=noninteractive
unset DEBIAN_PRIORITY
unset DEBIAN_FRONTEND
vim /etc/resolv.conf
domain douglas.lan
search douglas.lan
nameserver 192.168.0.25
nameserver 192.168.0.26
ntpdate -u a.ntp.br
vim /etc/krb5.conf
[libdefaults]
default_realm = DOUGLAS.LAN
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true
v4_instance_resolve = false
v4_name_convert = {
host = {
rcmd = host
ftp = ftp
}
plain = {
something = something-else
}
}
fcc-mit-ticketflags = true
[realms]
DOUGLAS.LAN = {
kdc = 192.168.0.25
kdc = 192.168.0.26
admin_server = 192.168.0.25:749
default_server = 192.168.0.25
}
[domain_realm]
.douglas.lan=DOUGLAS.LAN
douglas.lan=DOUGLAS.LAN
[login]
krb4_convert = true
krb4_get_tickets = false
[kdc]
profile = /etc/krb5kdc/kdc.conf
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
[logging]
default = file:/var/log/krb5libs.log
kdc = file:/var/log/krb5kdc.log
admin_server = file:/var/log/kadmind.log
vim /etc/security/limits.conf
[...]
#colocar no final do arquivo
root hard nofile 131072
root soft nofile 65536
mioutente hard nofile 32768
mioutente soft nofile 16384
vim /etc/samba/smb.conf
[global]
workgroup = DOUGLAS
security = ADS
realm = DOUGLAS.LAN
netbios name = DEBIAN
encrypt passwords = yes
idmap config * : backend = tdb
idmap config * : range = 10000-30000
idmap config DOUGLAS:backend = ad
idmap config DOUGLAS:schema_mode = rfc2307
auth methods = winbind
winbind nss info = rfc2307
winbind trusted domains only = no
winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes
template shell = /bin/bash
vim /etc/nsswitch.conf
[...]
passwd: compat winbind
group: compat winbind
/etc/init.d/samba restart
/etc/init.d/winbind restart
/etc/init.d/samba restart
/etc/init.d/winbind restart
vim /etc/pam.d/common-password
password sufficient pam_unix.so
password requisite pam_krb5.so minimum_uid=1000
password [success=2 default=ignore] pam_unix.so obscure
use_authtok try_first_pass sha512
password [success=1 default=ignore] pam_winbind.so use_authtok
try_first_pass
password requisite pam_deny.so
password required pam_permit.so
Vamos ajustar o controle de sessão do usuário para criar o diretório home quando ele efetuar o login
vim /etc/pam.d/common-session
session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session required pam_unix.so
session optional pam_winbind.so
session optional pam_mkhomedir.so skel=/etc/skel
umask=0027
wbinfo -t
checking the trust secret for domain DOUGLAS via RPC calls succeeded
wbinfo -u
douglas.santos
administrator
dns-nodo1
krbtgt
guest
wbinfo -g
allowed rodc password replication group
enterprise read-only domain controllers
ssh douglas.santos@192.168.0.52
douglas.santos@192.168.0.52's password:
Creating directory '/home/DOUGLAS/douglas.santos'.
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
tail -f /var/log/auth.log
Aug 27 10:35:44 debian sshd[4852]: pam_krb5(sshd:auth): user douglas.santos
authenticated as douglas.santos@DOUGLAS.LAN
Aug 27 10:35:44 debian sshd[4852]: Accepted password for douglas.santos from
192.168.0.130 port 51197 ssh2
Aug 27 10:35:44 debian sshd[4852]: pam_unix(sshd:session): session opened
for user douglas.santos by (uid=0)
Referências
1. http://www.samba.org/samba/history/samba-4.1.3.html
2. http://wiki.samba.org/index.php/Samba
3. http://wiki.samba.org/index.php/SysVol_Replication
From:
http://wiki.douglasqsantos.com.br/ - Douglas Quintiliano dos Santos
Permanent link:
http://wiki.douglasqsantos.com.br/doku.php/installing_and_configuring_samba4_as_master_slave_with_bind9_dlz_and_sysvol_replication_on_debian_jessie