Skip to content

alexrsagen/prochost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prochost (process host)

A service for allowing remote access via SSH to the input/output of a process, using a pseudoterminal (PTY).

Intended to allow remote access to Half-Life Dedicated Server, Source Dedicated Server or even a Minecraft server.

You can use it with any kind of process with input/output, even bash, cmd.exe or powershell.exe, but I wouldn't recommend it 😄

Features

  • SSH protocol for remote access
  • Client IP filtering
  • Restart process on success/failure
  • Pass a configurable set of input commands to the process on startup
  • Run as a systemd service on unix platforms, with Type=notify
  • Run as a Windows service

Known issues

  • SSH resize events are not necessarily forwarded to the pseudoterminal (but any ANSI escape sequences sent by an SSH client may be forwarded). The pseudoterminal has a fixed size.

Possible configuration values

A default configuration file config.json is generated when you launch prochost. You can modify this accordingly.

Settings for the process:

  • process.workingDir: Working directory to spawn the process in (optional, defaults to current directory)
  • process.path: Path to executable
  • process.arguments: Arguments to pass to executable (defaults to no arguments)
  • process.environment: Environment to pass to executable (optional)
  • process.inheritEnvironment: Whether the process should inherit the same environment prochost has (in addition to extra environment variables passed)
  • process.successExitCodes: A list of exit codes considered a successful termination of the process (defaults to [0])
  • process.restartOnSuccess: Whether to restart the process if it exited with a successful exit code (as defined by process.successExitCode, defaults to true)
  • process.restartOnFailure: Whether to restart the process if it exited with a non-successful exit code (as defined by process.successExitCode, defaults to false)
  • process.restartDelay: How long to wait before restarting the process (defaults to 5 seconds)
  • process.startupInput: Any input to pass to the process after startup (defaults to [])
  • process.delayBeforeStartupInput: Delay before passing process.startupInput to the process (defaults to 1 second)
  • process.delayBetweenStartupInput: Delay between passing each element in the process.startupInput list to the process (defaults to 10 milliseconds)
  • process.inputBufferSize: How many byte arrays for input data to buffer in memory at the same time before dropping any (defaults to 100)
  • process.outputBufferSize: How many byte arrays for output data to buffer in memory at the same time before dropping any (defaults to 100)

Settings for the SSH server:

  • server.listen: Listen address/port. Possible formats:

    • <IPv4>[:<port>] - example: 127.0.0.1, 127.0.0.1:22000 or 0.0.0.0:22000
    • <IPv6> - example: ::1 or ::
    • [<IPv6>][:<port>] - example: [::1]:22000 or [::]:22000
    • <hostname>[:<port>] - example: localhost:22000
  • server.maxConnections: Maximum allowed client connections

  • server.users: List of users to allow (default: []). Allows any user if empty. Format:

    [{
      "username": "username",
      "passwordHash": "$2a$12$Z0u0zCO.2FwfEl.6N7KxIeAs2J5zUzHouORhHdBk0WDOhKzrQcxSO",
      "allowedNetworksCIDR": []
    }]
  • server.allowedNetworksCIDR: List of networks in CIDR format to allow client connections from (default: []). Allows any client IP address if empty or not provided.

  • server.hostKeys: An array of OpenSSH private keys. An ed25519 and RSA host key is generated automatically when config.json is generated.

  • server.serverId: SSH Server ID (default: SSH-2.0-prochost_0.1.0)

  • server.authRejectionTime: Time before an invalid authentication attempt is rejected

  • server.maxAuthAttempts: Maximum number of authentication attempts before a client is disconnected

  • server.inactivityTimeout: Time before a client is disconnected due to inactivity (optional)

  • server.keepaliveInterval: If nothing is received from the client for this amount of time, send a keepalive message (optional)

  • server.keepaliveMax: If this many keepalives have been sent without reply, close the connection (default: 3)

  • server.nodelay: If active, invoke set_nodelay(true) on client sockets; disabled by default (i.e. Nagle's algorithm is active)

About

A service for allowing remote access via SSH to the input/output of a process, using a pseudoterminal (PTY).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages