termux-services icon indicating copy to clipboard operation
termux-services copied to clipboard

Support for OkcAgent

Open gerardo-junior opened this issue 4 years ago • 2 comments

OkcAgent runs a daemon and set $SSH_AUTH_SOCK to use openkeychain.

command to up service

$PREFIX/bin/okc-ssh-agent $PREFIX/var/run/okc-ssh-agent.sock > /dev/null 2>&1 & echo $! > $PREFIX/var/run/okc-ssh-agent.pid
export SSH_AUTH_SOCK=$PREFIX/var/run/okc-ssh-agent.sock

command to down service

kill -9 $(cat $PREFIX/var/run/okc-ssh-agent.pid)

command to status service

if [ -f /proc/$(cat $PREFIX/var/run/okc-ssh-agent.pid)/exe ]; then
   echo 'okc-ssh-agent is running...'
else
  echo 'okc-ssh-agent is not running...'
fi

more info https://github.com/DDoSolitary/OkcAgent https://github.com/DDoSolitary/OkcAgent/issues/18

gerardo-junior avatar Aug 27 '20 16:08 gerardo-junior

I don't think this will be possible purely through termux-services. You would need to have some code in your ~/.bashrc to export SSH_AUTH_SOCK anyways, so I am not sure if we want to package a half-working solution into okc-agents

Grimler91 avatar Sep 14 '20 10:09 Grimler91

I've been using ssha for this.

Add a function to the sh ENV file and you can override the path or binary used when ssh-agent is run by the ssha wrapper shell script.

$ cat -v "$ENV"
for _file in ~/.config/sh/rc.d/*.sh
do
    if  [ -s "${_file}" ] &&
        [ -r "${_file}" ]
    then
        . "${_file}"
    fi
done
unset -v _file
$ cat -v ~/.config/sh/rc.d/functions.sh
# Choose okc-ssh-agent as my default.
ssh-agent() {
    builtin command okc-ssh-agent "$@";
}
$ ssh-agent --version
okc-ssh-agent 0.1.2

tcely avatar Jul 19 '21 17:07 tcely