DEV Community

Emre Karabulut for Açıklab

Posted on • Edited on

3 1

CentOS 8 – Samba Domain Controller

CentOS 8 – Samba Domain Controller

Öncelikle hostnamectl ile hostname adımızı düzenliyoruz.

hostnamectl set-hostname test-sambadc02

nano /etc/hosts dosyası içerisine giriyorum ve ip adresim ile hostname adını giriyorum.

127.0.0.1 migtest.lab.test-sambadc02

Gerekli firewall ayarlarını yapıyorum

firewall-cmd --add-service={dns,kerberos,kpasswd,ldap,ldaps,samba} --permanent

firewall-cmd --add-port={135/tcp,137-138/udp,139/tcp,123/tcp,3268-3269/tcp,49152-65535/tcp} --permanent

firewall-cmd --add-port={135/udp,137-138/tcp,139/udp,123/udp,445/tcp,445/udp,389/tcp,389/udp,636/tcp,636/udp} --permanent

firewall-cmd --add-port={464/tcp,464/udp,53/tcp,53/udp,88/tcp,88/udp,3269/tcp,3268/tcp} --permanent

firewall-cmd --reload

veya

systemctl stop firewalld

systemctl disable firewalld

CentOS Depolarına Erişim'de sorun yaşıyorsanız.

Tıklayınız...

Bağımlılık olan paketleri yüklüyoruz.

yum groups -y install "Development Tools"
yum -y install iniparser libldb libtalloc libtdb libtevent python-devel gnutls-devel libacl-devel openldap-devel pam-devel readline-devel krb5-devel cups-devel
yum -y install epel-release
yum -y install python3-devel lmdb-devel lmdb gpgme-devel jansson-devel libarchive-devel
yum install python3 krb5-workstation python3-dns krb5-workstation avahi-libs avahi-libs -y

Gerekli yüklemeleri yaptıktan sonra;

yum update diyorum ve sistemi güncelliyorum.

Daha önce hazırlanan .Tar paketi sisteme atılır ve çalıştırılır.

İndirmek için lütfen tıklayınız.

mkdir samba
tar -zxvf samba.tar.gz
yes | cp -r samba/* /

smb.conf’un yedeklenmesi

mv /etc/samba/smb.conf /home/test/smb.conf.backup

Profile’in kabuk üzerinde tanımlanması ve yeni domain oluşturma:

source /etc/profile

samba-tool domain provision --server-role=dc --use-rfc2307 --dns-backend=SAMBA_INTERNAL --realm=MIGTEST2.LAB --domain=MIGTEST --adminpass=Passw0rd

systemctl status samba4.service dediğimiz de olası bir hata için;

nano /usr/lib/systemd/system/samba4.service girerek /n leri sileriz.

Kerberos ayarları için;

nano /etc/krb5.conf
# Configuration snippets may be placed in this directory as well
includedir /etc/krb5.conf.d/

[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
dns_lookup_realm = false
dns_lookup_kdc= true
kdc_timesync = 1
ccache_type = 4
ticket_lifetime = 24h
proxiable = true
renew_lifetime = 7d
forwardable = true
rdns = false
pkinit_anchors = FILE:/etc/pki/tls/certs/ca-bundle.crt
default_realm = MIGTEST2.LAB
default_ccache_name = KEYRING:persistent:%{uid}
fcc-mit-ticketflags = true
[realms]
# EXAMPLE.COM = {
# kdc = kerberos.example.com
# admin_server = kerberos.example.com
# }

[domain_realm]
# .example.com = EXAMPLE.COM
# example.com = EXAMPLE.COM

Migrate işlemi için

Geçici olarak /etc/resolv.conf üzerinde ilk satıra migrate edeceğiniz IP adresini nameserver IP ADRESİ şeklinde yazabilirsiniz.

Ağ ile ilgili hatalar bulunuyorsa /etc/samba/smb.conf dosyası içerisinde aşağıdaki satırlar eklenmeli.İnterface bilgisi için ip a komutu ile bakabilirsiniz. Birden fazla interface varsa yan yana boşluk ile ekleyebilirsiniz. Ama istemediğiniz bir IP adresi varsa onu yazmamalısınız. Yoksa dnsupdate sırasında ilgili kayıtları ekleyecektir.

bind interface only = yes interfaces = enp0s3

Sonrasında ise **Migrate** işlemine başlayabiliriz…
source /etc/profile

samba-tool domain join migtest2.lab DC -U "MIGTEST2\administrator" --dns-backend=SAMBA_INTERNAL --server=redhatdc02.migtest2.lab

samba-tool dns query localhost migtest2.lab @ ALL -U administrator --password Passw0rd

Windows Server 2012 R2 ile entegrasyon kurulacaksa aşağıdaki gibi ayarlar yapılmalıdır:

samba_dnsupdate
samba-tool domain functionalprep --function-level=2012_R2
samba-tool fsmo transfer --role=all -U administrator

Bu adımdan sonra artık Windows Server 2012R2’ye DNS adresi girilerek klasik bir DC ekleme işlemi yapılabilmektedir.

Kolay Gelsin

Açık Kaynak Yazılımları

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay