Skip to contentSkip to conversation

openssh: stop adding -D__FILE_OFFSET_BITS=64 to CFLAGS

PATCH In review Andre McCurdy 3 participants 11 messages Jun 7, 2018 – Jun 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 openssh: stop adding -D__FILE_OFFSET_BITS=64 to CFLAGS

Openssh takes care of enabling large-file support automatically via the AC_SYS_LARGEFILE in the configure.ac, so additional help from the recipe is not required.

Even if it were once required, defining __FILE_OFFSET_BITS (ie with double leading underscores) looks like a typo and probably never had any effect anyway?

---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-connectivity/openssh/openssh_7.7p1.bb +0 -3
index 7b6ee5c..7cf34eb 100644
@@ -46,9 +46,6 @@ SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
 
 inherit autotools-brokensep ptest
 
-# LFS support:
-CFLAGS += "-D__FILE_OFFSET_BITS=64"
-
 EXTRA_AUTORECONF += "--exclude=aclocal"
 
 # login path is hardcoded in sshd
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/7 openssh: stop manually hiding libutil etc headers from configure

Since we now have recipe specific sysroots, drop old workarounds for non-deterministic detection of sysroot header files.

---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 8 --------
 1 file changed, 8 deletions(-)
meta/recipes-connectivity/openssh/openssh_7.7p1.bb +0 -8
index 7cf34eb..0459782 100644
@@ -61,17 +61,9 @@ EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \
 # musl doesn't implement wtmp/utmp
 EXTRA_OECONF_append_libc-musl = " --disable-wtmp"
 
-# Since we do not depend on libbsd, we do not want configure to use it
-# just because it finds libutil.h.  But, specifying --disable-libutil
-# causes compile errors, so...
-CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no"
-
 # passwd path is hardcoded in sshd
 CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
 
-# We don't want to depend on libblockfile
-CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
-
 do_configure_prepend () {
 	export LD="${CC}"
 	install -m 0644 ${WORKDIR}/sshd_config ${B}/
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/7] openssh: stop manually hiding libutil etc headers from configure

Quoted 7 lines · Andre McCurdy

Since we now have recipe specific sysroots, drop old workarounds for non-deterministic detection of sysroot header files.

---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 8 --------
 1 file changed, 8 deletions(-)

Even if we have rss, I think showing/documenting these recipes configure scripts autodetect is a good thing so I'd prefer not to drop this kind of code if it isn't causing problems.

Cheers,

Richard

#3 lore raw

Re: [PATCH 2/7] openssh: stop manually hiding libutil etc headers from configure

Quoted 4 lines · Richard Purdie
Quoted 3 lines · Andre McCurdy

Since we now have recipe specific sysroots, drop old workarounds for non-deterministic detection of sysroot header files.

Quoted 8 lines
Quoted 4 lines
---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 8 --------
 1 file changed, 8 deletions(-)

Even if we have rss, I think showing/documenting these recipes configure scripts autodetect is a good thing so I'd prefer not to drop this kind of code if it isn't causing problems.

It looks like this has sneaked into master-next via mut.

#4 lore raw

PATCH 3/7 openssh: drop RCONFLICTS for openssh-keygen

In reply to Andre McCurdy

The "ssh-keygen" package no longer seems to be provided by any recipe in oe-core or meta-oe, so there's no clear reason for the openssh-keygen package to conflict with it.

---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-connectivity/openssh/openssh_7.7p1.bb +0 -1
index 0459782..e4feeca 100644
@@ -145,7 +145,6 @@ RPROVIDES_${PN}-sshd = "sshd"
 
 RCONFLICTS_${PN} = "dropbear"
 RCONFLICTS_${PN}-sshd = "dropbear"
-RCONFLICTS_${PN}-keygen = "ssh-keygen"
 
 CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
 CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
Signature · 1 line
1.9.1
#5 lore raw

PATCH 4/7 openssh: minor indent cleanup for sshd init script

In reply to Andre McCurdy

The openssh sshd init script contains a mix of indent styles, mostly inherited from the Debian script from which it is derived. Leave the indent from Debian as-is, but for lines which are OE specific (e.g. where Debian's log_daemon_msg helper has been replaced with echo) make the indent consistent with surrounding lines.

---
 meta/recipes-connectivity/openssh/openssh/init | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/recipes-connectivity/openssh/openssh/init +6 -6
index 34ba0f8..8887e3a 100644
@@ -36,7 +36,7 @@ check_privsep_dir() {
 }
 
 check_config() {
-	/usr/sbin/sshd -t $SSHD_OPTS || exit 1
+    /usr/sbin/sshd $SSHD_OPTS -t || exit 1
 }
 
 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
@@ -48,19 +48,19 @@ case "$1" in
 	@LIBEXECDIR@/sshd_check_keys
 	check_privsep_dir
 	start-stop-daemon -S -p $PIDFILE -x /usr/sbin/sshd -- $SSHD_OPTS
-        echo "done."
+	echo "done."
 	;;
   stop)
-        echo -n "Stopping OpenBSD Secure Shell server: sshd"
+	echo -n "Stopping OpenBSD Secure Shell server: sshd"
 	start-stop-daemon -K -p $PIDFILE -x /usr/sbin/sshd
-        echo "."
+	echo "."
 	;;
 
   reload|force-reload)
 	check_for_no_start
 	@LIBEXECDIR@/sshd_check_keys
 	check_config
-        echo -n "Reloading OpenBSD Secure Shell server's configuration"
+	echo -n "Reloading OpenBSD Secure Shell server's configuration"
 	start-stop-daemon -K -p $PIDFILE -s 1 -x /usr/sbin/sshd
 	echo "."
 	;;
@@ -68,7 +68,7 @@ case "$1" in
   restart)
 	@LIBEXECDIR@/sshd_check_keys
 	check_config
-        echo -n "Restarting OpenBSD Secure Shell server: sshd"
+	echo -n "Restarting OpenBSD Secure Shell server: sshd"
 	start-stop-daemon -K -p $PIDFILE --oknodo -x /usr/sbin/sshd
 	check_for_no_start
 	check_privsep_dir
Signature · 1 line
1.9.1
#6 lore raw

PATCH 5/7 openssh: sync local ssh_config + sshd_config files with upstream 7.7p1

In reply to Andre McCurdy

Changes are mostly related to the removal of support for SSH v.1 protocol, which was dropped from openssh sshd in 7.4p1:

https://www.openssh.com/txt/release-7.4

---
 .../openssh/openssh/ssh_config                     | 12 ++++-----
 .../openssh/openssh/sshd_config                    | 29 ++++++----------------
 2 files changed, 14 insertions(+), 27 deletions(-)
meta/recipes-connectivity/openssh/openssh/ssh_config +6 -6
index 9e91915..e0d0238 100644
@@ -1,4 +1,4 @@
-#	$OpenBSD: ssh_config,v 1.28 2013/09/16 11:35:43 sthen Exp $
+#	$OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $
 
 # This is the ssh client system-wide configuration file.  See
 # ssh_config(5) for more information.  This file provides defaults for
@@ -31,14 +31,14 @@ Host *
 #   AddressFamily any
 #   ConnectTimeout 0
 #   StrictHostKeyChecking ask
-#   IdentityFile ~/.ssh/identity
 #   IdentityFile ~/.ssh/id_rsa
 #   IdentityFile ~/.ssh/id_dsa
+#   IdentityFile ~/.ssh/id_ecdsa
+#   IdentityFile ~/.ssh/id_ed25519
 #   Port 22
-#   Protocol 2,1
-#   Cipher 3des
-#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
-#   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
+#   Protocol 2
+#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
+#   MACs hmac-md5,hmac-sha1,[email protected]
 #   EscapeChar ~
 #   Tunnel no
 #   TunnelDevice any:any
meta/recipes-connectivity/openssh/openssh/sshd_config +8 -21
index b7c3ccd..15f061b 100644
@@ -1,4 +1,4 @@
-#	$OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
+#	$OpenBSD: sshd_config,v 1.102 2018/02/16 02:32:40 djm Exp $
 
 # This is the sshd server system-wide configuration file.  See
 # sshd_config(5) for more information.
@@ -7,7 +7,7 @@
 
 # The strategy used for options in the default sshd_config shipped with
 # OpenSSH is to specify options with their default value where
-# possible, but leave them commented.  Uncommented options change a
+# possible, but leave them commented.  Uncommented options override the
 # default value.
 
 #Port 22
@@ -15,42 +15,30 @@
 #ListenAddress 0.0.0.0
 #ListenAddress ::
 
-# The default requires explicit activation of protocol 1
-Protocol 2
-
-# HostKey for protocol version 1
-#HostKey /etc/ssh/ssh_host_key
-# HostKeys for protocol version 2
 #HostKey /etc/ssh/ssh_host_rsa_key
 #HostKey /etc/ssh/ssh_host_ecdsa_key
 #HostKey /etc/ssh/ssh_host_ed25519_key
 
-# Lifetime and size of ephemeral version 1 server key
-#KeyRegenerationInterval 1h
-#ServerKeyBits 1024
-
 # Ciphers and keying
 #RekeyLimit default none
 
 # Logging
-# obsoletes QuietMode and FascistLogging
 #SyslogFacility AUTH
 #LogLevel INFO
 
 # Authentication:
 
 #LoginGraceTime 2m
-#PermitRootLogin yes
+#PermitRootLogin prohibit-password
 #StrictModes yes
 #MaxAuthTries 6
 #MaxSessions 10
 
-#RSAAuthentication yes
 #PubkeyAuthentication yes
 
 # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
 # but this is overridden so installations will only check .ssh/authorized_keys
-AuthorizedKeysFile .ssh/authorized_keys
+AuthorizedKeysFile	.ssh/authorized_keys
 
 #AuthorizedPrincipalsFile none
 
@@ -58,11 +46,9 @@ AuthorizedKeysFile .ssh/authorized_keys
 #AuthorizedKeysCommandUser nobody
 
 # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-#RhostsRSAAuthentication no
-# similar for protocol version 2
 #HostbasedAuthentication no
 # Change to yes if you don't trust ~/.ssh/known_hosts for
-# RhostsRSAAuthentication and HostbasedAuthentication
+# HostbasedAuthentication
 #IgnoreUserKnownHosts no
 # Don't read the user's ~/.rhosts and ~/.shosts files
 #IgnoreRhosts yes
@@ -71,7 +57,8 @@ AuthorizedKeysFile .ssh/authorized_keys
 #PasswordAuthentication yes
 #PermitEmptyPasswords no
 
-# Change to no to disable s/key passwords
+# Change to yes to enable challenge-response passwords (beware issues with
+# some PAM modules and threads)
 ChallengeResponseAuthentication no
 
 # Kerberos options
@@ -110,7 +97,7 @@ ChallengeResponseAuthentication no
 Compression no
 ClientAliveInterval 15
 ClientAliveCountMax 4
-#UseDNS yes
+#UseDNS no
 #PidFile /var/run/sshd.pid
 #MaxStartups 10:30:100
 #PermitTunnel no
Signature · 1 line
1.9.1
#7 lore raw

PATCH 6/7 openssh: only create sshd host keys which have been enabled

In reply to Andre McCurdy

Previously sshd_check_keys would create a full set of all possible sshd host keys, even if sshd_config has been set to only enable certain key types.

Update sshd_check_keys to only create keys which have been enabled in sshd_config (with a fallback to creating a full set of key types if no HostKey options are defined, as before).

---
 .../openssh/openssh/sshd_check_keys                | 42 ++++++++++------------
 1 file changed, 19 insertions(+), 23 deletions(-)
meta/recipes-connectivity/openssh/openssh/sshd_check_keys +19 -23
index be2e2ec..1931dc7 100644
@@ -56,27 +56,23 @@ while true ; do
     esac
 done
 
-# parse location of keys
-HOST_KEY_RSA=$(grep ^HostKey "${sshd_config}" | grep _rsa_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_RSA}" ] && HOST_KEY_RSA=$(grep HostKey "${sshd_config}" | grep _rsa_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_RSA}" ] && HOST_KEY_RSA=$SYSCONFDIR/ssh_host_rsa_key
-HOST_KEY_ECDSA=$(grep ^HostKey "${sshd_config}" | grep _ecdsa_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_ECDSA}" ] && HOST_KEY_ECDSA=$(grep HostKey "${sshd_config}" | grep _ecdsa_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_ECDSA}" ] && HOST_KEY_ECDSA=$SYSCONFDIR/ssh_host_ecdsa_key
-HOST_KEY_ED25519=$(grep ^HostKey "${sshd_config}" | grep _ed25519_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_ED25519}" ] && HOST_KEY_ED25519=$(grep HostKey "${sshd_config}" | grep _ed25519_ | tail -1 | awk ' { print $2 } ')
-[ -z "${HOST_KEY_ED25519}" ] && HOST_KEY_ED25519=$SYSCONFDIR/ssh_host_ed25519_key
+HOST_KEYS=$(sed -n 's/^[ \t]*HostKey[ \t]\+\(.*\)/\1/p' "${sshd_config}")
+[ -z "${HOST_KEYS}" ] && HOST_KEYS="$SYSCONFDIR/ssh_host_rsa_key $SYSCONFDIR/ssh_host_ecdsa_key $SYSCONFDIR/ssh_host_ed25519_key"
 
