Skip to contentSkip to conversation

Adding pam supporting

PATCH In review Xiaofeng Yan 3 participants 6 messages Jul 25, 2011

lore
Share & tools
lore
#0 lore raw

cover Adding pam supporting

From: Xiaofeng Yan <[email protected]>

Hi Saul,

I modified my patches according to your suggestion.
- Using spaces instead of tab
- The patches can work only when pam is enabled
- Using OE-Core instead of poky

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/pam
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/pam

Thanks,
Xiaofeng Yan <[email protected]>
---

Xiaofeng Yan (3):
openssh: Support PAM
polkit: Support pam
dropbear: Support pam

 .../openssh/openssh-5.8p2/sshd                     |   10 +++
 meta/recipes-connectivity/openssh/openssh_5.8p2.bb |   77 +++++++++++---------
 meta/recipes-core/dropbear/dropbear.inc            |   78 +++++++++++---------
 .../dropbear/dropbear/dropbear-enable-pam.patch    |   22 ++++++
 meta/recipes-core/dropbear/dropbear_0.52.bb        |    2 +-
 .../polkit/polkit-0.101/polkit-1_pam.patch         |   23 ++++++
 meta/recipes-extended/polkit/polkit_0.101.bb       |    7 +-
 7 files changed, 146 insertions(+), 73 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssh/openssh-5.8p2/sshd
 create mode 100644 meta/recipes-core/dropbear/dropbear/dropbear-enable-pam.patch
 create mode 100644 meta/recipes-extended/polkit/polkit-0.101/polkit-1_pam.patch
#1 lore raw

PATCH 1/3 openssh: Support PAM

From: Xiaofeng Yan <[email protected]>

Change as follows:
* Adding configuration file "sshd" in /etc/pam.d/ for supporting pam.
* Using four spaces instead of tab

---
 .../openssh/openssh-5.8p2/sshd                     |   10 +++
 meta/recipes-connectivity/openssh/openssh_5.8p2.bb |   77 +++++++++++---------
 2 files changed, 53 insertions(+), 34 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssh/openssh-5.8p2/sshd
meta/recipes-connectivity/openssh/openssh-5.8p2/sshd new file +10 -0
new file mode 100644
index 0000000..4882e58
@@ -0,0 +1,10 @@
+#%PAM-1.0
+
+auth       include      common-auth
+account    required     pam_nologin.so
+account    include      common-account
+password   include      common-password
+session    optional     pam_keyinit.so force revoke
+session    include      common-session
+session    required     pam_loginuid.so
+
meta/recipes-connectivity/openssh/openssh_5.8p2.bb +43 -34

126 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 1/3] openssh: Support PAM

Quoted 61 lines · Xiaofeng Yan

From: Xiaofeng Yan <[email protected]>

Change as follows:
* Adding configuration file "sshd" in /etc/pam.d/ for supporting pam.
* Using four spaces instead of tab

---
 .../openssh/openssh-5.8p2/sshd                     |   10 +++
 meta/recipes-connectivity/openssh/openssh_5.8p2.bb |   77 +++++++++++---------
 2 files changed, 53 insertions(+), 34 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssh/openssh-5.8p2/sshd
meta/recipes-connectivity/openssh/openssh-5.8p2/sshd new file +10 -0
new file mode 100644
index 0000000..4882e58
@@ -0,0 +1,10 @@
+#%PAM-1.0
+
+auth       include      common-auth
+account    required     pam_nologin.so
+account    include      common-account
+password   include      common-password
+session    optional     pam_keyinit.so force revoke
+session    include      common-session
+session    required     pam_loginuid.so
+
meta/recipes-connectivity/openssh/openssh_5.8p2.bb +4 -4
index e23069c..d5ccba1 100644
@@ -7,13 +7,11 @@ SECTION = "console/network"
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=bae9a689be41581503bcf95d8fb42c4e"
 
-PR = "r0"
+PR = "r1"
 
 DEPENDS = "zlib openssl"
 DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
-
 RPROVIDES = "ssh sshd"
-
 CONFLICTS_${PN} = "dropbear"
 RCONFLICTS_${PN}-sshd = "dropbear"
 RCONFLICTS_${PN}-keygen = "ssh-keygen"
@@ -23,7 +21,9 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
            file://sshd_config \
            file://ssh_config \
            file://init \
-          "
+           ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
+
+PAM_SRC_URI = "file://sshd"
 SRC_URI[md5sum] = "0541579adf9d55abb15ef927048d372e"
 SRC_URI[sha256sum] = "5c35ec7c966ce05cc4497ac59c0b54a556e55ae7368165cc8c4129694654f314"
 
@@ -47,23 +47,32 @@ EXTRA_OECONF = "--with-rand-helper=no \
 EXTRA_OECONF_append_libc-uclibc=" --without-pam"

meta/recipes-connectivity/openssh/openssh_5.8p2.bb EXTRA_OECONF = "--with-rand-helper=no \ · line 54

Quoted 10 lines
meta/recipes-connectivity/openssh/openssh_5.8p2.bb +4 -3
 
 do_configure_prepend () {
-	if [ ! -e acinclude.m4 -a -e aclocal.m4 ]; then
-		cp aclocal.m4 acinclude.m4
-	fi
+
+    if [ ! -e acinclude.m4 -a -e aclocal.m4 ]; then
+        cp aclocal.m4 acinclude.m4
+    fi
 }

Please resubmit this without changing the whitespace in the file!

Cheers,

Richard

#3 lore raw

PATCH 2/3 polkit: Support pam

In reply to Xiaofeng Yan

From: Xiaofeng Yan <[email protected]>

Modify configuration "polkit-1" in /etc/pam.d/ for supporting pam.

---
 .../polkit/polkit-0.101/polkit-1_pam.patch         |   23 ++++++++++++++++++++
 meta/recipes-extended/polkit/polkit_0.101.bb       |    7 ++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/polkit/polkit-0.101/polkit-1_pam.patch
meta/recipes-extended/polkit/polkit-0.101/polkit-1_pam.patch new file +23 -0
new file mode 100644
index 0000000..74647ef
@@ -0,0 +1,23 @@
+polkit: No system-auth in OE-Core, we can use common-* in place of it.
+
+Upstream-Status:Inappropriate [configuration]
+
+Signed-off-by: Xiaofeng Yan <[email protected]>
+
+--- a/configure.ac	2011-03-04 02:26:20.000000000 +0800
++++ b/configure.ac.new	2011-07-18 10:14:12.516818852 +0800
+@@ -350,10 +350,10 @@
+     PAM_FILE_INCLUDE_PASSWORD=system
+     PAM_FILE_INCLUDE_SESSION=system
+ else
+-   PAM_FILE_INCLUDE_AUTH=system-auth
+-   PAM_FILE_INCLUDE_ACCOUNT=system-auth
+-   PAM_FILE_INCLUDE_PASSWORD=system-auth
+-   PAM_FILE_INCLUDE_SESSION=system-auth
++   PAM_FILE_INCLUDE_AUTH=common-auth
++   PAM_FILE_INCLUDE_ACCOUNT=common-account
++   PAM_FILE_INCLUDE_PASSWORD=common-password
++   PAM_FILE_INCLUDE_SESSION=common-session
+ fi
+ 
+ AC_SUBST(PAM_FILE_INCLUDE_AUTH)
meta/recipes-extended/polkit/polkit_0.101.bb +5 -2
index 6769914..56ceca4 100644
@@ -7,8 +7,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=155db86cdbafa7532b41f390409283eb \
                     file://docs/polkit/html/license.html;md5=07ddbf5f29e44c80c99be19c1690ec1f"
 
 SRC_URI = "http://hal.freedesktop.org/releases/polkit-${PV}.tar.gz \
-           file://introspection.patch"
-PR = "r0"
+           file://introspection.patch \
+           ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
+
+PAM_SRC_URI = "file://polkit-1_pam.patch"
+PR = "r1"
 DEPENDS = "libpam expat dbus-glib eggdbus intltool"
 RDEPENDS_${PN} = "libpam"
 EXTRA_OECONF = "--with-authfw=pam --with-os-type=moblin --disable-man-pages --disable-gtk-doc --disable-introspection"
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 3/3 dropbear: Support pam

In reply to Xiaofeng Yan

From: Xiaofeng Yan <[email protected]>

I make a patch and some changes in dropbear.inc for supporting pam.
- Enable pam in configure
- Modify file option.h to open pam supporting

