[CentOS] DSA key not accepted on CentOS even after enabling

Thu Oct 17 14:27:35 UTC 2019
Gianluca Cecchi <gianluca.cecchi at gmail.com>

Hello,
I have some users that connect to a server with their DSA key that is of
type ssh-dss.
I'm migrating (installing as new) the server where they connect to CentOS 8
+ updates.
I was not able to connect with the keys to this new server even after
having added, as found in several internet pages, this directive at the end
of /etc/ssh/sshd_config of the CentOS 8 server:

# Accept also DSA keys
PubkeyAcceptedKeyTypes=+ssh-dss

and
systemctl restart sshd

I kept getting in journal the message:
userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes [preauth]

I saw that the sshd process had started with the option
... -oPubkeyAcceptedKeyTypes=rsa-sha2-256,ecdsa-sha2-nistp256,
ecdsa-sha2-nistp256-cert-v01 at openssh.com,ecdsa-sha2-nistp384,
ecdsa-sha2-nistp384-cert-v01 at openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,
ecdsa-sha2-nistp521-cert-v01 at openssh.com,ssh-ed25519,
ssh-ed25519-cert-v01 at openssh.com,ssh-rsa,ssh-rsa-cert-v01 at openssh.com

So I found the unit file for sshd that refers
to /etc/crypto-policies/back-ends/opensshserver.config
In the mean time I was able to reach my target going and editing the
/etc/sysconfig/sshd file adding the whole line obtained from the above and
adding ssh-dss

CRYPTO_POLICY='-oCiphers=aes256-gcm at openssh.com,
chacha20-poly1305 at openssh.com,aes256-ctr,aes256-cbc,aes128-gcm at openssh.com,aes128-ctr,aes128-cbc
-oMACs=hmac-sha2-256-etm at openssh.com,hmac-sha1-etm at openssh.com,
umac-128-etm at openssh.com,hmac-sha2-512-etm at openssh.com
,hmac-sha2-256,hmac-sha1,umac-128 at openssh.com,hmac-sha2-512
-oGSSAPIKexAlgorithms=gss-gex-sha1-,gss-group14-sha1- -oKexAlgorithms=
curve25519-sha256 at libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
-oHostKeyAlgorithms=rsa-sha2-256,ecdsa-sha2-nistp256,
ecdsa-sha2-nistp256-cert-v01 at openssh.com,ecdsa-sha2-nistp384,
ecdsa-sha2-nistp384-cert-v01 at openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,
ecdsa-sha2-nistp521-cert-v01 at openssh.com,ssh-ed25519,
ssh-ed25519-cert-v01 at openssh.com,ssh-rsa,ssh-rsa-cert-v01 at openssh.com
-oPubkeyAcceptedKeyTypes=rsa-sha2-256,ecdsa-sha2-nistp256,
ecdsa-sha2-nistp256-cert-v01 at openssh.com,ecdsa-sha2-nistp384,
ecdsa-sha2-nistp384-cert-v01 at openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,
ecdsa-sha2-nistp521-cert-v01 at openssh.com,ssh-ed25519,
ssh-ed25519-cert-v01 at openssh.com,ssh-rsa,ssh-rsa-cert-v01 at openssh.com
,ssh-dss'

and now it works with pubkey authentication based on DSA keys.
Not going to the querelle of OpenSSH 7 removing DSA keys and DSA vs RSA
(eg. some considerations by some years ago here:
https://security.stackexchange.com/questions/5096/rsa-vs-dsa-for-ssh-authentication-keys
),
any hint on smarter way to add?
I suppose further updates could change content
of  /etc/crypto-policies/back-ends/opensshserver.config that btw is part
of crypto-policies-20181217-6.git9a35207.el8.noarch and
not openssh-server-7.8p1-4.el8.x86_64

HIH others incurring in this problem and thanks in advance for any
insight/hint,
Gianluca