Commit Graph
3093 Commits
Author SHA1 Message Date
Jim 9207ec08f2 feat: add request ctx stream interceptor 2023-05-31 12:18:22 +00:00
Jim 0c465706cc chore: increment base version to 0.13.0 2023-05-31 12:18:22 +00:00
Johan Brandhorst-Satzkorn 98e0b9db98 commands: add created, updated to recordings 2023-05-31 12:18:22 +00:00
Johan Brandhorst-Satzkorn 3374d32a55 api: add created, updated times to conn, chan
In addition to session recordings, connection and
channel recordings now also include the created and
updated time.
2023-05-31 12:18:21 +00:00
Louis Ruch 7207353066 docs(ssh): Update docs to reflect ssh default port is not required 2023-05-31 12:18:21 +00:00
Timothy Messier b9de6cf00b fixup:(bsr): Correctly reference subcontainers when opening
This is a fixup for 60785b5a8
2023-05-31 12:18:21 +00:00
Timothy Messier 738a6c6472 feat(bsr/convert): Implement ToAsciicast
This adds support for converting a channel in a SSH BSR to an asciicast.
2023-05-31 12:18:21 +00:00
Timothy Messier 9227fcd879 feat(bsr/convert): Add logic to convert ssh channel to asciicast 2023-05-31 12:18:21 +00:00
Timothy Messier ed6882a457 feat(bsr/convert): Add asciicast package
This provides a new internal package for constructing and serializing an
asciicast in the v2 asciicast file fromat.

See: https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md
2023-05-31 12:18:21 +00:00
Timothy Messier 916a919bf0 feat(bsr): Remove ascii format of protocol
This was originally introduced to ensure that the meta files only
included ascii characters. However, this makes reading the protocol from
meta file less reliable since it does not exactly match the protocol
string. Instead protocol strings will be recorded in the meta files as
is. Generally protocol strings should include readable characters.

This also updates the ssh.Protocol to be 4 readable characters.
2023-05-31 12:18:21 +00:00
Timothy Messier 4112c4e8fe feat(bsr): Add methods for opening ChunkScanners for data files 2023-05-31 12:18:21 +00:00
Timothy Messier e37fa39c95 feat(bsr/fstest): Add localfs implementation
This adds another test storage.FS implemenation. This can be used to
write/read containers and files from a local filesystem via calls to the
os pacakge.
2023-05-31 12:18:21 +00:00
Timothy Messier 713d961152 feat(bsr/fstest): Add test TempFile implementation 2023-05-31 12:18:21 +00:00
Timothy Messier b4ce802572 refact(bsr/convert): Use new storage.TempFile interface
This changes the ToAscinema function to take a storage.TempFile instead
of a storage.FS. It was noticed that when this was being used a
storage.FS was being created just prior to calling this just so that it
could then create a temporary file. It seemed to make more sense to just
pass the temporary file in, instead of needing to expand the storage.FS
interface.

This also renames this method to align with the file format that the
returned io.Reader will contain.
2023-05-31 12:18:21 +00:00
Timothy Messier e29939ce41 feat(storage): Define interface for creating temporary files
This provides a new type for a temporary file and a method on a
RecordingStorage to create temporary files. Temporary files will get
removed when closed.
2023-05-31 12:18:21 +00:00
irenarindos 6705f6128a feat(bsr):unmarshal updated meta 2023-05-31 12:18:20 +00:00
irenarindos 304d15021f chore(bsr): remove references to ssh protocol 2023-05-31 12:18:20 +00:00
irenarindos e567bb97e6 feat(bsr): instantiate BSR session for playback 2023-05-31 12:18:20 +00:00
Timothy Messier 46e1752283 feat(bsr/fstest): Support read mode
This updates the fstest implementation of a storage.FS to support
opening sub containers and files in read-only mode.

Now when calling `SubContainer`:

- If using `storage.WithCreateFile`, an error is returned if the
  container already exists.
- If not using `storage.WithCreateFile` and error is returned if the
  container does *not* exist.

When calling `OpenFile`:

- on a container that was created with `storage.ReadOnly`, an error is
  returned if attempting to open the file wth `storage.ReadWrite`.
- with `storage.WithCreateFile`, an existing file is replaced with a new
  empty file, (ie "truncated").
- without `storage.WithCreateFile`, an error is returned if the file
  does not exist.
2023-05-31 12:18:20 +00:00
Timothy Messier e9c7e373e9 feat(bsr/fstest): Implement Open method 2023-05-31 12:18:20 +00:00
Timothy Messier 82989fd123 feat(storage): Stub out Open interface method 2023-05-31 12:18:20 +00:00
irenarindos d06c9b2933 feat(bsr): populate container meta from meta files 2023-05-31 12:18:20 +00:00
irenarindos 4e5401da7d bsr(chunk decode): fix intermittent error message inconsistency 2023-05-31 12:18:20 +00:00
Timothy Messier 5d0a9b706e feat(bsr): Add ChunkScanner
The scanner can be used to read any BSR data file. When creating a new
scanner, it will first verify the BSR magic string. Individual Chunks
can then be read back by calling Scan. The scanner will compute a
sha256sum while it is reading chunks. If the scanner was created using
the WithSha256Sum option, it will compare the computed checksum with the
one provided via the option once the scanner encounters an end chunk
(DONE) or an io.EOF error from the reader. If the checksums do not
match, and error will be returned from Scan. The current sha256sum can
be returned from the scanner using the Sum method.

There is also a convenience function, ChunkWalk that can be used to call
a function on each Chunk returned by a scanner.
2023-05-31 12:18:20 +00:00
Timothy Messier f983a05a3e feat(bsr/ssh): Support decoding chunks
This adds a function for decoding all of the SSH Chunk types and
registers the function with the chunk types so that the bsr.ChunkDecode
can be used to decode SSH Chunks.
2023-05-31 12:18:20 +00:00
Timothy Messier fe870fc989 feat(bsr): Add ChunkDecoder
A ChunkDecoder can be used to BSR Chunks. Each call to Decode will read
the next chunk from the decoder's io.Reader. It handles decompressing
any compressed chunk data, and verifying the CRCs of each chunk.
2023-05-31 12:18:20 +00:00
Timothy Messier 648842f031 feat(bsr/checksum): Add function to load SHA256SUM
This provides a Sha256Sums type to store the information from a
SHA256SUM file in memory for easy lookup of the sums of files. It can be
used when checking the checksums of individual files without needing to
go back to disk.
2023-05-31 12:18:19 +00:00
Johan Brandhorst-Satzkorn 74d10da7b4 bsr: remove duplicate target scope info
We were storing the project ID both as part of the scope
and as a field directly on the target. Remove the extra field.
2023-05-31 12:18:19 +00:00
Louis Ruch 78ca8beb77 fix(cli): Update storage CLI gen and help text 2023-05-31 12:18:19 +00:00
Michael Gaffney a783c91b2d feat(sql): Add dynamic credential hst tables to session recording
This adds the `recording_dynamic_credential` join table and a trigger
that runs as an after insert on the `recording_session` table. The join
table joins the `recording_session`, `credential_vault_store_hst`,
`credential_library_history_base`, and the `credential_purpose_enm`
tables.
2023-05-31 12:18:19 +00:00
Michael Gaffney 3769f0851c test(sql): Refactor the colors persona
This changes multiple IDs in the colors persona to be 12 characters. It
also renames some IDs in an attempt to make them more consistent. This
also changes the order of the columns in some insert statements to
follow the pattern of the other insert statements.

This also adds documentation to the top of colors persona file in an
attempt to explain the general patterns being followed in the file.
2023-05-31 12:18:19 +00:00
Michael Gaffney 03b1291b34 feat(sql): Add history tables for dynamic credentials
This adds history tables for `credential_vault_store`,
`credential_vault_library`, and `credential_vault_ssh_cert_library`.
This also adds a base table for the credential library history tables.
2023-05-31 12:18:19 +00:00
Danielle Miu 385b804ed2 update plugin options to include WithVersion 2023-05-31 12:18:19 +00:00
Todd 5f20eb60ad Add Host and Catalogs to the API resource 2023-05-31 12:18:19 +00:00
irenarindos 92df5cf8c7 feat(bsr): add worker information to session meta 2023-05-31 12:18:19 +00:00
Johan Brandhorst-Satzkorn 15524f3408 api: add created, updated times to recordings 2023-05-31 12:18:19 +00:00
irenarindos 200e7dca5a feat(bsr): add credentials to session meta 2023-05-31 12:18:19 +00:00
Jim 35a2296092 feat(cli): add session recordings: read and list cmds 2023-05-31 12:18:19 +00:00
Jim de88a871c6 feat: (api/cli): add custom type for duration 2023-05-31 12:18:18 +00:00
Jeff Mitchell 18e59998e9 Add storage bucket worker filter handling 2023-05-31 12:18:18 +00:00
Damian Debkowski 234c4ade86 refactor(plugin): use flat file system for loopback storage 2023-05-31 12:18:18 +00:00
Johan Brandhorst-Satzkorn 4387a59ce5 sessionrecordings: add endpoint 2023-05-31 12:18:18 +00:00
Damian Debkowski 331254402a feat(loopback): add ability to mock putObject response 2023-05-31 12:18:18 +00:00
Todd e1540be9f3 Add host information to session recording view 2023-05-31 12:18:18 +00:00
Michael Gaffney a8224f4f57 feat(sql): Add endpoint from session table to session recording
This adds an `endpoint` column to the `recording_session` table and
updates the session recording insert trigger to copy the value of
`endpoint` from the `session` table to the `recording_session` table.
2023-05-31 12:18:18 +00:00
Michael Gaffney 06e4e46248 feat(sql): Add static credential hst tables to session recording
This adds the `recording_static_credential` join table and a trigger
that runs as an after insert on the `recording_session` table. The join
table joins the `recording_session`, `credential_static_store_hst`,
`credential_static_history_base`, and the `credential_purpose_enm`
tables.
2023-05-31 12:18:18 +00:00
Michael Gaffney 3a64fb3d58 feat(sql): Add history tables for static credentials
This adds history tables for `credential_static_store`,
`credential_static_json_credential`,
`credential_static_username_password_credential`, and
`credential_static_ssh_private_key_credential`. This also adds a base
table for the static credential history tables.
2023-05-31 12:18:18 +00:00
Todd 386eac072c Add recording_channel_ssh_aggregate view 2023-05-31 12:18:18 +00:00
Johan Brandhorst-Satzkorn 89befba55e api: add state and error details fields to recordings 2023-05-31 12:18:18 +00:00
Johan Brandhorst-Satzkorn 11893a8885 db: add state and error_details to recording 2023-05-31 12:18:17 +00:00