Skip to content

Commit a94451d

Browse files
committed
#677 - Add explicit ciphers, kex and mac algorithms.
1 parent 0c467bb commit a94451d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

atr/ssh.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,36 @@
4343

4444
_CONFIG: Final = config.get()
4545

46+
_APPROVED_CIPHERS: Final[list[str]] = [
47+
"chacha20-poly1305@openssh.com",
48+
"aes256-gcm@openssh.com",
49+
"aes128-gcm@openssh.com",
50+
"aes256-ctr",
51+
"aes192-ctr",
52+
"aes128-ctr",
53+
]
54+
55+
_APPROVED_KEX: Final[list[str]] = [
56+
"rsa2048-sha256",
57+
"curve25519-sha256",
58+
"ecdh-sha2-nistp256",
59+
"diffie-hellman-group16-sha512",
60+
]
61+
62+
_APPROVED_MACS: Final[list[str]] = [
63+
"hmac-sha2-256-etm@openssh.com",
64+
"hmac-sha2-512-etm@openssh.com",
65+
"hmac-sha1-etm@openssh.com",
66+
"hmac-sha2-256",
67+
"hmac-sha2-512",
68+
"hmac-sha1",
69+
"hmac-sha256-2@ssh.com",
70+
"hmac-sha224@ssh.com",
71+
"hmac-sha256@ssh.com",
72+
"hmac-sha384@ssh.com",
73+
"hmac-sha512@ssh.com",
74+
]
75+
4676

4777
class RsyncArgsError(Exception):
4878
"""Exception raised when the rsync arguments are invalid."""
@@ -178,6 +208,9 @@ def process_factory(process: asyncssh.SSHServerProcess) -> asyncio.Task[None]:
178208
host=_CONFIG.SSH_HOST,
179209
port=_CONFIG.SSH_PORT,
180210
encoding=None,
211+
encryption_algs=_APPROVED_CIPHERS,
212+
kex_algs=_APPROVED_KEX,
213+
mac_algs=_APPROVED_MACS,
181214
)
182215

183216
log.info(f"SSH server started on {_CONFIG.SSH_HOST}:{_CONFIG.SSH_PORT}")

0 commit comments

Comments
 (0)