-# create keys if necessary
-if [ ! -f $HOST_KEY_RSA ]; then
-    echo "  generating ssh RSA key..."
-    generate_key $HOST_KEY_RSA rsa
-fi
-if [ ! -f $HOST_KEY_ECDSA ]; then
-    echo "  generating ssh ECDSA key..."
-    generate_key $HOST_KEY_ECDSA ecdsa
-fi
-if [ ! -f $HOST_KEY_ED25519 ]; then
-    echo "  generating ssh ED25519 key..."
-    generate_key $HOST_KEY_ED25519 ed25519
-fi
+for key in ${HOST_KEYS} ; do
+    [ -f $key ] && continue
+    case $key in
+    *_rsa_key)
+        echo "  generating ssh RSA host key..."
+        generate_key $key rsa
+        ;;
+    *_ecdsa_key)
+        echo "  generating ssh ECDSA host key..."
+        generate_key $key ecdsa
+        ;;
+    *_ed25519_key)
+        echo "  generating ssh ED25519 host key..."
+        generate_key $key ed25519
+        ;;
+    esac
+done
Signature · 1 line
1.9.1
#8 lore raw

PATCH 7/7 rootfs-postcommands.bbclass: drop obsolete sshd UseDNS rootfs postprocessing

In reply to Andre McCurdy

The sshd UseDNS option has defaulted to "no" since openssh 6.8p1, so it's no longer necessary to postprocess the rootfs to force the option:

https://www.openssh.com/txt/release-6.8

---
 meta/classes/rootfs-postcommands.bbclass | 11 -----------
 1 file changed, 11 deletions(-)
meta/classes/rootfs-postcommands.bbclass +0 -11
index 221869e..9d4d95e 100644
@@ -36,11 +36,6 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd"
 
 ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
 
-# Disable DNS lookups, the SSH_DISABLE_DNS_LOOKUP can be overridden to allow
-# distros to choose not to take this change
-SSH_DISABLE_DNS_LOOKUP ?= " ssh_disable_dns_lookup ; "
-ROOTFS_POSTPROCESS_COMMAND_append_qemuall = "${SSH_DISABLE_DNS_LOOKUP}"
-
 # Sort the user and group entries in /etc by ID in order to make the content
 # deterministic. Package installs are not deterministic, causing the ordering
 # of entries to change between builds. In case that this isn't desired,
@@ -171,12 +166,6 @@ ssh_allow_empty_password () {
 	fi
 }
 
-ssh_disable_dns_lookup () {
-	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
-		sed -i -e 's:#UseDNS yes:UseDNS no:' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
-	fi
-}
-
 python sort_passwd () {
     import rootfspostcommands
     rootfspostcommands.sort_passwd(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
Signature · 1 line
1.9.1
#9 lore raw
In reply to Andre McCurdy
Quoted 7 lines · Andre McCurdy

Openssh takes care of enabling large-file support automatically via the AC_SYS_LARGEFILE in the configure.ac, so additional help from the recipe is not required.

Even if it were once required, defining __FILE_OFFSET_BITS (ie with double leading underscores) looks like a typo and probably never had any effect anyway?

Ping.

Any issues with this (the whole series of 7)?

Quoted 22 lines
---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-connectivity/openssh/openssh_7.7p1.bb +0 -4
index 7b6ee5c..7cf34eb 100644
@@ -46,9 +46,6 @@ SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
 
 inherit autotools-brokensep ptest
 
-# LFS support:
-CFLAGS += "-D__FILE_OFFSET_BITS=64"
-
 EXTRA_AUTORECONF += "--exclude=aclocal"
 
 # login path is hardcoded in sshd
--

1.9.1

#10 lore raw

Looks good to me, marked for MUT.

Ross

Quoted 40 lines · Andre McCurdy
Quoted 7 lines · Andre McCurdy

Openssh takes care of enabling large-file support automatically via the AC_SYS_LARGEFILE in the configure.ac, so additional help from the recipe is not required.

Even if it were once required, defining __FILE_OFFSET_BITS (ie with double leading underscores) looks like a typo and probably never had any effect anyway?

Ping.

Any issues with this (the whole series of 7)?

Quoted 20 lines
---
 meta/recipes-connectivity/openssh/openssh_7.7p1.bb | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-connectivity/openssh/openssh_7.7p1.bb +0 -4
index 7b6ee5c..7cf34eb 100644
@@ -46,9 +46,6 @@ SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
 
 inherit autotools-brokensep ptest
 
-# LFS support:
-CFLAGS += "-D__FILE_OFFSET_BITS=64"
-
 EXTRA_AUTORECONF += "--exclude=aclocal"
 
 # login path is hardcoded in sshd
--
Quoted 2 lines

1.9.1

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