feat(bsr): add worker information to session meta
This commit is contained in:
1 parent
15524f3408
commit
92df5cf8c7
9 files changed
+49
-2
No files matched your search
@@ -58,6 +58,8 @@ func NewSession(ctx context.Context, meta *SessionMeta, f storage.FS, keys *kms.
|
||||
return nil, fmt.Errorf("%s: missing session user: %w", op, ErrInvalidParameter)
|
||||
case is.Nil(meta.Target):
|
||||
return nil, fmt.Errorf("%s: missing session target: %w", op, ErrInvalidParameter)
|
||||
case is.Nil(meta.Worker):
|
||||
return nil, fmt.Errorf("%s: missing session worker: %w", op, ErrInvalidParameter)
|
||||
case is.Nil(f):
|
||||
return nil, fmt.Errorf("%s: missing storage fs: %w", op, ErrInvalidParameter)
|
||||
case is.Nil(keys):
|
||||
|
||||
@@ -163,6 +163,29 @@ func (t Target) writeMeta(ctx context.Context, c *container) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Worker contains information about the worker used to record this session
|
||||
type Worker struct {
|
||||
PublicId string
|
||||
Version string
|
||||
Sha string
|
||||
}
|
||||
|
||||
func (w Worker) writeMeta(ctx context.Context, c *container) error {
|
||||
_, err := c.WriteMeta(ctx, "worker_publicId", w.PublicId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.WriteMeta(ctx, "worker_version", w.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.WriteMeta(ctx, "worker_sha", w.Sha)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StaticHostCatalog contains information about the static host catalog for this session
|
||||
type StaticHostCatalog struct {
|
||||
PublicId string
|
||||
@@ -702,6 +725,7 @@ type SessionMeta struct {
|
||||
Protocol Protocol
|
||||
User *User
|
||||
Target *Target
|
||||
Worker *Worker
|
||||
// StaticHost and DynamicHost are mutually exclusive
|
||||
StaticHost *StaticHost
|
||||
DynamicHost *DynamicHost
|
||||
@@ -727,6 +751,10 @@ func (s SessionMeta) writeMeta(ctx context.Context, c *container) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = s.Worker.writeMeta(ctx, c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if s.StaticHost != nil {
|
||||
err = s.StaticHost.writeMeta(ctx, c)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
.* wrappedPrivKey
|
||||
.* pubKeyBsrSignature.sign
|
||||
.* pubKeySelfSignature.sign
|
||||
f9c1b3593565129acbb7f62cd2397b527c86183bb552c5de4c27560b58602ddc session.meta
|
||||
04fb6e9ce96c411f2ab185167d8b69a6d66d894d8620bf347e4003afe270f662 session.meta
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session.summary
|
||||
@@ -10,6 +10,9 @@ target_projectId: proj123
|
||||
target_defaultPort: 0
|
||||
target_sessionMaxSeconds: 0
|
||||
target_sessionConnectionLimit: 0
|
||||
worker_publicId: w_12345
|
||||
worker_version: 0.25.5
|
||||
worker_sha: beepboopgitsha
|
||||
staticHost_publicId: host123
|
||||
staticHostCatalog_publicId: staticcat123
|
||||
staticHostCatalog_projectId: proj123
|
||||
|
||||
@@ -10,6 +10,9 @@ target_projectId: proj123
|
||||
target_defaultPort: 0
|
||||
target_sessionMaxSeconds: 0
|
||||
target_sessionConnectionLimit: 0
|
||||
worker_publicId: w_12345
|
||||
worker_version: 0.25.5
|
||||
worker_sha: beepboopgitsha
|
||||
staticHost_publicId: host123
|
||||
staticHostCatalog_publicId: staticcat123
|
||||
staticHostCatalog_projectId: proj123
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
.* wrappedPrivKey
|
||||
.* pubKeyBsrSignature.sign
|
||||
.* pubKeySelfSignature.sign
|
||||
f9c1b3593565129acbb7f62cd2397b527c86183bb552c5de4c27560b58602ddc session.meta
|
||||
04fb6e9ce96c411f2ab185167d8b69a6d66d894d8620bf347e4003afe270f662 session.meta
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session.summary
|
||||
@@ -10,6 +10,9 @@ target_projectId: proj123
|
||||
target_defaultPort: 0
|
||||
target_sessionMaxSeconds: 0
|
||||
target_sessionConnectionLimit: 0
|
||||
worker_publicId: w_12345
|
||||
worker_version: 0.25.5
|
||||
worker_sha: beepboopgitsha
|
||||
staticHost_publicId: host123
|
||||
staticHostCatalog_publicId: staticcat123
|
||||
staticHostCatalog_projectId: proj123
|
||||
|
||||
@@ -10,6 +10,9 @@ target_projectId: proj123
|
||||
target_defaultPort: 0
|
||||
target_sessionMaxSeconds: 0
|
||||
target_sessionConnectionLimit: 0
|
||||
worker_publicId: w_12345
|
||||
worker_version: 0.25.5
|
||||
worker_sha: beepboopgitsha
|
||||
staticHost_publicId: host123
|
||||
staticHostCatalog_publicId: staticcat123
|
||||
staticHostCatalog_projectId: proj123
|
||||
|
||||
@@ -66,6 +66,11 @@ func TestSessionMeta(s string, p Protocol) *SessionMeta {
|
||||
SessionMaxSeconds: 0,
|
||||
SessionConnectionLimit: 0,
|
||||
},
|
||||
Worker: &Worker{
|
||||
PublicId: "w_12345",
|
||||
Version: "0.25.5",
|
||||
Sha: "beepboopgitsha",
|
||||
},
|
||||
StaticCredentialStore: staticCredentialStore,
|
||||
VaultCredentialStore: vaultCredentialStore,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user