Logs
erock
created pr with ps-28
on erock
added ps-29
on erock
changed status
on {"status":"open"}
erock
added ps-30
on erock
changed status
on {"status":"open"}
erock
changed pr name
on {"name":"feat: private obj store service"}
erock
added ps-31
on erock
changed status
on {"status":"open"}
erock
added ps-32
on erock
changed status
on {"status":"open"}
erock
changed status
on {"status":"closed"}
Patchsets
Diff ↕
chore(pgs): add validation to project names
Eric Bower <me@erock.io>
filehandlers/assets/handler.go | 5 +++++ pgs/cli.go | 7 ++++++- shared/bucket.go | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
1From 3bd44dafed274bb1b832e6af830ade8e172d3c5c Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 11:27:37 -0400
4Subject: [PATCH] chore(pgs): add validation to project names
5
6---
7 filehandlers/assets/handler.go | 5 +++++
8 pgs/cli.go | 7 ++++++-
9 shared/bucket.go | 7 +++++++
10 3 files changed, 18 insertions(+), 1 deletion(-)
11
12diff --git a/filehandlers/assets/handler.go b/filehandlers/assets/handler.go
13index 22edce6..1c32d82 100644
14--- a/filehandlers/assets/handler.go
15+++ b/filehandlers/assets/handler.go
16@@ -268,6 +268,11 @@ func (h *UploadAssetHandler) Write(s ssh.Session, entry *utils.FileEntry) (strin
17
18 project := getProject(s)
19 projectName := shared.GetProjectName(entry)
20+ err = shared.ValidateProjectName(projectName)
21+ if err != nil {
22+ return "", err
23+ }
24+
25 logger = logger.With("project", projectName)
26
27 // find, create, or update project if we haven't already done it
28diff --git a/pgs/cli.go b/pgs/cli.go
29index 0af5802..8e82241 100644
30--- a/pgs/cli.go
31+++ b/pgs/cli.go
32@@ -374,8 +374,13 @@ func (c *Cmd) unlink(projectName string) error {
33 func (c *Cmd) link(projectName, linkTo string) error {
34 c.Log.Info("user running `link` command", "user", c.User.Name, "project", projectName, "link", linkTo)
35
36+ err := shared.ValidateProjectName(projectName)
37+ if err != nil {
38+ return err
39+ }
40+
41 projectDir := linkTo
42- _, err := c.Dbpool.FindProjectByName(c.User.ID, linkTo)
43+ _, err = c.Dbpool.FindProjectByName(c.User.ID, linkTo)
44 if err != nil {
45 e := fmt.Errorf("(%s) project doesn't exist", linkTo)
46 return e
47diff --git a/shared/bucket.go b/shared/bucket.go
48index 1257b55..4c28d94 100644
49--- a/shared/bucket.go
50+++ b/shared/bucket.go
51@@ -17,6 +17,13 @@ func GetAssetBucketName(userID string) string {
52 return fmt.Sprintf("static-%s", userID)
53 }
54
55+func ValidateProjectName(projectName string) error {
56+ if projectName == "pico-private" {
57+ return fmt.Errorf("%s is an invalid project name", projectName)
58+ }
59+ return nil
60+}
61+
62 func GetProjectName(entry *utils.FileEntry) string {
63 if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
64 return entry.Filepath
65--
662.45.2
67
ps-28
by
erock
on Diff ↕
chore(pgs): add validation to project names
Eric Bower <me@erock.io>
filehandlers/assets/handler.go | 5 +++++ pgs/cli.go | 7 ++++++- shared/bucket.go | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
1From 9002592db6a73e16ca3795bc49b0152996e2b5e3 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 11:27:37 -0400
4Subject: [PATCH] chore(pgs): add validation to project names
5
6---
7 filehandlers/assets/handler.go | 5 +++++
8 pgs/cli.go | 7 ++++++-
9 shared/bucket.go | 7 +++++++
10 3 files changed, 18 insertions(+), 1 deletion(-)
11
12diff --git a/filehandlers/assets/handler.go b/filehandlers/assets/handler.go
13index 22edce6..1c32d82 100644
14--- a/filehandlers/assets/handler.go
15+++ b/filehandlers/assets/handler.go
16@@ -268,6 +268,11 @@ func (h *UploadAssetHandler) Write(s ssh.Session, entry *utils.FileEntry) (strin
17
18 project := getProject(s)
19 projectName := shared.GetProjectName(entry)
20+ err = shared.ValidateProjectName(projectName)
21+ if err != nil {
22+ return "", err
23+ }
24+
25 logger = logger.With("project", projectName)
26
27 // find, create, or update project if we haven't already done it
28diff --git a/pgs/cli.go b/pgs/cli.go
29index 0af5802..8e82241 100644
30--- a/pgs/cli.go
31+++ b/pgs/cli.go
32@@ -374,8 +374,13 @@ func (c *Cmd) unlink(projectName string) error {
33 func (c *Cmd) link(projectName, linkTo string) error {
34 c.Log.Info("user running `link` command", "user", c.User.Name, "project", projectName, "link", linkTo)
35
36+ err := shared.ValidateProjectName(projectName)
37+ if err != nil {
38+ return err
39+ }
40+
41 projectDir := linkTo
42- _, err := c.Dbpool.FindProjectByName(c.User.ID, linkTo)
43+ _, err = c.Dbpool.FindProjectByName(c.User.ID, linkTo)
44 if err != nil {
45 e := fmt.Errorf("(%s) project doesn't exist", linkTo)
46 return e
47diff --git a/shared/bucket.go b/shared/bucket.go
48index 1257b55..e906cf0 100644
49--- a/shared/bucket.go
50+++ b/shared/bucket.go
51@@ -17,6 +17,13 @@ func GetAssetBucketName(userID string) string {
52 return fmt.Sprintf("static-%s", userID)
53 }
54
55+func ValidateProjectName(projectName string) error {
56+ if projectName == "pico-private" || projectName == "pico-imgs" {
57+ return fmt.Errorf("%s is an invalid project name", projectName)
58+ }
59+ return nil
60+}
61+
62 func GetProjectName(entry *utils.FileEntry) string {
63 if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
64 return entry.Filepath
65--
662.45.2
67
ps-29
by
erock
on Diff ↕
chore: update pobj
Eric Bower <me@erock.io>
go.mod | 21 ++++++++++- go.sum | 40 +++++++++++++++++++++ obj/config.go | 27 ++++++++++++++ obj/ssh.go | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 obj/config.go create mode 100644 obj/ssh.go
1From cd17cf4471be5b145107db6fbb11678545c8c1b8 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 11:57:19 -0400
4Subject: [PATCH 2/3] chore: update pobj
5
6---
7 go.mod | 21 ++++++++++-
8 go.sum | 40 +++++++++++++++++++++
9 obj/config.go | 27 ++++++++++++++
10 obj/ssh.go | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
11 4 files changed, 186 insertions(+), 1 deletion(-)
12 create mode 100644 obj/config.go
13 create mode 100644 obj/ssh.go
14
15diff --git a/go.mod b/go.mod
16index 549e3ad..ace2286 100644
17--- a/go.mod
18+++ b/go.mod
19@@ -32,7 +32,7 @@ require (
20 github.com/muesli/reflow v0.3.0
21 github.com/muesli/termenv v0.15.2
22 github.com/neurosnap/go-exif-remove v0.0.0-20221010134343-50d1e3c35577
23- github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a
24+ github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5
25 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11
26 github.com/picosh/tunkit v0.0.0-20240709033345-8315d4f3cd0e
27 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
28@@ -57,6 +57,25 @@ require (
29 github.com/andybalholm/cascadia v1.3.2 // indirect
30 github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
31 github.com/atotto/clipboard v0.1.4 // indirect
32+ github.com/aws/aws-sdk-go-v2 v1.30.4 // indirect
33+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 // indirect
34+ github.com/aws/aws-sdk-go-v2/config v1.27.28 // indirect
35+ github.com/aws/aws-sdk-go-v2/credentials v1.17.28 // indirect
36+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 // indirect
37+ github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11 // indirect
38+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
39+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
40+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
41+ github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 // indirect
42+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
43+ github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18 // indirect
44+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 // indirect
45+ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 // indirect
46+ github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0 // indirect
47+ github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 // indirect
48+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 // indirect
49+ github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 // indirect
50+ github.com/aws/smithy-go v1.20.4 // indirect
51 github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
52 github.com/aymerick/douceur v0.2.0 // indirect
53 github.com/beorn7/perks v1.0.1 // indirect
54diff --git a/go.sum b/go.sum
55index 2577975..d87c73a 100644
56--- a/go.sum
57+++ b/go.sum
58@@ -21,6 +21,44 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP
59 github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
60 github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
61 github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
62+github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8=
63+github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
64+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 h1:70PVAiL15/aBMh5LThwgXdSQorVr91L127ttckI9QQU=
65+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4/go.mod h1:/MQxMqci8tlqDH+pjmoLu1i0tbWCUP1hhyMRuFxpQCw=
66+github.com/aws/aws-sdk-go-v2/config v1.27.28 h1:OTxWGW/91C61QlneCtnD62NLb4W616/NM1jA8LhJqbg=
67+github.com/aws/aws-sdk-go-v2/config v1.27.28/go.mod h1:uzVRVtJSU5EFv6Fu82AoVFKozJi2ZCY6WRCXj06rbvs=
68+github.com/aws/aws-sdk-go-v2/credentials v1.17.28 h1:m8+AHY/ND8CMHJnPoH7PJIRakWGa4gbfbxuY9TGTUXM=
69+github.com/aws/aws-sdk-go-v2/credentials v1.17.28/go.mod h1:6TF7dSc78ehD1SL6KpRIPKMA1GyyWflIkjqg+qmf4+c=
70+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 h1:yjwoSyDZF8Jth+mUk5lSPJCkMC0lMy6FaCD51jm6ayE=
71+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12/go.mod h1:fuR57fAgMk7ot3WcNQfb6rSEn+SUffl7ri+aa8uKysI=
72+github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11 h1:FEDZD/Axt5tKSkPAs967KZ++MkvYdBqr0a+cetRbjLM=
73+github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11/go.mod h1:dvlsbA32KfvCzqwTiX7maABgFek2RyUuYEJ3kyn/PmQ=
74+github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY=
75+github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16/go.mod h1:2DwJF39FlNAUiX5pAc0UNeiz16lK2t7IaFcm0LFHEgc=
76+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 h1:jYfy8UPmd+6kJW5YhY0L1/KftReOGxI/4NtVSTh9O/I=
77+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16/go.mod h1:7ZfEPZxkW42Afq4uQB8H2E2e6ebh6mXTueEpYzjCzcs=
78+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
79+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
80+github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 h1:mimdLQkIX1zr8GIPY1ZtALdBQGxcASiBd2MOp8m/dMc=
81+github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16/go.mod h1:YHk6owoSwrIsok+cAH9PENCOGoH5PU2EllX4vLtSrsY=
82+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI=
83+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc=
84+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18 h1:GckUnpm4EJOAio1c8o25a+b3lVfwVzC9gnSBqiiNmZM=
85+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18/go.mod h1:Br6+bxfG33Dk3ynmkhsW2Z/t9D4+lRqdLDNCKi85w0U=
86+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 h1:tJ5RnkHCiSH0jyd6gROjlJtNwov0eGYNz8s8nFcR0jQ=
87+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18/go.mod h1:++NHzT+nAF7ZPrHPsA+ENvsXkOO8wEu+C6RXltAG4/c=
88+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 h1:jg16PhLPUiHIj8zYIW6bqzeQSuHVEiWnGA0Brz5Xv2I=
89+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16/go.mod h1:Uyk1zE1VVdsHSU7096h/rwnXDzOzYQVl+FNPhPw7ShY=
90+github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0 h1:Cso4Ev/XauMVsbwdhYEoxg8rxZWw43CFqqaPB5w3W2c=
91+github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0/go.mod h1:BSPI0EfnYUuNHPS0uqIo5VrRwzie+Fp+YhQOUs16sKI=
92+github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 h1:zCsFCKvbj25i7p1u94imVoO447I/sFv8qq+lGJhRN0c=
93+github.com/aws/aws-sdk-go-v2/service/sso v1.22.5/go.mod h1:ZeDX1SnKsVlejeuz41GiajjZpRSWR7/42q/EyA/QEiM=
94+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 h1:SKvPgvdvmiTWoi0GAJ7AsJfOz3ngVkD/ERbs5pUnHNI=
95+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5/go.mod h1:20sz31hv/WsPa3HhU3hfrIet2kxM4Pe0r20eBZ20Tac=
96+github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 h1:iAckBT2OeEK/kBDyN/jDtpEExhjeeA/Im2q4X0rJZT8=
97+github.com/aws/aws-sdk-go-v2/service/sts v1.30.4/go.mod h1:vmSqFK+BVIwVpDAGZB3CoCXHzurt4qBE8lf+I/kRTh0=
98+github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4=
99+github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
100 github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
101 github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
102 github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
103@@ -224,6 +262,8 @@ github.com/picosh/go-rsync-receiver v0.0.0-20240709135253-1daf4b12a9fc h1:bvcsoO
104 github.com/picosh/go-rsync-receiver v0.0.0-20240709135253-1daf4b12a9fc/go.mod h1:i0iR3W4GSm1PuvVxB9OH32E5jP+CYkVb2NQSe0JCtlo=
105 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a h1:Cr1xODiyd/SjjBRtYA9VX6Do3D+w+DansQzkb4NGeyA=
106 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a/go.mod h1:VIkR1MZBvxSK2OO47jikxikAO/sKb/vTmXX5ZuYTIvo=
107+github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5 h1:gYoKG14iOjlYYCTiyFiOgybrqAOpnAqe6YU5QXnn8+A=
108+github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
109 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11 h1:ElTyYxJPPfAz+NLRL9qy+SQ9UYaSGlWXWl2yYrLPzCU=
110 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11/go.mod h1:RAgLDK3LrDK6pNeXtU9tjo28obl5DxShcTUk2nm/KCM=
111 github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELijb//dYhyCo8A3fvxW5dijrJVtjs=
112diff --git a/obj/config.go b/obj/config.go
113new file mode 100644
114index 0000000..6e4747b
115--- /dev/null
116+++ b/obj/config.go
117@@ -0,0 +1,27 @@
118+package obj
119+
120+import (
121+ "github.com/picosh/pico/shared"
122+)
123+
124+func NewConfigSite() *shared.ConfigSite {
125+ debug := shared.GetEnv("OBJ_DEBUG", "0")
126+ storageDir := shared.GetEnv("OBJ_STORAGE_DIR", ".storage")
127+ minioURL := shared.GetEnv("MINIO_URL", "")
128+ minioUser := shared.GetEnv("MINIO_ROOT_USER", "")
129+ minioPass := shared.GetEnv("MINIO_ROOT_PASSWORD", "")
130+ dbURL := shared.GetEnv("DATABASE_URL", "")
131+
132+ cfg := shared.ConfigSite{
133+ Debug: debug == "1",
134+ DbURL: dbURL,
135+ StorageDir: storageDir,
136+ MinioURL: minioURL,
137+ MinioUser: minioUser,
138+ MinioPass: minioPass,
139+ Space: "obj",
140+ Logger: shared.CreateLogger(debug == "1"),
141+ }
142+
143+ return &cfg
144+}
145diff --git a/obj/ssh.go b/obj/ssh.go
146new file mode 100644
147index 0000000..ab70493
148--- /dev/null
149+++ b/obj/ssh.go
150@@ -0,0 +1,99 @@
151+package obj
152+
153+import (
154+ "context"
155+ "fmt"
156+ "log/slog"
157+ "os"
158+ "os/signal"
159+ "path/filepath"
160+ "syscall"
161+ "time"
162+
163+ "github.com/charmbracelet/wish"
164+ "github.com/picosh/pico/db"
165+ "github.com/picosh/pico/db/postgres"
166+ "github.com/picosh/pico/filehandlers/util"
167+ "github.com/picosh/pico/shared"
168+ "github.com/picosh/pico/shared/storage"
169+ "github.com/picosh/pobj"
170+ "github.com/picosh/send/send/utils"
171+)
172+
173+type AssetNamesPriv struct {
174+ DBPool db.DB
175+}
176+
177+var _ pobj.AssetNames = &AssetNamesPriv{}
178+var _ pobj.AssetNames = (*AssetNamesPriv)(nil)
179+
180+func (an *AssetNamesPriv) BucketName(userName string) string {
181+ user, _ := an.DBPool.FindUserForName(userName)
182+ return shared.GetAssetBucketName(user.ID)
183+}
184+func (an *AssetNamesPriv) ObjectName(entry *utils.FileEntry) string {
185+ return filepath.Join("pico-private", entry.Filepath)
186+}
187+
188+func StartSshServer() {
189+ logger := slog.Default()
190+ host := pobj.GetEnv("OBJ_SSH_HOST", "0.0.0.0")
191+ port := pobj.GetEnv("OBJ_SSH_PORT", "2222")
192+ cfg := NewConfigSite()
193+ dbpool := postgres.NewDB(cfg.DbURL, cfg.Logger)
194+ defer dbpool.Close()
195+
196+ var st storage.StorageServe
197+ var err error
198+ if cfg.MinioURL == "" {
199+ st, err = storage.NewStorageFS(cfg.StorageDir)
200+ } else {
201+ st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass)
202+ }
203+
204+ assetNames := &AssetNamesPriv{
205+ DBPool: dbpool,
206+ }
207+ objcfg := &pobj.Config{
208+ Logger: logger,
209+ Storage: st,
210+ AssetNames: assetNames,
211+ }
212+
213+ handler := pobj.NewUploadAssetHandler(objcfg)
214+
215+ sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
216+ s, err := wish.NewServer(
217+ wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
218+ wish.WithHostKeyPath("ssh_data/term_info_ed25519"),
219+ wish.WithPublicKeyAuth(sshAuth.PubkeyAuthHandler),
220+ pobj.WithProxy(handler),
221+ )
222+ if err != nil {
223+ logger.Error(err.Error())
224+ return
225+ }
226+
227+ done := make(chan os.Signal, 1)
228+ signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
229+ logger.Info(
230+ "starting SSH server",
231+ "host", host,
232+ "port", port,
233+ )
234+ go func() {
235+ if err = s.ListenAndServe(); err != nil {
236+ logger.Error(err.Error())
237+ }
238+ }()
239+
240+ <-done
241+ logger.Info("stopping SSH server")
242+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
243+ defer func() {
244+ cancel()
245+ }()
246+ if err := s.Shutdown(ctx); err != nil {
247+ logger.Error(err.Error())
248+ }
249+}
250--
2512.45.2
252
chore: complete impl
Eric Bower <me@erock.io>
cmd/obj/ssh/main.go | 7 +++++++ obj/ssh.go | 28 +++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 cmd/obj/ssh/main.go
1From a00def2eecb51eca1d70bcd55c12effeaebb86d5 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:02:22 -0400
4Subject: [PATCH 3/3] chore: complete impl
5
6---
7 cmd/obj/ssh/main.go | 7 +++++++
8 obj/ssh.go | 28 +++++++++++++++-------------
9 2 files changed, 22 insertions(+), 13 deletions(-)
10 create mode 100644 cmd/obj/ssh/main.go
11
12diff --git a/cmd/obj/ssh/main.go b/cmd/obj/ssh/main.go
13new file mode 100644
14index 0000000..c2ee277
15--- /dev/null
16+++ b/cmd/obj/ssh/main.go
17@@ -0,0 +1,7 @@
18+package main
19+
20+import "github.com/picosh/pico/obj"
21+
22+func main() {
23+ obj.StartSshServer()
24+}
25diff --git a/obj/ssh.go b/obj/ssh.go
26index ab70493..0d4b0eb 100644
27--- a/obj/ssh.go
28+++ b/obj/ssh.go
29@@ -10,8 +10,8 @@ import (
30 "syscall"
31 "time"
32
33+ "github.com/charmbracelet/ssh"
34 "github.com/charmbracelet/wish"
35- "github.com/picosh/pico/db"
36 "github.com/picosh/pico/db/postgres"
37 "github.com/picosh/pico/filehandlers/util"
38 "github.com/picosh/pico/shared"
39@@ -20,19 +20,20 @@ import (
40 "github.com/picosh/send/send/utils"
41 )
42
43-type AssetNamesPriv struct {
44- DBPool db.DB
45-}
46+type AssetNamesPriv struct{}
47
48 var _ pobj.AssetNames = &AssetNamesPriv{}
49 var _ pobj.AssetNames = (*AssetNamesPriv)(nil)
50
51-func (an *AssetNamesPriv) BucketName(userName string) string {
52- user, _ := an.DBPool.FindUserForName(userName)
53- return shared.GetAssetBucketName(user.ID)
54+func (an *AssetNamesPriv) BucketName(sesh ssh.Session) (string, error) {
55+ user, err := util.GetUser(sesh.Context())
56+ if err != nil {
57+ return "", err
58+ }
59+ return shared.GetAssetBucketName(user.ID), nil
60 }
61-func (an *AssetNamesPriv) ObjectName(entry *utils.FileEntry) string {
62- return filepath.Join("pico-private", entry.Filepath)
63+func (an *AssetNamesPriv) ObjectName(sesh ssh.Session, entry *utils.FileEntry) (string, error) {
64+ return filepath.Join("/pico-private", entry.Filepath), nil
65 }
66
67 func StartSshServer() {
68@@ -50,10 +51,12 @@ func StartSshServer() {
69 } else {
70 st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass)
71 }
72-
73- assetNames := &AssetNamesPriv{
74- DBPool: dbpool,
75+ if err != nil {
76+ logger.Error(err.Error())
77+ return
78 }
79+
80+ assetNames := &AssetNamesPriv{}
81 objcfg := &pobj.Config{
82 Logger: logger,
83 Storage: st,
84@@ -61,7 +64,6 @@ func StartSshServer() {
85 }
86
87 handler := pobj.NewUploadAssetHandler(objcfg)
88-
89 sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
90 s, err := wish.NewServer(
91 wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
92--
932.45.2
94
ps-30
by
erock
on Diff ↕
chore: update pobj
Eric Bower <me@erock.io>
go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
1From 0ed7dc9b88a7c87469b76bad860a2410c924a1ab Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:33:25 -0400
4Subject: [PATCH 4/5] chore: update pobj
5
6---
7 go.mod | 2 +-
8 go.sum | 2 ++
9 2 files changed, 3 insertions(+), 1 deletion(-)
10
11diff --git a/go.mod b/go.mod
12index ace2286..7a925c5 100644
13--- a/go.mod
14+++ b/go.mod
15@@ -32,7 +32,7 @@ require (
16 github.com/muesli/reflow v0.3.0
17 github.com/muesli/termenv v0.15.2
18 github.com/neurosnap/go-exif-remove v0.0.0-20221010134343-50d1e3c35577
19- github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5
20+ github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5
21 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11
22 github.com/picosh/tunkit v0.0.0-20240709033345-8315d4f3cd0e
23 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
24diff --git a/go.sum b/go.sum
25index d87c73a..470b1f1 100644
26--- a/go.sum
27+++ b/go.sum
28@@ -264,6 +264,8 @@ github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a h1:Cr1xODiyd/SjjBRtYA9
29 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a/go.mod h1:VIkR1MZBvxSK2OO47jikxikAO/sKb/vTmXX5ZuYTIvo=
30 github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5 h1:gYoKG14iOjlYYCTiyFiOgybrqAOpnAqe6YU5QXnn8+A=
31 github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
32+github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5 h1:jr1dHKPSHmsjTCo7WKDuNOe0k0Sls+8rsfkXnCH4mck=
33+github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
34 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11 h1:ElTyYxJPPfAz+NLRL9qy+SQ9UYaSGlWXWl2yYrLPzCU=
35 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11/go.mod h1:RAgLDK3LrDK6pNeXtU9tjo28obl5DxShcTUk2nm/KCM=
36 github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELijb//dYhyCo8A3fvxW5dijrJVtjs=
37--
382.45.2
39
working!
Eric Bower <me@erock.io>
obj/ssh.go | 3 +++ 1 file changed, 3 insertions(+)
1From 8ff1131a8874f3bed55da5ac85c12d9ce470df7d Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:37:25 -0400
4Subject: [PATCH 5/5] working!
5
6---
7 obj/ssh.go | 3 +++
8 1 file changed, 3 insertions(+)
9
10diff --git a/obj/ssh.go b/obj/ssh.go
11index 0d4b0eb..3dabfdd 100644
12--- a/obj/ssh.go
13+++ b/obj/ssh.go
14@@ -35,6 +35,9 @@ func (an *AssetNamesPriv) BucketName(sesh ssh.Session) (string, error) {
15 func (an *AssetNamesPriv) ObjectName(sesh ssh.Session, entry *utils.FileEntry) (string, error) {
16 return filepath.Join("/pico-private", entry.Filepath), nil
17 }
18+func (an *AssetNamesPriv) PrintObjectName(sesh ssh.Session, entry *utils.FileEntry, bucketName string) (string, error) {
19+ return entry.Filepath, nil
20+}
21
22 func StartSshServer() {
23 logger := slog.Default()
24--
252.45.2
26
ps-31
by
erock
on Diff ↕
chore(obj): prep service def
Eric Bower <me@erock.io>
Makefile | 10 +++++++++- docker-compose.override.yml | 11 +++++++++++ docker-compose.prod.yml | 12 ++++++++++++ docker-compose.yml | 7 +++++++ projects.txt | 5 ----- 5 files changed, 39 insertions(+), 6 deletions(-) delete mode 100644 projects.txt
1From 0c8ad0d411abaa1b490d6e213cc8c3f2d4d56ab0 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 22:01:14 -0400
4Subject: [PATCH 6/6] chore(obj): prep service def
5
6---
7 Makefile | 10 +++++++++-
8 docker-compose.override.yml | 11 +++++++++++
9 docker-compose.prod.yml | 12 ++++++++++++
10 docker-compose.yml | 7 +++++++
11 projects.txt | 5 -----
12 5 files changed, 39 insertions(+), 6 deletions(-)
13 delete mode 100644 projects.txt
14
15diff --git a/Makefile b/Makefile
16index 050b7b6..7cd7863 100644
17--- a/Makefile
18+++ b/Makefile
19@@ -53,7 +53,11 @@ bp-%: bp-setup
20 $(DOCKER_BUILDX_BUILD) --build-arg "APP=$*" -t "ghcr.io/picosh/pico/$*-web:$(DOCKER_TAG)" --target release-web .
21 .PHONY: bp-%
22
23-bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer
24+bp-obj: bp-setup
25+ $(DOCKER_BUILDX_BUILD) --build-arg "APP=obj" -t "ghcr.io/picosh/pico/obj-ssh:$(DOCKER_TAG)" --target release-ssh .
26+.PHONY: bp-bouncer
27+
28+bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer bp-obj
29 .PHONY: bp-all
30
31 build-auth:
32@@ -64,6 +68,10 @@ build-pico:
33 go build -o "build/pico-ssh" "./cmd/pico/ssh"
34 .PHONY: build-auth
35
36+build-obj:
37+ go build -o "build/obj-ssh" "./cmd/obj/ssh"
38+.PHONY: build-auth
39+
40 build-%:
41 go build -o "build/$*-web" "./cmd/$*/web"
42 go build -o "build/$*-ssh" "./cmd/$*/ssh"
43diff --git a/docker-compose.override.yml b/docker-compose.override.yml
44index 65b1cd9..298b87a 100644
45--- a/docker-compose.override.yml
46+++ b/docker-compose.override.yml
47@@ -142,6 +142,17 @@ services:
48 - ./data/pico-ssh/data:/app/ssh_data
49 ports:
50 - "2226:2222"
51+ obj-ssh:
52+ build:
53+ args:
54+ APP: obj
55+ target: release-ssh
56+ env_file:
57+ - .env.example
58+ volumes:
59+ - ./data/obj-ssh/data:/app/ssh_data
60+ ports:
61+ - "2227:2222"
62 auth-web:
63 build:
64 args:
65diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
66index 0195b37..f4b2679 100644
67--- a/docker-compose.prod.yml
68+++ b/docker-compose.prod.yml
69@@ -301,6 +301,18 @@ services:
70 ports:
71 - "${PICO_SSH_V4:-22}:2222"
72 - "${PICO_SSH_V6:-[::1]:22}:2222"
73+ obj-ssh:
74+ networks:
75+ pico:
76+ aliases:
77+ - ssh
78+ env_file:
79+ - .env.prod
80+ volumes:
81+ - ./data/obj-ssh/data:/app/ssh_data
82+ ports:
83+ - "${OBJ_SSH_V4:-22}:2222"
84+ - "${OBJ_SSH_V6:-[::1]:22}:2222"
85
86 networks:
87 default:
88diff --git a/docker-compose.yml b/docker-compose.yml
89index 9a6a10c..d449bc1 100644
90--- a/docker-compose.yml
91+++ b/docker-compose.yml
92@@ -106,6 +106,13 @@ services:
93 - pico
94 - services
95 - all
96+ obj-ssh:
97+ image: ghcr.io/picosh/pico/obj-ssh:latest
98+ restart: always
99+ profiles:
100+ - obj
101+ - services
102+ - all
103 auth-web:
104 image: ghcr.io/picosh/pico/auth-web:latest
105 restart: always
106diff --git a/projects.txt b/projects.txt
107deleted file mode 100644
108index 629a543..0000000
109--- a/projects.txt
110+++ /dev/null
111@@ -1,5 +0,0 @@
112-docs
113-test
114-tester
115-ui
116-
117--
1182.45.2
119
ps-32
by
erock
on chore(pgs): add validation to project names
Eric Bower <me@erock.io>
filehandlers/assets/handler.go | 5 +++++ pgs/cli.go | 7 ++++++- shared/bucket.go | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
1From 9002592db6a73e16ca3795bc49b0152996e2b5e3 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 11:27:37 -0400
4Subject: [PATCH 1/6] chore(pgs): add validation to project names
5
6---
7 filehandlers/assets/handler.go | 5 +++++
8 pgs/cli.go | 7 ++++++-
9 shared/bucket.go | 7 +++++++
10 3 files changed, 18 insertions(+), 1 deletion(-)
11
12diff --git a/filehandlers/assets/handler.go b/filehandlers/assets/handler.go
13index 22edce6..1c32d82 100644
14--- a/filehandlers/assets/handler.go
15+++ b/filehandlers/assets/handler.go
16@@ -268,6 +268,11 @@ func (h *UploadAssetHandler) Write(s ssh.Session, entry *utils.FileEntry) (strin
17
18 project := getProject(s)
19 projectName := shared.GetProjectName(entry)
20+ err = shared.ValidateProjectName(projectName)
21+ if err != nil {
22+ return "", err
23+ }
24+
25 logger = logger.With("project", projectName)
26
27 // find, create, or update project if we haven't already done it
28diff --git a/pgs/cli.go b/pgs/cli.go
29index 0af5802..8e82241 100644
30--- a/pgs/cli.go
31+++ b/pgs/cli.go
32@@ -374,8 +374,13 @@ func (c *Cmd) unlink(projectName string) error {
33 func (c *Cmd) link(projectName, linkTo string) error {
34 c.Log.Info("user running `link` command", "user", c.User.Name, "project", projectName, "link", linkTo)
35
36+ err := shared.ValidateProjectName(projectName)
37+ if err != nil {
38+ return err
39+ }
40+
41 projectDir := linkTo
42- _, err := c.Dbpool.FindProjectByName(c.User.ID, linkTo)
43+ _, err = c.Dbpool.FindProjectByName(c.User.ID, linkTo)
44 if err != nil {
45 e := fmt.Errorf("(%s) project doesn't exist", linkTo)
46 return e
47diff --git a/shared/bucket.go b/shared/bucket.go
48index 1257b55..e906cf0 100644
49--- a/shared/bucket.go
50+++ b/shared/bucket.go
51@@ -17,6 +17,13 @@ func GetAssetBucketName(userID string) string {
52 return fmt.Sprintf("static-%s", userID)
53 }
54
55+func ValidateProjectName(projectName string) error {
56+ if projectName == "pico-private" || projectName == "pico-imgs" {
57+ return fmt.Errorf("%s is an invalid project name", projectName)
58+ }
59+ return nil
60+}
61+
62 func GetProjectName(entry *utils.FileEntry) string {
63 if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
64 return entry.Filepath
65--
662.45.2
67
chore: update pobj
Eric Bower <me@erock.io>
go.mod | 21 ++++++++++- go.sum | 40 +++++++++++++++++++++ obj/config.go | 27 ++++++++++++++ obj/ssh.go | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 obj/config.go create mode 100644 obj/ssh.go
1From cd17cf4471be5b145107db6fbb11678545c8c1b8 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 11:57:19 -0400
4Subject: [PATCH 2/6] chore: update pobj
5
6---
7 go.mod | 21 ++++++++++-
8 go.sum | 40 +++++++++++++++++++++
9 obj/config.go | 27 ++++++++++++++
10 obj/ssh.go | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
11 4 files changed, 186 insertions(+), 1 deletion(-)
12 create mode 100644 obj/config.go
13 create mode 100644 obj/ssh.go
14
15diff --git a/go.mod b/go.mod
16index 549e3ad..ace2286 100644
17--- a/go.mod
18+++ b/go.mod
19@@ -32,7 +32,7 @@ require (
20 github.com/muesli/reflow v0.3.0
21 github.com/muesli/termenv v0.15.2
22 github.com/neurosnap/go-exif-remove v0.0.0-20221010134343-50d1e3c35577
23- github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a
24+ github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5
25 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11
26 github.com/picosh/tunkit v0.0.0-20240709033345-8315d4f3cd0e
27 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
28@@ -57,6 +57,25 @@ require (
29 github.com/andybalholm/cascadia v1.3.2 // indirect
30 github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
31 github.com/atotto/clipboard v0.1.4 // indirect
32+ github.com/aws/aws-sdk-go-v2 v1.30.4 // indirect
33+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 // indirect
34+ github.com/aws/aws-sdk-go-v2/config v1.27.28 // indirect
35+ github.com/aws/aws-sdk-go-v2/credentials v1.17.28 // indirect
36+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 // indirect
37+ github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11 // indirect
38+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
39+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
40+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
41+ github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 // indirect
42+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
43+ github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18 // indirect
44+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 // indirect
45+ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 // indirect
46+ github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0 // indirect
47+ github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 // indirect
48+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 // indirect
49+ github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 // indirect
50+ github.com/aws/smithy-go v1.20.4 // indirect
51 github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
52 github.com/aymerick/douceur v0.2.0 // indirect
53 github.com/beorn7/perks v1.0.1 // indirect
54diff --git a/go.sum b/go.sum
55index 2577975..d87c73a 100644
56--- a/go.sum
57+++ b/go.sum
58@@ -21,6 +21,44 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP
59 github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
60 github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
61 github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
62+github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8=
63+github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
64+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 h1:70PVAiL15/aBMh5LThwgXdSQorVr91L127ttckI9QQU=
65+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4/go.mod h1:/MQxMqci8tlqDH+pjmoLu1i0tbWCUP1hhyMRuFxpQCw=
66+github.com/aws/aws-sdk-go-v2/config v1.27.28 h1:OTxWGW/91C61QlneCtnD62NLb4W616/NM1jA8LhJqbg=
67+github.com/aws/aws-sdk-go-v2/config v1.27.28/go.mod h1:uzVRVtJSU5EFv6Fu82AoVFKozJi2ZCY6WRCXj06rbvs=
68+github.com/aws/aws-sdk-go-v2/credentials v1.17.28 h1:m8+AHY/ND8CMHJnPoH7PJIRakWGa4gbfbxuY9TGTUXM=
69+github.com/aws/aws-sdk-go-v2/credentials v1.17.28/go.mod h1:6TF7dSc78ehD1SL6KpRIPKMA1GyyWflIkjqg+qmf4+c=
70+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 h1:yjwoSyDZF8Jth+mUk5lSPJCkMC0lMy6FaCD51jm6ayE=
71+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12/go.mod h1:fuR57fAgMk7ot3WcNQfb6rSEn+SUffl7ri+aa8uKysI=
72+github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11 h1:FEDZD/Axt5tKSkPAs967KZ++MkvYdBqr0a+cetRbjLM=
73+github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.11/go.mod h1:dvlsbA32KfvCzqwTiX7maABgFek2RyUuYEJ3kyn/PmQ=
74+github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY=
75+github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16/go.mod h1:2DwJF39FlNAUiX5pAc0UNeiz16lK2t7IaFcm0LFHEgc=
76+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 h1:jYfy8UPmd+6kJW5YhY0L1/KftReOGxI/4NtVSTh9O/I=
77+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16/go.mod h1:7ZfEPZxkW42Afq4uQB8H2E2e6ebh6mXTueEpYzjCzcs=
78+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
79+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
80+github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 h1:mimdLQkIX1zr8GIPY1ZtALdBQGxcASiBd2MOp8m/dMc=
81+github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16/go.mod h1:YHk6owoSwrIsok+cAH9PENCOGoH5PU2EllX4vLtSrsY=
82+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI=
83+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc=
84+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18 h1:GckUnpm4EJOAio1c8o25a+b3lVfwVzC9gnSBqiiNmZM=
85+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18/go.mod h1:Br6+bxfG33Dk3ynmkhsW2Z/t9D4+lRqdLDNCKi85w0U=
86+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 h1:tJ5RnkHCiSH0jyd6gROjlJtNwov0eGYNz8s8nFcR0jQ=
87+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18/go.mod h1:++NHzT+nAF7ZPrHPsA+ENvsXkOO8wEu+C6RXltAG4/c=
88+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 h1:jg16PhLPUiHIj8zYIW6bqzeQSuHVEiWnGA0Brz5Xv2I=
89+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16/go.mod h1:Uyk1zE1VVdsHSU7096h/rwnXDzOzYQVl+FNPhPw7ShY=
90+github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0 h1:Cso4Ev/XauMVsbwdhYEoxg8rxZWw43CFqqaPB5w3W2c=
91+github.com/aws/aws-sdk-go-v2/service/s3 v1.59.0/go.mod h1:BSPI0EfnYUuNHPS0uqIo5VrRwzie+Fp+YhQOUs16sKI=
92+github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 h1:zCsFCKvbj25i7p1u94imVoO447I/sFv8qq+lGJhRN0c=
93+github.com/aws/aws-sdk-go-v2/service/sso v1.22.5/go.mod h1:ZeDX1SnKsVlejeuz41GiajjZpRSWR7/42q/EyA/QEiM=
94+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 h1:SKvPgvdvmiTWoi0GAJ7AsJfOz3ngVkD/ERbs5pUnHNI=
95+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5/go.mod h1:20sz31hv/WsPa3HhU3hfrIet2kxM4Pe0r20eBZ20Tac=
96+github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 h1:iAckBT2OeEK/kBDyN/jDtpEExhjeeA/Im2q4X0rJZT8=
97+github.com/aws/aws-sdk-go-v2/service/sts v1.30.4/go.mod h1:vmSqFK+BVIwVpDAGZB3CoCXHzurt4qBE8lf+I/kRTh0=
98+github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4=
99+github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
100 github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
101 github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
102 github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
103@@ -224,6 +262,8 @@ github.com/picosh/go-rsync-receiver v0.0.0-20240709135253-1daf4b12a9fc h1:bvcsoO
104 github.com/picosh/go-rsync-receiver v0.0.0-20240709135253-1daf4b12a9fc/go.mod h1:i0iR3W4GSm1PuvVxB9OH32E5jP+CYkVb2NQSe0JCtlo=
105 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a h1:Cr1xODiyd/SjjBRtYA9VX6Do3D+w+DansQzkb4NGeyA=
106 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a/go.mod h1:VIkR1MZBvxSK2OO47jikxikAO/sKb/vTmXX5ZuYTIvo=
107+github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5 h1:gYoKG14iOjlYYCTiyFiOgybrqAOpnAqe6YU5QXnn8+A=
108+github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
109 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11 h1:ElTyYxJPPfAz+NLRL9qy+SQ9UYaSGlWXWl2yYrLPzCU=
110 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11/go.mod h1:RAgLDK3LrDK6pNeXtU9tjo28obl5DxShcTUk2nm/KCM=
111 github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELijb//dYhyCo8A3fvxW5dijrJVtjs=
112diff --git a/obj/config.go b/obj/config.go
113new file mode 100644
114index 0000000..6e4747b
115--- /dev/null
116+++ b/obj/config.go
117@@ -0,0 +1,27 @@
118+package obj
119+
120+import (
121+ "github.com/picosh/pico/shared"
122+)
123+
124+func NewConfigSite() *shared.ConfigSite {
125+ debug := shared.GetEnv("OBJ_DEBUG", "0")
126+ storageDir := shared.GetEnv("OBJ_STORAGE_DIR", ".storage")
127+ minioURL := shared.GetEnv("MINIO_URL", "")
128+ minioUser := shared.GetEnv("MINIO_ROOT_USER", "")
129+ minioPass := shared.GetEnv("MINIO_ROOT_PASSWORD", "")
130+ dbURL := shared.GetEnv("DATABASE_URL", "")
131+
132+ cfg := shared.ConfigSite{
133+ Debug: debug == "1",
134+ DbURL: dbURL,
135+ StorageDir: storageDir,
136+ MinioURL: minioURL,
137+ MinioUser: minioUser,
138+ MinioPass: minioPass,
139+ Space: "obj",
140+ Logger: shared.CreateLogger(debug == "1"),
141+ }
142+
143+ return &cfg
144+}
145diff --git a/obj/ssh.go b/obj/ssh.go
146new file mode 100644
147index 0000000..ab70493
148--- /dev/null
149+++ b/obj/ssh.go
150@@ -0,0 +1,99 @@
151+package obj
152+
153+import (
154+ "context"
155+ "fmt"
156+ "log/slog"
157+ "os"
158+ "os/signal"
159+ "path/filepath"
160+ "syscall"
161+ "time"
162+
163+ "github.com/charmbracelet/wish"
164+ "github.com/picosh/pico/db"
165+ "github.com/picosh/pico/db/postgres"
166+ "github.com/picosh/pico/filehandlers/util"
167+ "github.com/picosh/pico/shared"
168+ "github.com/picosh/pico/shared/storage"
169+ "github.com/picosh/pobj"
170+ "github.com/picosh/send/send/utils"
171+)
172+
173+type AssetNamesPriv struct {
174+ DBPool db.DB
175+}
176+
177+var _ pobj.AssetNames = &AssetNamesPriv{}
178+var _ pobj.AssetNames = (*AssetNamesPriv)(nil)
179+
180+func (an *AssetNamesPriv) BucketName(userName string) string {
181+ user, _ := an.DBPool.FindUserForName(userName)
182+ return shared.GetAssetBucketName(user.ID)
183+}
184+func (an *AssetNamesPriv) ObjectName(entry *utils.FileEntry) string {
185+ return filepath.Join("pico-private", entry.Filepath)
186+}
187+
188+func StartSshServer() {
189+ logger := slog.Default()
190+ host := pobj.GetEnv("OBJ_SSH_HOST", "0.0.0.0")
191+ port := pobj.GetEnv("OBJ_SSH_PORT", "2222")
192+ cfg := NewConfigSite()
193+ dbpool := postgres.NewDB(cfg.DbURL, cfg.Logger)
194+ defer dbpool.Close()
195+
196+ var st storage.StorageServe
197+ var err error
198+ if cfg.MinioURL == "" {
199+ st, err = storage.NewStorageFS(cfg.StorageDir)
200+ } else {
201+ st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass)
202+ }
203+
204+ assetNames := &AssetNamesPriv{
205+ DBPool: dbpool,
206+ }
207+ objcfg := &pobj.Config{
208+ Logger: logger,
209+ Storage: st,
210+ AssetNames: assetNames,
211+ }
212+
213+ handler := pobj.NewUploadAssetHandler(objcfg)
214+
215+ sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
216+ s, err := wish.NewServer(
217+ wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
218+ wish.WithHostKeyPath("ssh_data/term_info_ed25519"),
219+ wish.WithPublicKeyAuth(sshAuth.PubkeyAuthHandler),
220+ pobj.WithProxy(handler),
221+ )
222+ if err != nil {
223+ logger.Error(err.Error())
224+ return
225+ }
226+
227+ done := make(chan os.Signal, 1)
228+ signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
229+ logger.Info(
230+ "starting SSH server",
231+ "host", host,
232+ "port", port,
233+ )
234+ go func() {
235+ if err = s.ListenAndServe(); err != nil {
236+ logger.Error(err.Error())
237+ }
238+ }()
239+
240+ <-done
241+ logger.Info("stopping SSH server")
242+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
243+ defer func() {
244+ cancel()
245+ }()
246+ if err := s.Shutdown(ctx); err != nil {
247+ logger.Error(err.Error())
248+ }
249+}
250--
2512.45.2
252
chore: complete impl
Eric Bower <me@erock.io>
cmd/obj/ssh/main.go | 7 +++++++ obj/ssh.go | 28 +++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 cmd/obj/ssh/main.go
1From a00def2eecb51eca1d70bcd55c12effeaebb86d5 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:02:22 -0400
4Subject: [PATCH 3/6] chore: complete impl
5
6---
7 cmd/obj/ssh/main.go | 7 +++++++
8 obj/ssh.go | 28 +++++++++++++++-------------
9 2 files changed, 22 insertions(+), 13 deletions(-)
10 create mode 100644 cmd/obj/ssh/main.go
11
12diff --git a/cmd/obj/ssh/main.go b/cmd/obj/ssh/main.go
13new file mode 100644
14index 0000000..c2ee277
15--- /dev/null
16+++ b/cmd/obj/ssh/main.go
17@@ -0,0 +1,7 @@
18+package main
19+
20+import "github.com/picosh/pico/obj"
21+
22+func main() {
23+ obj.StartSshServer()
24+}
25diff --git a/obj/ssh.go b/obj/ssh.go
26index ab70493..0d4b0eb 100644
27--- a/obj/ssh.go
28+++ b/obj/ssh.go
29@@ -10,8 +10,8 @@ import (
30 "syscall"
31 "time"
32
33+ "github.com/charmbracelet/ssh"
34 "github.com/charmbracelet/wish"
35- "github.com/picosh/pico/db"
36 "github.com/picosh/pico/db/postgres"
37 "github.com/picosh/pico/filehandlers/util"
38 "github.com/picosh/pico/shared"
39@@ -20,19 +20,20 @@ import (
40 "github.com/picosh/send/send/utils"
41 )
42
43-type AssetNamesPriv struct {
44- DBPool db.DB
45-}
46+type AssetNamesPriv struct{}
47
48 var _ pobj.AssetNames = &AssetNamesPriv{}
49 var _ pobj.AssetNames = (*AssetNamesPriv)(nil)
50
51-func (an *AssetNamesPriv) BucketName(userName string) string {
52- user, _ := an.DBPool.FindUserForName(userName)
53- return shared.GetAssetBucketName(user.ID)
54+func (an *AssetNamesPriv) BucketName(sesh ssh.Session) (string, error) {
55+ user, err := util.GetUser(sesh.Context())
56+ if err != nil {
57+ return "", err
58+ }
59+ return shared.GetAssetBucketName(user.ID), nil
60 }
61-func (an *AssetNamesPriv) ObjectName(entry *utils.FileEntry) string {
62- return filepath.Join("pico-private", entry.Filepath)
63+func (an *AssetNamesPriv) ObjectName(sesh ssh.Session, entry *utils.FileEntry) (string, error) {
64+ return filepath.Join("/pico-private", entry.Filepath), nil
65 }
66
67 func StartSshServer() {
68@@ -50,10 +51,12 @@ func StartSshServer() {
69 } else {
70 st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass)
71 }
72-
73- assetNames := &AssetNamesPriv{
74- DBPool: dbpool,
75+ if err != nil {
76+ logger.Error(err.Error())
77+ return
78 }
79+
80+ assetNames := &AssetNamesPriv{}
81 objcfg := &pobj.Config{
82 Logger: logger,
83 Storage: st,
84@@ -61,7 +64,6 @@ func StartSshServer() {
85 }
86
87 handler := pobj.NewUploadAssetHandler(objcfg)
88-
89 sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
90 s, err := wish.NewServer(
91 wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
92--
932.45.2
94
chore: update pobj
Eric Bower <me@erock.io>
go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
1From 0ed7dc9b88a7c87469b76bad860a2410c924a1ab Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:33:25 -0400
4Subject: [PATCH 4/6] chore: update pobj
5
6---
7 go.mod | 2 +-
8 go.sum | 2 ++
9 2 files changed, 3 insertions(+), 1 deletion(-)
10
11diff --git a/go.mod b/go.mod
12index ace2286..7a925c5 100644
13--- a/go.mod
14+++ b/go.mod
15@@ -32,7 +32,7 @@ require (
16 github.com/muesli/reflow v0.3.0
17 github.com/muesli/termenv v0.15.2
18 github.com/neurosnap/go-exif-remove v0.0.0-20221010134343-50d1e3c35577
19- github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5
20+ github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5
21 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11
22 github.com/picosh/tunkit v0.0.0-20240709033345-8315d4f3cd0e
23 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
24diff --git a/go.sum b/go.sum
25index d87c73a..470b1f1 100644
26--- a/go.sum
27+++ b/go.sum
28@@ -264,6 +264,8 @@ github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a h1:Cr1xODiyd/SjjBRtYA9
29 github.com/picosh/pobj v0.0.0-20240709135546-27097077b26a/go.mod h1:VIkR1MZBvxSK2OO47jikxikAO/sKb/vTmXX5ZuYTIvo=
30 github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5 h1:gYoKG14iOjlYYCTiyFiOgybrqAOpnAqe6YU5QXnn8+A=
31 github.com/picosh/pobj v0.0.0-20240818155605-c7df7b892bf5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
32+github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5 h1:jr1dHKPSHmsjTCo7WKDuNOe0k0Sls+8rsfkXnCH4mck=
33+github.com/picosh/pobj v0.0.0-20240818163214-07a552a008d5/go.mod h1:tPv/ydMnuXlGVpWUMvBlcWlyn/xu9PsVPdncYibweWY=
34 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11 h1:ElTyYxJPPfAz+NLRL9qy+SQ9UYaSGlWXWl2yYrLPzCU=
35 github.com/picosh/send v0.0.0-20240709135413-81b1dd703a11/go.mod h1:RAgLDK3LrDK6pNeXtU9tjo28obl5DxShcTUk2nm/KCM=
36 github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELijb//dYhyCo8A3fvxW5dijrJVtjs=
37--
382.45.2
39
working!
Eric Bower <me@erock.io>
obj/ssh.go | 3 +++ 1 file changed, 3 insertions(+)
1From 8ff1131a8874f3bed55da5ac85c12d9ce470df7d Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 12:37:25 -0400
4Subject: [PATCH 5/6] working!
5
6---
7 obj/ssh.go | 3 +++
8 1 file changed, 3 insertions(+)
9
10diff --git a/obj/ssh.go b/obj/ssh.go
11index 0d4b0eb..3dabfdd 100644
12--- a/obj/ssh.go
13+++ b/obj/ssh.go
14@@ -35,6 +35,9 @@ func (an *AssetNamesPriv) BucketName(sesh ssh.Session) (string, error) {
15 func (an *AssetNamesPriv) ObjectName(sesh ssh.Session, entry *utils.FileEntry) (string, error) {
16 return filepath.Join("/pico-private", entry.Filepath), nil
17 }
18+func (an *AssetNamesPriv) PrintObjectName(sesh ssh.Session, entry *utils.FileEntry, bucketName string) (string, error) {
19+ return entry.Filepath, nil
20+}
21
22 func StartSshServer() {
23 logger := slog.Default()
24--
252.45.2
26
chore(obj): prep service def
Eric Bower <me@erock.io>
Makefile | 10 +++++++++- docker-compose.override.yml | 11 +++++++++++ docker-compose.prod.yml | 12 ++++++++++++ docker-compose.yml | 7 +++++++ projects.txt | 5 ----- 5 files changed, 39 insertions(+), 6 deletions(-) delete mode 100644 projects.txt
1From 0c8ad0d411abaa1b490d6e213cc8c3f2d4d56ab0 Mon Sep 17 00:00:00 2001
2From: Eric Bower <me@erock.io>
3Date: Sun, 18 Aug 2024 22:01:14 -0400
4Subject: [PATCH 6/6] chore(obj): prep service def
5
6---
7 Makefile | 10 +++++++++-
8 docker-compose.override.yml | 11 +++++++++++
9 docker-compose.prod.yml | 12 ++++++++++++
10 docker-compose.yml | 7 +++++++
11 projects.txt | 5 -----
12 5 files changed, 39 insertions(+), 6 deletions(-)
13 delete mode 100644 projects.txt
14
15diff --git a/Makefile b/Makefile
16index 050b7b6..7cd7863 100644
17--- a/Makefile
18+++ b/Makefile
19@@ -53,7 +53,11 @@ bp-%: bp-setup
20 $(DOCKER_BUILDX_BUILD) --build-arg "APP=$*" -t "ghcr.io/picosh/pico/$*-web:$(DOCKER_TAG)" --target release-web .
21 .PHONY: bp-%
22
23-bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer
24+bp-obj: bp-setup
25+ $(DOCKER_BUILDX_BUILD) --build-arg "APP=obj" -t "ghcr.io/picosh/pico/obj-ssh:$(DOCKER_TAG)" --target release-ssh .
26+.PHONY: bp-bouncer
27+
28+bp-all: bp-prose bp-pastes bp-imgs bp-feeds bp-pgs bp-auth bp-bouncer bp-obj
29 .PHONY: bp-all
30
31 build-auth:
32@@ -64,6 +68,10 @@ build-pico:
33 go build -o "build/pico-ssh" "./cmd/pico/ssh"
34 .PHONY: build-auth
35
36+build-obj:
37+ go build -o "build/obj-ssh" "./cmd/obj/ssh"
38+.PHONY: build-auth
39+
40 build-%:
41 go build -o "build/$*-web" "./cmd/$*/web"
42 go build -o "build/$*-ssh" "./cmd/$*/ssh"
43diff --git a/docker-compose.override.yml b/docker-compose.override.yml
44index 65b1cd9..298b87a 100644
45--- a/docker-compose.override.yml
46+++ b/docker-compose.override.yml
47@@ -142,6 +142,17 @@ services:
48 - ./data/pico-ssh/data:/app/ssh_data
49 ports:
50 - "2226:2222"
51+ obj-ssh:
52+ build:
53+ args:
54+ APP: obj
55+ target: release-ssh
56+ env_file:
57+ - .env.example
58+ volumes:
59+ - ./data/obj-ssh/data:/app/ssh_data
60+ ports:
61+ - "2227:2222"
62 auth-web:
63 build:
64 args:
65diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
66index 0195b37..f4b2679 100644
67--- a/docker-compose.prod.yml
68+++ b/docker-compose.prod.yml
69@@ -301,6 +301,18 @@ services:
70 ports:
71 - "${PICO_SSH_V4:-22}:2222"
72 - "${PICO_SSH_V6:-[::1]:22}:2222"
73+ obj-ssh:
74+ networks:
75+ pico:
76+ aliases:
77+ - ssh
78+ env_file:
79+ - .env.prod
80+ volumes:
81+ - ./data/obj-ssh/data:/app/ssh_data
82+ ports:
83+ - "${OBJ_SSH_V4:-22}:2222"
84+ - "${OBJ_SSH_V6:-[::1]:22}:2222"
85
86 networks:
87 default:
88diff --git a/docker-compose.yml b/docker-compose.yml
89index 9a6a10c..d449bc1 100644
90--- a/docker-compose.yml
91+++ b/docker-compose.yml
92@@ -106,6 +106,13 @@ services:
93 - pico
94 - services
95 - all
96+ obj-ssh:
97+ image: ghcr.io/picosh/pico/obj-ssh:latest
98+ restart: always
99+ profiles:
100+ - obj
101+ - services
102+ - all
103 auth-web:
104 image: ghcr.io/picosh/pico/auth-web:latest
105 restart: always
106diff --git a/projects.txt b/projects.txt
107deleted file mode 100644
108index 629a543..0000000
109--- a/projects.txt
110+++ /dev/null
111@@ -1,5 +0,0 @@
112-docs
113-test
114-tester
115-ui
116-
117--
1182.45.2
119