Skip to contentSkip to conversation

quagga: add pam support for vtysh

PATCH In review Hongxu Jia 3 participants 6 messages Nov 8, 2013 – Nov 26, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover quagga: add pam support for vtysh

Test Case:
1. Add DISTRO_FEATURES += 'pam' to local.conf and build image with quagga.

2. On target:
1) cat /etc/pam.d/guagga
#
# The PAM configuration file for the quagga `vtysh' service #

# This allows root to change user infomation without being

# prompted for a password
auth		sufficient	pam_rootok.so

# The standard Unix authentication modules, used with # NIS (man nsswitch) as well as normal /etc/passwd and

# /etc/shadow entries.
auth       include      common-auth

2) add option debug to pam_rootok.so
auth sufficient pam_rootok.so debug

3) pam_rootok.so
run command vtysh as root, enter qemu0#:

root@qemu0:~# vtysh 

Hello, this is Quagga (version 0.99.21).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

qemu0#
log info in /var/log/message(or /var/log/auth.log) shows pam_rootok.so return success:

2013-11-08T03:33:44.898360+00:00 qemu0 vtysh: pam_rootok(quagga:auth): root check succeeded

4) pam_unix.so
the content of common-auth are shown at section "Common configure files" comment the configure file quagga pam_rootok.so line, because it will make pam return success:
#auth sufficient pam_rootok.so
and modify the pam_unix.so line in common-auth to remove nullok_secure:
auth [success=1 default=ignore] pam_unix.so debug

5) run commands with invalid password:

root@qemu0:~# vtysh 
Password: 
root@qemu0:~# 
log in /var/log/message(or /var/log/auth.log):
2013-11-08T04:20:49.418763+00:00 qemu0 vtysh: pam_unix(quagga:auth): authentication failure; logname=root uid=0 euid=0 tty= ruser= rhost=  user=root

//Hongxu

The following changes since commit ffb5434823195cbdc41c76a110eaa6ae04e2b010:

dnsmasq: uprev to 2.6.3 (2013-11-06 15:12:45 -0500)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-quagga-pam
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-quagga-pam

Hongxu Jia (1):
quagga: add pam support for vtysh

 meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 +++++++++++++
 meta-networking/recipes-protocols/quagga/quagga.inc       | 13 ++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga.pam
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/1 quagga: add pam support for vtysh

According to DISTRO_FEATURES to add pam support for quagga, and import configure file from Fedora.

---
 meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 +++++++++++++
 meta-networking/recipes-protocols/quagga/quagga.inc       | 13 ++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga.pam
meta-networking/recipes-protocols/quagga/files/quagga.pam new file +13 -0
new file mode 100644
index 0000000..3541a97
@@ -0,0 +1,13 @@
+#
+# The PAM configuration file for the quagga `vtysh' service
+#
+
+# This allows root to change user infomation without being
+# prompted for a password
+auth		sufficient	pam_rootok.so
+
+# The standard Unix authentication modules, used with
+# NIS (man nsswitch) as well as normal /etc/passwd and
+# /etc/shadow entries.
+auth       include      common-auth
+
meta-networking/recipes-protocols/quagga/quagga.inc +12 -1
index 2106c9b..52cd7a3 100644
@@ -32,10 +32,12 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
            file://watchquagga.init \
            file://watchquagga.default \
            file://volatiles.03_quagga \
+           file://file://quagga.pam \
            file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
 PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
+PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
 
 inherit autotools update-rc.d useradd
 
@@ -98,6 +100,15 @@ do_install () {
     # Remove generated info dir file, it doesn't belong in the generated
     # package.
     rm -f ${D}${infodir}/dir
+
+    # For PAM
+    for feature in ${DISTRO_FEATURES}; do
+        if [ "$feature" = "pam" ]; then
+            install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
+            break
+        fi
+    done
+
 }
 
 # Split into a main package and separate per-protocol packages
Signature · 1 line
1.8.1.2
#2 lore raw
Quoted 34 lines · Hongxu Jia

According to DISTRO_FEATURES to add pam support for quagga, and import configure file from Fedora.

---
  meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 +++++++++++++
  meta-networking/recipes-protocols/quagga/quagga.inc       | 13 ++++++++++++-
  2 files changed, 25 insertions(+), 1 deletion(-)

create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga.pam

meta-networking/recipes-protocols/quagga/files/quagga.pam new file +13 -0
new file mode 100644
index 0000000..3541a97
@@ -0,0 +1,13 @@
+#
+# The PAM configuration file for the quagga `vtysh' service
+#
+
+# This allows root to change user infomation without being
+# prompted for a password
+auth		sufficient	pam_rootok.so
+
+# The standard Unix authentication modules, used with
+# NIS (man nsswitch) as well as normal /etc/passwd and
+# /etc/shadow entries.
+auth       include      common-auth
+
meta-networking/recipes-protocols/quagga/quagga.inc +0 -0
index 2106c9b..52cd7a3 100644

meta-networking/recipes-protocols/quagga/quagga.inc SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg · line 35

Quoted 4 lines
meta-networking/recipes-protocols/quagga/quagga.inc +1 -0
@@ -32,10 +32,12 @@ SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg
             file://watchquagga.init \
             file://watchquagga.default \
             file://volatiles.03_quagga \
+           file://file://quagga.pam \

Why is there be two file://?

Quoted 12 lines
meta-networking/recipes-protocols/quagga/quagga.inc +2 -1
             file://ripd-fix-two-bugs-after-received-SIGHUP.patch"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
  PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
+PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
 
  inherit autotools update-rc.d useradd
 
@@ -98,6 +100,15 @@ do_install () {
      # Remove generated info dir file, it doesn't belong in the generated
      # package.

meta-networking/recipes-protocols/quagga/quagga.inc do_install () { · line 111

Quoted 10 lines
meta-networking/recipes-protocols/quagga/quagga.inc +9 -0
      rm -f ${D}${infodir}/dir
+
+    # For PAM
+    for feature in ${DISTRO_FEATURES}; do
+        if [ "$feature" = "pam" ]; then
+            install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
+            break
+        fi
+    done
+

Could you use the below method to simply this loop

if
${@base_contains('DISTRO_FEATURES','sysvinit','false','true',d)};then
if

-Roy

Quoted 4 lines
meta-networking/recipes-protocols/quagga/quagga.inc +0 -0
  }
 
  # Split into a main package and separate per-protocol packages
Signature · 2 lines
Best Reagrds,
Roy | RongQing Li
author
#3 lore raw
Quoted 39 lines · Rongqing Li
Quoted 36 lines · Hongxu Jia

According to DISTRO_FEATURES to add pam support for quagga, and import configure file from Fedora.

---
  meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 
+++++++++++++
  meta-networking/recipes-protocols/quagga/quagga.inc       | 13 
++++++++++++-
  2 files changed, 25 insertions(+), 1 deletion(-)

create mode 100644
meta-networking/recipes-protocols/quagga/files/quagga.pam

meta-networking/recipes-protocols/quagga/files/quagga.pam new file +13 -0
new file mode 100644
index 0000000..3541a97
@@ -0,0 +1,13 @@
+#
+# The PAM configuration file for the quagga `vtysh' service
+#
+
+# This allows root to change user infomation without being
+# prompted for a password
+auth        sufficient    pam_rootok.so
+
+# The standard Unix authentication modules, used with
+# NIS (man nsswitch) as well as normal /etc/passwd and
+# /etc/shadow entries.
+auth       include      common-auth
+
meta-networking/recipes-protocols/quagga/quagga.inc +0 -0
index 2106c9b..52cd7a3 100644
Quoted 9 lines
Quoted 6 lines
meta-networking/recipes-protocols/quagga/quagga.inc +0 -0
@@ -32,10 +32,12 @@ SRC_URI = 

"http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagg

             file://watchquagga.init \
             file://watchquagga.default \
             file://volatiles.03_quagga \

+ file://file://quagga.pam \

Why is there be two file://?

Oh, sorry for the typo, I have updated the git to correct this.

git://git.pokylinux.org/poky-contrib hongxu/fix-quagga-pam
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-quagga-pam

Thanks,
Hongxu

Quoted 41 lines
Quoted 22 lines

file://ripd-fix-two-bugs-after-received-SIGHUP.patch"

meta-networking/recipes-protocols/quagga/quagga.inc +1 -1
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', 

'', d)}"
PACKAGECONFIG[cap] =
"--enable-capabilities,--disable-capabilities,libcap"

meta-networking/recipes-protocols/quagga/quagga.inc +1 -0
+PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
 
  inherit autotools update-rc.d useradd
@@ -98,6 +100,15 @@ do_install () {
      # Remove generated info dir file, it doesn't belong in the 

generated

      # package.
      rm -f ${D}${infodir}/dir
meta-networking/recipes-protocols/quagga/quagga.inc +5 -0
+
+    # For PAM
+    for feature in ${DISTRO_FEATURES}; do
+        if [ "$feature" = "pam" ]; then
+            install -D -m 644 ${WORKDIR}/quagga.pam 

${D}/${sysconfdir}/pam.d/quagga

meta-networking/recipes-protocols/quagga/quagga.inc do_install () { · line 111

Quoted 4 lines
meta-networking/recipes-protocols/quagga/quagga.inc +4 -0
+            break
+        fi
+    done
+

Could you use the below method to simply this loop

if
${@base_contains('DISTRO_FEATURES','sysvinit','false','true',d)};then
if

-Roy

Quoted 4 lines
  }

# Split into a main package and separate per-protocol packages

author
#4 lore raw
In reply to Hongxu Jia
Quoted 6 lines · Hongxu Jia

Test Case:
1. Add DISTRO_FEATURES += 'pam' to local.conf and build image with quagga.

2. On target:
1) cat /etc/pam.d/guagga

s/guagga/quagga/

//Hongxu

Quoted 61 lines

#
# The PAM configuration file for the quagga `vtysh' service #

# This allows root to change user infomation without being

# prompted for a password
auth		sufficient	pam_rootok.so

# The standard Unix authentication modules, used with # NIS (man nsswitch) as well as normal /etc/passwd and

# /etc/shadow entries.
auth       include      common-auth

2) add option debug to pam_rootok.so
auth sufficient pam_rootok.so debug

3) pam_rootok.so
run command vtysh as root, enter qemu0#:

root@qemu0:~# vtysh

Hello, this is Quagga (version 0.99.21).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

qemu0#
log info in /var/log/message(or /var/log/auth.log) shows pam_rootok.so return success:

2013-11-08T03:33:44.898360+00:00 qemu0 vtysh: pam_rootok(quagga:auth): root check succeeded

4) pam_unix.so
the content of common-auth are shown at section "Common configure files" comment the configure file quagga pam_rootok.so line, because it will make pam return success:
#auth sufficient pam_rootok.so
and modify the pam_unix.so line in common-auth to remove nullok_secure:
auth [success=1 default=ignore] pam_unix.so debug

5) run commands with invalid password:

root@qemu0:~# vtysh
Password:
root@qemu0:~#
log in /var/log/message(or /var/log/auth.log):
2013-11-08T04:20:49.418763+00:00 qemu0 vtysh: pam_unix(quagga:auth): authentication failure; logname=root uid=0 euid=0 tty= ruser= rhost=  user=root

//Hongxu

The following changes since commit ffb5434823195cbdc41c76a110eaa6ae04e2b010:

   dnsmasq: uprev to 2.6.3 (2013-11-06 15:12:45 -0500)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-quagga-pam
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-quagga-pam

Hongxu Jia (1):
quagga: add pam support for vtysh

  meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 +++++++++++++
  meta-networking/recipes-protocols/quagga/quagga.inc       | 13 ++++++++++++-
  2 files changed, 25 insertions(+), 1 deletion(-)

create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga.pam

#5 lore raw
In reply to Hongxu Jia

The latest (and slightly tweaked to resolve a trivial conflict) version merged. Thanks.
-J.

Quoted 67 lines · [[oe] [PATCH 0/1] quagga: add pam support for vtysh] On 13.11.08 (Fri 12:32)…

Test Case:
1. Add DISTRO_FEATURES += 'pam' to local.conf and build image with quagga.

2. On target:
1) cat /etc/pam.d/guagga
#
# The PAM configuration file for the quagga `vtysh' service #

# This allows root to change user infomation without being

# prompted for a password
auth		sufficient	pam_rootok.so

# The standard Unix authentication modules, used with # NIS (man nsswitch) as well as normal /etc/passwd and

# /etc/shadow entries.
auth       include      common-auth

2) add option debug to pam_rootok.so
auth sufficient pam_rootok.so debug

3) pam_rootok.so
run command vtysh as root, enter qemu0#:

root@qemu0:~# vtysh 

Hello, this is Quagga (version 0.99.21).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

qemu0#
log info in /var/log/message(or /var/log/auth.log) shows pam_rootok.so return success:

2013-11-08T03:33:44.898360+00:00 qemu0 vtysh: pam_rootok(quagga:auth): root check succeeded

4) pam_unix.so
the content of common-auth are shown at section "Common configure files" comment the configure file quagga pam_rootok.so line, because it will make pam return success:
#auth sufficient pam_rootok.so
and modify the pam_unix.so line in common-auth to remove nullok_secure:
auth [success=1 default=ignore] pam_unix.so debug

5) run commands with invalid password:

root@qemu0:~# vtysh 
Password: 
root@qemu0:~# 
log in /var/log/message(or /var/log/auth.log):
2013-11-08T04:20:49.418763+00:00 qemu0 vtysh: pam_unix(quagga:auth): authentication failure; logname=root uid=0 euid=0 tty= ruser= rhost=  user=root

//Hongxu

The following changes since commit ffb5434823195cbdc41c76a110eaa6ae04e2b010:

dnsmasq: uprev to 2.6.3 (2013-11-06 15:12:45 -0500)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-quagga-pam
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-quagga-pam

Hongxu Jia (1):
quagga: add pam support for vtysh

 meta-networking/recipes-protocols/quagga/files/quagga.pam | 13 +++++++++++++
 meta-networking/recipes-protocols/quagga/quagga.inc       | 13 ++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-protocols/quagga/files/quagga.pam
Signature · 2 lines
-Joe MacDonald.
:wq