aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-13 15:03:23 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-13 15:03:23 +0800
commitc9b7532339890d6bda287d23f129677cbabeefb0 (patch)
treede68bad59f92c7c1ce9eddeb5e12160213072904
parent{main,ssh_server}.go: Log listening addresses (diff)
downloadforge-c9b7532339890d6bda287d23f129677cbabeefb0.tar.gz
forge-c9b7532339890d6bda287d23f129677cbabeefb0.tar.zst
forge-c9b7532339890d6bda287d23f129677cbabeefb0.zip
{http,ssh}_server.go: Add debug logs for incoming requests
-rw-r--r--http_server.go4
-rw-r--r--ssh_server.go4
2 files changed, 7 insertions, 1 deletions
diff --git a/http_server.go b/http_server.go
index 917d68c..5970cf7 100644
--- a/http_server.go
+++ b/http_server.go
@@ -6,11 +6,15 @@ import (
"net/http"
"strconv"
"strings"
+
+ "go.lindenii.runxiyu.org/lindenii-common/clog"
)
type http_router_t struct{}
func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ clog.Debug("Incoming HTTP: " + r.RemoteAddr + " " + r.Method + " " + r.RequestURI)
+
segments, _, err := parse_request_uri(r.RequestURI)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
diff --git a/ssh_server.go b/ssh_server.go
index e841e65..8cea1a9 100644
--- a/ssh_server.go
+++ b/ssh_server.go
@@ -5,6 +5,7 @@ import (
"net"
"os"
"os/exec"
+ "strings"
glider_ssh "github.com/gliderlabs/ssh"
"go.lindenii.runxiyu.org/lindenii-common/clog"
@@ -39,7 +40,8 @@ func serve_ssh(listener net.Listener) error {
if client_public_key != nil {
client_public_key_string = string(go_ssh.MarshalAuthorizedKey(client_public_key))
}
- _ = client_public_key_string
+
+ clog.Debug("Incoming SSH: " + session.RemoteAddr().String() + " " + strings.TrimSuffix(client_public_key_string, "\n") + " " + session.RawCommand())
cmd := session.Command()