Skip to content

Commit a23ae9e

Browse files
committed
feat: add webpage on / to give context for Alexandria
Signed-off-by: Xe Iaso <me@xeiaso.net>
1 parent b8c0ec0 commit a23ae9e

21 files changed

+530
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ Please note that opting out will limit Techaro's ability to support your
4242
installation of Anubis or other software.
4343

4444
For users, you can opt out by running Anubis with the
45-
`ANUBIS_LOG_SUBMISSION=i-want-to-make-it-harder-to-get-help` environment
45+
`ALEXANDRIA_LOG_SUBMISSION=i-want-to-make-it-harder-to-get-help` environment
4646
variable set.

SECURITY.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ Techaro follows the [Semver 2.0 scheme](https://semver.org/).
44

55
## Supported Versions
66

7-
Techaro strives to support the two most recent minor versions of published software. Patches to those versions will be published as patch releases.
7+
Techaro strives to support the two most recent minor versions of published
8+
software. Patches to those versions will be published as patch releases.
89

910
## Reporting a Vulnerability
1011

11-
Email security@techaro.lol with details on the vulnerability and reproduction steps. You will get a response as soon as possible.
12+
Email security@techaro.lol with details on the vulnerability and reproduction
13+
steps. You will get a response as soon as possible.
1214

13-
Please take care to send your email as a mixed plaintext and HTML message. Messages with GPG signatures or that are plaintext only may be blocked by the spam filter.
15+
Please take care to send your email as a mixed plaintext and HTML message.
16+
Messages with GPG signatures or that are plaintext only may be blocked by the
17+
spam filter.

alexandria/writerwrapper_enabled.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Writer(kind string, logID string, next io.Writer) *WriterWrapper {
2020
AddSource: true,
2121
}))
2222

23-
if val, ok := os.LookupEnv("ANUBIS_LOG_SUBMISSION"); ok && val == loggingDifficultyMessage {
23+
if val, ok := os.LookupEnv("ALEXANDRIA_LOG_SUBMISSION"); ok && val == loggingDifficultyMessage {
2424
lg.Info("Logging to Alexandria has been disabled by the environment variable ANUBIS_LOG_SUBMISSION. Your ability to recieve support is limited.", "docs", "https://anubis.techaro.lol/docs/admin/alexandria")
2525
return &WriterWrapper{
2626
next: next,

cmd/alexandria/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
"log/slog"
99
"net/http"
1010

11+
"github.com/TecharoHQ/alexandria/web"
12+
"github.com/TecharoHQ/alexandria/web/xess"
13+
"github.com/a-h/templ"
1114
"github.com/aws/aws-sdk-go-v2/config"
1215
"github.com/aws/aws-sdk-go-v2/service/s3"
1316
"github.com/facebookgo/flagenv"
@@ -47,6 +50,17 @@ func main() {
4750

4851
mux.Handle("PUT /upload/{kind}/{logID}", http.MaxBytesHandler(http.HandlerFunc(s.Upload), maxLogSize))
4952

53+
xess.Mount(mux)
54+
55+
mux.HandleFunc("/{$}", func(w http.ResponseWriter, r *http.Request) {
56+
templ.Handler(
57+
xess.Simple("Not found: "+r.URL.Path, web.Index()),
58+
templ.WithStatus(http.StatusTeapot),
59+
)
60+
})
61+
62+
mux.HandleFunc("/", xess.NotFound)
63+
5064
slog.Info("listening over HTTP", "bind", *bind)
5165
log.Fatal(http.ListenAndServe(*bind, mux))
5266
}

cmd/alexandria/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type Server struct {
2323
s3c *s3.Client
2424
}
2525

26+
func (s *Server) Index(w http.ResponseWriter, r *http.Request) {}
27+
2628
func (s *Server) Upload(w http.ResponseWriter, r *http.Request) {
2729
kind := r.PathValue("kind")
2830
logID := r.PathValue("logID")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Techaro's log aggregation pipeline",
55
"main": "index.js",
66
"scripts": {
7-
"dev": "npm run generate && go run ./cmd/web",
7+
"dev": "npm run generate && go run ./cmd/alexandria",
88
"format": "npx prettier -w . && go tool goimports -w .",
99
"generate": "go generate ./... && npm run format",
1010
"prepare": "husky",

web/generate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package web
2+
3+
//go:generate go tool templ generate

web/web.templ

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package web
2+
3+
templ Index() {
4+
<p>This is a log aggregation service for Anubis and other services like it. Any logs submitted to this service are security stored for one week (seven days) and then deleted. These logs are used in support or other such tasks.</p>
5+
<h2>How do I opt out of this?</h2>
6+
<p>For package maintainers, you can opt out by building Anubis with the <code>limitedsupportability</code> <a href="https://www.digitalocean.com/community/tutorials/customizing-go-binaries-with-build-tags">build tag</a>. Please note that opting out will limit the ability to support your installation of Anubis or other software.</p>
7+
<p>For users, you can opt out by running Anubis with the <code>ALEXANDRIA_LOG_SUBMISSION=i-want-to-make-it-harder-to-get-help</code> environment variable set.</p>
8+
}

web/web_templ.go

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/xess/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

0 commit comments

Comments
 (0)