Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #######################################################################################################################
- #########################
- # Routeur ASUS - MERLIN #
- #########################
- #
- # Ajout d'entrée dans le DNS du routeur pour une meilleur résolution depuis le réseau physique
- #
- # nano /jffs/configs/dnsmasq.conf.add ; service restart_dnsmasq
- #
- ####################################
- # FQDN: SLDEBIAN01.MONDOMAIN.LOCAL #
- # Distribution: Debian 10 #
- ####################################
- address=/SLDEBIAN01.mondomain.local/192.168.1.2
- address=/SLDEBIAN01.mondomain/192.168.1.2
- address=/SLDEBIAN01/192.168.1.2
- nslookup SLDEBIAN01.mondomain.local
- nslookup SLDEBIAN01.mondomain
- nslookup SLDEBIAN01
- Résultat : 192.168.1.2
- #######################################################################################################################
- # Etape 1 : Préparer votre machine Debian9
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_prepare_debian.html
- # Etape 2 : Installer et configurer Samba-AD sur Debian9
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_install_samba_debian.html
- # Etape 3 : Installer et configurer Bind-DLZ pour Samba-AD
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_install_binddlz_debian.html
- #
- # Etape 4A : Installer et configurer NTP pour Samba-AD sur Debian9 (Première Partie)
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_install_ntp_debian.html
- # : Maintenant, nous allons pouvoir installer Samba en mode Active Directory. Ca avance, c’est bien !! (Partie 4B)
- # Etape 4B : Installer et configurer Samba-AD sur Debian9
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_install_samba_debian.html#server-install-samba-debian
- # Etape 4C : Installer et configurer NTP pour Samba-AD sur Debian9 (Seconde Partie)
- # Liens : https://dev.tranquil.it/samba/fr/samba_config_server/debian/server_install_ntp_debian.html#forcer-une-resynchronisation-sur-un-poste-windows
- #######################################################################################################################
- ###########################################
- # Etape 0 : Ajout de paquet indispensable #
- ###########################################
- apt install -y bash-completion sudo net-tools qemu-guest-agent wget curl gnupg git iperf3 tasksel ; systemctl restart qemu-guest-agent
- apt update --fix-missing
- ################################################################
- # Actions supplémentaires : Paquet | SSH EN ROOT | Sudoer Marc #
- ################################################################
- apt install gnupg wget curl -y ;
- sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config ;/etc/init.d/ssh restart
- nano /etc/sudoers
- #marc ALL=(ALL) NOPASSWD:ALL
- ############################################
- # Etape 1 - Préparer votre machine Debian9 #
- ############################################
- nano /etc/network/interfaces ; systemctl restart networking ; systemctl reboot
- source /etc/network/interfaces.d/*
- auto lo
- iface lo inet loopback
- #Configuration interface ens18 (ethernet)
- auto ens18
- iface ens18 inet static
- address 192.168.1.2
- netmask 255.255.255.0
- network 192.168.1.0
- broadcast 192.168.1.255
- gateway 192.168.1.1
- dns-nameservers 192.168.1.1
- echo "SLDEBIAN01.mondomain.local" > /etc/hostname ; cat /etc/hostname
- echo "#IPV4
- 127.0.0.1 localhost
- 192.168.1.2 sldebian01.mondomain.local sldebian01
- #
- #IPV6
- ::1 localhost ip6-localhost ip6-loopback
- ff02::1 ip6-allnodes
- ff02::2 ip6-allrouters" > /etc/hosts
- dpkg-reconfigure tzdata ; timedatectl status
- # - Local time : mer. 2020-08-12 14:14:38 CEST
- # - Universal time : mer. 2020-08-12 12:14:38 UTC
- # - RTC time : mer. 2020-08-12 12:14:39
- # - Time zone : Europe/Paris (CEST, +0200)
- # - System clock syn: yes
- # - NTP service : inactive
- # - RTC in local TZ : no
- dpkg-reconfigure locales ; localectl status
- # - system Locale : LANG=fr_FR.UTF-8
- # - VC Keymap : n/a
- # - X11 Layout : fr
- # - X11 Model : pc105
- # - X11 Variant : latin9
- systemctl stop avahi-daemon.service avahi-daemon.socket ; systemctl disable avahi-daemon.service avahi-daemon.socket ;
- apt-get update -y ; apt-get install -y wget sudo screen nmap telnet tcpdump rsync net-tools dnsutils htop apt-transport-https vim ;
- ##########################################################
- # Etape 2 - Installer et configurer Samba-AD sur Debian9 #
- ##########################################################
- wget -O tissamba-pubkey.gpg http://samba.tranquil.it/tissamba-pubkey.gpg ; apt-key add tissamba-pubkey.gpg ; rm tissamba-pubkey.gpg ;
- # Version 4.10
- echo "deb https://samba.tranquil.it/debian/samba-4.10/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/tissamba.list ;
- # Version 4.11 (NON UTILISER)
- echo "deb https://samba.tranquil.it/debian/samba-4.11/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/tissamba.list ;
- export DEBIAN_FRONTEND=noninteractive ;
- apt-get update ; apt-get install -y samba winbind libnss-winbind krb5-user smbclient ldb-tools python3-crypto ; unset DEBIAN_FRONTEND
- echo "[libdefaults]
- default_realm = MONDOMAIN.LOCAL
- dns_lookup_kdc = true
- dns_lookup_realm = false" > /etc/krb5.conf
- rm -f /etc/samba/smb.conf ;
- samba-tool domain provision --realm=MONDOMAIN.LOCAL --domain MONDOMAIN --server-role=dc ;
- # Reset account administrator (samba)
- samba-tool user setpassword administrator ;
- #Resolv
- echo "search mondomain.local
- nameserver 127.0.0.1
- " > /etc/resolv.conf ; cat /etc/resolv.conf ;
- rm -f /var/lib/samba/private/krb5.conf ; ln -s /etc/krb5.conf /var/lib/samba/private/krb5.conf
- systemctl unmask samba-ad-dc ; systemctl enable samba-ad-dc ; systemctl disable samba winbind nmbd smbd ; systemctl mask samba winbind nmbd smbd ; systemctl reboot
- kinit administrator
- #Warning: Your password will expire in 41 days on mer. 23 sept. 2020 11:58:04 CEST
- klist
- # Valid starting Expires Service principal
- # 12/08/2020 14:27:51 13/08/2020 00:27:51 krbtgt/MONDOMAIN.LOCAL@MONDOMAIN.LOCAL
- # renew until 13/08/2020 14:27:48
- dig @localhost google.fr
- dig @localhost MONDOMAIN.LOCAL
- dig -t SRV @localhost _ldap._tcp.MONDOMAIN.LOCAL
- ####################################
- # Joindre un Ordinateur au domaine #
- ####################################
- # Domaine : Domain
- # User : administrator
- # pass : *****
- # Résultat : Réussi
- #################################
- # Installation des paquets RSAT #
- #################################
- #
- # Guide : https://dev.tranquil.it/samba/fr/samba_config_server/samba_install_RSAT.html#samba-install-rsat
- #
- # Powershell : Get-WindowsCapability -Online | ? Name -like 'RSAT*'|Where {$_.State -eq 'NotPresent'} |foreach {Add-WindowsCapability -online -name $_.Name}
- ############################################################
- # Etape 3 - Installer et configurer Bind-DLZ pour Samba-AD #
- ############################################################
- apt-get install -y bind9
- nano /etc/bind/named.conf.options
- options
- {
- directory "/var/cache/bind";
- allow-query {any;};
- listen-on-v6 {any;};
- dnssec-validation no;
- auth-nxdomain no;
- minimal-responses yes;
- forwarders { 192.168.1.1;};
- tkey-gssapi-keytab "/var/lib/samba/bind-dns/dns.keytab";
- };
- nano /etc/bind/named.conf.local
- dlz "mondomain.local" {database "dlopen /usr/lib/x86_64-linux-gnu/samba/bind9/dlz_bind9_10.so";};
- nano /etc/default/bind9
- # run resolvconf?
- RESOLVCONF=no
- # startup options for the server
- OPTIONS="-4 -u bind"
- nano /etc/samba/smb.conf
- [global]
- server services = -dns
- # dns forwarder =
- ###################
- # Dossier Partage #
- ###################
- mkdir /var/lib/samba/bind-dns ; mkdir /var/lib/samba/bind-dns/dns
- samba_upgradedns --dns-backend=BIND9_DLZ
- systemctl restart samba-ad-dc
- systemctl restart bind9
- netstat -tapn | grep 53
- dig @localhost google.fr
- dig @localhost mondomain.local
- dig -t SRV @localhost _ldap._tcp.mondomain.local
- #######################################################################################################################
- ####################################################################
- # Etape 4A - Installer et configurer NTP pour Samba-AD sur Debian9 #
- #####################################################################
- apt-get install -y ntpdate ntp
- ntpdate -bu pool.ntp.org
- nano /etc/ntp.conf
- ntpsigndsocket /var/lib/samba/ntp_signd
- restrict default mssntp
- chgrp ntp /var/lib/samba/ntp_signd
- systemctl restart ntp
- ################################################################
- # Etape 4C - Forcer une resynchronisation sur un poste windows #
- ################################################################
- #Lancer la Synchronisation :
- w32tm /resync /nowait
- #En cas de problème
- w32tm /config /syncfromflags:domhier
- w32tm /config /update
- w32tm /resync /nowait
- #Débuguer le client NTP sur windows
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogSize /t reg_dword /d 16777216 /f
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogName /t reg_sz /d "c:\w32time_debug.txt" /f
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogEntries /t reg_sz /d "0-300" /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogSize /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogName /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v FileLogEntries /f
- #Mode Nt5DS
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v Type /t reg_sz /d "Nt5DS" /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v Type /f
- #Mode NTP
- #net time /setsntp:sldebian01.mondomain.local
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v Type /t reg_sz /d "NTP" /f
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v ntpserver /t reg_sz /d "sldebian01.mondomain.local" /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v Type /f
- reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v ntpserver /f
- #Le service NTP semble ne pas prendre en compte votre configuration ntp.conf
- rm -f /var/lib/ntp/ntp.conf.dhcp
- #Vérifier le fonctionnement
- w32tm /monitor
- #SLDEBIAN01.mondomain.local *** PDC ***[192.168.1.2:123]: le domaine par défaut...
- # ICMP: 0ms retard
- # NTP: erreur ERROR_TIMEOUT - Aucune réponse du serveur dans 1000ms
- #Vérifier partage Samba:
- testparm -s
- #######################################################
- # ETEINDRE LES MACHINES ET REBOOT LE ROUTEUR PHYSIQUES#
- #######################################################
- ################
- # Expérimental #
- ################
- w32tm /config /update /manualpeerlist:"MON_AD,0x8" /syncfromflags:MANUAL,DOMHIER
- net stop w32time
- net start w32time
- w32tm /config /syncfromflags:DOMHIER /update
- w32tm /resync /nowait
- net stop w32time
- net start w32time
- w32tm /monitor
- ########
- # LDAP #
- ########
- https://www.linuxbabe.com/ubuntu/install-configure-openldap-server-ubuntu-16-04
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement