Skip to content

Commit 98af77e

Browse files
committed
T7557: DSA keys not supported in Trixie
1 parent af78529 commit 98af77e

8 files changed

Lines changed: 57 additions & 13 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 -->

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>

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}')

src/migration-scripts/ssh/2-to-3

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2020-2024 VyOS maintainers and contributors <maintainers@vyos.io>
2+
#
3+
# This library is free software; you can redistribute it and/or
4+
# modify it under the terms of the GNU Lesser General Public
5+
# License as published by the Free Software Foundation; either
6+
# version 2.1 of the License, or (at your option) any later version.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public License
14+
# along with this library. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# T7557: OpenSSH on Trixie does not support DSS keys
17+
# https://www.debian.org/releases/trixie/release-notes/issues.en.html#openssh-no-longer-supports-dsa-keys
18+
19+
20+
from vyos.configtree import ConfigTree
21+
22+
base = ['service', 'ssh']
23+
24+
def migrate(config: ConfigTree) -> None:
25+
if not config.exists(base):
26+
# Nothing to do
27+
return
28+
29+
dss_algo = [
30+
'ssh-dss',
31+
'ssh-dss-cert-v01@openssh.com',
32+
]
33+
34+
path_hostkey = base + ['hostkey-algorithm']
35+
if config.exists(path_hostkey):
36+
values = config.return_values(path_hostkey)
37+
for algo in dss_algo:
38+
if algo in values:
39+
config.delete_value(path_hostkey, algo)
40+
41+
path_pubkey = base + ['pubkey-accepted-algorithm']
42+
if config.exists(path_pubkey):
43+
values = config.return_values(path_pubkey)
44+
for algo in dss_algo:
45+
if algo in values:
46+
config.delete_value(path_pubkey, algo)

0 commit comments

Comments
 (0)