action-upterm icon indicating copy to clipboard operation
action-upterm copied to clipboard

Issue while using custom server

Open CarloDePieri opened this issue 3 years ago • 0 comments

This action is failing to launch the upterm host, when using my custom uptermd server. My custom server itself is working (both with ssh and ws protocols) when I try to connect from my terminal.

This is the failed action log (for my last ws attempt; using ssh results in a similar log):

2022-05-28T15:41:27.1593300Z Secret source: Actions
2022-05-28T15:41:27.1594079Z Prepare workflow directory
2022-05-28T15:41:27.2941208Z Prepare all required actions
2022-05-28T15:41:27.3150184Z Getting action download info
2022-05-28T15:41:27.5609560Z Download action repository 'lhotari/action-upterm@v1' (SHA:d23c2722bdab893785c9fbeae314cbf080645bd7)
2022-05-28T15:41:28.4010066Z ##[group]Run lhotari/action-upterm@v1
2022-05-28T15:41:28.4010419Z with:
2022-05-28T15:41:28.4010662Z   limit-access-to-actor: true
2022-05-28T15:41:28.4010938Z   limit-access-to-users: CarloDePieri
2022-05-28T15:41:28.4011343Z   upterm-server: ws://***:80
2022-05-28T15:41:28.4011728Z   GITHUB_TOKEN: ***
2022-05-28T15:41:28.4011947Z env:
2022-05-28T15:41:28.4012131Z   is_cron: false
2022-05-28T15:41:28.4012338Z ##[endgroup]
2022-05-28T15:41:29.0131355Z upterm
2022-05-28T15:41:29.0131993Z 
2022-05-28T15:41:29.3917240Z Auto-generating ~/.ssh/known_hosts by attempting connection to uptermd.upterm.dev
2022-05-28T15:41:29.6491930Z Pseudo-terminal will not be allocated because stdin is not a terminal.
2022-05-28T15:41:29.6492275Z 
2022-05-28T15:41:29.7888068Z Warning: Permanently added 'uptermd.upterm.dev' (ED25519) to the list of known hosts.
2022-05-28T15:41:29.7888373Z 
2022-05-28T15:41:29.8048808Z Connection closed by *** port 22
2022-05-28T15:41:29.8049254Z 
2022-05-28T15:41:29.8109578Z Adding actor "CarloDePieri" to allowed users.
2022-05-28T15:41:29.8123618Z Fetching SSH keys registered with GitHub profiles: CarloDePieri
2022-05-28T15:41:30.0561924Z Fetched 3 ssh public keys
2022-05-28T15:41:30.0562557Z Creating a new session. Connecting to upterm server ws://***:80
2022-05-28T15:41:32.2601272Z Created new session successfully
2022-05-28T15:41:33.2618623Z Entering main loop
2022-05-28T15:41:33.2735134Z Error: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /home/runner/.upterm/*.sock: connect: no such file or directory"
2022-05-28T15:41:33.2735882Z 
2022-05-28T15:41:33.2736901Z Usage:
2022-05-28T15:41:33.2737397Z   upterm session current [flags]
2022-05-28T15:41:33.2737782Z 
2022-05-28T15:41:33.2827031Z Aliases:
2022-05-28T15:41:33.2827320Z   current, c
2022-05-28T15:41:33.2827468Z 
2022-05-28T15:41:33.2827548Z 1
2022-05-28T15:41:33.2829383Z Examples:
2022-05-28T15:41:33.2829691Z   # Display the current session defined in $UPTERM_ADMIN_SOCKET
2022-05-28T15:41:33.2831313Z   upterm session current
2022-05-28T15:41:33.2831980Z   # Display the current session with a custom path
2022-05-28T15:41:33.2833909Z   upterm session current --admin-socket ADMIN_SOCKET_PATH
2022-05-28T15:41:33.2834122Z 
2022-05-28T15:41:33.2834219Z Flags:
2022-05-28T15:41:33.2835429Z       --admin-socket string   admin unix domain socket (required)
2022-05-28T15:41:33.2835824Z   -h, --help                  help for current
2022-05-28T15:41:33.2837029Z 
2022-05-28T15:41:33.2837849Z time="2022-05-28T15:41:33Z" level=fatal msg="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /home/runner/.upterm/*.sock: connect: no such file or directory\""
2022-05-28T15:41:33.2838210Z 
2022-05-28T15:41:33.3168761Z Cleaning up orphan processes
2022-05-28T15:41:33.3590362Z Terminate orphan process: pid (1695) (tmux: server)
2022-05-28T15:41:33.3659997Z Terminate orphan process: pid (1696) (upterm)

And this is the server log:

root@myserver:~/upterm/build# ./uptermd --ws-addr 0.0.0.0:80
INFO[0000] starting server                               app=uptermd network=mem network-opt="[]" node-addr="127.0.0.1:2222" ssh-addr="127.0.0.1:2222" ws-addr="[::]:80"
INFO[0250] dialing sshproxy sshd                         app=uptermd com=ws-sshproxy-dialer host=runner network=mem network-opt="[]" node-addr="127.0.0.1:2222" ssh-addr="127.0.0.1:2222" sshproxy-addr="127.0.0.1:2222" ws-addr="[::]:80"
ERRO[0253] error piping                                  app=uptermd com=ws-proxy error="readfrom tcp 127.0.0.1:56024->127.0.0.1:2222: websocket: close 1006 (abnormal closure): unexpected EOF" network=mem network-opt="[]" node-addr="127.0.0.1:2222" ssh-addr="127.0.0.1:2222" ws-addr="[::]:80"

And this is the action config:

      - name: Setup upterm session
        uses: lhotari/action-upterm@v1
        with:
          limit-access-to-actor: true
          limit-access-to-users: CarloDePieri
          upterm-server: ws://${{ secrets.UPTERM_SERVER }}:80

The action does work when using the default upterm server.

EDIT: taking a quick look at the code I see that from here https://github.com/lhotari/action-upterm/blob/d23c2722bdab893785c9fbeae314cbf080645bd7/src/index.js#L56 it tries to connect to the default server to save in the know_host file the server key... should it do the same for a custom ssh server when connecting with ssh?

CarloDePieri avatar May 28 '22 15:05 CarloDePieri