---
 meta/recipes-core/dropbear/dropbear.inc            |   78 +++++++++++---------
 .../dropbear/dropbear/dropbear-enable-pam.patch    |   22 ++++++
 meta/recipes-core/dropbear/dropbear_0.52.bb        |    2 +-
 3 files changed, 65 insertions(+), 37 deletions(-)
 create mode 100644 meta/recipes-core/dropbear/dropbear/dropbear-enable-pam.patch
meta/recipes-core/dropbear/dropbear.inc +42 -36
index 1b51e1a..df1c2a0 100644
@@ -9,13 +9,17 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3a5b0c2f0d0c49dfde9558ae2036683c"
 
 DEPENDS = "zlib"
 RPROVIDES = "ssh sshd"
+DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
 SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.gz \
-	         file://urandom-xauth-changes-to-options.h.patch \
-	         file://configure.patch \
-	         file://fix-2kb-keys.patch \
-	         file://allow-nopw.patch;apply=no \
-	         file://init"
+           file://urandom-xauth-changes-to-options.h.patch \
+           file://configure.patch \
+           file://fix-2kb-keys.patch \
+           file://allow-nopw.patch;apply=no \
+           file://init \
+           ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} "
+
+PAM_SRC_URI = "file://dropbear-enable-pam.patch"
 
 inherit autotools update-rc.d
 
@@ -28,54 +32,56 @@ LD = "${CC}"
 SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
 BINCOMMANDS = "dbclient ssh scp"
 EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
+EXTRA_OECONF += "\
+    ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
 
 DISTRO_TYPE = "${@base_contains("IMAGE_FEATURES", "debug-tweaks", "debug", "",d)}"
 
 do_debug_patch() {
-	if [ "${DISTRO_TYPE}" = "debug" ]; then
-		bbnote "WARNING: applying allow-nopw.patch which allows password-less logins!"
-		patch -p1 < ${WORKDIR}/allow-nopw.patch
-	fi
+    if [ "${DISTRO_TYPE}" = "debug" ]; then
+        bbnote "WARNING: applying allow-nopw.patch which allows password-less logins!"
+        patch -p1 < ${WORKDIR}/allow-nopw.patch
+    fi
 }
 
 addtask do_debug_patch after do_patch before do_configure
 
 do_install() {
-	install -d ${D}${sysconfdir} \
-		   ${D}${sysconfdir}/init.d \
-		   ${D}${sysconfdir}/default \
-		   ${D}${sysconfdir}/dropbear \
+    install -d ${D}${sysconfdir} \
+           ${D}${sysconfdir}/init.d \
+           ${D}${sysconfdir}/default \
+           ${D}${sysconfdir}/dropbear \
                    ${D}${bindir} \
-		   ${D}${sbindir} \
-		   ${D}${localstatedir}
+           ${D}${sbindir} \
+           ${D}${localstatedir}
 
-	install -m 0755 dropbearmulti ${D}${sbindir}/
-	ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
-	
-	for i in ${SBINCOMMANDS}
-	do
-		ln -s ./dropbearmulti ${D}${sbindir}/$i
-	done
-	cat ${WORKDIR}/init | sed -e 's,/etc,${sysconfdir},g' \
-				  -e 's,/usr/sbin,${sbindir},g' \
-				  -e 's,/var,${localstatedir},g' \
-				  -e 's,/usr/bin,${bindir},g' \
-				  -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/dropbear
-	chmod 755 ${D}${sysconfdir}/init.d/dropbear
+    install -m 0755 dropbearmulti ${D}${sbindir}/
+    ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
+    
+    for i in ${SBINCOMMANDS}
+    do
+        ln -s ./dropbearmulti ${D}${sbindir}/$i
+    done
+    cat ${WORKDIR}/init | sed -e 's,/etc,${sysconfdir},g' \
+                  -e 's,/usr/sbin,${sbindir},g' \
+                  -e 's,/var,${localstatedir},g' \
+                  -e 's,/usr/bin,${bindir},g' \
+                  -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/dropbear
+    chmod 755 ${D}${sysconfdir}/init.d/dropbear
 }
 
 pkg_postinst_${PN} () {
-	update-alternatives --install ${bindir}/scp scp ${sbindir}/dropbearmulti 20
-	update-alternatives --install ${bindir}/ssh ssh ${sbindir}/dropbearmulti 20
+    update-alternatives --install ${bindir}/scp scp ${sbindir}/dropbearmulti 20
+    update-alternatives --install ${bindir}/ssh ssh ${sbindir}/dropbearmulti 20
 }
 
 pkg_postrm_append_${PN} () {
-  if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
+    if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
         rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
-  fi
-  if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
+    fi
+    if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
         rm ${sysconfdir}/dropbear/dropbear_dss_host_key
-  fi
-  update-alternatives --remove ssh ${bindir}/dropbearmulti
-  update-alternatives --remove scp ${bindir}/dropbearmulti
+    fi
+    update-alternatives --remove ssh ${bindir}/dropbearmulti
+    update-alternatives --remove scp ${bindir}/dropbearmulti
 }
meta/recipes-core/dropbear/dropbear/dropbear-enable-pam.patch new file +22 -0
new file mode 100644
index 0000000..004d773
@@ -0,0 +1,22 @@
+dropbear: We need modify file option.h besides enabling pam in \
+configure if we want dropbear to support pam.
+
+Upstream-Status: Pending
+
+Signed-off-by: Xiaofeng Yan <[email protected]>
+
+--- a/options.h	2011-07-12 13:27:39.008819183 +0800
++++ b/options.h.new	2011-07-12 13:37:37.780819308 +0800
+@@ -149,9 +149,9 @@
+  * but there's an interface via a PAM module - don't bother using it otherwise.
+  * You can't enable both PASSWORD and PAM. */
+ 
+-#define ENABLE_SVR_PASSWORD_AUTH
++//#define ENABLE_SVR_PASSWORD_AUTH
+ /* PAM requires ./configure --enable-pam */
+-/*#define ENABLE_SVR_PAM_AUTH*/
++#define ENABLE_SVR_PAM_AUTH
+ #define ENABLE_SVR_PUBKEY_AUTH
+ 
+ /* Wether to ake public key options in authorized_keys file into account */
+
meta/recipes-core/dropbear/dropbear_0.52.bb +1 -1
index 78d6cf1..4013c65 100644
@@ -3,4 +3,4 @@ require dropbear.inc
 SRC_URI[md5sum] = "1c69ec674481d7745452f68f2ea5597e"
 SRC_URI[sha256sum] = "e3a2ca49ed85ce562240c0ac06e2f72826d7e52a83e80d91c067c8b97bf5c108"
 
-PR = "r2"
+PR = "r3"
Signature · 1 line
1.7.0.4
#5 lore raw
In reply to Xiaofeng Yan
Quoted 6 lines · Xiaofeng Yan

From: Xiaofeng Yan<[email protected]>

Hi Saul,

I modified my patches according to your suggestion.
- Using spaces instead of tab

Xiaofeng,

As Richard already pointed out you changed the white space incorrectly, there are 2 types of white space used in recipe files. For things that are shell commands, we use TAB (as the file originally was doing), for python fragments 4 spaces are used. For recipe metadata, spaces are used to line up indentation of lists (Such as SRC_URI, EXTRA_OEMAKE, ...)

Please review

https://wiki.yoctoproject.org/wiki/Best_Known_Methods_%28BKMs%29_for_Package_Updating#White_Space_Management

I am sorry that was not clear from my email.

Sau!

Quoted 36 lines

- The patches can work only when pam is enabled
- Using OE-Core instead of poky

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/pam
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/pam

Thanks,
Xiaofeng Yan<[email protected]>
---

Xiaofeng Yan (3):
openssh: Support PAM
polkit: Support pam
dropbear: Support pam

  .../openssh/openssh-5.8p2/sshd                     |   10 +++
  meta/recipes-connectivity/openssh/openssh_5.8p2.bb |   77 +++++++++++---------
  meta/recipes-core/dropbear/dropbear.inc            |   78 +++++++++++---------
  .../dropbear/dropbear/dropbear-enable-pam.patch    |   22 ++++++
  meta/recipes-core/dropbear/dropbear_0.52.bb        |    2 +-
  .../polkit/polkit-0.101/polkit-1_pam.patch         |   23 ++++++
  meta/recipes-extended/polkit/polkit_0.101.bb       |    7 +-
  7 files changed, 146 insertions(+), 73 deletions(-)

create mode 100644 meta/recipes-connectivity/openssh/openssh-5.8p2/sshd create mode 100644 meta/recipes-core/dropbear/dropbear/dropbear-enable-pam.patch create mode 100644 meta/recipes-extended/polkit/polkit-0.101/polkit-1_pam.patch

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core