Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd services don't work #76

Open
hacatu opened this issue Mar 30, 2023 · 1 comment
Open

Systemd services don't work #76

hacatu opened this issue Mar 30, 2023 · 1 comment

Comments

@hacatu
Copy link

hacatu commented Mar 30, 2023

On arch linux, there are three systemd unit files installed along with tinyssh by default (usr/lib/systemd/system/[email protected], usr/lib/systemd/system/[email protected], and usr/lib/systemd/system/tinysshgenkeys.service, see here). However, the man page (see here) lists two other unit files with very similar but slightly different names. Worse yet, I can't figure out how to get either to work.

If I enable [email protected] and then [email protected] (the two systemctl units that come pre installed with the package), the first one works fine, but then the second one fails. In the systemd logs, it simply says [email protected]: Got no socket. The same thing happens if I run [email protected] and then [email protected] (ie in the other order). It seems that it is creating the socket, but the service isn't actually listening on it correctly for some reason. ss -lx | grep ssh only shows /run/user/0/gnupg/S.gpg-agent.ssh, no socket for ssh. However, I can tell [email protected] is doing something, because nmap identifies port 22 as filtered instead of closed, and ssh-copy-id fails when trying to log in instead of timing out like it would if the port were closed. It just, you know, isn't actually connected to any tinyssh daemon.

What about the unit files described in the man page? Well, glancing quickly over this repo I noticed that the man page is very out of date, but I didn't spot where the unit files in the arch linux package are, so they might be a downstream thing. Anyway, if I add the unit files described in the man page, they also don't work. The error is exactly the same, as long as I remember to stop the other socket.

Finally, just for completeness's sake, if I simply run tinysshd /etc/tinyssh/sshkeydir, it hangs for 1 minute and then kills itself because fatal: closing connection (timed out){main_tinysshd.c:43} I did generate the server keys and make sure that the two systemd sockets were stopped before trying it.

I'm running tinyssh in a qemu virtual machine, and the arch linux version is built with NaCl "/ TweetNaCl"

@ktpx
Copy link

ktpx commented Aug 13, 2023

You just need to two files as per the man page. However there is a problem with it
as is. in the [email protected] this line:

ExecStart=/usr/sbin/tinysshd ${TINYSSHDOPTS} -- /etc/tinyssh/sshkeydir

Won't work, i think since systemd whines about empty variable.

I replaced with:

ExecStart=/usr/sbin/tinysshd -v /etc/tinyssh/sshkeydir
and it works.

Only the socket service needs to be running/active. And you can't just run the tinysshd as a command like that, it needs tcpserv, inetd or systemd.

Not sure why arch has 3 files, but you only need the two in the man page, then with
the fix above, unless you actually set the ENV variable to something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants