The X11 session startup files for xenodm and xinit share the same
snippet which checks if any of the default ssh private key files
exist, and if so, starts ssh-agent and runs ssh-add.

The list of key files is outdated.  SSH1 "identity" is gone, and
"id_ecdsa_sk" and "id_ed25519_sk" have been added for FIDO-based
keys.  The patch below updates the list and rephrases the shell
code a bit.

I have tested the xenodm Xsession script.

ok?

diff c65268ffd62e66b859aaf782a75cfa2f086925cb /usr/xenocara
blob - 1a1b6ab21ddb00673ddb17d7fb5f855ad21aa461
file + app/xenodm/config/Xsession.in
--- app/xenodm/config/Xsession.in
+++ app/xenodm/config/Xsession.in
@@ -23,18 +23,22 @@ else
 fi
 
 # if we have private ssh key(s), start ssh-agent and add the key(s)
-id1=$HOME/.ssh/identity
-id2=$HOME/.ssh/id_dsa
-id3=$HOME/.ssh/id_rsa
-id4=$HOME/.ssh/id_ecdsa
-id5=$HOME/.ssh/id_ed25519
-if [ -z "$SSH_AGENT_PID" ];
+if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]
 then
-       if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f 
$id4 -o -f $id5 ];
-       then
-               eval `ssh-agent -s`
-               ssh-add < /dev/null
-       fi
+       for keyfile in \
+           "$HOME/.ssh/id_rsa" \
+           "$HOME/.ssh/id_ecdsa" \
+           "$HOME/.ssh/id_ecdsa_sk" \
+           "$HOME/.ssh/id_ed25519" \
+           "$HOME/.ssh/id_ed25519_sk" \
+           "$HOME/.ssh/id_dsa"
+       do
+               if [ -f "$keyfile" ]; then
+                       eval `ssh-agent -s`
+                       ssh-add < /dev/null
+                       break
+               fi
+       done
 fi
 
 do_exit() {
blob - 4c9c3ae8aae50e3fe43f02aa1fb13b72712cbb64
file + app/xinit/xinitrc.cpp
--- app/xinit/xinitrc.cpp
+++ app/xinit/xinitrc.cpp
@@ -41,19 +41,23 @@ if [ -f "$usermodmap" ]; then
 fi
 
 XCOMM if we have private ssh key(s), start ssh-agent and add the key(s)
-id1=$HOME/.ssh/identity
-id2=$HOME/.ssh/id_dsa
-id3=$HOME/.ssh/id_rsa
-id4=$HOME/.ssh/id_ecdsa
-id5=$HOME/.ssh/id_ed25519
 
-if [ -z "$SSH_AGENT_PID" ];
+if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]
 then
-       if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f 
$id4 -o -f $id5 ];
-       then
-               eval `ssh-agent -s`
-               ssh-add < /dev/null
-       fi
+       for keyfile in \
+           "$HOME/.ssh/id_rsa" \
+           "$HOME/.ssh/id_ecdsa" \
+           "$HOME/.ssh/id_ecdsa_sk" \
+           "$HOME/.ssh/id_ed25519" \
+           "$HOME/.ssh/id_ed25519_sk" \
+           "$HOME/.ssh/id_dsa"
+       do
+               if [ -f "$keyfile" ]; then
+                       eval `ssh-agent -s`
+                       ssh-add < /dev/null
+                       break
+               fi
+       done
 fi
 
 XCOMM start some nice programs
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to