bastion,cmd/litebastion: add option to accept HTTP on localhost only - #39
Conversation
rgdd
left a comment
There was a problem hiding this comment.
LGTM, just dropped two minor comments.
Also tested that my witness is able to connect to a bastion running this version, both with and without the -listen-http option. And when -listen-http is on, I'm failing to send non-backend queries on the public endpoint (but it works on the local endpoint).
(And agreed your patch looks better -- thanks for cleaning it up!)
| arbitrary requests from the internet, you can accept request on localhost. | ||
| This is for example useful when running a bastion for your own log. | ||
|
|
||
| -listen-http PORT |
There was a problem hiding this comment.
That's what the README says? PORT is the placeholder.
| serveGroup.Go(func() error { | ||
| <-ctx.Done() | ||
| slog.Info("shutting down bastion listener") | ||
| l.Close() |
There was a problem hiding this comment.
Minor comment, but seeing this in the logs on ctrl-c shutdown:
time=2025-11-18T14:24:10.378Z level=INFO msg="shutting down bastion listener"
time=2025-11-18T14:24:10.378Z level=INFO msg="shutting down HTTP server"
time=2025-11-18T14:24:10.378Z level=INFO msg=exiting err="accept tcp ***.***.***.***:443: use of closed network connection"
I suppose because l is closed before hs? If i change the order I instead see:
time=2025-11-18T14:27:31.362Z level=INFO msg="shutting down HTTP server"
time=2025-11-18T14:27:31.362Z level=INFO msg="shutting down bastion listener"
time=2025-11-18T14:27:31.362Z level=INFO msg=exiting err="http: Server closed"
Which looks better? Anyway -- pick the order you prefer but at least wanted to call it out!
There was a problem hiding this comment.
Made it surface the signal context cancellation error, instead, and mailed https://go-review.googlesource.com/c/go/+/721700 upstream to make it more helpful.
Closes #38 Co-authored-by: Rasmus Dahlberg <rasmus@rgdd.se>
edeb32b to
e16e979
Compare
Closes #38