Skip to contentSkip to conversation

package/openssh: Set /var/empty permissions

PATCH New Chris Lesiak 3 participants 6 messages Dec 17, 2018 – Feb 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

The openssh privilege separation feature, enabled by default, requires that the path /var/empty exist and have certain permission. See README.privsep included as part of the openssh distribution.

Use OPENSSH_PERMISSIONS to ensure this is done correctly.

---
 package/openssh/openssh.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/openssh/openssh.mk +4 -0
index 07f3e0d663..9175f9589d 100644
@@ -22,6 +22,10 @@ define OPENSSH_USERS
 	sshd -1 sshd -1 * - - - SSH drop priv user
 endef
 
+define OPENSSH_PERMISSIONS
+	/var/empty d 755 root root - - - - -
+endef
+
 ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 OPENSSH_CONF_OPTS += --without-pie
 endif
Signature · 1 line
2.17.2
#1 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

Quoted 3 lines · Chris Lesiak

The openssh privilege separation feature, enabled by default, requires that the path /var/empty exist and have certain permission. See README.privsep included as part of the openssh distribution.

It's not clear to me from reading this file if /var/empty should actually be
writable or not. If it does have to be writable, then this won't work in the readonly rootfs case.

Also, README.privsep says that the sshd user should have /var/empty as its home
directory, so perhaps we should set that as well?

Regards,
Arnout

Quoted 24 lines

Use OPENSSH_PERMISSIONS to ensure this is done correctly.

---
 package/openssh/openssh.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/openssh/openssh.mk +4 -0
index 07f3e0d663..9175f9589d 100644
@@ -22,6 +22,10 @@ define OPENSSH_USERS
 	sshd -1 sshd -1 * - - - SSH drop priv user
 endef
 
+define OPENSSH_PERMISSIONS
+	/var/empty d 755 root root - - - - -
+endef
+
 ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 OPENSSH_CONF_OPTS += --without-pie
 endif
#2 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

Quoted 8 lines · Arnout Vandecappelle
Quoted 3 lines · Chris Lesiak

The openssh privilege separation feature, enabled by default, requires that the path /var/empty exist and have certain permission. See README.privsep included as part of the openssh distribution.

It's not clear to me from reading this file if /var/empty should actually be
writable or not. If it does have to be writable, then this won't work in the readonly rootfs case.

It should not be writable, even by? sshd.? The name "empty" is a clue that it is and forever shall remain empty.

Quoted 3 lines

Also, README.privsep says that the sshd user should have /var/empty as its home
directory, so perhaps we should set that as well?

I can certainly submit a new version that adds the following change:

?define OPENSSH_USERS
-?????? sshd -1 sshd -1 * - - - SSH drop priv user +?????? sshd -1 sshd -1 * /var/empty /bin/false - SSH drop priv user
?endef

Is everyone happy with using /var/empty as the home directory? It isn't obvious that /var/empty should belong to sshd.? In fact it doesn't and could be shared with other services wanting to use if for the same purpose.? /var/empty is traditional, but can be changed using --with-privsep-path=xxx.? Using /var/run/sshd might be more "modern" but I don't know if any other distributions are using it.? Oddly, Fedora uses /var/empty/sshd -- /var/empty isn't empty at all.

Sincerely,

Chris

Quoted 27 lines

Regards,
Arnout

Quoted 23 lines

Use OPENSSH_PERMISSIONS to ensure this is done correctly.

---
  package/openssh/openssh.mk | 4 ++++
  1 file changed, 4 insertions(+)
package/openssh/openssh.mk +4 -0
index 07f3e0d663..9175f9589d 100644
@@ -22,6 +22,10 @@ define OPENSSH_USERS
  	sshd -1 sshd -1 * - - - SSH drop priv user
  endef
 
+define OPENSSH_PERMISSIONS
+	/var/empty d 755 root root - - - - -
+endef
+
  ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
  OPENSSH_CONF_OPTS += --without-pie
  endif
Signature · 6 lines
Chris Lesiak
Principal Design Engineer, Software
LI-COR Biosciences
4647 Superior Street
Lincoln, NE 68504 USA
chris.lesiak at licor.com
#3 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

Quoted 10 lines · Chris Lesiak

I can certainly submit a new version that adds the following change:

?define OPENSSH_USERS
-?????? sshd -1 sshd -1 * - - - SSH drop priv user +?????? sshd -1 sshd -1 * /var/empty /bin/false - SSH drop priv user
?endef

Is everyone happy with using /var/empty as the home directory? It isn't obvious that /var/empty should belong to sshd.

It doesn't belong to sshd. There are plenty of system users that have home
directories like / or /sbin.

Note that there is no need to set the shell. - does not exist, so logging in as
that user doesn't work, which is what we want. I even think login treats it special.

But changing the home directory of sshd would probably be good.

Regards,
Arnout

#4 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

In reply to Chris Lesiak
Quoted 5 lines · Chris Lesiak

The openssh privilege separation feature, enabled by default, requires that the path /var/empty exist and have certain permission. See README.privsep included as part of the openssh distribution.

Use OPENSSH_PERMISSIONS to ensure this is done correctly.

I've added some of the discussion to the commit message and applied to master,
thanks.

Regards,
Arnout

Quoted 22 lines
---
 package/openssh/openssh.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/openssh/openssh.mk +4 -0
index 07f3e0d663..9175f9589d 100644
@@ -22,6 +22,10 @@ define OPENSSH_USERS
 	sshd -1 sshd -1 * - - - SSH drop priv user
 endef
 
+define OPENSSH_PERMISSIONS
+	/var/empty d 755 root root - - - - -
+endef
+
 ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 OPENSSH_CONF_OPTS += --without-pie
 endif
#5 lore raw

PATCH 1/1 package/openssh: Set /var/empty permissions

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 5 lines · Chris Lesiak

The openssh privilege separation feature, enabled by default, requires that the path /var/empty exist and have certain permission. See README.privsep included as part of the openssh distribution.

Use OPENSSH_PERMISSIONS to ensure this is done correctly.

I've added some of the discussion to the commit message and applied to master,
thanks.

Committed to 2018.02.x and 2018.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard