aboutsummaryrefslogtreecommitdiff
path: root/content/blog/2023-10-15-alpine-ssh-hardening.org
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2024-04-27 17:01:13 -0500
committerChristian Cleberg <[email protected]>2024-04-27 17:01:13 -0500
commit63a5afda03daefb45e061a055685335207f21b60 (patch)
treed5193997d72a52f7a6d6338ea5da8a6c80b4eddc /content/blog/2023-10-15-alpine-ssh-hardening.org
parenteac7b5d0841f62d4cf1dc81f0fed3f207316bca0 (diff)
downloadcleberg.net-63a5afda03daefb45e061a055685335207f21b60.tar.gz
cleberg.net-63a5afda03daefb45e061a055685335207f21b60.tar.bz2
cleberg.net-63a5afda03daefb45e061a055685335207f21b60.zip
test conversion back to markdown
Diffstat (limited to 'content/blog/2023-10-15-alpine-ssh-hardening.org')
-rw-r--r--content/blog/2023-10-15-alpine-ssh-hardening.org71
1 files changed, 0 insertions, 71 deletions
diff --git a/content/blog/2023-10-15-alpine-ssh-hardening.org b/content/blog/2023-10-15-alpine-ssh-hardening.org
deleted file mode 100644
index 4e7fcc5..0000000
--- a/content/blog/2023-10-15-alpine-ssh-hardening.org
+++ /dev/null
@@ -1,71 +0,0 @@
-#+title: SSH Hardening for Alpine Linux
-#+date: 2023-10-15
-#+description: A quick guide to harden SSH configuration on Alpine.
-#+filetags: :linux:
-
-* Overview
-This guide follows the standard
-[[https://www.ssh-audit.com/hardening_guides.html][ssh-audit]] hardening
-guide, tweaked for Alpine Linux.
-
-* Hardening Guide
-These steps must be performed as root. You can try to use =doas= or
-=sudo=, but there may be issues.
-
-1. Re-generate the RSA and ED25519 keys
-
-#+begin_src sh
-rm /etc/ssh/ssh_host_*
-ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
-ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
-#+end_src
-
-2. [@2] Remove small Diffie-Hellman moduli
-
-#+begin_src sh
-awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
-mv /etc/ssh/moduli.safe /etc/ssh/moduli
-#+end_src
-
-3. [@3] Enable the RSA and ED25519 HostKey directives in the
- /etc/ssh/sshd_{config} file
-
-#+begin_src sh
-sed -i 's/^\#HostKey \/etc\/ssh\/ssh_host_\(rsa\|ed25519\)_key$/HostKey \/etc\/ssh\/ssh_host_\1_key/g' /etc/ssh/sshd_config
-#+end_src
-
-4. [@4] Restrict supported key exchange, cipher, and MAC algorithms
-
-#+begin_src sh
-echo -e "\n# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com\n# hardening guide.\nKexAlgorithms [email protected],curve25519-sha256,[email protected],diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256\nCiphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr\nMACs [email protected],[email protected],[email protected]\nHostKeyAlgorithms ssh-ed25519,[email protected],[email protected],[email protected],rsa-sha2-512,[email protected],rsa-sha2-256,[email protected]" > /etc/ssh/sshd_config.d/ssh-audit_hardening.conf
-#+end_src
-
-5. [@5] Include the /etc/ssh/sshd_{config}.d directory
-
-#+begin_src sh
-echo -e "Include /etc/ssh/sshd_config.d/*.conf" > /etc/ssh/sshd_config
-#+end_src
-
-6. [@6] Restart OpenSSH server
-
-#+begin_src sh
-rc-service sshd restart
-#+end_src
-
-* Testing SSH
-You can test the results with the =ssh-audit= python script.
-
-#+begin_src sh
-pip3 install ssh-audit
-ssh-audit localhost
-#+end_src
-
-If everything succeeded, the results will show as all green. If anything
-is yellow, orange, or red, you may need to tweak additional settings.
-
-#+begin_src txt
-,#+caption: ssh audit
-#+end_src
-
-#+caption: ssh-audit
-[[https://img.cleberg.net/blog/20231015-ssh-hardening/ssh-audit.png]]