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

Failing to connect after establishing reverse tunnel #250

Closed
seyuboglu opened this issue Oct 17, 2022 · 4 comments
Closed

Failing to connect after establishing reverse tunnel #250

seyuboglu opened this issue Oct 17, 2022 · 4 comments

Comments

@seyuboglu
Copy link
Contributor

seyuboglu commented Oct 17, 2022

Thanks for the great work on this!

I've got sish running up on gcloud and have pointed my dns records to the external ip. Here's the configuration I used:

gcloud compute instances create-with-container sish \
    --zone="us-central1-a" \
    --tags="sish" \
    --container-mount-host-path="host-path=/mnt/stateful_partition/sish/ssl,mount-path=/ssl" \
    --container-mount-host-path="host-path=/mnt/stateful_partition/sish/keys,mount-path=/keys" \
    --container-mount-host-path="host-path=/mnt/stateful_partition/sish/pubkeys,mount-path=/pubkeys" \
    --container-image="antoniomika/sish:latest" \
    --machine-type="e2-micro" \
    --container-arg="--domain=meerkat.wiki" \
		--container-arg="--authentication=false" \
    --container-arg="--ssh-address=:2222" \
    --container-arg="--http-address=:80" \
    --container-arg="--https-address=:443" \
    --container-arg="--https=true" \
    --container-arg="--https-certificate-directory=/ssl" \
    --container-arg="--authentication-keys-directory=/pubkeys" \
    --container-arg="--private-keys-directory=/keys" \
    --container-arg="--bind-random-ports=false" \
    --container-arg="--bind-random-subdomains=false" \
    --container-arg="--bind-random-aliases=false" \
    --container-arg="--tcp-aliases=true" \
    --container-arg="--service-console=true" \
    --container-arg="--log-to-client=true" \
    --container-arg="--admin-console=true" \
    --container-arg="--verify-ssl=false" \
    --container-arg="--https-ondemand-certificate=false" \
    --container-arg="--https-ondemand-certificate-accept-terms=false" \
    --container-arg="[email protected]" \
    --container-arg="--idle-connection=false" \
    --container-arg="--ping-client-timeout=2m"

I'm able to setup the reverse tunnel with: ssh -p 2222 -R foo:80:httpbin.org:80 meerkat.wiki

However, when I try testing it with curl -vvv https://foo.meerkat.wiki/helloworld I get:

* Could not resolve host: foo.meerkat.wiki
* Closing connection 0
curl: (6) Could not resolve host: foo.meerkat.wiki

Any leads on what I may be missing in the setup?

@seyuboglu
Copy link
Contributor Author

Interestingly, if I change the subdomain to ssh -p 2222 -R test:80:httpbin.org:80 meerkat.wiki, then I get:

*   Trying 23.217.138.110:443...
* connect to 23.217.138.110 port 443 failed: Operation timed out
* Failed to connect to test.meerkat.wiki port 443 after 75069 ms: Operation timed out
* Closing connection 0
curl: (28) Failed to connect to test.meerkat.wiki port 443 after 75069 ms: Operation timed out

@seyuboglu seyuboglu changed the title curl: (28) Failed to connect to X port 443 after X ms: Connection refused Failing to connect after establishing reverse tunnel Oct 17, 2022
@antoniomika
Copy link
Owner

Hey @seyuboglu

Sorry for the delay and missing you on IRC, next time you join feel free to give me a ping!

Your first issue (could not resolve host) makes me think that's a DNS resolution issue. If you had recently setup the wildcard/A record for your domain. That's possible for why that happened.

I'm wondering if the firewall settings aren't being set to allow connections over port 443. Does it work with port 80?

I.e. did you run this line or change it to allow those ports?

Best.

@antoniomika
Copy link
Owner

Actually just checked, might just be missing the wildcard record for the TLD.

~$ dig @1.1.1.1 meerkat.wiki

; <<>> DiG 9.10.6 <<>> @1.1.1.1 meerkat.wiki
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1887
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;meerkat.wiki.                  IN      A

;; ANSWER SECTION:
meerkat.wiki.           1799    IN      A       XX.XXX.XXX.XXX

;; Query time: 58 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Tue Oct 18 11:59:37 EDT 2022
;; MSG SIZE  rcvd: 57

~$ dig @1.1.1.1 asdf.meerkat.wiki

; <<>> DiG 9.10.6 <<>> @1.1.1.1 asdf.meerkat.wiki
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 16837
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;asdf.meerkat.wiki.             IN      A

;; AUTHORITY SECTION:
meerkat.wiki.           3601    IN      SOA     dns1.registrar-servers.com. hostmaster.registrar-servers.com. 1666034979 43200 3600 604800 3601

;; Query time: 61 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Tue Oct 18 11:59:43 EDT 2022
;; MSG SIZE  rcvd: 119

@seyuboglu
Copy link
Contributor Author

That was the fix! – I had improperly setup that record on namecheap. Thanks for the quick response.

seyuboglu added a commit to seyuboglu/sish that referenced this issue Oct 18, 2022
Add commands for checking that the DNS records were set up correctly. Inspired by the issue antoniomika#250
antoniomika pushed a commit that referenced this issue Oct 21, 2022
Add commands for checking that the DNS records were set up correctly. Inspired by the issue #250
widhaprasa added a commit to widhaprasa/sish that referenced this issue May 27, 2024
commit f381389
Author: Antonio Mika <[email protected]>
Date:   Tue Apr 30 16:52:08 2024 -0400

    Update deps (antoniomika#302)

    * Update deps

    * Use bufio reader

    * Revert "Use bufio reader"

    This reverts commit c8003d4.

    * Print peeked info

    * Revert "Revert "Use bufio reader""

    This reverts commit ff656b0.

    * Fixed sni reading

    * Handle sni based unix conn better

commit 81e4350
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Apr 19 09:36:38 2024 -0400

    Bump golang.org/x/net from 0.22.0 to 0.23.0 (antoniomika#301)

    Bumps [golang.org/x/net](https://github.com/golang/net) from 0.22.0 to 0.23.0.
    - [Commits](golang/net@v0.22.0...v0.23.0)

    ---
    updated-dependencies:
    - dependency-name: golang.org/x/net
      dependency-type: indirect
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 7ad6956
Author: Antonio Mika <[email protected]>
Date:   Fri Mar 8 08:56:04 2024 -0500

    Enable the use of environment vars (antoniomika#300)

commit 9f3f566
Author: Antonio Mika <[email protected]>
Date:   Thu Mar 7 18:33:15 2024 -0500

    Update to go 1.22 and use multilistener (antoniomika#298)

    * Update to go 1.22 and use multilistener

    * Update

    * Updates

    * Set ports for tcp addresses properly

    * Fix address separator

    * Fixes

    * Update multilistener

    * Cleanup rogue log

commit d0511c4
Author: Eric Bower <[email protected]>
Date:   Thu Mar 7 09:13:34 2024 -0500

    chore: update pdocs to latest (antoniomika#295)

    * chore: update pdocs to latest

    * design: sidebar

commit 3ad5105
Author: Eric Bower <[email protected]>
Date:   Tue Feb 13 10:24:03 2024 -0500

    feat(docs): sitemap with links for headers (antoniomika#292)

commit c64d009
Author: Dominik Konik <[email protected]>
Date:   Mon Feb 12 23:08:27 2024 -0500

    Fix typo in comment (antoniomika#294)

commit e8c56f6
Author: Antonio Mika <[email protected]>
Date:   Mon Jan 29 10:30:04 2024 -0500

    Fix docs build

commit 97edc2e
Author: Antonio Mika <[email protected]>
Date:   Mon Jan 29 10:26:41 2024 -0500

    Run go mod tidy

commit 0c4f193
Author: Eric Bower <[email protected]>
Date:   Mon Jan 29 10:17:13 2024 -0500

    feat: docs site (antoniomika#286)

    * feat: docs site

    * docs: copy

    * chore(docs): update cli post

    * revert

    * chore: go.mod

commit 6892112
Author: Antonio Mika <[email protected]>
Date:   Tue Jan 23 11:32:29 2024 -0500

    Initial work on private aliases (antoniomika#291)

    * Initial work on private aliases

    * Ensure the current user is allowed to access the alias

    * Print the self ssh fingerprint

    * Add pubkeyfingerprint to alias log line

    * Start conn with self allowed for tcp aliases

    * Cleanup

commit 4ed4208
Author: Antonio Mika <[email protected]>
Date:   Thu Oct 12 16:20:01 2023 -0400

    Pin golang to major.minor.patch (antoniomika#284)

    * Pin golang to major.minor.patch

    * Update package deps

commit 7ca0808
Author: Antonio Mika <[email protected]>
Date:   Wed Oct 11 19:49:44 2023 -0400

    Update golang versions. Supersedes up antoniomika#282 (antoniomika#283)

commit b89a463
Author: Antonio Mika <[email protected]>
Date:   Mon Oct 9 14:48:00 2023 -0400

    Set conn deadline to both reads and writes (antoniomika#281)

commit 56816e6
Author: Antonio Mika <[email protected]>
Date:   Sat Oct 7 20:14:32 2023 -0400

    Updated go deps and general package work (antoniomika#279)

    * Updated go deps and general package work

    * Update used go version to 1.21

    * feat: wildcard support

    * Fixed lint

    * feat: auto redirect to https

    * Use proper hostname in redirect

    * Add wildcards to sni proxy

    * Ensure wildcard isn't too greedy and fix sni on https port

    * Code cleanup

    ---------

    Co-authored-by: Son Nguyen <[email protected]>

commit 62dec83
Author: Antonio Mika <[email protected]>
Date:   Tue Dec 20 13:31:17 2022 -0500

    Use original address for forwarded channel. Fix antoniomika#237

commit c54d681
Author: Antonio Mika <[email protected]>
Date:   Mon Dec 12 12:04:17 2022 -0500

    Force lower case aliases and subdomains

commit 4b5c2db
Author: Antonio Mika <[email protected]>
Date:   Mon Dec 12 10:56:14 2022 -0500

    Update ci/cd and deps (antoniomika#262)

    * Update ci/cd and deps

    * Fix build args

commit a8236e5
Author: Antonio Mika <[email protected]>
Date:   Tue Oct 25 10:20:34 2022 -0400

    Fixed http override port (antoniomika#256)

    * Fixed http override port

    * Cleanup references used for establishing tunnels

    * Removed short flag from authentication-key-request-url

commit fe2b1c2
Author: Roshan Jobanputra <[email protected]>
Date:   Fri Oct 21 12:04:10 2022 -0400

    Add authentication-key-request-url option  (antoniomika#247)

    * Add authentication-key-request-url option to allow validation of ssh public key auth via an http POST request to a separate application

    * Switch to using JSON body in request and include username & remote address of client.

commit bcd6911
Author: Sabri Eyuboglu <[email protected]>
Date:   Fri Oct 21 09:02:58 2022 -0700

    Add a check to the gcloud DNS record instructions (antoniomika#251)

    Add commands for checking that the DNS records were set up correctly. Inspired by the issue antoniomika#250

commit 9696686
Author: Antonio Mika <[email protected]>
Date:   Fri Oct 21 11:44:48 2022 -0400

    Added streaming for httpmuxer (antoniomika#255)

    * Added streaming for httpmuxer

    * Fix gzip response checking

commit 890c931
Author: Antonio Mika <[email protected]>
Date:   Mon Oct 17 12:17:52 2022 -0400

    Added full route identifiers

commit 7aecd2d
Author: Artem Ivanov <[email protected]>
Date:   Sun Sep 11 18:56:59 2022 +0200

    fix ondemand cert issuing (antoniomika#243)

commit c49a1ca
Author: Antonio Mika <[email protected]>
Date:   Sun Sep 11 12:55:54 2022 -0400

    Fixed acme tls-alpn challenges (antoniomika#244)

    * Fixed acme tls-alpn challenges

    * Return connection to default handler if unable to read hello

    * Fix peek check

    * Simplify dockerfile and update dependencies

    * Cleanup build cache requirements

commit b8ab4cf
Merge: 8f44621 3768d42
Author: Antonio Mika <[email protected]>
Date:   Wed Aug 24 11:41:25 2022 -0400

    Merge pull request antoniomika#241 from antoniomika/am/upgrade-go-1-19

    Updated sish to go 1.19

commit 3768d42
Author: Antonio Mika <[email protected]>
Date:   Wed Aug 24 11:26:25 2022 -0400

    Update dependencies

commit 58df1cd
Author: Antonio Mika <[email protected]>
Date:   Wed Aug 24 11:13:16 2022 -0400

    Updated sish to go 1.19

commit 8f44621
Author: Tim Krins <[email protected]>
Date:   Wed Aug 24 16:10:36 2022 +0100

    Expanded debug logging, fix deprecations (antoniomika#240)

    * Add debug messages for aborted requests

    * Don't use %s for Println

    * Fix deprecated ioutil calls

    * Fix incorrect leading spaces for comment

    * Add debug-interval option

    * Align debug logging syntax with existing error logging

    * Fix linting errors, fix status logging

    * Ensure debug-interval is not zero

commit 4a28b9e
Author: Antonio Mika <[email protected]>
Date:   Fri Aug 5 22:22:38 2022 -0400

    Update gcloud.md

    Closes antoniomika#238
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