organised and linted all posts

imported workspace into obsidian
linted files
organized yaml frontmatter
unified yaml value formats
removed yaml front matter no longer needed
This commit is contained in:
2024-11-29 02:26:53 +00:00
parent adf127f593
commit 0759020677
24 changed files with 252 additions and 191 deletions
+19 -24
View File
@@ -1,21 +1,16 @@
---
title: Securing SSH 🤖
date: 2021-12-07T22:41:02Z
author: "ahmza"
description: Ever wanted to make your SSH connections more secure. Read this
tags:
- HomeLab
- RemoteAccess
- SSH
author: ahmza
date: 2021-12-07
draft: false
weight:
tags: ["HomeLab", "SSH", "RemoteAccess"]
description: "Ever wanted to make your SSH connections more secure. Read this"
canonicalURL: "https://blog.ahmza.com/Page%28/posts/securing-ssh.md%29"
cover:
image: "/webp/posts/secure-ssh/feature-anim.webp"
alt: "ssh-alt image" # alt text
caption: "<text>" # display caption under cover
relative: false # when using page bundles set this to true
showtoc: true
searchHidden: false
featureimage: feature.webp
lastmod:
---
# **Introduction**
@@ -154,7 +149,7 @@ fine 😊
- AllowUsers <user>
- ClientAliveInterval 180
```
``` bash
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
@@ -289,21 +284,21 @@ Subsystem sftp /usr/lib/openssh/sftp-server
**Now lets explain what we just did**
- **Protocol 2** - released in 2006, SSH2 introduced improved encryption
algorithms.
algorithms.
- **Port 2222** - The port number can be whatever number you want. Choose
something other than 22 this will help hide your device from malicious actors
something other than 22 this will help hide your device from malicious actors
- **PermitRootLogin no** - If the root account gets compromised then the
attacker has full control so we stop root from logging in over ssh.
attacker has full control so we stop root from logging in over ssh.
- **MaxAuthTries 5** - After 5 failed attempts the remote host blocks requests
from that IP for some of time.
from that IP for some of time.
- **PasswordAuthentication no** - The SSH key is installed, no need to have
password authentication.
password authentication.
- **PermitEmptyPasswords no** - Don't allow empty passwords
- **AllowUsers username** - Add the users you want to connect to the remote
host, others will be dropped.
host, others will be dropped.
- **Client Alive Interval 180** - Drop the connection after 180s of inactivity
## **Check ability to connect**
## **Check Ability to connect**
restart sshd service
@@ -384,7 +379,7 @@ The config for _Fail2Ban_ is nice and short
- **logpath** - where the log you want fail2ban to read is
- **maxretry** - Times the client can attempt a login before being banned
- **findtime** - An amount of time which maxretry must occur to trigger a ban
for example in 10 minutes if 3 login attempts fail ban the IP
for example in 10 minutes if 3 login attempts fail ban the IP
**Restart** **_Fail2Ban_** to load the configuration
@@ -429,7 +424,7 @@ password. After 3 failed attempts it should say connection refused.
ssh test@host -p 2222
```
_Fail2Ban_ should do something along the lines of ...
_Fail2Ban_ should do something along the lines of …
{{< video label="you shall not pass" webm="/webm/you-shall-not-pass.webm" >}}
log back in as your normal user, remove the test user and restore the sshd