Skip to content

Commit 821a804

Browse files
committed
T7557: DSA keys not supported in Trixie
1 parent bd97505 commit 821a804

12 files changed

Lines changed: 96 additions & 22 deletions

File tree

data/templates/ssh/sshd_config.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#
88
Protocol 2
99
HostKey /etc/ssh/ssh_host_rsa_key
10-
HostKey /etc/ssh/ssh_host_dsa_key
1110
HostKey /etc/ssh/ssh_host_ecdsa_key
1211
HostKey /etc/ssh/ssh_host_ed25519_key
1312
SyslogFacility AUTH
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- include start from include/version/ssh-version.xml.i -->
2-
<syntaxVersion component='ssh' version='2'></syntaxVersion>
2+
<syntaxVersion component='ssh' version='3'></syntaxVersion>
33
<!-- include end -->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- include start from include/version/system-version.xml.i -->
2-
<syntaxVersion component='system' version='29'></syntaxVersion>
2+
<syntaxVersion component='system' version='30'></syntaxVersion>
33
<!-- include end -->

interface-definitions/service_ssh.xml.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@
138138
<help>Allowed host key signature algorithms</help>
139139
<completionHelp>
140140
<!-- generated by ssh -Q HostKeyAlgorithms | tr '\n' ' ' as this will not change dynamically -->
141-
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ssh-rsa rsa-sha2-256 rsa-sha2-512 ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ecdsa-sha2-nistp256@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512-cert-v01@openssh.com ssh-dss-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com</list>
141+
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ssh-rsa rsa-sha2-256 rsa-sha2-512 ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ecdsa-sha2-nistp256@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com</list>
142142
</completionHelp>
143143
<multi/>
144144
<constraint>
145-
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ssh-rsa|rsa-sha2-256|rsa-sha2-512|ssh-dss|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|sk-ecdsa-sha2-nistp256@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512-cert-v01@openssh.com|ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com)</regex>
145+
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ssh-rsa|rsa-sha2-256|rsa-sha2-512|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|sk-ecdsa-sha2-nistp256@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com)</regex>
146146
</constraint>
147147
</properties>
148148
</leafNode>
@@ -151,11 +151,11 @@
151151
<help>Allowed pubkey signature algorithms</help>
152152
<completionHelp>
153153
<!-- generated by ssh -Q PubkeyAcceptedAlgorithms | tr '\n' ' ' as this will not change dynamically -->
154-
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-dss ssh-dss-cert-v01@openssh.com ssh-rsa ssh-rsa-cert-v01@openssh.com rsa-sha2-256 rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-512-cert-v01@openssh.com</list>
154+
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa ssh-rsa-cert-v01@openssh.com rsa-sha2-256 rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-512-cert-v01@openssh.com</list>
155155
</completionHelp>
156156
<multi/>
157157
<constraint>
158-
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ecdsa-sha2-nistp256|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-dss|ssh-dss-cert-v01@openssh.com|ssh-rsa|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512|rsa-sha2-512-cert-v01@openssh.com)</regex>
158+
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ecdsa-sha2-nistp256|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512|rsa-sha2-512-cert-v01@openssh.com)</regex>
159159
</constraint>
160160
</properties>
161161
</leafNode>

interface-definitions/system_login.xml.in

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,8 @@
138138
<properties>
139139
<help>SSH public key type</help>
140140
<completionHelp>
141-
<list>ssh-dss ssh-rsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519@openssh.com</list>
141+
<list>ssh-rsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519@openssh.com</list>
142142
</completionHelp>
143-
<valueHelp>
144-
<format>ssh-dss</format>
145-
<description>Digital Signature Algorithm (DSA) key support</description>
146-
</valueHelp>
147143
<valueHelp>
148144
<format>ssh-rsa</format>
149145
<description>Key pair based on RSA algorithm</description>
@@ -173,7 +169,7 @@
173169
<description>Elliptic curve 25519 security key</description>
174170
</valueHelp>
175171
<constraint>
176-
<regex>(ssh-dss|ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com)</regex>
172+
<regex>(ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com)</regex>
177173
</constraint>
178174
</properties>
179175
</leafNode>

python/vyos/utils/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def split_ssh_public_key(key_string, defaultname=""):
104104
else:
105105
key_type, key_data, key_name = parts[0], parts[1], defaultname
106106

107-
if key_type not in ['ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']:
108-
raise ValueError("Bad key type \'{0}\', must be one of must be one of ssh-rsa, ssh-dss, ecdsa-sha2-nistp<256|384|521> or ssh-ed25519".format(key_type))
107+
if key_type not in ['ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']:
108+
raise ValueError("Bad key type \'{0}\', must be one of must be one of ssh-rsa, ecdsa-sha2-nistp<256|384|521> or ssh-ed25519".format(key_type))
109109

110110
return({"type": key_type, "data": key_data, "name": key_name})
111111

smoketest/config-tests/basic-vyos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ set service ssh ciphers 'aes192-ctr'
8686
set service ssh ciphers 'aes256-ctr'
8787
set service ssh ciphers 'chacha20-poly1305@openssh.com'
8888
set service ssh ciphers 'rijndael-cbc@lysator.liu.se'
89+
set service ssh hostkey-algorithm 'ssh-rsa'
8990
set service ssh key-exchange 'curve25519-sha256@libssh.org'
9091
set service ssh key-exchange 'diffie-hellman-group1-sha1'
9192
set service ssh key-exchange 'diffie-hellman-group-exchange-sha1'
9293
set service ssh key-exchange 'diffie-hellman-group-exchange-sha256'
9394
set service ssh listen-address '192.168.0.1'
9495
set service ssh port '22'
96+
set service ssh pubkey-accepted-algorithm 'ssh-rsa'
9597
set system config-management commit-revisions '100'
9698
set system conntrack ignore ipv4 rule 1 destination address '192.0.2.2'
9799
set system conntrack ignore ipv4 rule 1 source address '192.0.2.1'

smoketest/configs/basic-vyos

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ service {
228228
key-exchange curve25519-sha256@libssh.org
229229
key-exchange diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
230230
port 22
231+
hostkey-algorithm ssh-rsa
232+
hostkey-algorithm ssh-dss
233+
pubkey-accepted-algorithm ssh-rsa
234+
pubkey-accepted-algorithm ssh-dss
231235
}
232236
}
233237
system {

smoketest/scripts/cli/test_service_ssh.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
pki_path = ['pki']
3939

4040
key_rsa = '/etc/ssh/ssh_host_rsa_key'
41-
key_dsa = '/etc/ssh/ssh_host_dsa_key'
4241
key_ed25519 = '/etc/ssh/ssh_host_ed25519_key'
4342
trusted_user_ca = config_files['sshd_user_ca']
4443
test_command = 'uname -a'
@@ -156,7 +155,6 @@ def tearDown(self):
156155
self.cli_commit()
157156

158157
self.assertTrue(os.path.isfile(key_rsa))
159-
self.assertTrue(os.path.isfile(key_dsa))
160158
self.assertTrue(os.path.isfile(key_ed25519))
161159

162160
# Established SSH connections remains running after service is stopped.
@@ -408,7 +406,6 @@ def test_ssh_pubkey_accepted_algorithm(self):
408406
'ecdsa-sha2-nistp256',
409407
'ecdsa-sha2-nistp384',
410408
'ecdsa-sha2-nistp521',
411-
'ssh-dss',
412409
'ssh-rsa',
413410
'rsa-sha2-256',
414411
'rsa-sha2-512',

src/conf_mode/service_ssh.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
sshguard_whitelist = '/etc/sshguard/whitelist'
4343

4444
key_rsa = '/etc/ssh/ssh_host_rsa_key'
45-
key_dsa = '/etc/ssh/ssh_host_dsa_key'
4645
key_ed25519 = '/etc/ssh/ssh_host_ed25519_key'
4746

4847
trusted_user_ca = config_files['sshd_user_ca']
@@ -116,9 +115,6 @@ def generate(ssh):
116115
if not os.path.isfile(key_rsa):
117116
syslog(LOG_INFO, 'SSH RSA host key not found, generating new key!')
118117
call(f'ssh-keygen -q -N "" -t rsa -f {key_rsa}')
119-
if not os.path.isfile(key_dsa):
120-
syslog(LOG_INFO, 'SSH DSA host key not found, generating new key!')
121-
call(f'ssh-keygen -q -N "" -t dsa -f {key_dsa}')
122118
if not os.path.isfile(key_ed25519):
123119
syslog(LOG_INFO, 'SSH ed25519 host key not found, generating new key!')
124120
call(f'ssh-keygen -q -N "" -t ed25519 -f {key_ed25519}')

0 commit comments

Comments
 (0)