tmate-io / tmate

Instant Terminal Sharing
https://tmate.io/
Other
5.65k stars 300 forks source link

Webhooks not working as expected #215

Open RobertSmart opened 4 years ago

RobertSmart commented 4 years ago

Hi,

I think I've implement the webhook functionality correctly.

I have a server set up with the documented endpoints listening for post events.

I have created a tmate.conf file with the required fields in as per the documentation (see below, but changed to point at my server)

set-option -g tmate-webhook-url "http://example.com/tmate_events" set-option -g tmate-webhook-userdata "some private data"

I've then started the static version of tmate as below:

./tmate -F -f ./tmate.conf

I get nothing coming through to my webhook. I've tested it using curl and it is working correctly.

Are webhooks currently working? How can I diagnose where the fault is?

Many thanks,

Rob

woj-kamuf commented 3 years ago

Hi, I have a similar situation. Nothing comes from tmate. I also checked with curl and everything works fine then. I was stuck on it.

Best Regards, Kamuf

marcoas commented 3 years ago

I was able to make it work, putting the configuration inside the file: /etc/tmux.conf

set-option -g tmate-webhook-url "http://example.com/tmate_events"
set-option -g tmate-webhook-userdata "some private data"

And I run from: /etc/rc.local tmate -F

RobertSmart commented 3 years ago

does it work if you add those options into a tmate.conf file and point to it with the -f flag?

marcoas commented 3 years ago

does it work if you add those options into a tmate.conf file and point to it with the -f flag?

I don't use -f flag

And use the /etc/tmux.conf I don't use /etc/tmate.conf

RobertSmart commented 3 years ago

I'm trying to establish if that is why it doesn't work for me. Did you try it with the -f flag?

can I put other tmate config in the tmux file or will that get ignored?

marcoas commented 3 years ago

I'm trying to establish if that is why it doesn't work for me. Did you try it with the -f flag?

I don't have tmux installed I never tried to use the -f option

can I put other tmate config in the tmux file or will that get ignored? I don't know that

marcoas commented 3 years ago

This works for me too:

File /etc/tmate.conf

set-option -g tmate-webhook-url "https://my.server/tmate_events"
set-option -g tmate-webhook-userdata "rpi_001"

File /etc/rc.local

...
tmate -F -f /etc/tmate.conf
...

The webhook response is:


    [entity_id] => 1a22c7d4-2f5b-11eb-9c4c-********
    [generation] => 1
    [params] => stdClass Object
        (
            [client_version] => 2.4.0
            [foreground] => 1
            [ip_address] => 186.12.**.**
            [named] => 
            [reconnected] => 
            [ssh_cmd_fmt] => ssh %s@nyc1.tmate.io
            [ssh_only] => 
            [stoken] => 4un2qwyNqscCx********
            [stoken_ro] => ro-6nKvzun9HVC*********
            [uname] => stdClass Object
                (
                    [machine] => armv7l
                    [nodename] => raspberrypi
                    [release] => 5.4.72-v7l+
                    [sysname] => Linux
                    [version] => #1356 SMP Thu Oct 22 13:57:51 BST 2020
                )

            [web_url_fmt] => https://tmate.io/t/%s
            [ws_url_fmt] => wss://nyc1.tmate.io/ws/session/%s
        )

    [timestamp] => 2020-11-25T20:16:29.195237Z
    [type] => session_register
    [userdata] => rpi_001
dklymenk commented 2 years ago

I have also had an issue with no webhooks being sent/received as if the config was ignored.

Turns out that webhooks are sent from the tmate server and not the tmate host, so you need to use a tmate-webhook-url that is available publicly over the internet and not your local network.