Skip to content

SSH server does not work when running as windows service. #680

@btrepp

Description

@btrepp
  • Gitea version (or commit ref): (my own fork, but should happen on all versions)
  • Git version: 2.11.0-32
  • Operating system: Windows
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
    • MSSQL
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When running the inbuilt SSH server, ssh fails. My investigation has shown this to be caused by how minwinsvc determines is is running in service mode. What happens is as follows.

The ssh server starts correctly, and attempts to run the gitea.exe executable with the serv argument when a users is correctly authenticated with a SSH key (I have verified it is picking up keys correctly)
The gitea serv command returns 0 with no console output when run this way (via the inbuilt ssh server).

This is an issue with how minwinsvc determines whether to run as a service or console, the init code for minwinsvc calls Os exit with 0 if IsAnInteractiveSession() returns false. This is causing the shelling out of gitea to calling itself to return instantly.

I have created a ticket in kardianos/minwinsvc#2.

NOTE: The server works fine in windows when run via a console. As IsAnInteractiveSession will return true.

TLDR;. on windows using in built ssh server and running as a service; gitea.exe thinks it is a service when executing git-recieve-pack via ssh, and doesn't write to stdout, thus closing the connection to the client.

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions