Skip to content

Open-source status page, incident response and uptime monitoring

🔥 ssh status (#1366)

Thibault Le Ouay40821c15c3c2
diff --git a/apps/ssh-server/.dockerignore b/apps/ssh-server/.dockerignore
new file mode 100644
index 000000000..029a02c5e
--- /dev/null
+++ b/apps/ssh-server/.dockerignore
@@ -0,0 +1 @@
+**/.ssh
diff --git a/apps/ssh-server/.gitignore b/apps/ssh-server/.gitignore
new file mode 100644
index 000000000..59ba63a8b
--- /dev/null
+++ b/apps/ssh-server/.gitignore
@@ -0,0 +1 @@
+.ssh/
diff --git a/apps/ssh-server/Dockerfile b/apps/ssh-server/Dockerfile
new file mode 100644
index 000000000..754354f32
--- /dev/null
+++ b/apps/ssh-server/Dockerfile
@@ -0,0 +1,16 @@
+ARG GO_VERSION=1
+FROM golang:1.25.1-alpine as builder
+
+WORKDIR /usr/src/app
+COPY go.mod go.sum ./
+RUN go mod download && go mod verify
+COPY . .
+RUN go build -v -o /ssh-status-server .
+
+
+FROM debian:bookworm
+
+COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
+COPY --from=builder /ssh-status-server /app/ssh-status-server
+
+CMD ["/app/ssh-status-server"]
diff --git a/apps/ssh-server/banner.txt b/apps/ssh-server/banner.txt
new file mode 100644
index 000000000..cff82eb0c
--- /dev/null
+++ b/apps/ssh-server/banner.txt
@@ -0,0 +1,8 @@
+ _ _
+ | | | |
+ ___ _ __ ___ _ __ ___| |_ __ _| |_ _ _ ___
+ / _ \| '_ \ / _ \ '_ \/ __| __/ _` | __| | | / __|
+| (_) | |_) | __/ | | \__ \ || (_| | |_| |_| \__ \
+ \___/| .__/ \___|_| |_|___/\__\__,_|\__|\__,_|___/
+ | |
+ |_|
diff --git a/apps/ssh-server/fly.toml b/apps/ssh-server/fly.toml
new file mode 100644
index 000000000..a09614e81
--- /dev/null
+++ b/apps/ssh-server/fly.toml
@@ -0,0 +1,33 @@
+# fly.toml app configuration file generated for ssh-server-status on 2025-09-16T08:46:39+02:00
+#
+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
+#
+
+app = 'ssh-server-status'
+primary_region = 'cdg'
+
+[build]
+ dockerfile = './Dockerfile'
+
+
+
+[[services]]
+ internal_port = 2222
+ protocol = "tcp"
+ auto_stop_machines = true
+ auto_start_machines = true
+ [[services.ports]]
+ port = 22
+
+
+[env]
+ PORT = "2222"
+
+[mounts]
+ source = "ssh_key"
+ destination = "/data"
+
+
+[[vm]]
+ size = 'shared-cpu-1x'
+ memory = '256MB'
diff --git a/apps/ssh-server/go.mod b/apps/ssh-server/go.mod
new file mode 100644
index 000000000..009de8bf3
--- /dev/null
+++ b/apps/ssh-server/go.mod
@@ -0,0 +1,10 @@
+module github.com/openstatusHQ/openstatus/apps/ssh-server
+
+go 1.25.1
+
+require (
+ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
+ github.com/gliderlabs/ssh v0.3.8 // indirect
+ golang.org/x/crypto v0.42.0 // indirect
+ golang.org/x/sys v0.36.0 // indirect
+)
diff --git a/apps/ssh-server/go.sum b/apps/ssh-server/go.sum
new file mode 100644
index 000000000..d504a16dd
--- /dev/null
+++ b/apps/ssh-server/go.sum
@@ -0,0 +1,8 @@
+github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
+github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
+github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
+github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
+golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
+golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
+golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
+golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
diff --git a/apps/ssh-server/main.go b/apps/ssh-server/main.go
new file mode 100644
index 000000000..9e59c11a3
--- /dev/null
+++ b/apps/ssh-server/main.go
@@ -0,0 +1,123 @@
+package main
+
+import (
+ _ "embed"
+ "encoding/json"
+ "fmt"
+ "io"
+ "log"
+ "net/http"
+
+ "github.com/gliderlabs/ssh"
+)
+
+//go:embed banner.txt
+var banner string
+
+func bannerfunc(ctx ssh.Context) string {
+ return banner
+}
+
+var statusOk = `
++----------------------------------+
+| |
+| All Systems Operational |
+| |
++----------------------------------+
+`
+var statusDegraded = `
++----------------------------------+
+| |
+| System is degraded |
+| |
++----------------------------------+
+`
+var statusPartialOutage = `
++----------------------------------+
+| |
+| System is partially out of |
+| service |
+| |
++----------------------------------+
+`
+var statusMajorOutage = `
++----------------------------------+
+| |
+| System is out of service |
+| |
++----------------------------------+
+`
+var statusUnderMaintenance = `
++----------------------------------+
+| |
+| System is under |
+| maintenance |
+| |
++----------------------------------+
+`
+var statusIncident = `
++----------------------------------+
+| |
+| System is partially out of |
+| service |
+| |
++----------------------------------+
+`
+
+type status struct {
+ Status string `json:"status"`
+}
+
+func handler(s ssh.Session) {
+ url := fmt.Sprintf("https://api.openstatus.dev/public/status/%s", s.User())
+ res, err := http.Get(url)
+ if err != nil {
+ fmt.Fprintf(s, "Error fetching status: %v\n", err)
+ return
+ }
+ defer res.Body.Close()
+ var status status
+ json.NewDecoder(res.Body).Decode(&status)
+
+ var currentStatus string
+ switch status.Status {
+ case "operational":
+ currentStatus = statusOk
+ case "degraded_performance":
+ currentStatus = statusDegraded
+ case "partial_outage":
+ currentStatus = statusPartialOutage
+ case "major_outage":
+ currentStatus = statusMajorOutage
+ case "under_maintenance":
+ currentStatus = statusUnderMaintenance
+ case "incident":
+ currentStatus = statusIncident
+ default:
+ currentStatus = ""
+ }
+
+ if currentStatus == "" {
+ io.WriteString(s, "Unknown status page")
+ return
+ }
+
+ io.WriteString(s, fmt.Sprintf("\nCurrent Status for: %s\n\n%s\n\nVisit the status page at https://%s.openstatus.dev/\n\n", s.User(), currentStatus, s.User()))
+}
+
+func main() {
+
+ server := &ssh.Server{
+ Addr: ":2222",
+ BannerHandler: bannerfunc,
+ Handler: handler,
+
+ }
+ ssh.HostKeyFile("/data/id_rsa")
+ // server.AddHostKey(ssh.HostKeyFile(filepath string))
+
+ log.Println("starting ssh server on port 2222...")
+ log.Fatal(server.ListenAndServe())
+
+
+}
diff --git a/packages/db/src/schema/pages/constants.ts b/packages/db/src/schema/pages/constants.ts
index 376aceca6..9b8aedb2a 100644
--- a/packages/db/src/schema/pages/constants.ts
+++ b/packages/db/src/schema/pages/constants.ts
@@ -10,4 +10,5 @@ export const subdomainSafeList = [
"light",
"workflows",
"template",
+ "ssh",
];