{"id":58238,"date":"2023-07-13T17:46:12","date_gmt":"2023-07-13T09:46:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=58238"},"modified":"2023-07-13T17:46:12","modified_gmt":"2023-07-13T09:46:12","slug":"ubuntu-dc-samba4-ad-dc","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-dc-samba4-ad-dc.html","title":{"rendered":"Ubuntu DC + Samba4 AD \u5b9e\u73b0\u53cc\u57df\u63a7\u4e3b\u673a\u6a21"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6587\u7ae0\u5c06\u8bb2\u89e3\u5982\u4f55\u4f7f\u7528 Ubuntu 16.04 \u670d\u52a1\u5668\u7248\u7cfb\u7edf\u6765\u521b\u5efa\u7b2c\u4e8c\u53f0 Samba4 \u57df\u63a7\u5236\u5668\uff0c\u5e76\u5c06\u5176\u52a0\u5165\u5230\u5df2\u521b\u5efa\u597d\u7684 Samba AD DC \u6797\u73af\u5883\u4e2d\uff0c\u4ee5\u4fbf\u4e3a\u4e00\u4e9b\u5173\u952e\u7684 AD DC \u670d\u52a1\u63d0\u4f9b\u8d1f\u8f7d\u5747\u8861\u53ca\u6545\u969c\u5207\u6362\u529f\u80fd\uff0c\u5c24\u5176\u662f\u4e3a\u90a3\u4e9b\u91cd\u8981\u7684\u670d\u52a1\uff0c\u6bd4\u5982 DNS \u670d\u52a1\u548c\u4f7f\u7528 SAM \u6570\u636e\u5e93\u7684 AD DC LDAP \u6a21\u5f0f\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u7b2c\u4e00\u6b65\uff1a\u4e3a\u8bbe\u7f6e Samba4 \u8fdb\u884c\u521d\u59cb\u5316\u914d\u7f6e<\/strong><\/div>\n

\u5728\u5f00\u59cb\u628a\u7b2c\u4e8c\u4e2a DC \u670d\u52a1\u5668\u52a0\u5165\u5230 Samba4 AD DC \u57df\u73af\u5883\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u521d\u59cb\u5316\u8bbe\u7f6e\u4fe1\u606f\uff0c\u9996\u5148\uff0c\u786e\u4fdd\u8fd9\u4e2a\u65b0\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\u5305\u542b\u63cf\u8ff0\u6027\u540d\u79f0\u3002<\/p>\n

\u5047\u8bbe\u7b2c\u4e00\u4e2a\u57df\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u53eb\u505a adc1 \uff0c\u4f60\u53ef\u4ee5\u628a\u7b2c\u4e8c\u4e2a\u57df\u670d\u52a1\u5668\u547d\u540d\u4e3a adc2\uff0c\u4ee5\u4fdd\u6301\u57df\u63a7\u5236\u5668\u540d\u79f0\u7684\u4e00\u81f4\u6027\u3002<\/p>\n

\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u4fee\u6539\u7cfb\u7edf\u4e3b\u673a\u540d\uff1a<\/p>\n

#\u00a0hostnamectl\u00a0set-hostname\u00a0adc2<\/pre>\n

\u6216\u8005\u4f60\u4e5f\u53ef\u4ee5\u624b\u52a8\u7f16\u8f91 \/etc\/hostname \u6587\u4ef6\uff0c\u5728\u65b0\u7684\u4e00\u884c\u8f93\u5165\u4f60\u60f3\u8bbe\u7f6e\u7684\u4e3b\u673a\u540d\u3002<\/p>\n

#\u00a0nano\u00a0\/etc\/hostname<\/pre>\n

\u8fd9\u91cc\u6dfb\u52a0\u4e3b\u673a\u540d\u3002<\/p>\n

adc2<\/pre>\n

\u4e0b\u4e00\u6b65\uff0c\u6253\u5f00\u672c\u5730\u7cfb\u7edf\u89e3\u6790\u6587\u4ef6\u5e76\u6dfb\u52a0\u4e00\u4e2a\u6761\u76ee\uff0c\u5305\u542b\u4e3b\u57df\u63a7\u5236\u5668\u7684 IP \u5730\u5740\u548c FQDN \u540d\u79f0\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n

\u5728\u8fd9\u7bc7\u6559\u7a0b\u4e2d\uff0c\u4e3b\u57df\u63a7\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u4e3a adc1.tecmint.lan \uff0c\u5176\u5bf9\u5e94\u7684 IP \u5730\u5740\u4e3a 192.168.1.254 \u3002<\/p>\n

#\u00a0nano\u00a0\/etc\/hosts<\/pre>\n

\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n

IP_of_main_DC\u00a0FQDN_of_main_DC\u00a0short_name_of_main_DC<\/pre>\n

\"\"<\/p>\n

\u4e3a Samba4 AD DC \u670d\u52a1\u5668\u8bbe\u7f6e\u4e3b\u673a\u540d<\/p>\n

\u4e0b\u4e00\u6b65\uff0c\u6253\u5f00 \/etc\/network\/interfaces \u914d\u7f6e\u6587\u4ef6\u5e76\u8bbe\u7f6e\u4e00\u4e2a\u9759\u6001 IP \u5730\u5740\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n

\u6ce8\u610f dns-nameservers \u548c dns-search \u8fd9\u4e24\u4e2a\u53c2\u6570\u7684\u503c\u3002\u4e3a\u4e86\u4f7f DNS \u89e3\u6790\u6b63\u5e38\u5de5\u4f5c\uff0c\u9700\u8981\u628a\u8fd9\u4e24\u4e2a\u503c\u8bbe\u7f6e\u6210\u4e3b Samba4 AD DC \u670d\u52a1\u5668\u7684 IP \u5730\u5740\u548c\u57df\u540d\u3002<\/div>\n

\u91cd\u542f\u7f51\u5361\u670d\u52a1\u4ee5\u8ba9\u4fee\u6539\u7684\u914d\u7f6e\u751f\u6548\u3002\u68c0\u67e5 \/etc\/resolv.conf \u6587\u4ef6\uff0c\u786e\u4fdd\u8be5\u7f51\u5361\u4e0a\u914d\u7f6e\u7684\u8fd9\u4e24\u4e2a DNS \u7684\u503c\u5df2\u66f4\u65b0\u5230\u8fd9\u4e2a\u6587\u4ef6\u3002<\/p>\n

#\u00a0nano\u00a0\/etc\/network\/interfaces<\/pre>\n

\u7f16\u8f91\u5e76\u66ff\u6362\u4f60\u81ea\u5b9a\u4e49\u7684 IP \u8bbe\u7f6e\uff1a<\/p>\n

\n
    \n
  • auto\u00a0ens33<\/li>\n
  • iface\u00a0ens33\u00a0inet\u00a0static<\/li>\n
  • address\u00a0192.168.1.253<\/li>\n
  • netmask\u00a0255.255.255.0<\/li>\n
  • brodcast\u00a0192.168.1.1<\/li>\n
  • gateway\u00a0192.168.1.1<\/li>\n
  • dns-nameservers\u00a0192.168.1.254<\/li>\n
  • dns-search\u00a0tecmint.lan<\/li>\n<\/ul>\n<\/div>\n

    \u91cd\u542f\u7f51\u5361\u670d\u52a1\u5e76\u786e\u8ba4\u751f\u6548\u3002<\/p>\n

    #\u00a0systemctl\u00a0restart\u00a0networking.service\r\n#\u00a0cat\u00a0\/etc\/resolv.conf\r\n<\/pre>\n

    \"\"<\/p>\n

    \u914d\u7f6e Samba4 AD \u670d\u52a1\u5668\u7684 DNS<\/p>\n

    \u5f53\u4f60\u901a\u8fc7\u7b80\u5199\u540d\u79f0(\u7528\u4e8e\u6784\u5efa FQDN \u540d)\u67e5\u8be2\u4e3b\u673a\u540d\u65f6\uff0c dns-search \u503c\u5c06\u4f1a\u81ea\u52a8\u628a\u57df\u540d\u6dfb\u52a0\u4e0a\u3002<\/p>\n

    \u4e3a\u4e86\u6d4b\u8bd5 DNS \u89e3\u6790\u662f\u5426\u6b63\u5e38\uff0c\u4f7f\u7528\u4e00\u7cfb\u5217 ping \u547d\u4ee4\u6d4b\u8bd5\uff0c\u547d\u4ee4\u540e\u5206\u522b\u4e3a\u7b80\u5199\u540d\uff0c FQDN \u540d\u548c\u57df\u540d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n

    \u5728\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u4e2d\uff0cSamba4 AD DC DNS \u670d\u52a1\u5668\u90fd\u5e94\u8be5\u8fd4\u56de\u4e3b\u57df\u63a7\u670d\u52a1\u5668\u7684 IP \u5730\u5740\u3002<\/p>\n

    \"\"<\/p>\n

    \u9a8c\u8bc1 Samba4 AD \u73af\u5883 DNS \u89e3\u6790\u662f\u5426\u6b63\u5e38<\/p>\n

    \u6700\u540e\u4f60\u9700\u8981\u6ce8\u610f\u7684\u662f\u786e\u4fdd\u8fd9\u4e2a\u4e3b\u673a\u8ddf\u57df\u63a7\u670d\u52a1\u5668\u65f6\u95f4\u540c\u6b65\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5 NTP \u5ba2\u6237\u7aef\u5de5\u5177\u6765\u5b9e\u73b0\u65f6\u95f4\u540c\u6b65\u529f\u80fd\uff1a<\/p>\n

    #\u00a0apt-get\u00a0install\u00a0ntpdate\r\n<\/pre>\n

    \u5047\u8bbe\u4f60\u60f3\u624b\u52a8\u5f3a\u5236\u672c\u5730\u670d\u52a1\u5668\u4e0e samba4 AD DC \u670d\u52a1\u5668\u65f6\u95f4\u540c\u6b65\uff0c\u4f7f\u7528 ntpdate \u547d\u4ee4\u52a0\u4e0a\u4e3b\u57df\u63a7\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

    #\u00a0ntpdate\u00a0adc1\r\n<\/pre>\n

    \"\"<\/p>\n

    \u4e0e Samba4 AD \u670d\u52a1\u5668\u8fdb\u884c\u65f6\u95f4\u540c\u6b65<\/p>\n

    \u7b2c 2 \u6b65\uff1a\u5b89\u88c5 Samba4 \u5fc5\u987b\u7684\u4f9d\u8d56\u5305<\/strong><\/div>\n

    \u4e3a\u4e86\u8ba9 Ubuntu 16.04 \u7cfb\u7edf\u52a0\u5165\u5230\u4f60\u7684\u57df\u4e2d\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u4ece Ubuntu \u5b98\u65b9\u8f6f\u4ef6\u5e93\u4e2d\u5b89\u88c5 Samba4 \u5957\u4ef6\u3001 Kerberos \u5ba2\u6237\u7aef \u548c\u5176\u5b83\u4e00\u4e9b\u91cd\u8981\u7684\u8f6f\u4ef6\u5305\u4ee5\u4fbf\u5c06\u6765\u4f7f\u7528\uff1a<\/p>\n

    #\u00a0apt-get\u00a0install\u00a0samba\u00a0krb5-user\u00a0krb5-config\u00a0winbind\u00a0libpam-winbind\u00a0libnss-winbind\r\n<\/pre>\n

    \"\"\u00a0<\/center><\/p>\n

    \u5728 Ubuntu \u7cfb\u7edf\u4e2d\u5b89\u88c5 Samba4<\/p>\n

    \u5728\u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u9700\u8981\u63d0\u4f9b Kerberos \u57df\u540d\u3002\u8f93\u5165\u5927\u5199\u7684\u57df\u540d\u7136\u540e\u6309\u56de\u8f66\u952e\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\u3002<\/p>\n

    \"\"<\/p>\n

    \u4e3a Samba4 \u914d\u7f6e Kerberos \u8ba4\u8bc1<\/p>\n

    \u6240\u6709\u4f9d\u8d56\u5305\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4f7f\u7528 kinit \u547d\u4ee4\u4e3a\u57df\u7ba1\u7406\u5458\u8bf7\u6c42\u4e00\u4e2a Kerberos \u7968\u636e\u4ee5\u9a8c\u8bc1\u8bbe\u7f6e\u662f\u5426\u6b63\u786e\u3002\u4f7f\u7528 klist \u547d\u4ee4\u6765\u5217\u51fa\u5df2\u6388\u6743\u7684 kerberos \u7968\u636e\u4fe1\u606f\u3002<\/p>\n

    #\u00a0kinit\u00a0domain-admin-user@YOUR_DOMAIN.TLD#\u00a0klist\r\n<\/pre>\n

    \"\"<\/p>\n

    \u5728 Samba4 \u57df\u73af\u5883\u4e2d\u9a8c\u8bc1 Kerberos<\/p>\n

    \u7b2c 3 \u6b65\uff1a\u4ee5\u57df\u63a7\u5236\u5668\u7684\u8eab\u4efd\u52a0\u5165\u5230 Samba4 AD DC<\/strong><\/div>\n

    \u5728\u628a\u4f60\u7684\u673a\u5668\u96c6\u6210\u5230 Samba4 DC \u73af\u5883\u4e4b\u524d\uff0c\u5148\u628a\u7cfb\u7edf\u4e2d\u6240\u6709\u8fd0\u884c\u7740\u7684 Samba4 \u670d\u52a1\u505c\u6b62\uff0c\u5e76\u4e14\u91cd\u547d\u540d\u9ed8\u8ba4\u7684 Samba \u914d\u7f6e\u6587\u4ef6\u4ee5\u4fbf\u4ece\u5934\u5f00\u59cb\u3002\u5728\u57df\u63a7\u5236\u5668\u914d\u7f6e\u7684\u8fc7\u7a0b\u4e2d\uff0c Samba \u5c06\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n

    #\u00a0systemctl\u00a0stop\u00a0samba-ad-dc\u00a0smbd\u00a0nmbd\u00a0winbind\r\n#\u00a0mv\u00a0\/etc\/samba\/smb.conf\u00a0\/etc\/samba\/smb.conf.initial\r\n<\/pre>\n

    \u5728\u51c6\u5907\u52a0\u5165\u57df\u524d\uff0c\u5148\u542f\u52a8 samba-ad-dc \u670d\u52a1\uff0c\u4e4b\u540e\u4f7f\u7528\u57df\u7ba1\u7406\u5458\u8d26\u53f7\u8fd0\u884c samba-tool \u547d\u4ee4\u5c06\u670d\u52a1\u5668\u52a0\u5165\u5230\u57df\u3002<\/p>\n

    #\u00a0samba-tool\u00a0domain\u00a0join\u00a0your_domain\u00a0-U\u00a0\"your_domain_admin\"\r\n<\/pre>\n

    \u52a0\u5165\u57df\u8fc7\u7a0b\u90e8\u5206\u622a\u56fe:<\/p>\n

    #\u00a0samba-tool\u00a0domain\u00a0join\u00a0tecmint.lan\u00a0DC\u00a0-U\u00a0\"tecmint_user\"\r\n<\/pre>\n

    \u8f93\u51fa\u793a\u4f8b\uff1a<\/p>\n

    \n
      \n
    • Finding\u00a0a\u00a0writeable\u00a0DC\u00a0for\u00a0domain\u00a0'tecmint.lan'<\/li>\n
    • Found\u00a0DC\u00a0adc1.tecmint.lan<\/li>\n
    • Password\u00a0for\u00a0[WORKGROUP\/tecmint_user]:<\/li>\n
    • workgroup\u00a0is\u00a0TECMINT<\/li>\n
    • realm\u00a0is\u00a0tecmint.lan<\/li>\n
    • checking\u00a0sAMAccountName<\/li>\n
    • Deleted\u00a0CN=ADC2,CN=Computers,DC=tecmint,DC=lan<\/li>\n
    • Adding\u00a0CN=ADC2,OU=Domain\u00a0Controllers,DC=tecmint,DC=lan<\/li>\n
    • Adding\u00a0CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan<\/li>\n
    • Adding\u00a0CN=NTDS\u00a0Settings,CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan<\/li>\n
    • Adding\u00a0SPNs\u00a0to\u00a0CN=ADC2,OU=Domain\u00a0Controllers,DC=tecmint,DC=lan<\/li>\n
    • Setting\u00a0account\u00a0password\u00a0for\u00a0ADC2$<\/li>\n
    • Enabling\u00a0account<\/li>\n
    • Calling\u00a0bare\u00a0provision<\/li>\n
    • Looking\u00a0up\u00a0IPv4\u00a0addresses<\/li>\n
    • Looking\u00a0up\u00a0IPv6\u00a0addresses<\/li>\n
    • No\u00a0IPv6\u00a0address\u00a0will\u00a0be\u00a0assigned<\/li>\n
    • Setting\u00a0up\u00a0share.ldb<\/li>\n
    • Setting\u00a0up\u00a0secrets.ldb<\/li>\n
    • Setting\u00a0up\u00a0the\u00a0registry<\/li>\n
    • Setting\u00a0up\u00a0the\u00a0privileges\u00a0database<\/li>\n
    • Setting\u00a0up\u00a0idmap\u00a0db<\/li>\n
    • Setting\u00a0up\u00a0SAM\u00a0db<\/li>\n
    • Setting\u00a0up\u00a0sam.ldb\u00a0partitions\u00a0and\u00a0settings<\/li>\n
    • Setting\u00a0up\u00a0sam.ldb\u00a0rootDSE<\/li>\n
    • Pre-loading\u00a0the\u00a0Samba\u00a04\u00a0and\u00a0AD\u00a0schema<\/li>\n
    • A\u00a0Kerberos\u00a0configuration\u00a0suitable\u00a0for\u00a0Samba\u00a04\u00a0has\u00a0been\u00a0generated\u00a0at\u00a0\/var\/lib\/samba\/private\/krb5.conf<\/li>\n
    • Provision\u00a0OK\u00a0for\u00a0domain\u00a0DN\u00a0DC=tecmint,DC=lan<\/li>\n
    • Starting\u00a0replication<\/li>\n
    • Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[402\/1550]\u00a0linked_values[0\/0]<\/li>\n
    • Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[804\/1550]\u00a0linked_values[0\/0]<\/li>\n
    • Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[1206\/1550]\u00a0linked_values[0\/0]<\/li>\n
    • Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[1550\/1550]\u00a0linked_values[0\/0]<\/li>\n
    • Analyze\u00a0and\u00a0apply\u00a0schema\u00a0objects<\/li>\n
    • Partition[CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[402\/1614]\u00a0linked_values[0\/0]<\/li>\n
    • Partition[CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[804\/1614]\u00a0linked_values[0\/0]<\/li>\n
    • Partition[CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[1206\/1614]\u00a0linked_values[0\/0]<\/li>\n
    • Partition[CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[1608\/1614]\u00a0linked_values[0\/0]<\/li>\n
    • Partition[CN=Configuration,DC=tecmint,DC=lan]\u00a0objects[1614\/1614]\u00a0linked_values[28\/0]<\/li>\n
    • Replicating\u00a0critical\u00a0objects\u00a0from\u00a0the\u00a0base\u00a0DN\u00a0of\u00a0the\u00a0domain<\/li>\n
    • Partition[DC=tecmint,DC=lan]\u00a0objects[97\/97]\u00a0linked_values[24\/0]<\/li>\n
    • Partition[DC=tecmint,DC=lan]\u00a0objects[380\/283]\u00a0linked_values[27\/0]<\/li>\n
    • Done\u00a0with\u00a0always\u00a0replicated\u00a0NC\u00a0(base,\u00a0config,\u00a0schema)<\/li>\n
    • Replicating\u00a0DC=DomainDnsZones,DC=tecmint,DC=lan<\/li>\n
    • Partition[DC=DomainDnsZones,DC=tecmint,DC=lan]\u00a0objects[45\/45]\u00a0linked_values[0\/0]<\/li>\n
    • Replicating\u00a0DC=ForestDnsZones,DC=tecmint,DC=lan<\/li>\n
    • Partition[DC=ForestDnsZones,DC=tecmint,DC=lan]\u00a0objects[18\/18]\u00a0linked_values[0\/0]<\/li>\n
    • Committing\u00a0SAM\u00a0database<\/li>\n
    • Sending\u00a0DsReplicaUpdateRefs\u00a0for\u00a0all\u00a0the\u00a0replicated\u00a0partitions<\/li>\n
    • Setting\u00a0isSynchronized\u00a0and\u00a0dsServiceName<\/li>\n
    • Setting\u00a0up\u00a0secrets\u00a0database<\/li>\n
    • Joined\u00a0domain\u00a0TECMINT\u00a0(SID\u00a0S-1-5-21-715537322-3397311598-55032968)\u00a0as\u00a0a\u00a0DC<\/li>\n<\/ul>\n<\/div>\n

      \"\"<\/p>\n

      \u628a\u57df\u52a0\u5165\u5230 Samba4 AD DC<\/p>\n

      \u5728\u5df2\u5b89\u88c5\u4e86 Samba4 \u5957\u4ef6\u7684 Ubuntu \u7cfb\u7edf\u52a0\u5165\u57df\u4e4b\u540e\uff0c\u6253\u5f00 Samba \u4e3b\u914d\u7f6e\u6587\u4ef6\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n

      #\u00a0nano\u00a0\/etc\/samba\/smb.conf\r\n<\/pre>\n

      \u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5230 smb.conf \u914d\u7f6e\u6587\u4ef6\u4e2d\u3002<\/p>\n

      \n