Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package openssh.15813 for openSUSE:Leap:15.2:Update checked in at 2021-02-22 14:05:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2:Update/openssh.15813 (Old) and /work/SRC/openSUSE:Leap:15.2:Update/.openssh.15813.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openssh.15813" Mon Feb 22 14:05:26 2021 rev:1 rq:873732 version:8.1p1 Changes: -------- New Changes file: --- /dev/null 2021-02-22 01:36:22.145178436 +0100 +++ /work/SRC/openSUSE:Leap:15.2:Update/.openssh.15813.new.2378/openssh-askpass-gnome.changes 2021-02-22 14:05:28.882689280 +0100 @@ -0,0 +1,289 @@ +------------------------------------------------------------------- +Thu Jul 18 14:07:56 UTC 2019 - Fabian Vogt <fv...@suse.com> + +- Supplement libgtk-3-0 instead to avoid installation on a textmode install + (boo#1142000) + +------------------------------------------------------------------- +Thu Feb 14 10:36:03 UTC 2019 - Tom???? Chv??tal <tchva...@suse.com> + +- Supplement the openssh and libx11 together to ensure this package + is installed on machines where there is X stack + +------------------------------------------------------------------- +Mon Oct 22 08:59:02 UTC 2018 - Pedro Monreal Gonzalez <pmonrealgonza...@suse.com> + +- Version update to 7.9p1 + * No actual changes for the askpass + * See main package changelog for details + +------------------------------------------------------------------- +Tue Oct 9 10:52:15 UTC 2018 - Tom???? Chv??tal <tchva...@suse.com> + +- Update to 7.8p1: + * no actual changes for the askpass +- Format with spec-cleaner +- Respect cflags +- Use gtk3 rather than gtk2 which is being phased out + +------------------------------------------------------------------- +Mon May 21 15:19:03 UTC 2018 - pce...@suse.com + +- Upgrade to 7.7p1 (bsc#1094068) + +------------------------------------------------------------------- +Wed Jan 31 22:54:55 UTC 2018 - pce...@suse.com + +- .spec file cleanup + +------------------------------------------------------------------- +Fri Nov 3 12:27:18 UTC 2017 - pce...@suse.com + +- upgrade to 7.6p1 + see main package changelog for details + +------------------------------------------------------------------- +Mon Jul 25 13:45:53 UTC 2016 - meiss...@suse.com + +- fixed url + +------------------------------------------------------------------- +Sun Apr 17 23:27:51 UTC 2016 - pce...@suse.com + +- upgrade to 7.2p2 + +------------------------------------------------------------------- +Tue Feb 10 13:28:56 UTC 2015 - pce...@suse.com + +- changing license to 2-clause BSD to match source + +------------------------------------------------------------------- +Fri Apr 11 21:50:51 UTC 2014 - pce...@suse.com + +- Update of the underlying OpenSSH to 6.6p1 + +------------------------------------------------------------------- +Wed Feb 12 01:24:16 UTC 2014 - pce...@suse.com + +- Update of the underlying OpenSSH to 6.5p1 + +------------------------------------------------------------------- +Fri Jan 24 15:13:09 UTC 2014 - pce...@suse.com + +- Update of the underlying OpenSSH to 6.4p1 + +------------------------------------------------------------------- +Thu Sep 19 02:02:56 UTC 2013 - pce...@suse.com + +- spec file cleanup (don't pointelssly build whole OpenSSH) + +------------------------------------------------------------------- +Sat Aug 3 18:12:20 UTC 2013 - crrodrig...@opensuse.org + +- Update for 6.2p2 + +------------------------------------------------------------------- +Tue Nov 13 10:51:12 UTC 2012 - meiss...@suse.com + +- Updated to 6.1p1, a bugfix release + Features: + * sshd(8): This release turns on pre-auth sandboxing sshd by default for + new installs, by setting UsePrivilegeSeparation=sandbox in sshd_config. + * ssh-keygen(1): Add options to specify starting line number and number of + lines to process when screening moduli candidates, allowing processing + of different parts of a candidate moduli file in parallel + * sshd(8): The Match directive now supports matching on the local (listen) + address and port upon which the incoming connection was received via + LocalAddress and LocalPort clauses. + * sshd(8): Extend sshd_config Match directive to allow setting AcceptEnv + and {Allow,Deny}{Users,Groups} + * Add support for RFC6594 SSHFP DNS records for ECDSA key types. bz#1978 + * ssh-keygen(1): Allow conversion of RSA1 keys to public PEM and PKCS8 + * sshd(8): Allow the sshd_config PermitOpen directive to accept "none" as + an argument to refuse all port-forwarding requests. + * sshd(8): Support "none" as an argument for AuthorizedPrincipalsFile + * ssh-keyscan(1): Look for ECDSA keys by default. bz#1971 + * sshd(8): Add "VersionAddendum" to sshd_config to allow server operators + to append some arbitrary text to the server SSH protocol banner. + Bugfixes: + * ssh(1)/sshd(8): Don't spin in accept() in situations of file + descriptor exhaustion. Instead back off for a while. + * ssh(1)/sshd(8): Remove hmac-sha2-256-96 and hmac-sha2-512-96 MACs as + they were removed from the specification. bz#2023, + * sshd(8): Handle long comments in config files better. bz#2025 + * ssh(1): Delay setting tty_flag so RequestTTY options are correctly + picked up. bz#1995 + * sshd(8): Fix handling of /etc/nologin incorrectly being applied to root + on platforms that use login_cap. + Portable OpenSSH: + * sshd(8): Allow sshd pre-auth sandboxing to fall-back to the rlimit + sandbox from the Linux SECCOMP filter sandbox when the latter is + not available in the kernel. + * ssh(1): Fix NULL dereference when built with LDNS and using DNSSEC to + retrieve a CNAME SSHFP record. + * Fix cross-compilation problems related to pkg-config. bz#1996 + +------------------------------------------------------------------- +Wed Jun 27 09:51:19 UTC 2012 - co...@suse.com + +- the gnome askpass does not require the x11 askpass - especially not + in the version of openssh (it's at 1.X) + +------------------------------------------------------------------- +Tue May 29 07:14:53 UTC 2012 - meiss...@suse.com + +- use correct tarball url +- update to 6.0p1. + +------------------------------------------------------------------- +Wed Mar 28 11:42:32 UTC 2012 - a...@suse.de + +- Add build require on autoconf and automake. + +------------------------------------------------------------------- +Wed Dec 21 10:31:42 UTC 2011 - co...@suse.com + +- remove call to suse_update_config (very old work around) + +------------------------------------------------------------------- +Wed Oct 19 00:40:15 UTC 2011 - pce...@suse.com + +- Update to 5.9p1 + +------------------------------------------------------------------- +Fri Feb 4 11:19:14 UTC 2011 - lchiqui...@novell.com + +- Update to 5.8p1 + +------------------------------------------------------------------- +Mon Jan 24 11:51:10 UTC 2011 - lchiqui...@novell.com + +- Update to 5.7p1 + +------------------------------------------------------------------- +Wed Jan 12 13:37:38 CET 2011 - sbra...@suse.cz + +- Removed relics of no more implemented opensc support. + +------------------------------------------------------------------- +Tue Aug 24 15:50:17 CEST 2010 - ani...@suse.cz + +- update to 5.6p1 + +------------------------------------------------------------------- +Fri Mar 26 11:04:59 CET 2010 - ani...@suse.cz + +- update to 5.4p1 +- remove -pam-fix4.diff (in upstream now) + +------------------------------------------------------------------- +Mon Feb 23 17:27:22 CET 2009 - ani...@suse.cz + +- update to 5.2p1 + +------------------------------------------------------------------- +Wed Apr 9 14:35:42 CEST 2008 - ani...@suse.cz + +- update to 5.0p1 + +------------------------------------------------------------------- +Wed Apr 2 15:06:01 CEST 2008 - ani...@suse.cz + +- update to 4.9p1 + +------------------------------------------------------------------- +Wed Dec 5 10:56:07 CET 2007 - ani...@suse.cz + +- - update to 4.7p1 ++++ 92 more lines (skipped) ++++ between /dev/null ++++ and /work/SRC/openSUSE:Leap:15.2:Update/.openssh.15813.new.2378/openssh-askpass-gnome.changes New Changes file: --- /dev/null 2021-02-22 01:36:22.145178436 +0100 +++ /work/SRC/openSUSE:Leap:15.2:Update/.openssh.15813.new.2378/openssh.changes 2021-02-22 14:05:28.950689336 +0100 @@ -0,0 +1,4275 @@ +------------------------------------------------------------------- +Fri Jan 8 01:37:02 UTC 2021 - Hans Petter Jansson <h...@suse.com> + +- Update openssh-8.1p1-audit.patch (bsc#1180501). This fixes + occasional crashes on connection termination caused by accessing + freed memory. + +------------------------------------------------------------------- +Wed Dec 2 21:14:34 UTC 2020 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-CVE-2020-14145-information-leak.patch + (CVE-2020-14145, bsc#1173513). This partially mitigates a + potential information leak during host key exchange that could + be exploited by a man-in-the-middle attacker. + +------------------------------------------------------------------- +Mon Nov 2 20:18:41 UTC 2020 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-fips-ensure-approved-moduli.patch (bsc#1177939). + This ensures only approved DH parameters are used in FIPS mode. + +------------------------------------------------------------------- +Fri Sep 25 21:41:20 UTC 2020 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-8.1p1-ed25519-use-openssl-rng.patch (bsc#1173799). + This uses OpenSSL's RAND_bytes() directly instead of the internal + ChaCha20-based implementation to obtain random bytes for Ed25519 + curve computations. This is required for FIPS compliance. + +------------------------------------------------------------------- +Fri Feb 28 16:15:06 UTC 2020 - Ludwig Nussel <lnus...@suse.de> + +- Don't recommend xauth to avoid pulling in X. + +------------------------------------------------------------------- +Tue Feb 18 14:47:36 UTC 2020 - Fabian Vogt <fv...@suse.com> + +- Add patches to fix the sandbox blocking glibc on 32bit platforms + (boo#1164061): + * openssh-8.1p1-seccomp-clock_nanosleep_time64.patch + * openssh-8.1p1-seccomp-clock_gettime64.patch + +------------------------------------------------------------------- +Tue Feb 11 02:20:32 UTC 2020 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-8.1p1-use-openssl-kdf.patch (jsc#SLE-9443). This + performs key derivation using OpenSSL's SSHKDF facility, which + allows OpenSSH to benefit from the former's FIPS certification + status. + +------------------------------------------------------------------- +Thu Nov 21 04:49:22 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Make sure ssh-keygen runs if SSHD_AUTO_KEYGEN variable is unset + or contains an unrecognized value (bsc#1157176). + +------------------------------------------------------------------- +Fri Nov 8 18:05:37 UTC 2019 - Cristian Rodr??guez <crrodrig...@opensuse.org> + +- Add openssh-8.1p1-seccomp-clock_nanosleep.patch, allow clock_nanosleep + glibc master implements multiple functions using that syscall making + the privsep sandbox kill the preauth process. + +------------------------------------------------------------------- +Thu Oct 17 06:23:58 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Update openssh-7.7p1-audit.patch to fix crash (bsc#1152730). Fix + by Enzo Matsumiya (ematsum...@suse.com). This was integrated in + a separate code stream merged with the Oct. 10 update; the patch + was also rebased and renamed to openssh-8.1p1-audit.patch. + +------------------------------------------------------------------- +Mon Oct 14 23:58:39 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-7.9p1-keygen-preserve-perms.patch (bsc#1150574). + This attempts to preserve the permissions of any existing + known_hosts file when modified by ssh-keygen (for instance, + with -R). +- Added openssh-7.9p1-revert-new-qos-defaults.patch, which reverts + an upstream commit that caused compatibility issues with other + software (bsc#1136402). + +------------------------------------------------------------------- +Mon Oct 14 23:56:42 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Run 'ssh-keygen -A' on startup only if SSHD_AUTO_KEYGEN="yes" + in /etc/sysconfig/ssh. This is set to "yes" by default, but + can be changed by the system administrator (bsc#1139089). + +------------------------------------------------------------------- +Mon Oct 14 23:50:04 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Add openssh-7.9p1-keygen-preserve-perms.patch (bsc#1150574). + This attempts to preserve the permissions of any existing + known_hosts file when modified by ssh-keygen (for instance, + with -R). + +------------------------------------------------------------------- +Thu Oct 10 00:41:18 UTC 2019 - Hans Petter Jansson <h...@suse.com> + +- Version update to 8.1p1: + * ssh-keygen(1): when acting as a CA and signing certificates with + an RSA key, default to using the rsa-sha2-512 signature algorithm. + Certificates signed by RSA keys will therefore be incompatible + with OpenSSH versions prior to 7.2 unless the default is + overridden (using "ssh-keygen -t ssh-rsa -s ..."). + * ssh(1): Allow %n to be expanded in ProxyCommand strings + * ssh(1), sshd(8): Allow prepending a list of algorithms to the + default set by starting the list with the '^' character, E.g. + "HostKeyAlgorithms ^ssh-ed25519" + * ssh-keygen(1): add an experimental lightweight signature and + verification ability. Signatures may be made using regular ssh keys + held on disk or stored in a ssh-agent and verified against an + authorized_keys-like list of allowed keys. Signatures embed a + namespace that prevents confusion and attacks between different + usage domains (e.g. files vs email). + * ssh-keygen(1): print key comment when extracting public key from a + private key. + * ssh-keygen(1): accept the verbose flag when searching for host keys + in known hosts (i.e. "ssh-keygen -vF host") to print the matching + host's random-art signature too. + * All: support PKCS8 as an optional format for storage of private + keys to disk. The OpenSSH native key format remains the default, + but PKCS8 is a superior format to PEM if interoperability with + non-OpenSSH software is required, as it may use a less insecure + key derivation function than PEM's. + +- Additional changes from 8.0p1 release: + * scp(1): Add "-T" flag to disable client-side filtering of + server file list. + * sshd(8): Remove support for obsolete "host/port" syntax. + * ssh(1), ssh-agent(1), ssh-add(1): Add support for ECDSA keys in + PKCS#11 tokens. + * ssh(1), sshd(8): Add experimental quantum-computing resistant + key exchange method, based on a combination of Streamlined NTRU + Prime 4591^761 and X25519. + * ssh-keygen(1): Increase the default RSA key size to 3072 bits, + following NIST Special Publication 800-57's guidance for a + 128-bit equivalent symmetric security level. + * ssh(1): Allow "PKCS11Provider=none" to override later instances of + the PKCS11Provider directive in ssh_config, + * sshd(8): Add a log message for situations where a connection is + dropped for attempting to run a command but a sshd_config + ForceCommand=internal-sftp restriction is in effect. + * ssh(1): When prompting whether to record a new host key, accept + the key fingerprint as a synonym for "yes". This allows the user + to paste a fingerprint obtained out of band at the prompt and + have the client do the comparison for you. + * ssh-keygen(1): When signing multiple certificates on a single + command-line invocation, allow automatically incrementing the + certificate serial number. + * scp(1), sftp(1): Accept -J option as an alias to ProxyJump on + the scp and sftp command-lines. + * ssh-agent(1), ssh-pkcs11-helper(8), ssh-add(1): Accept "-v" + command-line flags to increase the verbosity of output; pass + verbose flags though to subprocesses, such as ssh-pkcs11-helper + started from ssh-agent. + * ssh-add(1): Add a "-T" option to allowing testing whether keys in + an agent are usable by performing a signature and a verification. + * sftp-server(8): Add a "lsets...@openssh.com" protocol extension + that replicates the functionality of the existing SSH2_FXP_SETSTAT + operation but does not follow symlinks. + * sftp(1): Add "-h" flag to chown/chgrp/chmod commands to request + they do not follow symlinks. + * sshd(8): Expose $SSH_CONNECTION in the PAM environment. This makes + the connection 4-tuple available to PAM modules that wish to use + it in decision-making. + * sshd(8): Add a ssh_config "Match final" predicate Matches in same + pass as "Match canonical" but doesn't require hostname + canonicalisation be enabled. + * sftp(1): Support a prefix of '@' to suppress echo of sftp batch + commands. + * ssh-keygen(1): When printing certificate contents using + "ssh-keygen -Lf /path/certificate", include the algorithm that + the CA used to sign the cert. + +- Rebased patches: + * openssh-7.7p1-IPv6_X_forwarding.patch + * openssh-7.7p1-X_forward_with_disabled_ipv6.patch + * openssh-7.7p1-cavstest-ctr.patch + * openssh-7.7p1-cavstest-kdf.patch + * openssh-7.7p1-disable_openssl_abi_check.patch + * openssh-7.7p1-fips.patch + * openssh-7.7p1-fips_checks.patch + * openssh-7.7p1-hostname_changes_when_forwarding_X.patch + * openssh-7.7p1-ldap.patch + * openssh-7.7p1-seed-prng.patch + * openssh-7.7p1-sftp_force_permissions.patch + * openssh-7.7p1-sftp_print_diagnostic_messages.patch + * openssh-8.0p1-gssapi-keyex.patch (formerly + openssh-7.7p1-gssapi_key_exchange.patch) + * openssh-8.1p1-audit.patch (formerly openssh-7.7p1-audit.patch) + +- Removed patches (integrated upstream): + * 0001-upstream-Fix-two-race-conditions-in-sshd-relating-to.patch + * openssh-7.7p1-seccomp_ioctl_s390_EP11.patch + * openssh-7.9p1-CVE-2018-20685.patch ++++ 4078 more lines (skipped) ++++ between /dev/null ++++ and /work/SRC/openSUSE:Leap:15.2:Update/.openssh.15813.new.2378/openssh.changes New: ---- README.FIPS README.SUSE README.kerberos cavs_driver-ssh.pl openssh-7.7p1-IPv6_X_forwarding.patch openssh-7.7p1-X11_trusted_forwarding.patch openssh-7.7p1-X_forward_with_disabled_ipv6.patch openssh-7.7p1-allow_root_password_login.patch openssh-7.7p1-cavstest-ctr.patch openssh-7.7p1-cavstest-kdf.patch openssh-7.7p1-disable_openssl_abi_check.patch openssh-7.7p1-eal3.patch openssh-7.7p1-enable_PAM_by_default.patch openssh-7.7p1-fips.patch openssh-7.7p1-fips_checks.patch openssh-7.7p1-host_ident.patch openssh-7.7p1-hostname_changes_when_forwarding_X.patch openssh-7.7p1-ldap.patch openssh-7.7p1-no_fork-no_pid_file.patch openssh-7.7p1-pam_check_locks.patch openssh-7.7p1-pts_names_formatting.patch openssh-7.7p1-remove_xauth_cookies_on_exit.patch openssh-7.7p1-seccomp_ipc_flock.patch openssh-7.7p1-seccomp_stat.patch openssh-7.7p1-seed-prng.patch openssh-7.7p1-send_locale.patch openssh-7.7p1-sftp_force_permissions.patch openssh-7.7p1-sftp_print_diagnostic_messages.patch openssh-7.7p1-systemd-notify.patch openssh-7.9p1-keygen-preserve-perms.patch openssh-7.9p1-revert-new-qos-defaults.patch openssh-8.0p1-gssapi-keyex.patch openssh-8.1p1-audit.patch openssh-8.1p1-ed25519-use-openssl-rng.patch openssh-8.1p1-seccomp-clock_gettime64.patch openssh-8.1p1-seccomp-clock_nanosleep.patch openssh-8.1p1-seccomp-clock_nanosleep_time64.patch openssh-8.1p1-use-openssl-kdf.patch openssh-8.1p1.tar.gz openssh-8.1p1.tar.gz.asc openssh-CVE-2020-14145-information-leak.patch openssh-askpass-gnome.changes openssh-askpass-gnome.spec openssh-fips-ensure-approved-moduli.patch openssh.changes openssh.spec ssh-askpass ssh.reg sshd-gen-keys-start sshd.fw sshd.pamd sshd.service sysconfig.ssh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openssh-askpass-gnome.spec ++++++ # # spec file for package openssh-askpass-gnome # # Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define _name openssh Name: openssh-askpass-gnome Version: 8.1p1 Release: 0 Summary: A GNOME-Based Passphrase Dialog for OpenSSH License: BSD-2-Clause Group: Productivity/Networking/SSH URL: http://www.openssh.com/ Source: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/%{_name}-%{version}.tar.gz Source42: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/%{_name}-%{version}.tar.gz.asc Requires: %{_name} = %{version} Supplements: packageand(openssh:libgtk-3-0) %if 0%{?suse_version} >= 1550 BuildRequires: gtk3-devel %else BuildRequires: gtk2-devel %endif %description SSH (Secure Shell) is a program for logging into a remote machine and for executing commands on a remote machine. This package contains a GNOME-based passphrase dialog for OpenSSH. %prep %setup -q -n %{_name}-%{version} %build cd contrib export CFLAGS="%{optflags}" %if 0%{?suse_version} >= 1550 make %{?_smp_mflags} gnome-ssh-askpass3 %else make %{?_smp_mflags} gnome-ssh-askpass2 %endif %install install -d -m 755 %{buildroot}%{_libexecdir}/ssh/ %if 0%{?suse_version} >= 1550 install contrib/gnome-ssh-askpass3 %{buildroot}%{_libexecdir}/ssh/gnome-ssh-askpass %else install contrib/gnome-ssh-askpass2 %{buildroot}%{_libexecdir}/ssh/gnome-ssh-askpass %endif %files %dir %{_libexecdir}/ssh %attr(0755,root,root) %{_libexecdir}/ssh/gnome-ssh-askpass %changelog ++++++ openssh.spec ++++++ # # spec file for package openssh # # Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define sandbox_seccomp 0 %ifnarch ppc %define sandbox_seccomp 1 %endif %if 0%{?suse_version} >= 1500 %bcond_without tirpc %else %bcond_with tirpc %endif %define _fwdir %{_sysconfdir}/sysconfig/SuSEfirewall2.d %define _fwdefdir %{_fwdir}/services %define _appdefdir %( grep "configdirspec=" $( which xmkmf ) | sed -r 's,^[^=]+=.*-I(.*)/config.*$,\\1/app-defaults,' ) %define CHECKSUM_SUFFIX .hmac %define CHECKSUM_HMAC_KEY "HMAC_KEY:OpenSSH-FIPS@SLE" #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir %{_localstatedir}/adm/fillup-templates %endif Name: openssh Version: 8.1p1 Release: 0 Summary: Secure Shell Client and Server (Remote Login Program) License: BSD-2-Clause AND MIT Group: Productivity/Networking/SSH URL: http://www.openssh.com/ Source0: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz Source1: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz.asc Source2: sshd.pamd Source3: README.SUSE Source4: README.kerberos Source5: ssh.reg Source6: ssh-askpass Source7: sshd.fw Source8: sysconfig.ssh Source9: sshd-gen-keys-start Source10: sshd.service Source11: README.FIPS Source12: cavs_driver-ssh.pl Patch0: openssh-7.7p1-allow_root_password_login.patch Patch1: openssh-7.7p1-X11_trusted_forwarding.patch Patch3: openssh-7.7p1-enable_PAM_by_default.patch Patch4: openssh-7.7p1-eal3.patch Patch6: openssh-7.7p1-send_locale.patch Patch7: openssh-7.7p1-hostname_changes_when_forwarding_X.patch Patch8: openssh-7.7p1-remove_xauth_cookies_on_exit.patch Patch9: openssh-7.7p1-pts_names_formatting.patch Patch10: openssh-7.7p1-pam_check_locks.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2752 Patch14: openssh-7.7p1-seccomp_stat.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2752 Patch15: openssh-7.7p1-seccomp_ipc_flock.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2752 # Local FIPS patchset Patch17: openssh-7.7p1-fips.patch # Local cavs patchset Patch18: openssh-7.7p1-cavstest-ctr.patch # Local cavs patchset Patch19: openssh-7.7p1-cavstest-kdf.patch # Local FIPS patchset Patch20: openssh-7.7p1-fips_checks.patch Patch21: openssh-7.7p1-seed-prng.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2641 Patch22: openssh-7.7p1-systemd-notify.patch Patch23: openssh-8.0p1-gssapi-keyex.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=1402 Patch24: openssh-8.1p1-audit.patch # Local patch to disable runtime abi SSL checks, quite pointless for us Patch26: openssh-7.7p1-disable_openssl_abi_check.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2641 Patch27: openssh-7.7p1-no_fork-no_pid_file.patch Patch28: openssh-7.7p1-host_ident.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=1844 Patch29: openssh-7.7p1-sftp_force_permissions.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2143 Patch30: openssh-7.7p1-X_forward_with_disabled_ipv6.patch Patch31: openssh-7.7p1-ldap.patch # https://bugzilla.mindrot.org/show_bug.cgi?id=2213 Patch32: openssh-7.7p1-IPv6_X_forwarding.patch Patch33: openssh-7.7p1-sftp_print_diagnostic_messages.patch Patch34: openssh-7.9p1-keygen-preserve-perms.patch Patch35: openssh-7.9p1-revert-new-qos-defaults.patch Patch36: openssh-8.1p1-seccomp-clock_nanosleep.patch Patch37: openssh-8.1p1-seccomp-clock_nanosleep_time64.patch Patch38: openssh-8.1p1-seccomp-clock_gettime64.patch Patch39: openssh-8.1p1-use-openssl-kdf.patch Patch40: openssh-8.1p1-ed25519-use-openssl-rng.patch Patch41: openssh-fips-ensure-approved-moduli.patch Patch42: openssh-CVE-2020-14145-information-leak.patch BuildRequires: audit-devel BuildRequires: autoconf BuildRequires: groff BuildRequires: libedit-devel BuildRequires: libselinux-devel BuildRequires: openldap2-devel BuildRequires: openssl-devel BuildRequires: pam-devel BuildRequires: pkgconfig BuildRequires: zlib-devel BuildRequires: pkgconfig(libsystemd) Requires(post): %fillup_prereq Requires(pre): pwdutils Recommends: %{name}-helpers = %{version}-%{release} Recommends: audit Conflicts: %{name}-fips < %{version}-%{release} Conflicts: %{name}-fips > %{version}-%{release} Conflicts: nonfreessh %{?systemd_requires} %if %{with tirpc} BuildRequires: libtirpc-devel %endif %if 0%{?suse_version} >= 1550 BuildRequires: pkgconfig(krb5) %else BuildRequires: krb5-mini-devel %endif %description SSH (Secure Shell) is a program for logging into and executing commands on a remote machine. It is intended to replace rsh (rlogin and rsh) and provides openssl (secure encrypted communication) between two untrusted hosts over an insecure network. xorg-x11 (X Window System) connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. %package helpers Summary: OpenSSH AuthorizedKeysCommand helpers Group: Productivity/Networking/SSH Requires: %{name} = %{version}-%{release} %description helpers Helper applications for OpenSSH which retrieve keys from various sources. %package fips Summary: OpenSSH FIPS cryptomodule HMACs Group: Productivity/Networking/SSH Requires: %{name} = %{version}-%{release} Conflicts: %{name} < %{version}-%{release} Conflicts: %{name} > %{version}-%{release} Obsoletes: %{name}-hmac %description fips Hashes that together with the main package form the FIPS certifiable cryptomodule. %package cavs Summary: OpenSSH FIPS cryptomodule CAVS tests Group: Productivity/Networking/SSH Requires: %{name} = %{version}-%{release} %description cavs FIPS140 CAVS tests related parts of the OpenSSH package %prep %setup -q cp %{SOURCE3} %{SOURCE4} %{SOURCE11} . %autopatch -p1 # set libexec dir in the LDAP patch sed -i.libexec 's,@LIBEXECDIR@,%{_libexecdir}/ssh,' \ $( grep -Rl @LIBEXECDIR@ \ $( grep "^+++" openssh-7.7p1-ldap.patch | sed -r 's@^.+/([^/\t ]+).*$@\1@' ) ) %build autoreconf -fiv %ifarch s390 s390x %{sparc} PIEFLAGS="-fPIE" %else PIEFLAGS="-fpie" %endif CFLAGS="%{optflags} $PIEFLAGS -fstack-protector" CXXFLAGS="%{optflags} $PIEFLAGS -fstack-protector" LDFLAGS="-pie -Wl,--as-needed" #CPPFLAGS="%%{optflags} -DUSE_INTERNAL_B64" export LDFLAGS CFLAGS CXXFLAGS CPPFLAGS %configure \ --sysconfdir=%{_sysconfdir}/ssh \ --libexecdir=%{_libexecdir}/ssh \ --with-selinux \ --with-pid-dir=/run \ --with-systemd \ --with-ssl-engine \ --with-pam \ --with-kerberos5=%{_prefix} \ --with-privsep-path=%{_localstatedir}/lib/empty \ %if %{sandbox_seccomp} --with-sandbox=seccomp_filter \ %else --with-sandbox=rlimit \ %endif --disable-strip \ --with-audit=linux \ --with-ldap \ --with-xauth=%{_bindir}/xauth \ --with-libedit \ --target=%{_target_cpu}-suse-linux make %{?_smp_mflags} %install %make_install install -d -m 755 %{buildroot}%{_sysconfdir}/pam.d install -d -m 755 %{buildroot}%{_localstatedir}/lib/sshd install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/sshd install -d -m 755 %{buildroot}%{_sysconfdir}/slp.reg.d/ install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/slp.reg.d/ install -D -m 0644 %{SOURCE10} %{buildroot}%{_unitdir}/sshd.service ln -s service %{buildroot}%{_sbindir}/rcsshd install -d -m 755 %{buildroot}%{_fillupdir} install -m 644 %{SOURCE8} %{buildroot}%{_fillupdir} # install shell script to automate the process of adding your public key to a remote machine install -m 755 contrib/ssh-copy-id %{buildroot}%{_bindir} install -m 644 contrib/ssh-copy-id.1 %{buildroot}%{_mandir}/man1 sed -i -e s@%{_prefix}/libexec@%{_libexecdir}@g %{buildroot}%{_sysconfdir}/ssh/sshd_config %if 0%{?suse_version} < 1550 # install firewall definitions mkdir -p %{buildroot}%{_fwdefdir} install -m 644 %{SOURCE7} %{buildroot}%{_fwdefdir}/sshd %endif # askpass wrapper sed -e "s,@LIBEXECDIR@,%{_libexecdir},g" < %{SOURCE6} > %{buildroot}%{_libexecdir}/ssh/ssh-askpass sed -e "s,@LIBEXECDIR@,%{_libexecdir},g" < %{SOURCE12} > %{buildroot}%{_libexecdir}/ssh/cavs_driver-ssh.pl rm -f %{buildroot}%{_datadir}/Ssh.bin # sshd keys generator wrapper install -D -m 0755 %{SOURCE9} %{buildroot}%{_sbindir}/sshd-gen-keys-start # the hmac hashes - taken from openssl # # re-define the __os_install_post macro: the macro strips # the binaries and thereby invalidates any hashes created earlier. # # this shows up earlier because otherwise the %%expand of # the macro is too late. %{expand:%%global __os_install_post {%__os_install_post for b in \ %{_bindir}/ssh \ %{_sbindir}/sshd \ %{_libexecdir}/ssh/sftp-server \ ; do openssl dgst -sha256 -binary -hmac %{CHECKSUM_HMAC_KEY} < %{buildroot}$b > %{buildroot}$b%{CHECKSUM_SUFFIX} done }} %pre getent group sshd >/dev/null || %{_sbindir}/groupadd -r sshd getent passwd sshd >/dev/null || %{_sbindir}/useradd -r -g sshd -d %{_localstatedir}/lib/sshd -s /bin/false -c "SSH daemon" sshd %service_add_pre sshd.service %post %{fillup_only -n ssh sshd} %service_add_post sshd.service %set_permissions %{_sysconfdir}/ssh/sshd_config %preun %service_del_preun sshd.service %postun # The openssh-fips trigger script for openssh will normally restart sshd once # it gets installed, so only restart the service here is openssh-fips is not # present rpm -q openssh-fips >& /dev/null && DISABLE_RESTART_ON_UPDATE=yes %service_del_postun sshd.service %triggerin -n openssh-fips -- %{name} = %{version}-%{release} %restart_on_update sshd %verifyscript %verify_permissions -e %{_sysconfdir}/ssh/sshd_config %files %exclude %{_bindir}/ssh%{CHECKSUM_SUFFIX} %exclude %{_sbindir}/sshd%{CHECKSUM_SUFFIX} %exclude %{_libexecdir}/ssh/sftp-server%{CHECKSUM_SUFFIX} %exclude %{_libexecdir}/ssh/cavs* %dir %attr(755,root,root) %{_localstatedir}/lib/sshd %license LICENCE %doc README.SUSE README.kerberos README.FIPS ChangeLog OVERVIEW README TODO CREDITS %attr(0755,root,root) %dir %{_sysconfdir}/ssh %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/moduli %verify(not mode) %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config %verify(not mode) %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/sshd %attr(0644,root,root) %{_unitdir}/sshd.service %attr(0755,root,root) %{_bindir}/* %attr(0755,root,root) %{_sbindir}/* %attr(0755,root,root) %dir %{_libexecdir}/ssh %exclude %{_libexecdir}/ssh/ssh-ldap* %attr(0755,root,root) %{_libexecdir}/ssh/* %attr(0444,root,root) %{_mandir}/man1/* %attr(0444,root,root) %{_mandir}/man5/* %attr(0444,root,root) %{_mandir}/man8/* %exclude %{_mandir}/man5/ssh-ldap* %exclude %{_mandir}/man8/ssh-ldap* %dir %{_sysconfdir}/slp.reg.d %config %{_sysconfdir}/slp.reg.d/ssh.reg %{_fillupdir}/sysconfig.ssh %if 0%{?suse_version} < 1550 %dir %{_fwdir} %dir %{_fwdefdir} %config %{_fwdefdir}/sshd %endif %files helpers %attr(0755,root,root) %dir %{_sysconfdir}/ssh %verify(not mode) %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ldap.conf %attr(0755,root,root) %dir %{_libexecdir}/ssh %attr(0755,root,root) %{_libexecdir}/ssh/ssh-ldap* %attr(0444,root,root) %{_mandir}/man5/ssh-ldap* %attr(0444,root,root) %{_mandir}/man8/ssh-ldap* %doc HOWTO.ldap-keys openssh-lpk-openldap.schema openssh-lpk-sun.schema %files fips %attr(0444,root,root) %{_bindir}/ssh%{CHECKSUM_SUFFIX} %attr(0444,root,root) %{_sbindir}/sshd%{CHECKSUM_SUFFIX} %attr(0444,root,root) %{_libexecdir}/ssh/sftp-server%{CHECKSUM_SUFFIX} %files cavs %attr(0755,root,root) %{_libexecdir}/ssh/cavs* %changelog ++++++ README.FIPS ++++++ Notes on FIPS mode and OpenSSH --- SUSE OpenSSH comes with FIPS 140-2 support, and certain versions have been certified as FIPS compliant by NIST. Apart from other things, this standard puts restrictions on cryptographic algorithms that may be used. Important notice: FIPS is not only a matter of functionality. If you want to claim having a FIPS certified service, you *must* use the certified binaries. Even binaries built from the same sources in the same environment and running on a certified system, yet from a package lacking the certification, are formally not considered to be fulfilling the requirements. The certified binaries (ssh, sshd, sftp-server) perform mandatory selfcheck at startup and proceed only when the checks succeed (non-certified binaries may skip the check). These checks require the cryptographic hashes contained in the openssh-fips subpackage. The FIPS mode for OpenSSH is enabled in two ways - either: 1) /proc/sys/crypto/fips_enabled contains a single character '1' - this is a system-wide setting controlled bu the fips kernel parameter; or 2) the environment variable SSH_FORCE_FIPS - if set (to any value), the binaries behave as if they were running on a system in FIPS mode. Since FIPS 140-2 only allows use of certain cryptographic algorithms, both the client and server will fail if they are requested to use non-approved algorithms while in FIPS mode. This means that working configurations for FIPS mode form a proper subset of all working (generic) configurations. Some configurations may even prevent the binaries from starting at all. This however should be viewed in the context of FIPS being a security policy tool - it is not of much use to run the same system both in FIPS mode and outside of it, since that would defeat the main purpose of FIPS having guaranteeing standardised minimum restrictions on cryptographic algorithms (and thus on the overall security of the system). Unless you specify what cryptographic algorithms you wish to use, both the client and server should work out of the box in FIPS mode. For sshd, you can use the `-t` option to check whether the configuration file is working. Setting the above mentioned environment variable allows testing of behaviour in FIPS mode (checksum files for both OpenSSH and OpenSSL must be installed). In addition to cryptographic algorithms restrictions, sshd performs periodic PRNG re-seeding. The seed is read from entropy source either /dev/urandom or /dev/random. By default, the former is used, unless the environment variable SSH_USE_STRONG_RNG is set to a non-zero value or the binary is running in FIPS mode. This has two important implications: 1) the selected entropy source must be available, i.e. when running in a changeroot the device files need to be present there. 2) /dev/random is a blocking interface - unless enough randomness is available, the process stops until the entropy pool is replenished. Thus on systems where a long running processes are expected, one should make sure there is always enough entropy for sshd. Sporadically this may also cause sshd to aborted, since some versions of OpenSSL (the underlying cryptographic engine) don't handle gracefully being interrupted while trying to read entropy from the system source. ++++++ README.SUSE ++++++ There are following changes in default settings of ssh client and server: * Accepting and sending of locale environment variables in protocol 2 is enabled. * PAM authentication is enabled and mostly even required, do not turn it off. * root authentiation with password is enabled by default (PermitRootLogin yes). NOTE: this has security implications and is only done in order to not change behaviour of the server in an update. We strongly suggest setting this option either "prohibit-password" or even better to "no" (which disables direct remote root login entirely). * DSA authentication is enabled by default for maximum compatibility. NOTE: do not use DSA authentication since it is being phased out for a reason - the size of DSA keys is limited by the standard to 1024 bits which cannot be considered safe any more. * Accepting all RFC4419 specified DH group parameters. See KexDHMin in ssh_config and sshd_config manual pages. For more information on differences in SUSE OpenSSH package see README.FIPS ++++++ README.kerberos ++++++ This version of the Kerbros/GSSAPI support avoids DNS lookups for Kerberos-related names. These DNS lookups were problematic for dialup users because they would lead to excessive delays if DNS was not reachable. If you do use Kerberos, please make sure you edit the server and client configuration files as follows: /etc/ssh/sshd_config: GSSAPIAuthentication yes GSSAPICleanupCredentials yes /etc/ssh/ssh_config: Host * ... lots of other options ... GSSAPIAuthentication yes GSSAPIDelegateCredentials yes ++++++ cavs_driver-ssh.pl ++++++ #!/usr/bin/perl # # CAVS test driver for OpenSSH # # Copyright (C) 2015, Stephan Mueller <smuel...@chronox.de> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # NO WARRANTY # # BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY # FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN # OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES # PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED # OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS # TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE # PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, # REPAIR OR CORRECTION. # # IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING # WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR # REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, # INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING # OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED # TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY # YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER # PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # use strict; use warnings; use IPC::Open2; # Executing a program by feeding STDIN and retrieving # STDOUT # $1: data string to be piped to the app on STDIN # rest: program and args # returns: STDOUT of program as string sub pipe_through_program($@) { my $in = shift; my @args = @_; my ($CO, $CI); my $pid = open2($CO, $CI, @args); my $out = ""; my $len = length($in); my $first = 1; while (1) { my $rin = ""; my $win = ""; # Output of prog is FD that we read vec($rin,fileno($CO),1) = 1; # Input of prog is FD that we write # check for $first is needed because we can have NULL input # that is to be written to the app if ( $len > 0 || $first) { (vec($win,fileno($CI),1) = 1); $first=0; } # Let us wait for 100ms my $nfound = select(my $rout=$rin, my $wout=$win, undef, 0.1); if ( $wout ) { my $written = syswrite($CI, $in, $len); die "broken pipe" if !defined $written; $len -= $written; substr($in, 0, $written) = ""; if ($len <= 0) { close $CI or die "broken pipe: $!"; } } if ( $rout ) { my $tmp_out = ""; my $bytes_read = sysread($CO, $tmp_out, 4096); $out .= $tmp_out; last if ($bytes_read == 0); } } close $CO or die "broken pipe: $!"; waitpid $pid, 0; return $out; } # Parser of CAVS test vector file # $1: Test vector file # $2: Output file for test results # return: nothing sub parse($$) { my $infile = shift; my $outfile = shift; my $out = ""; my $K = ""; my $H = ""; my $session_id = ""; my $ivlen = 0; my $eklen = ""; my $iklen = ""; open(IN, "<$infile"); while(<IN>) { my $line = $_; chomp($line); $line =~ s/\r//; if ($line =~ /\[SHA-1\]/) { $iklen = 20; } elsif ($line =~ /\[SHA-256\]/) { $iklen = 32; } elsif ($line =~ /\[SHA-384\]/) { $iklen = 48; } elsif ($line =~ /\[SHA-512\]/) { $iklen = 64; } elsif ($line =~ /^\[IV length\s*=\s*(.*)\]/) { $ivlen = $1; $ivlen = $ivlen / 8; } elsif ($line =~ /^\[encryption key length\s*=\s*(.*)\]/) { $eklen = $1; $eklen = $eklen / 8; } elsif ($line =~ /^K\s*=\s*(.*)/) { $K = $1; $K = substr($K, 8); $K = "00" . $K; } elsif ($line =~ /^H\s*=\s*(.*)/) { $H = $1; } elsif ($line =~ /^session_id\s*=\s*(.*)/) { $session_id = $1; } $out .= $line . "\n"; if ($K ne "" && $H ne "" && $session_id ne "" && $ivlen ne "" && $eklen ne "" && $iklen > 0) { $out .= pipe_through_program("", "@LIBEXECDIR@/ssh/cavstest-kdf -H $H -K $K -s $session_id -i $ivlen -e $eklen -m $iklen"); $K = ""; $H = ""; $session_id = ""; } } close IN; $out =~ s/\n/\r\n/g; # make it a dos file open(OUT, ">$outfile") or die "Cannot create output file $outfile: $?"; print OUT $out; close OUT; } ############################################################ # # let us pretend to be C :-) sub main() { my $infile=$ARGV[0]; die "Error: Test vector file $infile not found" if (! -f $infile); my $outfile = $infile; # let us add .rsp regardless whether we could strip .req $outfile =~ s/\.req$//; $outfile .= ".rsp"; if (-f $outfile) { die "Output file $outfile could not be removed: $?" unless unlink($outfile); } print STDERR "Performing tests from source file $infile with results stored in destination file $outfile\n"; # Do the job parse($infile, $outfile); } ########################################### # Call it main(); 1; ++++++ openssh-7.7p1-IPv6_X_forwarding.patch ++++++ # HG changeset patch # Parent 8df645ca39d64de025d8838c5713812e72308c92 Correctly parse DISPLAY variable for cases where it contains an IPv6 address (which should - but not always is - in (square) brackets). bnc#847710 - https://bugzilla.novell.com/show_bug.cgi?id=847710 diff --git a/openssh-7.7p1/channels.c b/openssh-7.7p1/channels.c --- openssh-7.7p1/channels.c +++ openssh-7.7p1/channels.c @@ -4590,33 +4590,42 @@ x11_connect_display(struct ssh *ssh) return -1; /* OK, we now have a connection to the display. */ return sock; } /* * Connect to an inet socket. The DISPLAY value is supposedly * hostname:d[.s], where hostname may also be numeric IP address. + * Note that IPv6 numeric addresses contain colons (e.g. ::1:0) */ strlcpy(buf, display, sizeof(buf)); - cp = strchr(buf, ':'); + cp = strrchr(buf, ':'); if (!cp) { error("Could not find ':' in DISPLAY: %.100s", display); return -1; } *cp = 0; /* * buf now contains the host name. But first we parse the * display number. */ if (sscanf(cp + 1, "%u", &display_number) != 1) { error("Could not parse display number from DISPLAY: %.100s", display); return -1; } + + /* Remove brackets surrounding IPv6 addresses if there are any. */ + if (buf[0] == '[' && (cp = strchr(buf, ']'))) { + *cp = 0; + cp = buf + 1; + } else { + cp = buf; + } /* Look up the host address */ memset(&hints, 0, sizeof(hints)); hints.ai_family = ssh->chanctxt->IPv4or6; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%u", 6000 + display_number); if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { error("%.100s: unknown host. (%s)", buf, ++++++ openssh-7.7p1-X11_trusted_forwarding.patch ++++++ # HG changeset patch # Parent d25c96855fd67e997e25ec1198d953af33eb289c # enable trusted X11 forwarding by default in both sshd and sshsystem-wide # configuration # bnc#50836 (was suse #35836) Enable Trusted X11 forwarding by default, since the security benefits of having it disabled are negligible these days with XI2 being widely used. Index: openssh-7.8p1/ssh_config =================================================================== --- openssh-7.8p1.orig/ssh_config +++ openssh-7.8p1/ssh_config @@ -17,9 +17,20 @@ # list of available options, their meanings and defaults, please see the # ssh_config(5) man page. -# Host * +Host * # ForwardAgent no # ForwardX11 no + +# If you do not trust your remote host (or its administrator), you +# should not forward X11 connections to your local X11-display for +# security reasons: Someone stealing the authentification data on the +# remote side (the "spoofed" X-server by the remote sshd) can read your +# keystrokes as you type, just like any other X11 client could do. +# Set this to "no" here for global effect or in your own ~/.ssh/config +# file if you want to have the remote X11 authentification data to +# expire after twenty minutes after remote login. + ForwardX11Trusted yes + # PasswordAuthentication yes # HostbasedAuthentication no # GSSAPIAuthentication no Index: openssh-7.8p1/sshd_config =================================================================== --- openssh-7.8p1.orig/sshd_config +++ openssh-7.8p1/sshd_config @@ -84,7 +84,7 @@ AuthorizedKeysFile .ssh/authorized_keys #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no -#X11Forwarding no +X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes ++++++ openssh-7.7p1-X_forward_with_disabled_ipv6.patch ++++++ # HG changeset patch # Parent 44592f09f090e74432f608084069d30d808fda69 Do not throw away already open sockets for X11 forwarding if another socket family is not available for bind() diff --git a/channels.c b/channels.c index f51b7e3..95af47e 100644 --- a/channels.c +++ b/channels.c @@ -4637,6 +4637,13 @@ x11_create_display_inet(struct ssh *ssh, int x11_display_offset, debug2("%s: bind port %d: %.100s", __func__, port, strerror(errno)); close(sock); + /* do not remove successfully opened sockets if + * the request failed because the protocol + * IPv4/6 is not available (e.g. IPv6 may be + * disabled while being supported) + */ + if (EADDRNOTAVAIL == errno) + continue; for (n = 0; n < num_socks; n++) close(socks[n]); num_socks = 0; ++++++ openssh-7.7p1-allow_root_password_login.patch ++++++ # HG changeset patch # Parent af43d436bc7fe818dd976c923ad99b89051eb299 Allow root login with password by default. While less secure than upstream default of forbidding access to the root account with a password, we are temporarily introducing this change to keep the default used in older OpenSSH versions shipped with SLE. Index: openssh-7.9p1/servconf.c =================================================================== --- openssh-7.9p1.orig/servconf.c +++ openssh-7.9p1/servconf.c @@ -292,7 +292,7 @@ fill_default_server_options(ServerOption if (options->login_grace_time == -1) options->login_grace_time = 120; if (options->permit_root_login == PERMIT_NOT_SET) - options->permit_root_login = PERMIT_NO_PASSWD; + options->permit_root_login = PERMIT_YES; if (options->ignore_rhosts == -1) options->ignore_rhosts = 1; if (options->ignore_user_known_hosts == -1) Index: openssh-7.9p1/sshd_config =================================================================== --- openssh-7.9p1.orig/sshd_config +++ openssh-7.9p1/sshd_config @@ -29,7 +29,7 @@ # Authentication: #LoginGraceTime 2m -#PermitRootLogin prohibit-password +PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 Index: openssh-7.9p1/sshd_config.0 =================================================================== --- openssh-7.9p1.orig/sshd_config.0 +++ openssh-7.9p1/sshd_config.0 @@ -749,7 +749,7 @@ DESCRIPTION PermitRootLogin Specifies whether root can log in using ssh(1). The argument must be yes, prohibit-password, forced-commands-only, or no. The - default is prohibit-password. + default is yes. If this option is set to prohibit-password (or its deprecated alias, without-password), password and keyboard-interactive Index: openssh-7.9p1/sshd_config.5 =================================================================== --- openssh-7.9p1.orig/sshd_config.5 +++ openssh-7.9p1/sshd_config.5 @@ -1285,7 +1285,7 @@ The argument must be or .Cm no . The default is -.Cm prohibit-password . +.Cm yes . .Pp If this option is set to .Cm prohibit-password ++++++ openssh-7.7p1-cavstest-ctr.patch ++++++ # HG changeset patch # Parent cc1022edba2c5eeb0facba08468f65afc2466b63 CAVS test for OpenSSH's own CTR encryption mode implementation diff --git a/Makefile.in b/Makefile.in index 7488595..d426006 100644 --- a/Makefile.in +++ b/Makefile.in @@ -24,6 +24,7 @@ ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass SFTP_SERVER=$(libexecdir)/sftp-server SSH_KEYSIGN=$(libexecdir)/ssh-keysign SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper +CAVSTEST_CTR=$(libexecdir)/cavstest-ctr PRIVSEP_PATH=@PRIVSEP_PATH@ SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ STRIP_OPT=@STRIP_OPT@ @@ -62,6 +63,8 @@ MKDIR_P=@MKDIR_P@ TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) +TARGETS += cavstest-ctr$(EXEEXT) + XMSS_OBJS=\ ssh-xmss.o \ sshkey-xmss.o \ @@ -210,6 +213,10 @@ sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o s sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o $(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT) +# FIPS tests +cavstest-ctr$(EXEEXT): $(LIBCOMPAT) libssh.a cavstest-ctr.o + $(LD) -o $@ cavstest-ctr.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) + # test driver for the loginrec code - not built by default logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS) @@ -354,6 +361,7 @@ install-files: $(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT) $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT) $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT) + $(INSTALL) -m 0755 $(STRIP_OPT) cavstest-ctr$(EXEEXT) $(DESTDIR)$(libexecdir)/cavstest-ctr$(EXEEXT) $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 diff --git a/cavstest-ctr.c b/cavstest-ctr.c new file mode 100644 index 0000000..f81cb72 --- /dev/null +++ b/cavstest-ctr.c @@ -0,0 +1,214 @@ +/* + * + * invocation (all of the following are equal): + * ./ctr-cavstest --algo aes128-ctr --key 987212980144b6a632e864031f52dacc --mode encrypt --data a6deca405eef2e8e4609abf3c3ccf4a6 + * ./ctr-cavstest --algo aes128-ctr --key 987212980144b6a632e864031f52dacc --mode encrypt --data a6deca405eef2e8e4609abf3c3ccf4a6 --iv 00000000000000000000000000000000 + * echo -n a6deca405eef2e8e4609abf3c3ccf4a6 | ./ctr-cavstest --algo aes128-ctr --key 987212980144b6a632e864031f52dacc --mode encrypt + */ + +#include "includes.h" + +#include <sys/types.h> +#include <sys/param.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "xmalloc.h" +#include "log.h" +#include "cipher.h" + +/* compatibility with old or broken OpenSSL versions */ +#include "openbsd-compat/openssl-compat.h" + +void +usage(void) +{ + fprintf(stderr, "Usage: ctr-cavstest --algo <ssh-crypto-algorithm>\n" + " --key <hexadecimal-key> --mode <encrypt|decrypt>\n" + " [--iv <hexadecimal-iv>] --data <hexadecimal-data>\n\n" + "Hexadecimal output is printed to stdout.\n" + "Hexadecimal input data can be alternatively read from stdin.\n"); + exit(1); +} + +void * +fromhex(char *hex, size_t * len) +{ + unsigned char *bin; + char *p; + size_t n = 0; + int shift = 4; + unsigned char out = 0; + unsigned char *optr; + + bin = xmalloc(strlen(hex) / 2); + optr = bin; + + for (p = hex; *p != '\0'; ++p) { + unsigned char c; + + c = *p; + if (isspace(c)) + continue; + + if (c >= '0' && c <= '9') { + c = c - '0'; + } else if (c >= 'A' && c <= 'F') { + c = c - 'A' + 10; + } else if (c >= 'a' && c <= 'f') { + c = c - 'a' + 10; + } else { + /* truncate on nonhex cipher */ + break; + } + + out |= c << shift; + shift = (shift + 4) % 8; + + if (shift) { + *(optr++) = out; + out = 0; + ++n; + } + } + + *len = n; + return bin; +} + +#define READ_CHUNK 4096 +#define MAX_READ_SIZE 1024*1024*100 +char * +read_stdin(void) +{ + char *buf; + size_t n, total = 0; + + buf = xmalloc(READ_CHUNK); + + do { + n = fread(buf + total, 1, READ_CHUNK, stdin); + if (n < READ_CHUNK) /* terminate on short read */ + break; + + total += n; + buf = xreallocarray(buf, total + READ_CHUNK, 1); + } while (total < MAX_READ_SIZE); + return buf; +} + +int +main(int argc, char *argv[]) +{ + + struct sshcipher *c; + struct sshcipher_ctx cc; + struct sshcipher_ctx *ccp; + char *algo = "aes128-ctr"; + char *hexkey = NULL; + char *hexiv = "00000000000000000000000000000000"; + char *hexdata = NULL; + char *p; + int i; + int encrypt = 1; + void *key; + size_t keylen; + void *iv; + size_t ivlen; + void *data; + size_t datalen; + void *outdata; + + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--algo") == 0) { + algo = argv[++i]; + } else if (strcmp(argv[i], "--key") == 0) { + hexkey = argv[++i]; + } else if (strcmp(argv[i], "--mode") == 0) { + ++i; + if (argv[i] == NULL) { + usage(); + } + if (strncmp(argv[i], "enc", 3) == 0) { + encrypt = 1; + } else if (strncmp(argv[i], "dec", 3) == 0) { + encrypt = 0; + } else { + usage(); + } + } else if (strcmp(argv[i], "--iv") == 0) { + hexiv = argv[++i]; + } else if (strcmp(argv[i], "--data") == 0) { + hexdata = argv[++i]; + } + } + + if (hexkey == NULL || algo == NULL) { + usage(); + } + + OpenSSL_add_all_algorithms(); + + c = cipher_by_name(algo); + if (c == NULL) { + fprintf(stderr, "Error: unknown algorithm\n"); + return 2; + } + + if (hexdata == NULL) { + hexdata = read_stdin(); + } else { + hexdata = xstrdup(hexdata); + } + + key = fromhex(hexkey, &keylen); + + if (keylen != 16 && keylen != 24 && keylen == 32) { + fprintf(stderr, "Error: unsupported key length\n"); + return 2; + } + + iv = fromhex(hexiv, &ivlen); + + if (ivlen != 16) { + fprintf(stderr, "Error: unsupported iv length\n"); + return 2; + } + + data = fromhex(hexdata, &datalen); + + if (data == NULL || datalen == 0) { + fprintf(stderr, "Error: no data to encrypt/decrypt\n"); + return 2; + } + + ccp = &cc; + cipher_init(&ccp, c, key, keylen, iv, ivlen, encrypt); + + free(key); + free(iv); + + outdata = malloc(datalen); + if (outdata == NULL) { + fprintf(stderr, "Error: memory allocation failure\n"); + return 2; + } + + cipher_crypt(&cc, 0, outdata, data, datalen, 0, 0); + + free(data); + + cipher_free(&cc); + + for (p = outdata; datalen > 0; ++p, --datalen) { + printf("%02X", (unsigned char) *p); + } + + free(outdata); + + printf("\n"); + return 0; +} diff --git a/cipher.c b/cipher.c index acca752..b67a4ff 100644 --- a/cipher.c +++ b/cipher.c @@ -58,15 +58,6 @@ #define EVP_CIPHER_CTX void #endif -struct sshcipher_ctx { - int plaintext; - int encrypt; - EVP_CIPHER_CTX *evp; - struct chachapoly_ctx cp_ctx; /* XXX union with evp? */ - struct aesctr_ctx ac_ctx; /* XXX union with evp? */ - const struct sshcipher *cipher; -}; - struct sshcipher { char *name; u_int block_size; diff --git a/cipher.h b/cipher.h index 5843aab..d7d8c89 100644 --- a/cipher.h +++ b/cipher.h @@ -48,7 +48,15 @@ #define CIPHER_DECRYPT 0 struct sshcipher; -struct sshcipher_ctx; +struct sshcipher_ctx { + int plaintext; + int encrypt; + EVP_CIPHER_CTX *evp; + struct chachapoly_ctx cp_ctx; /* XXX union with evp? */ + struct aesctr_ctx ac_ctx; /* XXX union with evp? */ + const struct sshcipher *cipher; +}; + const struct sshcipher *cipher_by_name(const char *); const char *cipher_warning_message(const struct sshcipher_ctx *); ++++++ openssh-7.7p1-cavstest-kdf.patch ++++++ # HG changeset patch # Parent 1e1d5a2ab8bddfc800f570755f9ea1addcc878c1 CAVS test for KDF implementation in OpenSSH diff --git a/Makefile.in b/Makefile.in index d426006..85818f4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -25,6 +25,7 @@ SFTP_SERVER=$(libexecdir)/sftp-server SSH_KEYSIGN=$(libexecdir)/ssh-keysign SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper CAVSTEST_CTR=$(libexecdir)/cavstest-ctr +CAVSTEST_KDF=$(libexecdir)/cavstest-kdf PRIVSEP_PATH=@PRIVSEP_PATH@ SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ STRIP_OPT=@STRIP_OPT@ @@ -63,7 +64,7 @@ MKDIR_P=@MKDIR_P@ TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) -TARGETS += cavstest-ctr$(EXEEXT) +TARGETS += cavstest-ctr$(EXEEXT) cavstest-kdf$(EXEEXT) XMSS_OBJS=\ ssh-xmss.o \ @@ -217,6 +218,9 @@ sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glo cavstest-ctr$(EXEEXT): $(LIBCOMPAT) libssh.a cavstest-ctr.o $(LD) -o $@ cavstest-ctr.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) +cavstest-kdf$(EXEEXT): $(LIBCOMPAT) libssh.a cavstest-kdf.o + $(LD) -o $@ cavstest-kdf.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) + # test driver for the loginrec code - not built by default logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS) @@ -362,6 +366,7 @@ install-files: $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT) $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT) $(INSTALL) -m 0755 $(STRIP_OPT) cavstest-ctr$(EXEEXT) $(DESTDIR)$(libexecdir)/cavstest-ctr$(EXEEXT) + $(INSTALL) -m 0755 $(STRIP_OPT) cavstest-kdf$(EXEEXT) $(DESTDIR)$(libexecdir)/cavstest-kdf$(EXEEXT) $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 diff --git a/cavstest-kdf.c b/cavstest-kdf.c new file mode 100644 index 0000000..a6ecf45 --- /dev/null +++ b/cavstest-kdf.c @@ -0,0 +1,402 @@ +/* + * Copyright (C) 2015, Stephan Mueller <smuel...@chronox.de> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, and the entire permission notice in its entirety, + * including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * ALTERNATIVELY, this product may be distributed under the terms of + * the GNU General Public License, in which case the provisions of the GPL2 + * are required INSTEAD OF the above restrictions. (This clause is + * necessary due to a potential bad interaction between the GPL and + * the restrictions contained in a BSD-style copyright.) + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF + * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + */ + +#include "includes.h" + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <sys/types.h> +#include <string.h> + +#include <openssl/bn.h> + +#include "xmalloc.h" +#include "ssherr.h" +#include "sshbuf.h" +#include "sshkey.h" +#include "cipher.h" +#include "kex.h" +#include "packet.h" + +static int bin_char(unsigned char hex) +{ + if (48 <= hex && 57 >= hex) + return (hex - 48); + if (65 <= hex && 70 >= hex) + return (hex - 55); + if (97 <= hex && 102 >= hex) + return (hex - 87); + return 0; +} + +/* + * Convert hex representation into binary string + * @hex input buffer with hex representation + * @hexlen length of hex + * @bin output buffer with binary data + * @binlen length of already allocated bin buffer (should be at least + * half of hexlen -- if not, only a fraction of hexlen is converted) + */ +static void hex2bin(const char *hex, size_t hexlen, + unsigned char *bin, size_t binlen) +{ + size_t i = 0; + size_t chars = (binlen > (hexlen / 2)) ? (hexlen / 2) : binlen; + + for (i = 0; i < chars; i++) { + bin[i] = bin_char(hex[(i*2)]) << 4; + bin[i] |= bin_char(hex[((i*2)+1)]); + } +} + +/* + * Allocate sufficient space for binary representation of hex + * and convert hex into bin + * + * Caller must free bin + * @hex input buffer with hex representation + * @hexlen length of hex + * @bin return value holding the pointer to the newly allocated buffer + * @binlen return value holding the allocated size of bin + * + * return: 0 on success, !0 otherwise + */ +static int hex2bin_alloc(const char *hex, size_t hexlen, + unsigned char **bin, size_t *binlen) +{ + unsigned char *out = NULL; + size_t outlen = 0; + + if (!hexlen) + return -EINVAL; + + outlen = (hexlen + 1) / 2; + + out = calloc(1, outlen); + if (!out) + return -errno; + + hex2bin(hex, hexlen, out, outlen); + *bin = out; + *binlen = outlen; + return 0; +} + +static char hex_char_map_l[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; +static char hex_char_map_u[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; +static char hex_char(unsigned int bin, int u) +{ + if (bin < sizeof(hex_char_map_l)) + return (u) ? hex_char_map_u[bin] : hex_char_map_l[bin]; + return 'X'; +} + +/* + * Convert binary string into hex representation + * @bin input buffer with binary data + * @binlen length of bin + * @hex output buffer to store hex data + * @hexlen length of already allocated hex buffer (should be at least + * twice binlen -- if not, only a fraction of binlen is converted) + * @u case of hex characters (0=>lower case, 1=>upper case) + */ +static void bin2hex(const unsigned char *bin, size_t binlen, + char *hex, size_t hexlen, int u) +{ + size_t i = 0; + size_t chars = (binlen > (hexlen / 2)) ? (hexlen / 2) : binlen; + + for (i = 0; i < chars; i++) { + hex[(i*2)] = hex_char((bin[i] >> 4), u); + hex[((i*2)+1)] = hex_char((bin[i] & 0x0f), u); + } +} + +struct kdf_cavs { + unsigned char *K; + size_t Klen; + unsigned char *H; + size_t Hlen; + unsigned char *session_id; + size_t session_id_len; + + unsigned int iv_len; + unsigned int ek_len; + unsigned int ik_len; +}; + +#ifdef WITH_OPENSSL +static int +kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen, + const BIGNUM *secret) +{ + struct sshbuf *shared_secret; + int r; + + if ((shared_secret = sshbuf_new()) == NULL) + return SSH_ERR_ALLOC_FAIL; + if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0) + r = kex_derive_keys(ssh, hash, hashlen, shared_secret); + sshbuf_free(shared_secret); + return r; +} +#endif + +static int sshkdf_cavs(struct kdf_cavs *test) +{ + int ret = 0; + struct kex kex; + BIGNUM *Kbn = NULL; + int mode = 0; + struct newkeys *keys_client; + struct newkeys *keys_server; + struct ssh *ssh = NULL; + +#define HEXOUTLEN 500 + char hex[HEXOUTLEN]; + + memset(&kex, 0, sizeof(struct kex)); + + Kbn = BN_new(); + BN_bin2bn(test->K, test->Klen, Kbn); + if (!Kbn) { + printf("cannot convert K into BIGNUM\n"); + ret = 1; + goto out; + } + + kex.session_id = test->session_id; + kex.session_id_len = test->session_id_len; + + /* setup kex */ + + /* select the right hash based on struct ssh_digest digests */ + switch (test->ik_len) { + case 20: + kex.hash_alg = 2; + break; + case 32: + kex.hash_alg = 3; + break; + case 48: + kex.hash_alg = 4; + break; + case 64: + kex.hash_alg = 5; + break; + default: + printf("Wrong hash type %u\n", test->ik_len); + ret = 1; + goto out; + } + + /* implement choose_enc */ + for (mode = 0; mode < 2; mode++) { + kex.newkeys[mode] = calloc(1, sizeof(struct newkeys)); + if (!kex.newkeys[mode]) { + printf("allocation of newkeys failed\n"); + ret = 1; + goto out; + } + kex.newkeys[mode]->enc.iv_len = test->iv_len; + kex.newkeys[mode]->enc.key_len = test->ek_len; + kex.newkeys[mode]->enc.block_size = (test->iv_len == 64) ? 8 : 16; + kex.newkeys[mode]->mac.key_len = test->ik_len; + } + + /* implement kex_choose_conf */ + kex.we_need = kex.newkeys[0]->enc.key_len; + if (kex.we_need < kex.newkeys[0]->enc.block_size) + kex.we_need = kex.newkeys[0]->enc.block_size; + if (kex.we_need < kex.newkeys[0]->enc.iv_len) + kex.we_need = kex.newkeys[0]->enc.iv_len; + if (kex.we_need < kex.newkeys[0]->mac.key_len) + kex.we_need = kex.newkeys[0]->mac.key_len; + + /* MODE_OUT (1) -> server to client + * MODE_IN (0) -> client to server */ + kex.server = 1; + + /* do it */ + if ((ssh = ssh_packet_set_connection(NULL, -1, -1)) == NULL){ + printf("Allocation error\n"); + goto out; + } + ssh->kex = &kex; + kex_derive_keys_bn(ssh, test->H, test->Hlen, Kbn); + + keys_client = kex.newkeys[0]; + keys_server = kex.newkeys[1]; + + /* get data */ + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_client->enc.iv, (size_t)keys_client->enc.iv_len, + hex, HEXOUTLEN, 0); + printf("Initial IV (client to server) = %s\n", hex); + + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_server->enc.iv, (size_t)keys_server->enc.iv_len, + hex, HEXOUTLEN, 0); + printf("Initial IV (server to client) = %s\n", hex); + + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_client->enc.key, (size_t)keys_client->enc.key_len, + hex, HEXOUTLEN, 0); + printf("Encryption key (client to server) = %s\n", hex); + + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_server->enc.key, (size_t)keys_server->enc.key_len, + hex, HEXOUTLEN, 0); + printf("Encryption key (server to client) = %s\n", hex); + + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_client->mac.key, (size_t)keys_client->mac.key_len, + hex, HEXOUTLEN, 0); + printf("Integrity key (client to server) = %s\n", hex); + + memset(hex, 0, HEXOUTLEN); + bin2hex(keys_server->mac.key, (size_t)keys_server->mac.key_len, + hex, HEXOUTLEN, 0); + printf("Integrity key (server to client) = %s\n", hex); + +out: + if (Kbn) + BN_free(Kbn); + if (ssh) + ssh_packet_close(ssh); + if (kex.newkeys[0]) + free(kex.newkeys[0]); + if (kex.newkeys[1]) + free(kex.newkeys[1]); + return ret; +} + +static void usage(void) +{ + fprintf(stderr, "\nOpenSSH KDF CAVS Test\n\n"); + fprintf(stderr, "Usage:\n"); + fprintf(stderr, "\t-K\tShared secret string\n"); + fprintf(stderr, "\t-H\tHash string\n"); + fprintf(stderr, "\t-s\tSession ID string\n"); + fprintf(stderr, "\t-i\tIV length to be generated\n"); + fprintf(stderr, "\t-e\tEncryption key length to be generated\n"); + fprintf(stderr, "\t-m\tMAC key length to be generated\n"); +} + +/* + * Test command example: + * ./ssh-cavs -K 0055d50f2d163cc07cd8a93cc7c3430c30ce786b572c01ad29fec7597000cf8618d664e2ec3dcbc8bb7a1a7eb7ef67f61cdaf291625da879186ac0a5cb27af571b59612d6a6e0627344d846271959fda61c78354aa498773d59762f8ca2d0215ec590d8633de921f920d41e47b3de6ab9a3d0869e1c826d0e4adebf8e3fb646a15dea20a410b44e969f4b791ed6a67f13f1b74234004d5fa5e87eff7abc32d49bbdf44d7b0107e8f10609233b7e2b7eff74a4daf25641de7553975dac6ac1e5117df6f6dbaa1c263d23a6c3e5a3d7d49ae8a828c1e333ac3f85fbbf57b5c1a45be45e43a7be1a4707eac779b8285522d1f531fe23f890fd38a004339932b93eda4 -H d3ab91a850febb417a25d892ec48ed5952c7a5de -s d3ab91a850febb417a25d892ec48ed5952c7a5de -i 8 -e 24 -m 20 + * + * Expected result for example: + * Initial IV (client to server) = 4bb320d1679dfd3a + * Encryption key (client to server) = 13048cc600b9d3cf9095aa6cf8e2ff9cf1c54ca0520c89ed + * Integrity key (client to server) = ecef63a092b0dcc585bdc757e01b2740af57d640 + * Initial IV (server to client) = 43dea6fdf263a308 + * Encryption key (server to client) = 1e483c5134e901aa11fc4e0a524e7ec7b75556148a222bb0 + * Integrity key (server to client) = 7424b05f3c44a72b4ebd281fb71f9cbe7b64d479 + */ +int main(int argc, char *argv[]) +{ + struct kdf_cavs test; + int ret = 1; + int opt = 0; + + memset(&test, 0, sizeof(struct kdf_cavs)); + while((opt = getopt(argc, argv, "K:H:s:i:e:m:")) != -1) + { + size_t len = 0; + switch(opt) + { + /* + * CAVS K is MPINT + * we want a hex (i.e. the caller must ensure the + * following transformations already happened): + * 1. cut off first four bytes + * 2. if most significant bit of value is + * 1, prepend 0 byte + */ + case 'K': + len = strlen(optarg); + ret = hex2bin_alloc(optarg, len, + &test.K, &test.Klen); + if (ret) + goto out; + break; + case 'H': + len = strlen(optarg); + ret = hex2bin_alloc(optarg, len, + &test.H, &test.Hlen); + if (ret) + goto out; + break; + case 's': + len = strlen(optarg); + ret = hex2bin_alloc(optarg, len, + &test.session_id, + &test.session_id_len); + if (ret) + goto out; + break; + case 'i': + test.iv_len = strtoul(optarg, NULL, 10); + break; + case 'e': + test.ek_len = strtoul(optarg, NULL, 10); + break; + case 'm': + test.ik_len = strtoul(optarg, NULL, 10); + break; + default: + usage(); + goto out; + } + } + + ret = sshkdf_cavs(&test); + +out: + if (test.session_id) + free(test.session_id); + if (test.K) + free(test.K); + if (test.H) + free(test.H); + return ret; + +} ++++++ openssh-7.7p1-disable_openssl_abi_check.patch ++++++ # HG changeset patch # Parent b13da8c3e99081cb92ab226d2c512241a82cd0d5 disable run-time check for OpenSSL ABI by version number as that is not a reliable indicator of ABI changes and doesn't make much sense in a distribution package diff --git a/configure.ac b/configure.ac index 42ffd95..20a1884 100644 --- a/configure.ac +++ b/configure.ac @@ -4878,6 +4878,19 @@ AC_ARG_WITH([bsd-auth], ] ) +# Whether we are using distribution (Open)SSL, so no runtime checks are necessary +DISTRO_SSL=no +AC_ARG_WITH([distro-ssl], + [ --with-distro-ssl Disable runtime OpenSSL version checks (good for distributions)], + [ + if test "x$withval" != "xno" ; then + AC_DEFINE([DISTRO_SSL], [1], + [Define if you are using distribution SSL library and don;t expect its API/ABI to change]) + DISTRO_SSL=yes + fi + ] +) + # Where to place sshd.pid piddir=/var/run # make sure the directory exists diff --git a/entropy.c b/entropy.c index f8b9f42..4957b23 100644 --- a/entropy.c +++ b/entropy.c @@ -223,11 +223,13 @@ seed_rng(void) /* Initialise libcrypto */ ssh_libcrypto_init(); +#ifndef DISTRO_SSL if (!ssh_compatible_openssl(OPENSSL_VERSION_NUMBER, OpenSSL_version_num())) fatal("OpenSSL version mismatch. Built against %lx, you " "have %lx", (u_long)OPENSSL_VERSION_NUMBER, OpenSSL_version_num()); +#endif #ifndef OPENSSL_PRNG_ONLY if (RAND_status() == 1) ++++++ openssh-7.7p1-eal3.patch ++++++ # HG changeset patch # Parent 8fd4e445c3a5c823568661a4f71b064cbcb217a9 fix paths and references in sshd man pages diff --git a/openssh-7.7p1/Makefile.in b/openssh-7.7p1/Makefile.in --- openssh-7.7p1/Makefile.in +++ openssh-7.7p1/Makefile.in @@ -127,17 +127,18 @@ MANTYPE = @MANTYPE@ CONFIGFILES=sshd_config.out ssh_config.out moduli.out CONFIGFILES_IN=sshd_config ssh_config moduli PATHSUBS = \ -e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \ -e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \ -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \ -e 's|/usr/libexec|$(libexecdir)|g' \ - -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \ + -e 's|login\.conf|login.defs|g' \ + -e 's|/etc/shosts.equiv|$(sysconfdir)/ssh/shosts.equiv|g' \ -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \ -e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \ -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \ -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ -e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \ -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ -e 's|/etc/moduli|$(sysconfdir)/moduli|g' \ -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ ++++++ openssh-7.7p1-enable_PAM_by_default.patch ++++++ # HG changeset patch # Parent 5c1e122e31b601de64d81085294216af33f31aed # force PAM in defaullt install (this was removed from upstream in 3.8p1) # bnc#46749 # --used to be called '-pam-fix2' diff --git a/openssh-7.7p1/sshd_config b/openssh-7.7p1/sshd_config --- openssh-7.7p1/sshd_config +++ openssh-7.7p1/sshd_config @@ -74,17 +74,17 @@ AuthorizedKeysFile .ssh/authorized_keys # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of "PermitRootLogin without-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. -#UsePAM no +UsePAM yes #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes ++++++ openssh-7.7p1-fips.patch ++++++ ++++ 845 lines (skipped) ++++++ openssh-7.7p1-fips_checks.patch ++++++ # HG changeset patch # Parent e9b69da9a0f8dca923f8fc2836b38fe6590c791a # # Simple implementation of FIPS 140-2 selfchecks. Use OpenSSL to generate and # verify checksums of binaries. Any hash iused in OpenSSH can be used (MD5 would # obviously be a poor choice, since OpenSSL would barf and abort immediately in # FIPS mode). SHA-2 seems to be a reasonable choice. # # The logic of the checks is as follows: decide whether FIPS mode is mandated # (either by checking /proc/sys/crypto/fips_enabled or envoroinment variable # SSH_FORCE_FIPS. In FIPS mode, checksums are required to match (inability to # retrieve pre-calculated hash is a fatal error). In non-FIPS mode the checks # still must be performed, unless the hashes are not installed. Thus if the hash # file is not found (or the hash matches), proceed in non-FIPS mode and abort # otherwise. diff --git a/fips-check.c b/fips-check.c new file mode 100644 index 0000000..eceb031 --- /dev/null +++ b/fips-check.c @@ -0,0 +1,34 @@ +#include "includes.h" +#include <fcntl.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include "digest.h" +#include "fips.h" + +#include <openssl/err.h> + +#define PROC_NAME_LEN 64 + +static const char *argv0; + +void +print_help_exit(int ev) +{ + fprintf(stderr, "%s <-c|-w> <file> <checksum_file>\n", argv0); + fprintf(stderr, " -c verify hash of 'file' against hash in 'checksum_file'\n"); + fprintf(stderr, " -w write hash of 'file' into 'checksum_file'\n"); + exit(ev); +} + +int +main(int argc, char **argv) +{ + fips_ssh_init(); + return 0; +} diff --git a/fips.c b/fips.c index 23e3876..297ae99 100644 --- a/fips.c +++ b/fips.c @@ -35,30 +35,293 @@ #include "log.h" #include "xmalloc.h" +#include <errno.h> +#include <fcntl.h> #include <string.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> #include <openssl/crypto.h> +#include <openssl/err.h> +#include <openssl/hmac.h> static int fips_state = -1; +/* calculates HMAC of contents of a file given by filename using the hash + * algorithm specified by FIPS_HMAC_EVP in fips.h and placing the result into + * newly allacated memory - remember to free it when not needed anymore */ static int -fips_check_required_env(void) +hmac_file(const char *filename, u_char **hmac_out) +{ + int check = -1; + int fd; + struct stat fs; + void *hmap; + unsigned char *hmac; + unsigned char *hmac_rv = NULL; + + hmac = xmalloc(FIPS_HMAC_LEN); + + fd = open(filename, O_RDONLY); + if (-1 == fd) + goto bail_out; + + if (-1 == fstat(fd, &fs)) + goto bail_out; + + hmap = mmap(NULL, fs.st_size, PROT_READ, MAP_SHARED, fd, 0); + + if ((void *)(-1) != hmap) { + hmac_rv = HMAC(FIPS_HMAC_EVP(), FIPS_HMAC_KEY + , strlen(FIPS_HMAC_KEY), hmap, fs.st_size, hmac, NULL); + check = CHECK_OK; + munmap(hmap, fs.st_size); + } + close(fd); + +bail_out: + if (hmac_rv) { + check = CHECK_OK; + *hmac_out = hmac; + } else { + check = CHECK_FAIL; + *hmac_out = NULL; + free(hmac); + } + return check; +} + +/* find pathname of binary of process with PID pid. exe is buffer expected to + * be capable of holding at least max_pathlen characters + */ +static int +get_executable_path(pid_t pid, char *exe, int max_pathlen) +{ + char exe_sl[PROC_EXE_PATH_LEN]; + int n; + int rv = -1; + + n = snprintf(exe_sl, sizeof(exe_sl), "/proc/%u/exe", pid); + if ((n <= 10) || (n >= max_pathlen)) { + fatal("error compiling filename of link to executable"); + } + + exe[0] = 0; + n = readlink(exe_sl, exe, max_pathlen); + /* the file doesn't need to exist - procfs might not be mounted in + * chroot */ + if (n == -1) { + rv = CHECK_MISSING; + } else { + if (n < max_pathlen) { + exe[n] = 0; + rv = CHECK_OK; + } else { + rv = CHECK_FAIL; + } + } + return rv; +} + +/* Read HMAC from file chk, allocating enough memory to hold the HMAC and + * return it in *hmac. + * Remember to free() it when it's not needed anymore. + */ +static int +read_hmac(const char *chk, u_char **hmac) +{ + int check = -1; + int fdh, n; + u_char *hmac_in; + + *hmac = NULL; + + fdh = open(chk, O_RDONLY); + if (-1 == fdh) { + switch (errno) { + case ENOENT: + check = CHECK_MISSING; + debug("fips: checksum file %s is missing\n", chk); + break; + default: + check = CHECK_FAIL; + debug("fips: ckecksum file %s not accessible\n", chk); + break; + + } + goto bail_out; + } + + hmac_in = xmalloc(FIPS_HMAC_LEN); + + n = read(fdh, (void *)hmac_in, FIPS_HMAC_LEN); + if (FIPS_HMAC_LEN != n) { + debug("fips: unable to read whole checksum from checksum file\n"); + free (hmac_in); + check = CHECK_FAIL; + } else { + check = CHECK_OK; + *hmac = hmac_in; + } +bail_out: + return check; +} + +static int +fips_hmac_self(void) +{ + int check = -1; + u_char *hmac = NULL, *hmac_chk = NULL; + char *exe, *chk; + + exe = xmalloc(PATH_MAX); + chk = xmalloc(PATH_MAX); + + /* we will need to add the suffix and the null terminator */ + check = get_executable_path(getpid(), exe + , PATH_MAX - strlen(CHECKSUM_SUFFIX) - 1); + if (CHECK_OK != check) + goto cleanup; + + strncpy(chk, exe, PATH_MAX); + strlcat(chk, CHECKSUM_SUFFIX, PATH_MAX); + + check = read_hmac(chk, &hmac_chk); + if (CHECK_OK != check) + goto cleanup; + + check = hmac_file(exe, &hmac); + if (CHECK_OK != check) + goto cleanup; + + check = memcmp(hmac, hmac_chk, FIPS_HMAC_LEN); + if (0 == check) { + check = CHECK_OK; + debug("fips: checksum matches\n"); + } else { + check = CHECK_FAIL; + debug("fips: checksum mismatch!\n"); + } + +cleanup: + free(hmac); + free(hmac_chk); + free(chk); + free(exe); + + return check; +} + +static int +fips_check_required_proc(void) { int fips_required = 0; - char *env = getenv(SSH_FORCE_FIPS_ENV); - - if (env) { - errno = 0; - fips_required = strtol(env, NULL, 10); - if (errno) { - debug("bogus value in the %s environment variable, ignoring\n" - , SSH_FORCE_FIPS_ENV); - fips_required = 0; - } else - fips_required = 1; + int fips_fd; + char fips_sys = 0; + + struct stat dummy; + if (-1 == stat(FIPS_PROC_PATH, &dummy)) { + switch (errno) { + case ENOENT: + case ENOTDIR: + break; + default: + fatal("Check for system-wide FIPS mode is required and %s cannot" + " be accessed for reason other than non-existence - aborting" + , FIPS_PROC_PATH); + break; + } + } else { + if (-1 == (fips_fd = open(FIPS_PROC_PATH, O_RDONLY))) + fatal("Check for system-wide FIPS mode is required and %s cannot" + " be opened for reading - aborting" + , FIPS_PROC_PATH); + if (1 > read(fips_fd, &fips_sys, 1)) + fatal("Check for system-wide FIPS mode is required and %s doesn't" + " return at least one character - aborting" + , FIPS_PROC_PATH); + close(fips_sys); + switch (fips_sys) { + case '0': + case '1': + fips_required = fips_sys - '0'; + break; + default: + fatal("Bogus character %c found in %s - aborting" + , fips_sys, FIPS_PROC_PATH); + } } return fips_required; } +static int +fips_check_required_env(void) +{ + return (NULL != getenv(SSH_FORCE_FIPS_ENV)); +} + +static int +fips_required(void) +{ + int fips_requests = 0; + fips_requests += fips_check_required_proc(); + fips_requests += fips_check_required_env(); + return fips_requests; +} + +/* check whether FIPS mode is required and perform selfchecksum/selftest */ +void +fips_ssh_init(void) +{ + int checksum; + + checksum = fips_hmac_self(); + + if (fips_required()) { + switch (checksum) { + case CHECK_OK: + debug("fips: mandatory checksum ok"); + break; + case CHECK_FAIL: + fatal("fips: mandatory checksum failed - aborting"); + break; + case CHECK_MISSING: + fatal("fips: mandatory checksum data missing - aborting"); + break; + default: + fatal("Fatal error: internal error at %s:%u" + , __FILE__, __LINE__); + break; + } + fips_state = FIPS_mode_set(1); + if (1 != fips_state) { + ERR_load_crypto_strings(); + u_long err = ERR_get_error(); + error("fips: OpenSSL error %lx: %s" + , err, ERR_error_string(err, NULL)); + fatal("fips: unable to set OpenSSL into FIPS mode - aborting"); + } + } else { + switch (checksum) { + case CHECK_OK: + debug("fips: checksum ok"); + break; + case CHECK_FAIL: + fatal("fips: checksum failed - aborting"); + break; + case CHECK_MISSING: + debug("fips: checksum data missing, but not required - continuing non-FIPS"); + break; + default: + fatal("Fatal error: internal error at %s:%u", + __FILE__, __LINE__); + break; + } + } + return; +} + int fips_mode(void) { diff --git a/fips.h b/fips.h index a115a61..3404684 100644 --- a/fips.h +++ b/fips.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Petr Cerny. All rights reserved. + * Copyright (c) 2012-2014 Petr Cerny. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +27,15 @@ #include "sshkey.h" #define SSH_FORCE_FIPS_ENV "SSH_FORCE_FIPS" +#define FIPS_PROC_PATH "/proc/sys/crypto/fips_enabled" + +#define PROC_EXE_PATH_LEN 64 +#define CHECKSUM_SUFFIX ".hmac" +#define FIPS_HMAC_KEY "HMAC_KEY:OpenSSH-FIPS@SLE" +#define FIPS_HMAC_EVP EVP_sha256 +#define FIPS_HMAC_LEN 32 + +void fips_ssh_init(void); typedef enum { FIPS_FILTER_CIPHERS, @@ -34,6 +43,12 @@ typedef enum { FIPS_FILTER_KEX_ALGS } fips_filters; +typedef enum { + CHECK_OK = 0, + CHECK_FAIL, + CHECK_MISSING +} fips_checksum_status; + int fips_mode(void); int fips_correct_dgst(int); int fips_dgst_min(void); @@ -41,4 +56,3 @@ enum fp_type fips_correct_fp_type(enum fp_type); int fips_filter_crypto(char **, fips_filters); #endif - diff --git a/sftp-server.c b/sftp-server.c index b133cbc..c3086b6 100644 --- a/sftp-server.c +++ b/sftp-server.c @@ -53,6 +53,8 @@ char *sftp_realpath(const char *, char *); /* sftp-realpath.c */ +#include "fips.h" + /* Our verbosity */ static LogLevel log_level = SYSLOG_LEVEL_ERROR; @@ -1595,6 +1597,9 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) extern char *optarg; extern char *__progname; + /* initialize fips */ + fips_ssh_init(); + __progname = ssh_get_progname(argv[0]); log_init(__progname, log_level, log_facility, log_stderr); diff --git a/ssh.c b/ssh.c index ee51823..882d1da 100644 --- a/ssh.c +++ b/ssh.c @@ -113,6 +113,8 @@ #include "ssh-pkcs11.h" #endif +#include "fips.h" + extern char *__progname; /* Saves a copy of argv for setproctitle emulation */ @@ -596,6 +598,10 @@ main(int ac, char **av) struct ssh_digest_ctx *md; u_char conn_hash[SSH_DIGEST_MAX_LENGTH]; + /* initialize fips - can go before ssh_malloc_init(), since that is a + * OpenBSD-only thing (as of OpenSSH 7.6p1) */ + fips_ssh_init(); + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); diff --git a/sshd.c b/sshd.c index c8086cd..bb20eec 100644 --- a/sshd.c +++ b/sshd.c @@ -1443,6 +1443,10 @@ main(int ac, char **av) Authctxt *authctxt; struct connection_info *connection_info = NULL; + /* initialize fips - can go before ssh_malloc_init(), since that is a + * OpenBSD-only thing (as of OpenSSH 7.6p1) */ + fips_ssh_init(); + #ifdef HAVE_SECUREWARE (void)set_auth_parameters(ac, av); #endif ++++++ openssh-7.7p1-host_ident.patch ++++++ # HG changeset patch # Parent 0f731d0b541b8a919d24ac91098f560a49712822 Suggest command line for removal of offending keys from known_hosts file diff --git a/openssh-7.7p1/sshconnect.c b/openssh-7.7p1/sshconnect.c --- openssh-7.7p1/sshconnect.c +++ openssh-7.7p1/sshconnect.c @@ -1147,16 +1147,21 @@ check_host_key(char *hostname, struct so } /* The host key has changed. */ warn_changed_key(host_key); error("Add correct host key in %.100s to get rid of this message.", user_hostfiles[0]); error("Offending %s key in %s:%lu", sshkey_type(host_found->key), host_found->file, host_found->line); + error("You can use following command to remove the offending key:"); + if (host_found->file) + error("ssh-keygen -R %s -f %s", host, host_found->file); + else + error("ssh-keygen -R %s", host); /* * If strict host key checking is in use, the user will have * to edit the key manually and we can only abort. */ if (options.strict_host_key_checking != SSH_STRICT_HOSTKEY_OFF) { error("%s host key for %.200s has changed and you have " ++++++ openssh-7.7p1-hostname_changes_when_forwarding_X.patch ++++++ # HG changeset patch # Parent 5e19a205fa03584bb0d829ecbba7495ce1899b65 # -- uset do be called '-xauthlocalhostname' handle hostname changes when forwarding X bnc#98627 diff --git a/session.c b/session.c index 94d7438..d81060c 100644 --- a/session.c +++ b/session.c @@ -981,7 +981,7 @@ copy_environment(char **source, char ***env, u_int *envsize) } static char ** -do_setup_env(struct ssh *ssh, Session *s, const char *shell) +do_setup_env(struct ssh *ssh, Session *s, const char *shell, int *env_size) { char buf[256]; size_t n; @@ -1191,6 +1191,8 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) for (i = 0; env[i]; i++) fprintf(stderr, " %.200s\n", env[i]); } + + *env_size = envsize; return env; } @@ -1199,7 +1201,7 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) * first in this order). */ static void -do_rc_files(struct ssh *ssh, Session *s, const char *shell) +do_rc_files(struct ssh *ssh, Session *s, const char *shell, char **env, int *env_size) { FILE *f = NULL; char cmd[1024]; @@ -1254,12 +1256,20 @@ do_rc_files(struct ssh *ssh, Session *s, const char *shell) options.xauth_location); f = popen(cmd, "w"); if (f) { + char hostname[MAXHOSTNAMELEN]; + fprintf(f, "remove %s\n", s->auth_display); fprintf(f, "add %s %s %s\n", s->auth_display, s->auth_proto, s->auth_data); pclose(f); + if (gethostname(hostname,sizeof(hostname)) >= 0) + child_set_env(&env,env_size,"XAUTHLOCALHOSTNAME", + hostname); + else + debug("Cannot set up XAUTHLOCALHOSTNAME %s\n", + strerror(errno)); } else { fprintf(stderr, "Could not run %s\n", cmd); @@ -1515,6 +1525,7 @@ do_child(struct ssh *ssh, Session *s, const char *command) char **env, *argv[ARGV_MAX], remote_id[512]; const char *shell, *shell0; struct passwd *pw = s->pw; + int env_size; int r = 0; sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id)); @@ -1571,7 +1582,7 @@ do_child(struct ssh *ssh, Session *s, const char *command) * Make sure $SHELL points to the shell from the password file, * even if shell is overridden from login.conf */ - env = do_setup_env(ssh, s, shell); + env = do_setup_env(ssh, s, shell, &env_size); #ifdef HAVE_LOGIN_CAP shell = login_getcapstr(lc, "shell", (char *)shell, (char *)shell); @@ -1635,7 +1646,7 @@ do_child(struct ssh *ssh, Session *s, const char *command) closefrom(STDERR_FILENO + 1); - do_rc_files(ssh, s, shell); + do_rc_files(ssh, s, shell, env, &env_size); /* restore SIGPIPE for child */ signal(SIGPIPE, SIG_DFL); ++++++ openssh-7.7p1-ldap.patch ++++++ ++++ 2726 lines (skipped) ++++++ openssh-7.7p1-no_fork-no_pid_file.patch ++++++ # HG changeset patch # Parent bad0c8b3b8d72abb6960ed85b57ee42352371738 Do not write a PID file when not daemonizing (e.g. when running from systemd) diff --git a/openssh-7.7p1/sshd.c b/openssh-7.7p1/sshd.c --- openssh-7.7p1/sshd.c +++ openssh-7.7p1/sshd.c @@ -1996,17 +1996,17 @@ main(int ac, char **av) signal(SIGCHLD, main_sigchld_handler); signal(SIGTERM, sigterm_handler); signal(SIGQUIT, sigterm_handler); /* * Write out the pid file after the sigterm handler * is setup and the listen sockets are bound */ - if (options.pid_file != NULL && !debug_flag) { + if (!no_daemon_flag && options.pid_file != NULL && !debug_flag) { FILE *f = fopen(options.pid_file, "w"); if (f == NULL) { error("Couldn't create pid file \"%s\": %s", options.pid_file, strerror(errno)); } else { fprintf(f, "%ld\n", (long) getpid()); fclose(f); ++++++ openssh-7.7p1-pam_check_locks.patch ++++++ # HG changeset patch # Parent 089f4fba0112d410a1bfa74398941f076681d446 new option UsePAMCheckLocks to enforce checking for locked accounts while UsePAM is used bnc#708678, FATE#312033 Index: openssh-7.8p1/auth.c =================================================================== --- openssh-7.8p1.orig/auth.c +++ openssh-7.8p1/auth.c @@ -112,7 +112,7 @@ allowed_user(struct passwd * pw) return 0; #ifdef USE_SHADOW - if (!options.use_pam) + if (!options.use_pam || options.use_pam_check_locks) spw = getspnam(pw->pw_name); #ifdef HAS_SHADOW_EXPIRE if (!options.use_pam && spw != NULL && auth_shadow_acctexpired(spw)) @@ -132,7 +132,7 @@ allowed_user(struct passwd * pw) #endif /* check for locked account */ - if (!options.use_pam && passwd && *passwd) { + if ((!options.use_pam || options.use_pam_check_locks) && passwd && *passwd) { int locked = 0; #ifdef LOCKED_PASSWD_STRING Index: openssh-7.8p1/servconf.c =================================================================== --- openssh-7.8p1.orig/servconf.c +++ openssh-7.8p1/servconf.c @@ -83,6 +83,7 @@ initialize_server_options(ServerOptions /* Portable-specific options */ options->use_pam = -1; + options->use_pam_check_locks = -1; /* Standard Options */ options->num_ports = 0; @@ -259,6 +260,8 @@ fill_default_server_options(ServerOption /* Portable-specific options */ if (options->use_pam == -1) options->use_pam = 0; + if (options->use_pam_check_locks == -1) + options->use_pam_check_locks = 0; /* Standard Options */ if (options->num_host_key_files == 0) { @@ -459,7 +462,7 @@ fill_default_server_options(ServerOption typedef enum { sBadOption, /* == unknown option */ /* Portable-specific options */ - sUsePAM, + sUsePAM, sUsePAMChecklocks, /* Standard Options */ sPort, sHostKeyFile, sLoginGraceTime, sPermitRootLogin, sLogFacility, sLogLevel, @@ -509,8 +512,10 @@ static struct { /* Portable-specific options */ #ifdef USE_PAM { "usepam", sUsePAM, SSHCFG_GLOBAL }, + { "usepamchecklocks", sUsePAMChecklocks, SSHCFG_GLOBAL }, #else { "usepam", sUnsupported, SSHCFG_GLOBAL }, + { "usepamchecklocks", sUnsupported, SSHCFG_GLOBAL }, #endif { "pamauthenticationviakbdint", sDeprecated, SSHCFG_GLOBAL }, /* Standard Options */ @@ -1250,6 +1255,9 @@ process_server_config_line(ServerOptions case sUsePAM: intptr = &options->use_pam; goto parse_flag; + case sUsePAMChecklocks: + intptr = &options->use_pam_check_locks; + goto parse_flag; /* Standard Options */ case sBadOption: Index: openssh-7.8p1/servconf.h =================================================================== --- openssh-7.8p1.orig/servconf.h +++ openssh-7.8p1/servconf.h @@ -181,6 +181,7 @@ typedef struct { char *adm_forced_command; int use_pam; /* Enable auth via PAM */ + int use_pam_check_locks; /* internally check for locked accounts even when using PAM */ int permit_tun; Index: openssh-7.8p1/sshd_config.0 =================================================================== --- openssh-7.8p1.orig/sshd_config.0 +++ openssh-7.8p1/sshd_config.0 @@ -961,6 +961,14 @@ DESCRIPTION If UsePAM is enabled, you will not be able to run sshd(8) as a non-root user. The default is no. + UsePAMCheckLocks + When set to ``yes'', the checks whether the account has been + locked with `passwd -l' are performed even when PAM authentication + is enabled via UsePAM. This is to ensure that it is not possible + to log in with e.g. a public key (in such a case PAM is used only + to set up the session and some PAM modules will not check whether + the account is locked in this scenario). The default is ``no''. + VersionAddendum Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default Index: openssh-7.8p1/sshd_config.5 =================================================================== --- openssh-7.8p1.orig/sshd_config.5 +++ openssh-7.8p1/sshd_config.5 @@ -1613,6 +1613,18 @@ is enabled, you will not be able to run as a non-root user. The default is .Cm no . +.It Cm UsePAMCheckLocks +When set to +.Dq yes +, the checks whether the account has been locked with +.Pa passwd -l +are performed even when PAM authentication is enabled via +.Cm UsePAM . +This is to ensure that it is not possible to log in with e.g. a +public key (in such a case PAM is used only to set up the session and some PAM +modules will not check whether the account is locked in this scenario). The +default is +.Dq no . .It Cm VersionAddendum Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. ++++++ openssh-7.7p1-pts_names_formatting.patch ++++++ # HG changeset patch # Parent 7cd948c83939479d1ba88a3161991cb561306f3f # use same lines naming as utempter (prevents problems with using different # formats in ?tmp? files) # --used to be called '-pts' diff --git a/openssh-7.7p1/loginrec.c b/openssh-7.7p1/loginrec.c --- openssh-7.7p1/loginrec.c +++ openssh-7.7p1/loginrec.c @@ -541,17 +541,17 @@ getlast_entry(struct logininfo *li) /* * 'line' string utility functions * * These functions process the 'line' string into one of three forms: * * 1. The full filename (including '/dev') * 2. The stripped name (excluding '/dev') * 3. The abbreviated name (e.g. /dev/ttyp00 -> yp00 - * /dev/pts/1 -> ts/1 ) + * /dev/pts/1 -> /1 ) * * Form 3 is used on some systems to identify a .tmp.? entry when * attempting to remove it. Typically both addition and removal is * performed by one application - say, sshd - so as long as the choice * uniquely identifies a terminal it's ok. */ @@ -602,16 +602,20 @@ line_abbrevname(char *dst, const char *s /* Always skip prefix if present */ if (strncmp(src, "/dev/", 5) == 0) src += 5; #ifdef WITH_ABBREV_NO_TTY if (strncmp(src, "tty", 3) == 0) src += 3; #endif + if (strncmp(src, "pts/", 4) == 0) { + src += 3; + if (strlen(src) > 4) src++; + } len = strlen(src); if (len > 0) { if (((int)len - dstsize) > 0) src += ((int)len - dstsize); /* note: _don't_ change this to strlcpy */ ++++++ openssh-7.7p1-remove_xauth_cookies_on_exit.patch ++++++ # HG changeset patch # Parent a60c0d88667efe0a64c030168950b69476af1622 # --used to be called '-xauth' try to remove xauth cookies on logout bnc#98815 diff --git a/openssh-7.7p1/session.c b/openssh-7.7p1/session.c --- openssh-7.7p1/session.c +++ openssh-7.7p1/session.c @@ -2302,16 +2302,44 @@ session_close(struct ssh *ssh, Session * u_int i; verbose("Close session: user %s from %.200s port %d id %d", s->pw->pw_name, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), s->self); + if ((s->display != NULL) && (s->auth_proto != NULL) && + (s->auth_data != NULL) && (options.xauth_location != NULL)) { + pid_t pid; + FILE *f; + char cmd[1024]; + struct passwd * pw = s->pw; + + if (!(pid = fork())) { + permanently_set_uid(pw); + + /* Remove authority data from .Xauthority if appropriate. */ + debug("Running %.500s remove %.100s\n", + options.xauth_location, s->auth_display); + + snprintf(cmd, sizeof cmd, "unset XAUTHORITY && HOME=\"%.200s\" %s -q -", + s->pw->pw_dir, options.xauth_location); + f = popen(cmd, "w"); + if (f) { + fprintf(f, "remove %s\n", s->auth_display); + pclose(f); + } else + error("Could not run %s\n", cmd); + exit(0); + } else if (pid > 0) { + waitpid(pid, NULL, 0); + } + } + if (s->ttyfd != -1) session_pty_cleanup(s); free(s->term); free(s->display); free(s->x11_chanids); free(s->auth_display); free(s->auth_data); free(s->auth_proto); ++++++ openssh-7.7p1-seccomp_ipc_flock.patch ++++++ # HG changeset patch # Parent 9d38b7292619a6d5faf554b1a88888fdfa535de7 Patch from IBM enabling the use of OpenCryptoki, submitted upstreams: From: Eduardo Barretto <ebarre...@linux.vnet.ibm.com> To: openssh-unix-...@mindrot.org Subject: [PATCH 1/3] Allow flock and ipc syscall for s390 architecture Date: Tue, 9 May 2017 14:27:13 -0300 In order to use the OpenSSL-ibmpkcs11 engine it is needed to allow flock and ipc calls, because this engine calls OpenCryptoki (a PKCS#11 implementation) which calls the libraries that will communicate with the crypto cards. OpenCryptoki makes use of flock and ipc and, as of now, this is only need on s390 architecture. Signed-off-by: Eduardo Barretto <ebarre...@linux.vnet.ibm.com> Index: openssh-7.9p1/sandbox-seccomp-filter.c =================================================================== --- openssh-7.9p1.orig/sandbox-seccomp-filter.c +++ openssh-7.9p1/sandbox-seccomp-filter.c @@ -175,6 +175,9 @@ static const struct sock_filter preauth_ #ifdef __NR_geteuid32 SC_ALLOW(__NR_geteuid32), #endif +#if defined(__NR_flock) && defined(__s390__) + SC_ALLOW(__NR_flock), +#endif #ifdef __NR_getpgid SC_ALLOW(__NR_getpgid), #endif @@ -193,6 +196,9 @@ static const struct sock_filter preauth_ #ifdef __NR_getuid32 SC_ALLOW(__NR_getuid32), #endif +#if defined(__NR_ipc) && defined(__s390__) + SC_ALLOW(__NR_ipc), +#endif #ifdef __NR_madvise SC_ALLOW(__NR_madvise), #endif ++++++ openssh-7.7p1-seccomp_stat.patch ++++++ # HG changeset patch # Parent 5034ae16f6a5c9c7151d931dc1cce2a541fe010e Allow the stat() syscall for OpenSSL re-seed patch (which causes OpenSSL use stat() on some file) bnc#912436 diff --git a/openssh-7.7p1/sandbox-seccomp-filter.c b/openssh-7.7p1/sandbox-seccomp-filter.c --- openssh-7.7p1/sandbox-seccomp-filter.c +++ openssh-7.7p1/sandbox-seccomp-filter.c @@ -224,16 +224,19 @@ static const struct sock_filter preauth_ SC_ALLOW(__NR_select), #endif #ifdef __NR_shutdown SC_ALLOW(__NR_shutdown), #endif #ifdef __NR_sigprocmask SC_ALLOW(__NR_sigprocmask), #endif +#ifdef __NR_stat + SC_ALLOW(__NR_stat), +#endif #ifdef __NR_time SC_ALLOW(__NR_time), #endif #ifdef __NR_write SC_ALLOW(__NR_write), #endif #ifdef __NR_socketcall SC_ALLOW_ARG(__NR_socketcall, 0, SYS_SHUTDOWN), ++++++ openssh-7.7p1-seed-prng.patch ++++++ # HG changeset patch # Parent e655fcb8e89d19ce9e954d6fc330e5e3e093a848 # extended support for (re-)seeding the OpenSSL PRNG from /dev/random # bnc#703221, FATE#312172 diff --git a/Makefile.in b/Makefile.in index 85818f4..750aada 100644 --- a/Makefile.in +++ b/Makefile.in @@ -182,13 +182,13 @@ libssh.a: $(LIBSSH_OBJS) $(RANLIB) $@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS) - $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS) $(GSSLIBS) + $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(SSHLIBS) $(LIBS) $(GSSLIBS) sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) - $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS) + $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS) scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o - $(LD) -o $@ scp.o progressmeter.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) + $(LD) -o $@ scp.o progressmeter.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) @@ -197,10 +197,10 @@ ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o $(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o sshsig.o - $(LD) -o $@ ssh-keygen.o sshsig.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) + $(LD) -o $@ ssh-keygen.o sshsig.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o readconf.o uidswap.o compat.o - $(LD) -o $@ ssh-keysign.o readconf.o uidswap.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) + $(LD) -o $@ ssh-keysign.o readconf.o uidswap.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) @@ -209,10 +209,10 @@ ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-realpath.o sftp-server-main.o - $(LD) -o $@ sftp-server.o sftp-common.o sftp-realpath.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) + $(LD) -o $@ sftp-server.o sftp-common.o sftp-realpath.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o - $(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT) + $(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT) # FIPS tests cavstest-ctr$(EXEEXT): $(LIBCOMPAT) libssh.a cavstest-ctr.o diff --git a/entropy.c b/entropy.c index 5de6801..f8b9f42 100644 --- a/entropy.c +++ b/entropy.c @@ -239,6 +239,8 @@ seed_rng(void) } #endif /* OPENSSL_PRNG_ONLY */ + linux_seed(); + if (RAND_status() != 1) fatal("PRNG is not seeded"); diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 1162dc5..80fd688 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -91,6 +91,7 @@ COMPAT= arc4random.o \ PORTS= port-aix.o \ port-irix.o \ port-linux.o \ + port-linux-prng.o \ port-solaris.o \ port-net.o \ port-uw.o diff --git a/openbsd-compat/port-linux-prng.c b/openbsd-compat/port-linux-prng.c new file mode 100644 index 0000000..dfc4bdb --- /dev/null +++ b/openbsd-compat/port-linux-prng.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011 Jan F. Chadima <jchad...@redhat.com> + * (c) 2011 Petr Cerny <pce...@suse.cz> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Linux-specific portability code - prng support + */ + +#include "includes.h" +#include "defines.h" + +#include <errno.h> +#include <stdarg.h> +#include <string.h> +#include <stdio.h> +#include <openssl/rand.h> + +#include "log.h" +#include "port-linux.h" +#include "fips.h" + +#define RNG_BYTES_DEFAULT 6L +#define RNG_ENV_VAR "SSH_USE_STRONG_RNG" + +long rand_bytes = 0; +char *rand_file = NULL; + +static void +linux_seed_init(void) +{ + long elen = 0; + char *env = getenv(RNG_ENV_VAR); + + if (env) { + errno = 0; + elen = strtol(env, NULL, 10); + if (errno) { + elen = RNG_BYTES_DEFAULT; + debug("bogus value in the %s environment variable, " + "using %li bytes from /dev/random\n", + RNG_ENV_VAR, RNG_BYTES_DEFAULT); + } + } + + if (elen || fips_mode()) + rand_file = "/dev/random"; + else + rand_file = "/dev/urandom"; + + rand_bytes = MAX(elen, RNG_BYTES_DEFAULT); +} + +void +linux_seed(void) +{ + long len; + if (!rand_file) + linux_seed_init(); + + errno = 0; + len = RAND_load_file(rand_file, rand_bytes); + if (len != rand_bytes) { + if (errno) + fatal ("cannot read from %s, %s", rand_file, strerror(errno)); + else + fatal ("EOF reading %s", rand_file); + } +} diff --git a/openbsd-compat/port-linux.h b/openbsd-compat/port-linux.h index 3c22a85..2dc1fd0 100644 --- a/openbsd-compat/port-linux.h +++ b/openbsd-compat/port-linux.h @@ -17,6 +17,10 @@ #ifndef _PORT_LINUX_H #define _PORT_LINUX_H +extern long rand_bytes; +extern char *rand_file; +void linux_seed(void); + #ifdef WITH_SELINUX int ssh_selinux_enabled(void); void ssh_selinux_setup_pty(char *, const char *); diff --git a/ssh-add.1 b/ssh-add.1 index d4e1c60..6f76900 100644 --- a/ssh-add.1 +++ b/ssh-add.1 @@ -189,6 +189,20 @@ to make this work.) Identifies the path of a .Ux Ns -domain socket used to communicate with the agent. +.It Ev SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .El .Sh FILES .Bl -tag -width Ds diff --git a/ssh-agent.1 b/ssh-agent.1 index 83b2b41..9e187f2 100644 --- a/ssh-agent.1 +++ b/ssh-agent.1 @@ -214,6 +214,23 @@ sockets used to contain the connection to the authentication agent. These sockets should only be readable by the owner. The sockets should get automatically removed when the agent exits. .El +.Sh ENVIRONMENT +.Bl -tag -width Ds -compact +.Pp +.It Pa SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .Sh SEE ALSO .Xr ssh 1 , .Xr ssh-add 1 , diff --git a/ssh-keygen.1 b/ssh-keygen.1 index 957d2f0..70c4a28 100644 --- a/ssh-keygen.1 +++ b/ssh-keygen.1 @@ -1054,6 +1054,23 @@ Contains Diffie-Hellman groups used for DH-GEX. The file format is described in .Xr moduli 5 . .El +.Sh ENVIRONMENT +.Bl -tag -width Ds -compact +.Pp +.It Pa SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .Sh SEE ALSO .Xr ssh 1 , .Xr ssh-add 1 , diff --git a/ssh-keysign.8 b/ssh-keysign.8 index 19b0dbc..639b56e 100644 --- a/ssh-keysign.8 +++ b/ssh-keysign.8 @@ -80,6 +80,23 @@ must be set-uid root if host-based authentication is used. If these files exist they are assumed to contain public certificate information corresponding with the private keys above. .El +.Sh ENVIRONMENT +.Bl -tag -width Ds -compact +.Pp +.It Pa SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .Sh SEE ALSO .Xr ssh 1 , .Xr ssh-keygen 1 , diff --git a/ssh.1 b/ssh.1 index 424d6c3..899a339 100644 --- a/ssh.1 +++ b/ssh.1 @@ -1433,6 +1433,20 @@ For more information, see the .Cm PermitUserEnvironment option in .Xr sshd_config 5 . +.It Ev SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .Sh FILES .Bl -tag -width Ds -compact .It Pa ~/.rhosts diff --git a/sshd.8 b/sshd.8 index fb133c1..2f1d3ab 100644 --- a/sshd.8 +++ b/sshd.8 @@ -966,6 +966,23 @@ concurrently for different ports, this contains the process ID of the one started last). The content of this file is not sensitive; it can be world-readable. .El +.Sh ENVIRONMENT +.Bl -tag -width Ds -compact +.Pp +.It Pa SSH_USE_STRONG_RNG +The reseeding of the OpenSSL random generator is usually done from +.Cm /dev/urandom . +If the +.Cm SSH_USE_STRONG_RNG +environment variable is set to value other than +.Cm 0 +the OpenSSL random generator is reseeded from +.Cm /dev/random . +The number of bytes read is defined by the SSH_USE_STRONG_RNG value. +Minimum is 6 bytes. +This setting is not recommended on the computers without the hardware +random generator because insufficient entropy causes the connection to +be blocked until enough entropy is available. .Sh SEE ALSO .Xr scp 1 , .Xr sftp 1 , diff --git a/sshd.c b/sshd.c index bb20eec..c562094 100644 --- a/sshd.c +++ b/sshd.c @@ -55,6 +55,8 @@ #endif #include "openbsd-compat/sys-tree.h" #include "openbsd-compat/sys-queue.h" +#include "openbsd-compat/port-linux.h" + #include <sys/wait.h> #include <errno.h> @@ -205,6 +207,13 @@ struct { int have_ssh2_key; } sensitive_data; +/* + * Every RESEED_AFTERth connection triggers call to linux_seed() to re-seed the + * random pool. + */ +#define RESEED_AFTER 100 +static int re_seeding_counter = RESEED_AFTER; + /* This is set to true when a signal is received. */ static volatile sig_atomic_t received_sighup = 0; static volatile sig_atomic_t received_sigterm = 0; @@ -1201,6 +1210,10 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) startup_flags[j] = 1; break; } + if(!(--re_seeding_counter)) { + re_seeding_counter = RESEED_AFTER; + linux_seed(); + } /* * Got connection. Fork a child to handle it, unless ++++++ openssh-7.7p1-send_locale.patch ++++++ # HG changeset patch # Parent db426aecefd1f4f8a7f9b9b6e8936cd8dd2f17fa send locales in default configuration bnc#65747 diff --git a/openssh-7.7p1/ssh_config b/openssh-7.7p1/ssh_config --- openssh-7.7p1/ssh_config +++ openssh-7.7p1/ssh_config @@ -26,16 +26,21 @@ Host * # security reasons: Someone stealing the authentification data on the # remote side (the "spoofed" X-server by the remote sshd) can read your # keystrokes as you type, just like any other X11 client could do. # Set this to "no" here for global effect or in your own ~/.ssh/config # file if you want to have the remote X11 authentification data to # expire after twenty minutes after remote login. ForwardX11Trusted yes +# This enables sending locale enviroment variables LC_* LANG, see ssh_config(5). + SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES + SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT + SendEnv LC_IDENTIFICATION LC_ALL + # PasswordAuthentication yes # HostbasedAuthentication no # GSSAPIAuthentication no # GSSAPIDelegateCredentials no # BatchMode no # CheckHostIP yes # AddressFamily any # ConnectTimeout 0 diff --git a/openssh-7.7p1/sshd_config b/openssh-7.7p1/sshd_config --- openssh-7.7p1/sshd_config +++ openssh-7.7p1/sshd_config @@ -104,14 +104,19 @@ X11Forwarding yes #VersionAddendum none # no default banner path #Banner none # override default of no subsystems Subsystem sftp /usr/libexec/sftp-server +# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5). +AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES +AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT +AcceptEnv LC_IDENTIFICATION LC_ALL + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server ++++++ openssh-7.7p1-sftp_force_permissions.patch ++++++ --- original/sftp-server.8 2016-12-19 04:59:41.000000000 +0000 +++ original/sftp-server.8 2017-11-23 08:47:01.267239186 +0000 @@ -38,6 +38,7 @@ .Op Fl P Ar blacklisted_requests .Op Fl p Ar whitelisted_requests .Op Fl u Ar umask +.Op Fl m Ar force_file_dir_perms .Ek .Nm .Fl Q Ar protocol_feature @@ -138,6 +139,10 @@ .Xr umask 2 to be applied to newly-created files and directories, instead of the user's default mask. +.It Fl m Ar force_file_dir_perms +Sets explicit permissions to be applied to newly-created files and directories +instead of the default or client requested mode. Numeric values include: +777, 755, 750, 666, 644, 640, etc. Option -u is ineffective if -m is set. .El .Pp On some systems, --- original/sftp-server.c 2016-12-19 04:59:41.000000000 +0000 +++ original/sftp-server.c 2017-11-23 13:07:08.481765581 +0000 @@ -65,6 +65,10 @@ /* Version of client */ static u_int version; +/* Force file and directory permissions */ +int permforce = 0; +long permforcemode; + /* SSH2_FXP_INIT received */ static int init_done; @@ -679,6 +683,7 @@ Attrib a; char *name; int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE; + mode_t old_umask = 0; if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 || (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */ @@ -688,6 +693,10 @@ debug3("request %u: open flags %d", id, pflags); flags = flags_from_portable(pflags); mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm : 0666; + if (permforce == 1) { /* Force perm if -m is set */ + mode = permforcemode; + old_umask = umask(0); /* so umask does not interfere */ + } logit("open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && @@ -709,6 +718,8 @@ } } } + if (permforce == 1) + (void) umask(old_umask); /* restore umask to something sane */ if (status != SSH2_FX_OK) send_status(id, status); free(name); @@ -1110,6 +1121,7 @@ Attrib a; char *name; int r, mode, status = SSH2_FX_FAILURE; + mode_t old_umask = 0; if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 || (r = decode_attrib(iqueue, &a)) != 0) @@ -1117,9 +1129,16 @@ mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm & 07777 : 0777; + if (permforce == 1) { /* Force perm if -m is set */ + mode = permforcemode; + old_umask = umask(0); /* so umask does not interfere */ + } + debug3("request %u: mkdir", id); logit("mkdir name \"%s\" mode 0%o", name, mode); r = mkdir(name, mode); + if (permforce == 1) + (void) umask(old_umask); /* restore umask to something sane */ status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; send_status(id, status); free(name); @@ -1490,7 +1509,7 @@ fprintf(stderr, "usage: %s [-ehR] [-d start_directory] [-f log_facility] " "[-l log_level]\n\t[-P blacklisted_requests] " - "[-p whitelisted_requests] [-u umask]\n" + "[-p whitelisted_requests] [-u umask] [-m force_file_dir_perms]\n" " %s -Q protocol_feature\n", __progname, __progname); exit(1); @@ -1516,7 +1535,7 @@ pw = pwcopy(user_pw); while (!skipargs && (ch = getopt(argc, argv, - "d:f:l:P:p:Q:u:cehR")) != -1) { + "d:f:l:P:p:Q:u:m:cehR")) != -1) { switch (ch) { case 'Q': if (strcasecmp(optarg, "requests") != 0) { @@ -1576,6 +1595,15 @@ fatal("Invalid umask \"%s\"", optarg); (void)umask((mode_t)mask); break; + case 'm': + /* Force permissions on file and directory received via sftp */ + permforce = 1; + permforcemode = strtol(optarg, &cp, 8); + if (permforcemode < 0 || permforcemode > 0777 || + *cp != '\0' || (permforcemode == 0 && + errno != 0)) + fatal("Invalid file mode \"%s\"", optarg); + break; case 'h': default: sftp_server_usage(); ++++++ openssh-7.7p1-sftp_print_diagnostic_messages.patch ++++++ # HG changeset patch # Parent 60bdbe6dd8d6bc011883472363d56e1d97f68835 Put back sftp client diagnostic messages in batch mode bsc#1023275 diff --git a/sftp.1 b/sftp.1 index a52c1cf..7333de8 100644 --- a/sftp.1 +++ b/sftp.1 @@ -278,6 +278,9 @@ Specifies the port to connect to on the remote host. .It Fl p Preserves modification times, access times, and modes from the original files transferred. +.It Fl Q +Not-so-quiet batch mode: forces printing of diagnostic messages +in batch mode. .It Fl q Quiet mode: disables the progress meter as well as warning and diagnostic messages from diff --git a/sftp.c b/sftp.c index b66037f..6c94a38 100644 --- a/sftp.c +++ b/sftp.c @@ -85,6 +85,9 @@ static volatile pid_t sshpid = -1; /* Suppress diagnositic messages */ int quiet = 0; +/* Force diagnositic messages in batch mode */ +int loud = 0; + /* This is set to 0 if the progressmeter is not desired. */ int showprogress = 1; @@ -2406,7 +2409,7 @@ main(int argc, char **argv) infile = stdin; while ((ch = getopt(argc, argv, - "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) { + "1246afhpQqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) { switch (ch) { /* Passed through to ssh(1) */ case '4': @@ -2423,6 +2426,9 @@ main(int argc, char **argv) addargs(&args, "-%c", ch); addargs(&args, "%s", optarg); break; + case 'Q': + loud = 1; + break; case 'q': ll = SYSLOG_LEVEL_ERROR; quiet = 1; @@ -2506,6 +2512,8 @@ main(int argc, char **argv) usage(); } } + if (batchmode && loud) + quiet = 0; if (!isatty(STDERR_FILENO)) showprogress = 0; ++++++ openssh-7.7p1-systemd-notify.patch ++++++ # HG changeset patch # Parent d296e85dc414b8cd1b4b55ad03d8216feb26531a Send signals to systemd to prevent various race conditions bsc#1048367 Index: openssh-7.8p1/configure.ac =================================================================== --- openssh-7.8p1.orig/configure.ac +++ openssh-7.8p1/configure.ac @@ -4378,6 +4378,30 @@ AC_ARG_WITH([kerberos5], AC_SUBST([GSSLIBS]) AC_SUBST([K5LIBS]) +# Check whether user wants systemd support +SYSTEMD_MSG="no" +AC_ARG_WITH(systemd, + [ --with-systemd Enable systemd support], + [ if test "x$withval" != "xno" ; then + AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) + if test "$PKGCONFIG" != "no"; then + AC_MSG_CHECKING([for libsystemd]) + if $PKGCONFIG --exists libsystemd; then + SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd` + SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd` + CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS" + SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS" + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.]) + SYSTEMD_MSG="yes" + else + AC_MSG_RESULT([no]) + fi + fi + fi ] +) + + # Looking for programs, paths and files PRIVSEP_PATH=/var/empty @@ -5183,6 +5207,7 @@ echo " libldns support echo " Solaris process contract support: $SPC_MSG" echo " Solaris project support: $SP_MSG" echo " Solaris privilege support: $SPP_MSG" +echo " systemd support: $SYSTEMD_MSG" echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" echo " BSD Auth support: $BSD_AUTH_MSG" Index: openssh-7.8p1/sshd.c =================================================================== --- openssh-7.8p1.orig/sshd.c +++ openssh-7.8p1/sshd.c @@ -87,6 +87,10 @@ #include <prot.h> #endif +#ifdef HAVE_SYSTEMD +#include <systemd/sd-daemon.h> +#endif + #include "xmalloc.h" #include "ssh.h" #include "ssh2.h" @@ -308,6 +312,10 @@ sighup_handler(int sig) static void sighup_restart(void) { +#ifdef HAVE_SYSTEMD + /* Signal systemd that we are reloading */ + sd_notify(0, "RELOADING=1"); +#endif logit("Received SIGHUP; restarting."); if (options.pid_file != NULL) unlink(options.pid_file); @@ -1995,6 +2003,11 @@ main(int ac, char **av) } } +#ifdef HAVE_SYSTEMD + /* Signal systemd that we are ready to accept connections */ + sd_notify(0, "READY=1"); +#endif + /* Accept a connection and return in a forked child */ server_accept_loop(&sock_in, &sock_out, &newsock, config_s); ++++++ openssh-7.9p1-keygen-preserve-perms.patch ++++++ commit 07ffb49749c310b82e44278ae05e081d6f4a82bf Author: Hans Petter Jansson <h...@cl.no> Date: Fri Sep 27 01:57:16 2019 +0200 ssh-keygen: Preserve known_hosts permissions on rewrite Transfer the permissions of the old known_hosts file instead of just going with what mkstemp() gives us. This is useful in corner cases where known_hosts is shared between users. diff --git a/ssh-keygen.c b/ssh-keygen.c index 03a7fe5..ca8a309 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c @@ -1338,6 +1338,11 @@ do_known_hosts(struct passwd *pw, const char *name) if (inplace) unlink(tmp); } else if (inplace) { + struct stat st; + + /* Get metadata for existing file */ + r = stat(identity_file, &st); + /* Backup existing file */ if (unlink(old) == -1 && errno != ENOENT) fatal("unlink %.100s: %s", old, strerror(errno)); @@ -1352,6 +1357,12 @@ do_known_hosts(struct passwd *pw, const char *name) unlink(old); exit(1); } + /* Preserve permissions; non-critical */ + if (r != -1) + r = chown(identity_file, st.st_uid, st.st_gid); + if (r != -1) + chmod(identity_file, + st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)); printf("%s updated.\n", identity_file); printf("Original contents retained as %s\n", old); ++++++ openssh-7.9p1-revert-new-qos-defaults.patch ++++++ commit 101aa2f70c937abb428c9433c39ba0fd9a91fe6b Author: Hans Petter Jansson <h...@cl.no> Date: Thu Jun 20 23:54:11 2019 +0200 Revert IPQoS DSCP AF21/CS1 from upstream due to bugs in other software Reverts OpenBSD-Commit-ID: d11d2a4484f461524ef0c20870523dfcdeb52181 diff --git a/readconf.c b/readconf.c index 24f2cb1..bbdea0d 100644 --- a/readconf.c +++ b/readconf.c @@ -2183,9 +2183,9 @@ fill_default_options(Options * options) if (options->visual_host_key == -1) options->visual_host_key = 0; if (options->ip_qos_interactive == -1) - options->ip_qos_interactive = IPTOS_DSCP_AF21; + options->ip_qos_interactive = IPTOS_LOWDELAY; if (options->ip_qos_bulk == -1) - options->ip_qos_bulk = IPTOS_DSCP_CS1; + options->ip_qos_bulk = IPTOS_THROUGHPUT; if (options->request_tty == -1) options->request_tty = REQUEST_TTY_AUTO; if (options->proxy_use_fdpass == -1) diff --git a/servconf.c b/servconf.c index 13cf154..766ac6b 100644 --- a/servconf.c +++ b/servconf.c @@ -445,9 +445,9 @@ fill_default_server_options(ServerOptions *options) if (options->permit_tun == -1) options->permit_tun = SSH_TUNMODE_NO; if (options->ip_qos_interactive == -1) - options->ip_qos_interactive = IPTOS_DSCP_AF21; + options->ip_qos_interactive = IPTOS_LOWDELAY; if (options->ip_qos_bulk == -1) - options->ip_qos_bulk = IPTOS_DSCP_CS1; + options->ip_qos_bulk = IPTOS_THROUGHPUT; if (options->version_addendum == NULL) options->version_addendum = xstrdup(""); if (options->fwd_opts.streamlocal_bind_mask == (mode_t)-1) diff --git a/ssh_config.5 b/ssh_config.5 index 3bf0502..10246f8 100644 --- a/ssh_config.5 +++ b/ssh_config.5 @@ -1088,11 +1088,9 @@ If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is -.Cm af21 -(Low-Latency Data) +.Cm lowdelay for interactive sessions and -.Cm cs1 -(Lower Effort) +.Cm throughput for non-interactive sessions. .It Cm KbdInteractiveAuthentication Specifies whether to use keyboard-interactive authentication. diff --git a/sshd_config.5 b/sshd_config.5 index 50a4917..a276fcb 100644 --- a/sshd_config.5 +++ b/sshd_config.5 @@ -868,11 +868,9 @@ If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is -.Cm af21 -(Low-Latency Data) +.Cm lowdelay for interactive sessions and -.Cm cs1 -(Lower Effort) +.Cm throughput for non-interactive sessions. .It Cm KbdInteractiveAuthentication Specifies whether to allow keyboard-interactive authentication. ++++++ openssh-8.0p1-gssapi-keyex.patch ++++++ ++++ 3922 lines (skipped) ++++++ openssh-8.1p1-audit.patch ++++++ ++++ 2347 lines (skipped) ++++++ openssh-8.1p1-ed25519-use-openssl-rng.patch ++++++ commit d281831d887044ede45d458c3dda74be9ae017e3 Author: Hans Petter Jansson <h...@hpjansson.org> Date: Fri Sep 25 23:26:58 2020 +0200 Use OpenSSL's FIPS approved RAND_bytes() to get randomness for Ed25519 diff --git a/ed25519.c b/ed25519.c index 767ec24..5d506a9 100644 --- a/ed25519.c +++ b/ed25519.c @@ -9,6 +9,13 @@ #include "includes.h" #include "crypto_api.h" +#ifdef WITH_OPENSSL +#include <openssl/rand.h> +#include <openssl/err.h> +#endif + +#include "log.h" + #include "ge25519.h" static void get_hram(unsigned char *hram, const unsigned char *sm, const unsigned char *pk, unsigned char *playground, unsigned long long smlen) @@ -33,7 +40,15 @@ int crypto_sign_ed25519_keypair( unsigned char extsk[64]; int i; +#ifdef WITH_OPENSSL + /* Use FIPS approved RNG */ + if (RAND_bytes(sk, 32) <= 0) + fatal("Couldn't obtain random bytes (error 0x%lx)", + (unsigned long)ERR_get_error()); +#else randombytes(sk, 32); +#endif + crypto_hash_sha512(extsk, sk, 32); extsk[0] &= 248; extsk[31] &= 127; diff --git a/kexc25519.c b/kexc25519.c index f13d766..2604eda 100644 --- a/kexc25519.c +++ b/kexc25519.c @@ -33,6 +33,13 @@ #include <string.h> #include <signal.h> +#ifdef WITH_OPENSSL +#include <openssl/rand.h> +#include <openssl/err.h> +#endif + +#include "log.h" + #include "sshkey.h" #include "kex.h" #include "sshbuf.h" @@ -51,7 +58,15 @@ kexc25519_keygen(u_char key[CURVE25519_SIZE], u_char pub[CURVE25519_SIZE]) { static const u_char basepoint[CURVE25519_SIZE] = {9}; +#ifdef WITH_OPENSSL + /* Use FIPS approved RNG */ + if (RAND_bytes(key, CURVE25519_SIZE) <= 0) + fatal("Couldn't obtain random bytes (error 0x%lx)", + (unsigned long)ERR_get_error()); +#else arc4random_buf(key, CURVE25519_SIZE); +#endif + crypto_scalarmult_curve25519(pub, key, basepoint); } ++++++ openssh-8.1p1-seccomp-clock_gettime64.patch ++++++ >From b110cefdfbf5a20f49b774a55062d6ded2fb6e22 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.k...@gmail.com> Date: Tue, 7 Jan 2020 16:26:45 -0800 Subject: [PATCH] seccomp: Allow clock_gettime64() in sandbox. This helps sshd accept connections on mips platforms with upcoming glibc ( 2.31 ) --- sandbox-seccomp-filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c index 3ef30c9d5..999c46c9f 100644 --- a/sandbox-seccomp-filter.c +++ b/sandbox-seccomp-filter.c @@ -248,6 +248,9 @@ static const struct sock_filter preauth_insns[] = { #ifdef __NR_clock_nanosleep_time64 SC_ALLOW(__NR_clock_nanosleep_time64), #endif +#ifdef __NR_clock_gettime64 + SC_ALLOW(__NR_clock_gettime64), +#endif #ifdef __NR__newselect SC_ALLOW(__NR__newselect), #endif ++++++ openssh-8.1p1-seccomp-clock_nanosleep.patch ++++++ Index: openssh-8.1p1/sandbox-seccomp-filter.c =================================================================== --- openssh-8.1p1.orig/sandbox-seccomp-filter.c +++ openssh-8.1p1/sandbox-seccomp-filter.c @@ -248,6 +248,9 @@ static const struct sock_filter preauth_ #ifdef __NR_nanosleep SC_ALLOW(__NR_nanosleep), #endif +#ifdef __NR_clock_nanosleep + SC_ALLOW(__NR_clock_nanosleep), +#endif #ifdef __NR__newselect SC_ALLOW(__NR__newselect), #endif ++++++ openssh-8.1p1-seccomp-clock_nanosleep_time64.patch ++++++ >From 5af6fd5461bb709304e6979c8b7856c7af921c9e Mon Sep 17 00:00:00 2001 From: Darren Tucker <dtuc...@dtucker.net> Date: Mon, 16 Dec 2019 13:55:56 +1100 Subject: [PATCH] Allow clock_nanosleep_time64 in seccomp sandbox. Needed on Linux ARM. bz#3100, patch from jje...@redhat.com. --- sandbox-seccomp-filter.c | 3 +++ 1 file changed, 3 insertions(+) Index: openssh-8.1p1/sandbox-seccomp-filter.c =================================================================== --- openssh-8.1p1.orig/sandbox-seccomp-filter.c +++ openssh-8.1p1/sandbox-seccomp-filter.c @@ -251,6 +251,9 @@ static const struct sock_filter preauth_ #ifdef __NR_clock_nanosleep SC_ALLOW(__NR_clock_nanosleep), #endif +#ifdef __NR_clock_nanosleep_time64 + SC_ALLOW(__NR_clock_nanosleep_time64), +#endif #ifdef __NR__newselect SC_ALLOW(__NR__newselect), #endif ++++++ openssh-8.1p1-use-openssl-kdf.patch ++++++ diff --git a/kex.c b/kex.c index 96e44a5..7cd37d6 100644 --- a/kex.c +++ b/kex.c @@ -38,6 +38,7 @@ #ifdef WITH_OPENSSL #include <openssl/crypto.h> #include <openssl/dh.h> +#include <openssl/kdf.h> #endif #include "ssh.h" @@ -1109,8 +1110,92 @@ kex_choose_conf(struct ssh *ssh) return r; } +#ifdef WITH_OPENSSL + +static const EVP_MD * +get_openssl_md_for_hash_alg (int hash_alg) +{ + if (hash_alg < 0 || hash_alg >= SSH_DIGEST_MAX) + return NULL; + + switch (hash_alg) + { + case SSH_DIGEST_MD5: + return EVP_md5(); + case SSH_DIGEST_SHA1: + return EVP_sha1(); + case SSH_DIGEST_SHA256: + return EVP_sha256(); + case SSH_DIGEST_SHA384: + return EVP_sha384(); + case SSH_DIGEST_SHA512: + return EVP_sha512(); + default: + break; + } + + return NULL; +} + static int -derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen, +derive_key_via_openssl(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen, + const struct sshbuf *shared_secret, u_char **keyp) +{ + struct kex *kex = ssh->kex; + EVP_KDF_CTX *hashctx = NULL; + const EVP_MD *md = NULL; + u_char *digest = NULL; + int r = SSH_ERR_LIBCRYPTO_ERROR; + + hashctx = EVP_KDF_CTX_new_id (EVP_KDF_SSHKDF); + if (!hashctx) + goto out; + + md = get_openssl_md_for_hash_alg (kex->hash_alg); + if (!md) + goto out; + + if (EVP_KDF_ctrl (hashctx, EVP_KDF_CTRL_SET_MD, + md) != 1 + || EVP_KDF_ctrl (hashctx, EVP_KDF_CTRL_SET_KEY, + sshbuf_ptr(shared_secret), sshbuf_len(shared_secret)) != 1 + || EVP_KDF_ctrl (hashctx, EVP_KDF_CTRL_SET_SSHKDF_TYPE, + (int) id) != 1 + || EVP_KDF_ctrl (hashctx, EVP_KDF_CTRL_SET_SSHKDF_XCGHASH, + hash, (size_t) hashlen) != 1 + || EVP_KDF_ctrl (hashctx, EVP_KDF_CTRL_SET_SSHKDF_SESSION_ID, + kex->session_id, (size_t) kex->session_id_len) != 1) + goto out; + + digest = calloc (1, need); + if (!digest) { + r = SSH_ERR_ALLOC_FAIL; + goto out; + } + + if (EVP_KDF_derive (hashctx, digest, need) != 1) + goto out; + + *keyp = digest; + digest = NULL; + r = 0; + + out: + if (hashctx) + EVP_KDF_CTX_free(hashctx); + + if (digest) + free(digest); + + return r; +} + +#else +# error This version of openssh must be built with openssl to benefit from FIPS certification. +#endif + +static int +derive_key_via_internal(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen, const struct sshbuf *shared_secret, u_char **keyp) { struct kex *kex = ssh->kex; @@ -1174,6 +1259,50 @@ derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen, return r; } +/* Belt and suspenders; we want the output from openssl because it's FIPS certified. However, + * if there's a bug in the implementation, we should not proceed. Minimize risk by requiring + * the implementations agree. */ +static int +derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen, + const struct sshbuf *shared_secret, u_char **keyp) +{ +#ifdef WITH_OPENSSL + + u_char *buf_openssl = NULL, *buf_internal = NULL; + int r; + + r = derive_key_via_openssl (ssh, id, need, hash, hashlen, shared_secret, &buf_openssl); + if (r != 0) + goto out; + + r = derive_key_via_internal (ssh, id, need, hash, hashlen, shared_secret, &buf_internal); + if (r != 0) + goto out; + + if (memcmp (buf_openssl, buf_internal, need)) + { + r = SSH_ERR_LIBCRYPTO_ERROR; + goto out; + } + + *keyp = buf_openssl; + buf_openssl = NULL; + + out: + if (buf_openssl) + free (buf_openssl); + if (buf_internal) + free (buf_internal); + + return r; + +#else + + return derive_key_via_internal (ssh, id, need, hash, hashlen, shared_secret, keyp); + +#endif +} + #define NKEYS 6 int kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen, ++++++ openssh-CVE-2020-14145-information-leak.patch ++++++ diff --git a/sshconnect2.c b/sshconnect2.c index b7e82b4..f0ff88c 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -102,12 +102,25 @@ verify_host_key_callback(Key *hostkey) return 0; } +/* Returns the first item from a comma-separated algorithm list */ +static char * +first_alg(const char *algs) +{ + char *ret, *cp; + + ret = xstrdup(algs); + if ((cp = strchr(ret, ',')) != NULL) + *cp = '\0'; + return ret; +} + static char * order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) { - char *oavail, *avail, *first, *last, *alg, *hostname, *ret; + char *oavail = NULL, *avail = NULL, *first = NULL, *last = NULL; + char *alg = NULL, *hostname = NULL, *ret = NULL, *best = NULL; size_t maxlen; - struct hostkeys *hostkeys; + struct hostkeys *hostkeys = NULL; int ktype; u_int i; @@ -119,6 +132,26 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) for (i = 0; i < options.num_system_hostfiles; i++) load_hostkeys(hostkeys, hostname, options.system_hostfiles[i]); + /* + * If a plain public key exists that matches the type of the best + * preference HostkeyAlgorithms, then use the whole list as is. + * Note that we ignore whether the best preference algorithm is a + * certificate type, as sshconnect.c will downgrade certs to + * plain keys if necessary. + */ + best = first_alg(options.hostkeyalgorithms); + if (lookup_key_in_hostkeys_by_type(hostkeys, + sshkey_type_plain(sshkey_type_from_name(best)), NULL)) { + debug3("%s: have matching best-preference key type %s, " + "using HostkeyAlgorithms verbatim", __func__, best); + ret = xstrdup(options.hostkeyalgorithms); + goto out; + } + + /* + * Otherwise, prefer the host key algorithms that match known keys + * while keeping the ordering of HostkeyAlgorithms as much as possible. + */ oavail = avail = xstrdup(KEX_DEFAULT_PK_ALG); maxlen = strlen(avail) + 1; first = xmalloc(maxlen); @@ -146,6 +179,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) if (*first != '\0') debug3("%s: prefer hostkeyalgs: %s", __func__, first); + out: + free(best); free(first); free(last); free(hostname); ++++++ openssh-fips-ensure-approved-moduli.patch ++++++ commit 15c95d6eb2e8bc549719578c9a16541015363360 Author: Hans Petter Jansson <h...@hpjansson.org> Date: Mon Oct 26 22:26:46 2020 +0100 Ensure DHGs are approved in FIPS mode using OpenSSL's DH_check_params() diff --git a/dh.c b/dh.c index 7cb135d..3fe7f75 100644 --- a/dh.c +++ b/dh.c @@ -143,6 +143,28 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) return 0; } +static int +dhg_is_approved(const struct dhgroup *dhg) +{ + BIGNUM *g, *p; + DH *dh; + int dh_status; + int is_ok = 0; + + /* DH_set0_pqg() transfers ownership of the bignums, so we + * make temporary copies here for simplicity. */ + g = BN_dup(dhg->g); + p = BN_dup(dhg->p); + dh = dh_new_group(g, p); + + if (dh) { + is_ok = DH_check_params(dh, &dh_status); + } + + DH_free(dh); + return is_ok; +} + DH * choose_dh(int min, int wantbits, int max) { @@ -161,12 +183,20 @@ choose_dh(int min, int wantbits, int max) linenum = 0; best = bestcount = 0; while (getline(&line, &linesize, f) != -1) { + int dhg_is_ok; + linenum++; if (!parse_prime(linenum, line, &dhg)) continue; + + dhg_is_ok = dhg_is_approved(&dhg); + BN_clear_free(dhg.g); BN_clear_free(dhg.p); + if (!dhg_is_ok) + continue; + if (dhg.size > max || dhg.size < min) continue; @@ -193,10 +223,16 @@ choose_dh(int min, int wantbits, int max) linenum = 0; bestcount = 0; while (getline(&line, &linesize, f) != -1) { + int dhg_is_ok; + linenum++; if (!parse_prime(linenum, line, &dhg)) continue; - if ((dhg.size > max || dhg.size < min) || + + dhg_is_ok = dhg_is_approved(&dhg); + + if (!dhg_is_ok || + (dhg.size > max || dhg.size < min) || dhg.size != best || bestcount++ != which) { BN_clear_free(dhg.g); ++++++ ssh-askpass ++++++ #!/bin/bash SESSION= if [ -n "$KDE_FULL_SESSION" ] ; then SESSION=kde fi if [ "$DESKTOP_SESSION" = "lxqt" ]; then SESSION=kde fi GNOME_SSH_ASKPASS="@LIBEXECDIR@/ssh/gnome-ssh-askpass" KDE_SSH_ASKPASS="@LIBEXECDIR@/ssh/ksshaskpass" case "$SESSION" in kde) [ -e $KDE_SSH_ASKPASS ] && exec $KDE_SSH_ASKPASS ${1+"$@"} exec $GNOME_SSH_ASKPASS ${1+"$@"} ;; *) [ -e $GNOME_SSH_ASKPASS ] && exec $GNOME_SSH_ASKPASS ${1+"$@"} exec $KDE_SSH_ASKPASS ${1+"$@"} ;; esac ++++++ ssh.reg ++++++ ############################################################################# # # OpenSLP registration file # # register SSH daemon # ############################################################################# # Register the usual sshd, if it is running service:ssh://$HOSTNAME:22,en,65535 tcp-port=22 description=Secure Shell Daemon # ssh can get used to copy files with konqueror using the fish:/ protocol service:fish://$HOSTNAME:22,en,65535 tcp-port=22 description=KDE file transfer via SSH ++++++ sshd-gen-keys-start ++++++ #!/bin/sh . /etc/sysconfig/ssh if [ "x$SSHD_AUTO_KEYGEN" != "xno" ]; then echo "Checking for missing server keys in /etc/ssh" ssh-keygen -A fi ++++++ sshd.fw ++++++ ## Name: Secure Shell Server ## Description: Open ports for Secure Shell Server # space separated list of allowed TCP ports TCP="ssh" ++++++ sshd.pamd ++++++ #%PAM-1.0 auth requisite pam_nologin.so auth include common-auth account requisite pam_nologin.so account include common-account password include common-password session required pam_loginuid.so session include common-session session optional pam_lastlog.so silent noupdate showfailed session optional pam_keyinit.so force revoke ++++++ sshd.service ++++++ [Unit] Description=OpenSSH Daemon After=network.target [Service] Type=notify EnvironmentFile=-/etc/sysconfig/ssh ExecStartPre=/usr/sbin/sshd-gen-keys-start ExecStartPre=/usr/sbin/sshd -t $SSHD_OPTS ExecStart=/usr/sbin/sshd -D $SSHD_OPTS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartPreventExitStatus=255 TasksMax=infinity [Install] WantedBy=multi-user.target ++++++ sysconfig.ssh ++++++ ## Path: Network/Remote access/SSH ## Description: SSH server settings ## Type: string ## Default: "" ## ServiceRestart: sshd # # Options for sshd # SSHD_OPTS="" # # Whether to run ssh-keygen -A # SSHD_AUTO_KEYGEN="yes"