Skip to contentSkip to conversation

samba: fixes for AD DC service

PATCH Superseded [email protected] 1 participant 4 messages Oct 24, 2017 – Nov 2, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover samba: fixes for AD DC service

From: Jackie Huang <[email protected]>

--
The following changes since commit 0d220e002e4f525469f0c24e0585318d2178e7a1:

tslib: update project homepage (2017-10-20 16:14:56 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib.git jhuang0/d_samba-ad-dc_171024_0
http://git.pokylinux.org/cgit.cgi//log/?h=jhuang0/d_samba-ad-dc_171024_0

Jackie Huang (2):
samba: add missing RDEPENDS
samba: fix for AD DC service

 .../recipes-connectivity/samba/samba_4.6.7.bb      | 38 +++++++++++++++++-----
 1 file changed, 29 insertions(+), 9 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 samba: add missing RDEPENDS

From: Jackie Huang <[email protected]>

* samba-tool requires the python modules from samba-python or it fails with:

Traceback (most recent call last):
File "/usr/bin/samba-tool", line 33, in <module>
from samba.netcmd.main import cmd_sambatool
ImportError: No module named samba.netcmd.main

* Provisioning with samba-tool requires samba-dsdb-modules or it fails with:

Setting up secrets.ldb
ldb: unable to stat module /usr/lib64/samba/ldb : No such file or directory
WARNING: Module [samba_secrets] not found - do you need to set LDB_MODULES_PATH? Unable to load modules for /var/lib/samba/private/secrets.ldb: (null) ERROR(ldb): uncaught exception - None

* samba-python requires pytalloc and python-tdb or it fails with:

TypeError: pytalloc: unable to get talloc.BaseObject type ERROR(<type 'exceptions.ImportError'>): uncaught exception - No module named tdb

---
 meta-networking/recipes-connectivity/samba/samba_4.6.7.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +2 -1
index 59d7425c8..2b227c95d 100644
@@ -186,7 +186,8 @@ python samba_populate_packages() {
 
 PACKAGESPLITFUNCS_prepend = "samba_populate_packages "
 
-RDEPENDS_${PN} += "${PN}-base"
+RDEPENDS_${PN} += "${PN}-base ${PN}-python ${PN}-dsdb-modules"
+RDEPENDS_${PN}-python += "pytalloc python-tdb"
 
 FILES_${PN}-base = "${sbindir}/nmbd \
                     ${sbindir}/smbd \
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 samba: fix for AD DC service

In reply to [email protected]

From: Jackie Huang <[email protected]>

The AD DC service is installed by default since the commit:
"""
commit 28b8edc760d5e0664ad4861464f5de06f5fc305a
samba: install all systemd unit files
This includes samba.service, which other major distributions install, too. """

But lack of required executable since ad-dc feature is disabled by default.

To fix the issue:
- Add PACKAGECONFIG for ad-dc and enable by default.
- Add PACKAGECONFIG for gnutls which is required by ad-dc and enable by default.
- Add PACKAGECONFIG for mitkrb5 but disable by default because of an known issue:
http://samba.2283325.n4.nabble.com/samba-4-6-6-Unknown-dependency-kdc-in-service-kdc-objlist-td4722096.html
- Don't install samba.service if ad-dc is disabled.
- Re-package ad-dc service and executable into a new package samba-ad-dc

---
 .../recipes-connectivity/samba/samba_4.6.7.bb      | 35 +++++++++++++++++-----
 1 file changed, 27 insertions(+), 8 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +27 -8
index 2b227c95d..9372ea34a 100644
@@ -34,7 +34,7 @@ inherit systemd waf-samba cpan-base perlnative update-rc.d
 # remove default added RDEPENDS on perl
 RDEPENDS_${PN}_remove = "perl"
 
-DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb krb5 libbsd libaio libpam"
+DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libbsd libaio libpam"
 DEPENDS_append_libc-musl = " libtirpc"
 CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
 LDFLAGS_append_libc-musl = " -ltirpc"
@@ -45,12 +45,18 @@ LSB_linuxstdbase = "lsb"
 INITSCRIPT_NAME = "samba"
 INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
 
-SYSTEMD_PACKAGES = "${PN}-base winbind"
+SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind"
 SYSTEMD_SERVICE_${PN}-base = "nmb.service smb.service"
+SYSTEMD_SERVICE_${PN}-ad-dc = "samba.service"
 SYSTEMD_SERVICE_winbind = "winbind.service"
 
+# There are prerequisite settings to enable ad-dc, so disable the service by default.
+# Reference:
+# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
+SYSTEMD_AUTO_ENABLE_${PN}-ad-dc = "disable"
+
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \
-                   acl cups ldap \
+                   acl ad-dc cups gnutls ldap \
 "
 
 RDEPENDS_${PN}-base += "${LSB}"
@@ -68,6 +74,15 @@ PACKAGECONFIG[valgrind] = ",--without-valgrind,valgrind,"
 PACKAGECONFIG[lttng] = "--with-lttng, --without-lttng,lttng-ust"
 PACKAGECONFIG[archive] = "--with-libarchive, --without-libarchive, libarchive"
 
+# Building the AD (Active Directory) DC (Domain Controller) requires GnuTLS,
+# And ad-dc doesn't work with mitkrb5 for versions prior to 4.7.0 according to:
+# http://samba.2283325.n4.nabble.com/samba-4-6-6-Unknown-dependency-kdc-in-service-kdc-objlist-td4722096.html
+# So the working combination is:
+# 1) ad-dc: enable, gnutls: enable, mitkrb5: disable
+# 2) ad-dc: disable, gnutls: enable/disable, mitkrb5: enable
+PACKAGECONFIG[ad-dc] = ",--without-ad-dc,,"
+PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
+PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5,,krb5,"
 
 SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2"
 SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"
@@ -82,12 +97,9 @@ EXTRA_OECONF += "--enable-fhs \
                  --with-modulesdir=${libdir}/samba \
                  --with-lockdir=${localstatedir}/lib/samba \
                  --with-cachedir=${localstatedir}/lib/samba \
-                 --disable-gnutls \
                  --disable-rpath-install \
                  --with-shared-modules=${SAMBA4_MODULES} \
                  --bundled-libraries=${SAMBA4_LIBS} \
-                 --with-system-mitkrb5 \
-                 --without-ad-dc \
                  ${@base_conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
                  --with-cluster-support \
                  --with-profiling-data \
@@ -113,6 +125,10 @@ do_install_append() {
         -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
         -i ${D}${systemd_system_unitdir}/*.service
 
+    if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then
+        rm -f ${D}${systemd_system_unitdir}/samba.service
+    fi
+
     install -d ${D}${sysconfdir}/tmpfiles.d
     install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf
     echo "d ${localstatedir}/log/samba 0755 root root -" \
@@ -161,7 +177,7 @@ do_install_append() {
 PACKAGES =+ "${PN}-python ${PN}-pidl \
              ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
              winbind \
-             ${PN}-common ${PN}-base ${PN}-ctdb-tests \
+             ${PN}-common ${PN}-base ${PN}-ad-dc ${PN}-ctdb-tests \
              smbclient"
 
 python samba_populate_packages() {
@@ -196,9 +212,12 @@ FILES_${PN}-base = "${sbindir}/nmbd \
                     ${localstatedir}/nmbd \
                     ${localstatedir}/spool/samba \
                     ${systemd_system_unitdir}/nmb.service \
-                    ${systemd_system_unitdir}/samba.service \
                     ${systemd_system_unitdir}/smb.service"
 
+FILES_${PN}-ad-dc = "${sbindir}/samba \
+                     ${systemd_system_unitdir}/samba.service \
+                    "
+
 FILES_${PN}-ctdb-tests = "${bindir}/ctdb_run_tests \
                           ${bindir}/ctdb_run_cluster_tests \
                           ${sysconfdir}/ctdb/nodes \
Signature · 1 line
2.11.0
#3 lore raw

Re: [meta-networking][PATCH 2/2] samba: fix for AD DC service

Please ignore this since we found an issue after disabling mitkrb5:

Samba can be built with either:
- system_mitkrb5 (--with-system-mitkrb5)
- embedded_heimdal
- system_heimdal

If we don't set --with-system-mitkrb5, it will find if there is system_heimdal , if not, It will built with embedded_heimdal which seems only builds for x86 and x86-64, and it needs libbsd on the host, it will fail when build for x86 and there is no 32bit libbsd on the host:

tmp-glibc/work/core2-32-wrsmllib32-linux/lib32-samba/4.6.7-r0/samba-4.6.7/bin/asn1_compile: error while loading shared libraries: libbsd.so.0: cannot open shared object file: No such file or directory

So I will re-work the patch to turn back to mitkrb5, but ad-dc will need to be disabled by default since another know issue I mentioned in the comments. And someone from WR might work on the above issue.

Thanks,
Jackie

Quoted 158 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Tuesday, October 24, 2017 16:23
To: [email protected]
Subject: [oe] [meta-networking][PATCH 2/2] samba: fix for AD DC service

From: Jackie Huang <[email protected]>

The AD DC service is installed by default since the commit:
"""
commit 28b8edc760d5e0664ad4861464f5de06f5fc305a
samba: install all systemd unit files
This includes samba.service, which other major distributions install, too. """

But lack of required executable since ad-dc feature is disabled by default.

To fix the issue:
- Add PACKAGECONFIG for ad-dc and enable by default.
- Add PACKAGECONFIG for gnutls which is required by ad-dc and enable by default.
- Add PACKAGECONFIG for mitkrb5 but disable by default because of an known issue:
http://samba.2283325.n4.nabble.com/samba-4-6-6-Unknown-dependency-
kdc-in-service-kdc-objlist-td4722096.html
- Don't install samba.service if ad-dc is disabled.
- Re-package ad-dc service and executable into a new package samba-ad-dc

---
 .../recipes-connectivity/samba/samba_4.6.7.bb      | 35 +++++++++++++++++----
(quoted diff) +0 -1
-
 1 file changed, 27 insertions(+), 8 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +0 -0
index 2b227c95d..9372ea34a 100644
@@ -34,7 +34,7 @@ inherit systemd waf-samba cpan-base perlnative update-

rc.d

 # remove default added RDEPENDS on perl
 RDEPENDS_${PN}_remove = "perl"

-DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb krb5 libbsd libaio libpam"
+DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libbsd libaio libpam"
DEPENDS_append_libc-musl = " libtirpc"
CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" LDFLAGS_append_libc-musl = " -ltirpc"

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +3 -1
@@ -45,12 +45,18 @@ LSB_linuxstdbase = "lsb"
 INITSCRIPT_NAME = "samba"
 INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
 
-SYSTEMD_PACKAGES = "${PN}-base winbind"
+SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind"
 SYSTEMD_SERVICE_${PN}-base = "nmb.service smb.service"
+SYSTEMD_SERVICE_${PN}-ad-dc = "samba.service"
 SYSTEMD_SERVICE_winbind = "winbind.service"
 
+# There are prerequisite settings to enable ad-dc, so disable the service by

default.

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +2 -0
+# Reference:
+#

https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_
Domain_Controller

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +2 -0
+SYSTEMD_AUTO_ENABLE_${PN}-ad-dc = "disable"
+
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd

zeroconf', d)} \

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +1 -1
-                   acl cups ldap \
+                   acl ad-dc cups gnutls ldap \
 "
 
 RDEPENDS_${PN}-base += "${LSB}"
@@ -68,6 +74,15 @@ PACKAGECONFIG[valgrind] = ",--without-

valgrind,valgrind,"
PACKAGECONFIG[lttng] = "--with-lttng, --without-lttng,lttng-ust" PACKAGECONFIG[archive] = "--with-libarchive, --without-libarchive, libarchive"

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +3 -0
+# Building the AD (Active Directory) DC (Domain Controller) requires GnuTLS,
+# And ad-dc doesn't work with mitkrb5 for versions prior to 4.7.0 according to:
+# http://samba.2283325.n4.nabble.com/samba-4-6-6-Unknown-dependency-

kdc-in-service-kdc-objlist-td4722096.html

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +6 -0
+# So the working combination is:
+# 1) ad-dc: enable, gnutls: enable, mitkrb5: disable
+# 2) ad-dc: disable, gnutls: enable/disable, mitkrb5: enable
+PACKAGECONFIG[ad-dc] = ",--without-ad-dc,,"
+PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
+PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5,,krb5,"

SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,id map_tdb2"

SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +0 -3
@@ -82,12 +97,9 @@ EXTRA_OECONF += "--enable-fhs \
                  --with-modulesdir=${libdir}/samba \
                  --with-lockdir=${localstatedir}/lib/samba \
                  --with-cachedir=${localstatedir}/lib/samba \
-                 --disable-gnutls \
                  --disable-rpath-install \
                  --with-shared-modules=${SAMBA4_MODULES} \
                  --bundled-libraries=${SAMBA4_LIBS} \
-                 --with-system-mitkrb5 \
-                 --without-ad-dc \
                  ${@base_conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs',
 d)} \
                  --with-cluster-support \
                  --with-profiling-data \
meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +1 -0
@@ -113,6 +125,10 @@ do_install_append() {
         -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
         -i ${D}${systemd_system_unitdir}/*.service
 
+    if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ];

then

meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +3 -0
+        rm -f ${D}${systemd_system_unitdir}/samba.service
+    fi
+
     install -d ${D}${sysconfdir}/tmpfiles.d
     install -m644 packaging/systemd/samba.conf.tmp

${D}${sysconfdir}/tmpfiles.d/samba.conf

     echo "d ${localstatedir}/log/samba 0755 root root -" \
meta-networking/recipes-connectivity/samba/samba_4.6.7.bb +5 -3
@@ -161,7 +177,7 @@ do_install_append() {
 PACKAGES =+ "${PN}-python ${PN}-pidl \
              ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
              winbind \
-             ${PN}-common ${PN}-base ${PN}-ctdb-tests \
+             ${PN}-common ${PN}-base ${PN}-ad-dc ${PN}-ctdb-tests \
              smbclient"
 
 python samba_populate_packages() {
@@ -196,9 +212,12 @@ FILES_${PN}-base = "${sbindir}/nmbd \
                     ${localstatedir}/nmbd \
                     ${localstatedir}/spool/samba \
                     ${systemd_system_unitdir}/nmb.service \
-                    ${systemd_system_unitdir}/samba.service \
                     ${systemd_system_unitdir}/smb.service"
 
+FILES_${PN}-ad-dc = "${sbindir}/samba \
+                     ${systemd_system_unitdir}/samba.service \
+                    "
+
 FILES_${PN}-ctdb-tests = "${bindir}/ctdb_run_tests \
                           ${bindir}/ctdb_run_cluster_tests \
                           ${sysconfdir}/ctdb/nodes \
--

2.11.0

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel