Skip to contentSkip to conversation

dropbear: enable PAM athentication if linux-pam is selected

PATCH Superseded Carlos Santos 3 participants 7 messages Jun 28, 2018 – Jun 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dropbear: enable PAM athentication if linux-pam is selected

- Disable password file athentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the ofe from from openssh.

---
 package/dropbear/dropbear.mk    | 14 ++++++++++++++
 package/dropbear/etc-pam.d-sshd |  7 +++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/dropbear/etc-pam.d-sshd
package/dropbear/dropbear.mk +14 -0
index fc41a84c1f..bb902bc7ce 100644
@@ -34,6 +34,19 @@ ifeq ($(BR2_SHARED_STATIC_LIBS),y)
 DROPBEAR_CONF_OPTS += --disable-static
 endif
 
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+define DROPBEAR_SVR_PAM_AUTH
+	echo '#define DROPBEAR_SVR_PASSWORD_AUTH 0'     >> $(@D)/localoptions.h
+	echo '#define DROPBEAR_SVR_PAM_AUTH 1'          >> $(@D)/localoptions.h
+endef
+define DROPBEAR_INSTALL_PAM_CONF
+	$(INSTALL) -D -m 644 package/dropbear/etc-pam.d-sshd $(TARGET_DIR)/etc/pam.d/sshd
+endef
+DROPBEAR_DEPENDENCIES += linux-pam
+DROPBEAR_CONF_OPTS += --enable-pam
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PAM_AUTH
+DROPBEAR_POST_INSTALL_TARGET_HOOKS += DROPBEAR_INSTALL_PAM_CONF
+else
 # Ensure that dropbear doesn't use crypt() when it's not available
 define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#if !HAVE_CRYPT'                          >> $(@D)/localoptions.h
@@ -41,6 +54,7 @@ define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#endif'                                   >> $(@D)/localoptions.h
 endef
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PASSWORD_AUTH
+endif
 
 define DROPBEAR_ENABLE_REVERSE_DNS
 	echo '#define DO_HOST_LOOKUP 1'                 >> $(@D)/localoptions.h
package/dropbear/etc-pam.d-sshd new file +7 -0
new file mode 100644
index 0000000000..5e13fc0d60
@@ -0,0 +1,7 @@
+#%PAM-1.0
+auth       required     pam_unix.so shadow nodelay
+account    required     pam_nologin.so
+account    required     pam_unix.so
+password   required     pam_unix.so shadow nullok use_authtok
+session    required     pam_unix.so
+session    required     pam_limits.so
Signature · 1 line
2.14.4
#1 lore raw

PATCH 1/1 dropbear: enable PAM athentication if linux-pam is selected

Hi Carlos,

Quoted 3 lines · Carlos Santos

- Disable password file athentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the ofe from from openssh.

Something went wrong in this sentence.

Quoted 1 line

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH v2 1/1 dropbear: enable PAM athentication if linux-pam is selected

- Disable password file athentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the one installed by openssh.

---
Changes v1->v2:
- Fix commit message.

---
 package/dropbear/dropbear.mk    | 14 ++++++++++++++
 package/dropbear/etc-pam.d-sshd |  7 +++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/dropbear/etc-pam.d-sshd
package/dropbear/dropbear.mk +14 -0
index fc41a84c1f..bb902bc7ce 100644
@@ -34,6 +34,19 @@ ifeq ($(BR2_SHARED_STATIC_LIBS),y)
 DROPBEAR_CONF_OPTS += --disable-static
 endif
 
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+define DROPBEAR_SVR_PAM_AUTH
+	echo '#define DROPBEAR_SVR_PASSWORD_AUTH 0'     >> $(@D)/localoptions.h
+	echo '#define DROPBEAR_SVR_PAM_AUTH 1'          >> $(@D)/localoptions.h
+endef
+define DROPBEAR_INSTALL_PAM_CONF
+	$(INSTALL) -D -m 644 package/dropbear/etc-pam.d-sshd $(TARGET_DIR)/etc/pam.d/sshd
+endef
+DROPBEAR_DEPENDENCIES += linux-pam
+DROPBEAR_CONF_OPTS += --enable-pam
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PAM_AUTH
+DROPBEAR_POST_INSTALL_TARGET_HOOKS += DROPBEAR_INSTALL_PAM_CONF
+else
 # Ensure that dropbear doesn't use crypt() when it's not available
 define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#if !HAVE_CRYPT'                          >> $(@D)/localoptions.h
@@ -41,6 +54,7 @@ define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#endif'                                   >> $(@D)/localoptions.h
 endef
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PASSWORD_AUTH
+endif
 
 define DROPBEAR_ENABLE_REVERSE_DNS
 	echo '#define DO_HOST_LOOKUP 1'                 >> $(@D)/localoptions.h
package/dropbear/etc-pam.d-sshd new file +7 -0
new file mode 100644
index 0000000000..5e13fc0d60
@@ -0,0 +1,7 @@
+#%PAM-1.0
+auth       required     pam_unix.so shadow nodelay
+account    required     pam_nologin.so
+account    required     pam_unix.so
+password   required     pam_unix.so shadow nullok use_authtok
+session    required     pam_unix.so
+session    required     pam_limits.so
Signature · 1 line
2.14.4
#3 lore raw

PATCH v2 1/1 dropbear: enable PAM athentication if linux-pam is selected

Hi Carlos,

Quoted 5 lines · Carlos Santos

- Disable password file athentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the one installed by openssh.

Please keep the review tag in subsequent patch submissions.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#4 lore raw

PATCH v3 1/1 dropbear: enable PAM authentication if linux-pam is selected

- Disable password file authentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the one installed by openssh.

---
Changes v1->v2:
- Fix commit message.
Changes v2->v3:
- athentication -> authentication (gah!)

---
Change-Id: Ic62953e03b598bceb6374eb40436f908ab5d07ee

---
 package/dropbear/dropbear.mk    | 14 ++++++++++++++
 package/dropbear/etc-pam.d-sshd |  7 +++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/dropbear/etc-pam.d-sshd
package/dropbear/dropbear.mk +14 -0
index fc41a84c1f..bb902bc7ce 100644
@@ -34,6 +34,19 @@ ifeq ($(BR2_SHARED_STATIC_LIBS),y)
 DROPBEAR_CONF_OPTS += --disable-static
 endif
 
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+define DROPBEAR_SVR_PAM_AUTH
+	echo '#define DROPBEAR_SVR_PASSWORD_AUTH 0'     >> $(@D)/localoptions.h
+	echo '#define DROPBEAR_SVR_PAM_AUTH 1'          >> $(@D)/localoptions.h
+endef
+define DROPBEAR_INSTALL_PAM_CONF
+	$(INSTALL) -D -m 644 package/dropbear/etc-pam.d-sshd $(TARGET_DIR)/etc/pam.d/sshd
+endef
+DROPBEAR_DEPENDENCIES += linux-pam
+DROPBEAR_CONF_OPTS += --enable-pam
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PAM_AUTH
+DROPBEAR_POST_INSTALL_TARGET_HOOKS += DROPBEAR_INSTALL_PAM_CONF
+else
 # Ensure that dropbear doesn't use crypt() when it's not available
 define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#if !HAVE_CRYPT'                          >> $(@D)/localoptions.h
@@ -41,6 +54,7 @@ define DROPBEAR_SVR_PASSWORD_AUTH
 	echo '#endif'                                   >> $(@D)/localoptions.h
 endef
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PASSWORD_AUTH
+endif
 
 define DROPBEAR_ENABLE_REVERSE_DNS
 	echo '#define DO_HOST_LOOKUP 1'                 >> $(@D)/localoptions.h
package/dropbear/etc-pam.d-sshd new file +7 -0
new file mode 100644
index 0000000000..5e13fc0d60
@@ -0,0 +1,7 @@
+#%PAM-1.0
+auth       required     pam_unix.so shadow nodelay
+account    required     pam_nologin.so
+account    required     pam_unix.so
+password   required     pam_unix.so shadow nullok use_authtok
+session    required     pam_unix.so
+session    required     pam_limits.so
Signature · 1 line
2.14.4
#5 lore raw

PATCH v3 1/1 dropbear: enable PAM authentication if linux-pam is selected

Hello,

Quoted 11 lines · Carlos Santos

- Disable password file authentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the one installed by openssh.

---
Changes v1->v2:
- Fix commit message.
Changes v2->v3:
- athentication -> authentication (gah!)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH v3 1/1 dropbear: enable PAM authentication if linux-pam is selected

Carlos, Baruch,

Quoted 13 lines · Thomas Petazzoni
Quoted 11 lines · Carlos Santos

- Disable password file authentication, since it's not possible to have both at once.
- Install a /etc/pam.d/sshd file, based on the one installed by openssh.

---
Changes v1->v2:
- Fix commit message.
Changes v2->v3:
- athentication -> authentication (gah!)

Quoted 1 line

Applied to master, thanks.

Since you're looking at dropbear, could you review the following patches:

http://patchwork.ozlabs.org/patch/909724/
http://patchwork.ozlabs.org/patch/884051/

The former looks OK to me, but the latter seems less OK as I'm not sure we want to handle this specifically for dropbear: there are other SSH servers as well. Let me know if you see a reason to have that second patch.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com