From patchwork Mon Jan 20 20:04:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 2711 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 481jLm1NFhz3xY8 for ; Mon, 20 Jan 2020 20:04:48 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 481jLl00pJz2Qb; Mon, 20 Jan 2020 20:04:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 481jLk5dgMz2yHm; Mon, 20 Jan 2020 20:04:46 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 481jLk1FWwz2xn4 for ; Mon, 20 Jan 2020 20:04:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 481jLj01NWz2Qb for ; Mon, 20 Jan 2020 20:04:44 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1579550685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ilBRgZ9XvfqlBcQhhxMnxcW5b8X24aDLgeWLyBrWD3c=; b=uhlBNUNuKbLwDbeisWgCCcP5ZTwt01NdLE+CFuJPeqS3bjJ6k9SyiPhh3prYNKZMETz5O5 iJiSYmvzp7yHBQAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1579550685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ilBRgZ9XvfqlBcQhhxMnxcW5b8X24aDLgeWLyBrWD3c=; b=kqwCF835ZUNSBolyjZsSocTn1gyyhWJo+jwc/fjWB7wAwD2bj2JS4XGxvxjRhLEEgCAnv6 SmMeqkm2mj42yGQZgjlzT4oQWOc4Si8cSpKx/ce57UJ8e6mkQcgjHuXMzSbFvzOcUlnHo8 An0tTOOhWe6EnLuhD0hUW56mn0VFxXKwQj84OCYG1yoLVxOvArF5Vka0Yhf8RE71HBUviY FBYqJdxiCCNnxbh3TstSHLvmRmqETtNMWpvVLCygRas2d4mlJQHoBGHNZQKShbzqAizz7M vUuosNHxx+l7bEW8GFnNguKwronqrbLGpPHMrKux28zvn0aCC/5zRoaFipZ/uw== To: "IPFire: Development-List" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH 1/2] sshd_config: Do not set defaults explicitly Message-ID: <0026bf7c-a550-0df8-8ee9-ac181047055e@ipfire.org> Date: Mon, 20 Jan 2020 20:04:00 +0000 MIME-Version: 1.0 Content-Language: en-US Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=pmueller smtp.mailfrom=peter.mueller@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" In order to keep configurations as small as possible and to make them easier to read/audit, this patch omits all default configuration in the OpenSSH server configuration file. Further, it mentions where to refer for the full documentation. Signed-off-by: Peter Müller Reviewed-by: Michael Tremer --- config/ssh/sshd_config | 62 ++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/config/ssh/sshd_config b/config/ssh/sshd_config index a248c4906..bea5cee53 100644 --- a/config/ssh/sshd_config +++ b/config/ssh/sshd_config @@ -1,81 +1,59 @@ -# ultra-secure OpenSSH server configuration +# OpenSSH server configuration file for IPFire +# +# The full documentation is available at: https://man.openbsd.org/sshd_config +# -# only allow version 2 of SSH protocol +# Only allow version 2 of SSH protocol Protocol 2 -# listen on port 22 by default +# Listen on port 22 by default Port 22 -# listen on these interfaces and protocols -AddressFamily any +# Listen on every interface and IPv4 only +AddressFamily inet ListenAddress 0.0.0.0 -# limit authentication thresholds +# Limit authentication timeout to 30 seconds LoginGraceTime 30s -MaxAuthTries 6 -# limit maximum instanctes to prevent DoS +# Limit maximum instanctes to prevent DoS MaxStartups 5 -# ensure proper logging -SyslogFacility AUTH -LogLevel INFO - -# enforce permission checks before a login is accepted -# (prevents damage because of hacked systems with world-writeable -# home directories or similar) -StrictModes yes - -# only allow safe crypto algorithms (may break some _very_ outdated clients) -# see also: https://stribika.github.io/2015/01/04/secure-secure-shell.html +# Only allow safe crypto algorithms (may break some _very_ outdated clients) +# See also: https://stribika.github.io/2015/01/04/secure-secure-shell.html KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256 Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com -# enable data compression after successful login only -Compression delayed - -# only allow cryptographically safe SSH host keys (adjust paths if needed) +# Only allow cryptographically safe SSH host keys (adjust paths if needed) HostKey /etc/ssh/ssh_host_ed25519_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_rsa_key -# only allow login via public key by default +# Only allow login via public key by default PubkeyAuthentication yes PasswordAuthentication no ChallengeResponseAuthentication no -PermitEmptyPasswords no -# permit root login as there is no other user in IPFire 2.x +# Permit root login as there is no other user in IPFire 2.x PermitRootLogin yes -# ignore user ~/.rhost* files -IgnoreRhosts yes - -# ignore user known hosts file +# Ignore user ~/.ssh/known_hosts file IgnoreUserKnownHosts yes -# ignore user environments -PermitUserEnvironment no - -# do not allow any kind of forwarding (provides only low security) +# Do not allow any kind of forwarding (provides only low security); # some of them might need to be re-enabled if SSH server is a jump platform -X11Forwarding no AllowTcpForwarding no AllowAgentForwarding no -PermitTunnel no -GatewayPorts no PermitOpen none -# detect broken sessions by sending keep-alive messages to -# clients (both via TCP and SSH) -TCPKeepAlive yes +# Detect broken sessions by sending keep-alive messages to clients via SSH connection ClientAliveInterval 10 -# close unresponsive SSH sessions which fail to answer keep-alive +# Close unresponsive SSH sessions which fail to answer keep-alive ClientAliveCountMax 6 -# add support for SFTP +# Add support for SFTP Subsystem sftp /usr/lib/openssh/sftp-server # EOF From patchwork Mon Jan 20 20:05:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 2712 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 481jMR3lQqz3xY8 for ; Mon, 20 Jan 2020 20:05:23 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 481jMR1V74z4W9; Mon, 20 Jan 2020 20:05:23 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 481jMR0mjTz2yMx; Mon, 20 Jan 2020 20:05:23 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 481jMQ11hlz2xn4 for ; Mon, 20 Jan 2020 20:05:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 481jMP1y6nz2lQ for ; Mon, 20 Jan 2020 20:05:21 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1579550721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aJkmX4isLcshA3psZ7rDJ5ZVaTesPhawBQCZypxnZZU=; b=3/HPLgCq0WZqMuh1NGEnpX0Dfi/B50yJ5GloTlqn9i/bAYFyPhvXY7ZU0lDZOTnqX7V2he JyKFVfgLldSQhuDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1579550721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aJkmX4isLcshA3psZ7rDJ5ZVaTesPhawBQCZypxnZZU=; b=b60SWl6a0anMCl60NP2maKFoi5tGzR9KtYmoRCDkkYjT8HhGDICiKL2R1qoXZFUIW2qArb TkqeziURrzr9WywlM7tD+wjbLtwTjpanyvZLdTUNSGMnAT56o+QPId8yP0kpwqJfn5gSGH YIm7BhJ8p6xgGtla7jdluhxUx1rZEEMaAwii404UuHF7AIBZoFNLqPP/G3ftsTjRWhNNJj qeBJaDGNwH0z4R0yo9uyxULiovizpL8OQBWGosz0b41iO99Mbw78HSp0X04hrlprjIjz/i bK+2kmfI5bexIoMz+CcbaJI7ELqve6GQv3kecaBri9/JE/nRUjJ1vbkPQjzcLQ== Subject: [PATCH 2/2] ssh_config: Do not set defaults explicitly From: =?utf-8?q?Peter_M=C3=BCller?= To: "IPFire: Development-List" References: <0026bf7c-a550-0df8-8ee9-ac181047055e@ipfire.org> Message-ID: <6a71a56c-7894-adf3-23db-c8ede6bd41eb@ipfire.org> Date: Mon, 20 Jan 2020 20:05:00 +0000 MIME-Version: 1.0 In-Reply-To: <0026bf7c-a550-0df8-8ee9-ac181047055e@ipfire.org> Content-Language: en-US Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=pmueller smtp.mailfrom=peter.mueller@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Peter Müller Reviewed-by: Michael Tremer --- config/ssh/ssh_config | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/config/ssh/ssh_config b/config/ssh/ssh_config index 2abfae6d1..2e2ee60c3 100644 --- a/config/ssh/ssh_config +++ b/config/ssh/ssh_config @@ -1,33 +1,32 @@ -# OpenSSH client configuration +# OpenSSH client configuration file for IPFire # -# set some basic hardening options for all connections +# The full documentation is available at: https://man.openbsd.org/ssh_config +# + +# Set some basic hardening options for all connections Host * - # disable Roaming as it is known to be vulnerable + # Disable Roaming as it is known to be vulnerable UseRoaming no - # only use secure crypto algorithm + # Only use secure crypto algorithms KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256 Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com - # always visualise server host keys (has no technical - # effect, but helps to identify key based MITM attacks) + # Always visualise server host keys (but helps to identify key based MITM attacks) VisualHostKey yes - # use SSHFP (might work on some up-to-date networks) to look up host keys + # Use SSHFP (might work on some up-to-date networks) to look up host keys VerifyHostKeyDNS yes # send keep-alive messages to connected server to avoid broken connections ServerAliveInterval 10 ServerAliveCountMax 6 - # disable X11 forwarding (security risk) - ForwardX11 no - - # always check server IP address - CheckHostIP yes - - # ensure only allowed authentication methods are used + # Ensure only allowed authentication methods are used PreferredAuthentications publickey,keyboard-interactive,password + # Prevent information leak by hashing ~/.ssh/known_hosts + HashKnownHosts yes + # EOF