Commit Graph

207 Commits

Author SHA1 Message Date
Elijah R
db4ddea2e7 cvmts: fix ban, re-add audit log 2025-03-21 21:36:02 -04:00
Elijah R
5705971be6 cvmts: fix rename oddities 2025-03-21 21:28:13 -04:00
Elijah R
10dd3c2489 cvmts: Move initial protocol selection to transport layer 2025-03-21 20:29:16 -04:00
Elijah R
ab63420075 cvmts: rip out raw tcp transport
it's really just a tech debt that nothing uses, these is pretty much no point keeping it
2025-03-21 19:13:15 -04:00
Elijah R
e1e5f4a352 Merge branch 'master' into dev/proto_capability_rework 2025-03-21 19:03:55 -04:00
modeco80
53dd05ccc2 cvmts: Fix protocol error disconnection behavior so it actually works 2025-03-06 17:08:58 -05:00
modeco80
b015274e3b cvm-rs: Fix out of bound element length scanning
Also, add a unit test just to make sure this doesn't happen again.
2025-03-06 16:46:09 -05:00
Lily
751b0492f6 Merge pull request #32 from computernewb/dependabot/npm_and_yarn/micromatch-4.0.8
build(deps): bump micromatch from 4.0.7 to 4.0.8
2024-11-05 05:35:15 -05:00
modeco80
405e88bd1b cvmts: Allow specifying cgroup cpu period
probably limited utility wise but it's there now
2024-11-03 13:10:57 -05:00
modeco80
fe82973b9f Only try enabling cpuset controller if required
Additionally, "handle" (in many airquotes) errors trying to set controller values.
2024-11-02 18:01:07 -04:00
modeco80
e7a06b7141 cvmts: Delete cgroup on VM stop
Makes clean shutdown with systemd actually work.

I've also made superqemu version a SemVer thing so that we don't need to bump it as often, only on a major or minor bump.
2024-11-02 11:58:35 -04:00
modeco80
a3581854d2 had to help this hellfest of a language along slightly 2024-11-02 08:06:36 -04:00
modeco80
9fbdb84822 ok fiiiiine i'll do it the non hacky way 2024-11-02 07:54:26 -04:00
modeco80
86f1345a2d cvmts: Only target QEMU vCPU threads by default
Previous behaviour was to limit the whole QEMU process; this only limits the vCPU threads. A bit (very) hacky how I did this but it does work.
2024-11-02 07:46:59 -04:00
modeco80
4344b233bc cvmts: Bump up cpu.max period to 100000
(well, it DOES still work, but i imagine it's 100000 by default for a reason)
2024-11-02 06:33:31 -04:00
modeco80
e780ecabf0 cvmts: Add support for cgroup process resource limits on Linux
Using systemd's `Delegate=` option, it is possible to get it to let you manage your own cgroup subtree, therefore allowing you to set options and other fun stuff.

This commit adds support for doing so and configuring the resource limits in config.toml.

For later: The cgroup created has to be a threaded one. Iin theory, we can actually wait for the QEMU process to handshake qmp, grab the vCPU threads, and only limit those. For now, just limiting the entire QEMU process works, though and is the least complicated.

NOTE: Windows support should still work, even if you have resource limits configured. If you do, it should only warn and complain, but still function.
2024-11-02 06:08:26 -04:00
modeco80
bbc873a113 cvmts: Bump superqemu to 0.3.0 2024-11-02 03:11:07 -04:00
modeco80
25ed0515dd Revert "cvmts: rate limit the 'sync' instruction"
This reverts commit 199924ff92.

nvm the decade old shitcode webapp that people seem to still flock to for NO reason breaks
honestly why do we even support that hunk of trash it's a decade old, falling apart, and all it does
is stifle progress if anything
2024-10-05 05:11:02 -04:00
modeco80
199924ff92 cvmts: rate limit the 'sync' instruction
the original Guacamole code did this too I'm pretty sure, and it was even more aggressive about it.
2024-10-05 05:00:52 -04:00
modeco80
41ee71f053 cvmts: Add staff audit logging support
Basically what it says on the tin.

More staff operations should probably be audited, but for now this provides a good starting point.
2024-09-21 21:14:27 -04:00
modeco80
072fd06918 cvmts: fix display event handler duplication
By only adding event handlers when the display is first lazily initalized.
2024-09-19 04:11:25 -04:00
modeco80
210e36f430 cvmts: fix memory leak
javascript blows chunks
2024-09-12 13:11:12 -04:00
dependabot[bot]
4fdd209c87 build(deps): bump micromatch from 4.0.7 to 4.0.8
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.7 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.7...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-12 05:23:11 +00:00
modeco80
9d57779c75 fix config error logging so pino actually logs the Error object 2024-09-09 22:39:01 -04:00
modeco80
689be9d395 cvmts: Explicitly disable ws PMD/tracking
Seems to fix or at least make a pretty bad memory leak much slower.

I hate ws but the only other library is written by someone who isn't
a very nice person (putting it on the nice side)
2024-09-05 04:15:19 -04:00
modeco80
fae4c6d146 cvmts: Fix WebSocket errors causing process crashes 2024-08-30 20:30:17 -04:00
modeco80
4c085619ff remove todo that was done already 2024-08-23 10:15:38 -04:00
modeco80
48409a469a remove dead import 2024-08-23 10:15:38 -04:00
modeco80
a8d32f0555 move ProtocolManager into its own unit 2024-08-23 10:15:35 -04:00
modeco80
74d7b17d8b re-org source tree slightly
network layer is net/
protocol is protocol/
2024-08-23 10:15:10 -04:00
modeco80
f7fb30ba20 make network abstraction pass bare buffer
this bitrots tcp a bit. once the tcp protocol is replaced with a message based one it shouild be fine
2024-08-23 10:14:25 -04:00
modeco80
53b5b6d874 oops 2024-08-23 10:14:25 -04:00
modeco80
8f48092c5c move turn to protocol
everything now uses the protocol layer! woohoo.
2024-08-23 10:14:25 -04:00
modeco80
5dc53116b2 move flag and rename to protocol layer
This means that 'turn' is now the only thing not sent by the protocol layer.
2024-08-23 10:14:25 -04:00
modeco80
c9edb174f1 keep forgeting javascript tooling has about the same usability as a 80s ford 2024-08-23 10:14:25 -04:00
modeco80
0010a8f300 move 'vote' to Protocol 2024-08-23 10:14:24 -04:00
modeco80
1673f0abd7 move some shared stuff into a new baseclass for protocols to implement
will make greenfield (i.e: brand new non-Guac or whatever) protocol implementation a bit less boilerplatey
2024-08-23 10:14:23 -04:00
modeco80
4583531fce re-implement binrect protocol
pretty easy since we can just subclass guac
2024-08-23 10:14:23 -04:00
modeco80
6e1a075194 oops thought that was one of the admin only opcodes 2024-08-23 10:14:22 -04:00
modeco80
a82388f823 handle admin messages
TODO: Add senders for admin responses
and flag
and rename

also verify I didn't fuck boolean conversion up
2024-08-23 10:14:20 -04:00
modeco80
1c062697b9 WIP: protocol abstraction
Work on abstracting the CollabVMServer so it now calls into a interface for sending/recieving protocol messages. This will allow cleaner bringup of a fully binary protocol, and generally is just cleaner code.

Mostly everything is parsd/running through this new layer, although there are some TODO items:

- NetworkClient/... should just spit out a Buffer or something that eventually turns into or has one
- TCP protocol will need to be revamped so we can support an actual binary protocol on top of it. The current thing is line based
- More admin op stuff needs to be handled
- The handlers are a bit jumbled around atm
- There is still a good amount of code which assumes guacamole which needs to be rewritten

dont use this branch fuckers
2024-08-23 10:13:15 -04:00
Lily
3c4ddb72b8 Merge pull request #30 from computernewb/dev/better_display
merge better display branch
2024-08-23 10:04:19 -04:00
modeco80
338cc6e824 clean up some stuff and upgrade to the latest superqemu release 2024-08-23 10:01:41 -04:00
modeco80
b66810a227 it is nullable now so this comment doesn't make sense anymore 2024-08-23 07:29:32 -04:00
modeco80
e839f7f5aa better display/vm stuff
- moved superqemu's "QemuDisplay" here; the VNC VM and Qemu both share it (and it has been renamed to a less goofy dumb name)

- VNC VM has been heavily refactored to just use the VNC display we have (this means only one source of truth, less bugs, and it's generally just Better to share the code imho). this means that future plans to abstract this further (or implement the client in cvm-rs in general) won't cause any explosions, or require duplicate effort

- vms are now in src/vm/... just better organization

- superqemu doesn't manage a display anymore (or care about it, other than making sure the socket is unlinked on stop). Instead now it provides info for us to setup our own VNC client. This is also why we provide our own shim interface

This currently relies on a alpha version of superqemu.

Before this is merged into cvmts main I will publish a stable tag and point cvmts to that new version
2024-08-23 07:26:23 -04:00
modeco80
7d9fab2485 cvm-rs: don't leave reference to input buffer live
i think this was causing it to not be freed because we were holding a live reference (to NAPI/node/v8 side of things) even after we were done so the input buffer just never got freed from the buffer pool
2024-08-23 04:39:23 -04:00
modeco80
17191b0917 cvm-rs: version 0.2.0
- switch to napi-rs. this mostly affects only the backend side of things, but IMO napi-rs is better (also, way less boilerplate is needed compared to neon).

- jpeg encoding no longer clones the input buffer internally (or wraps it in a Mutex as well), thanks to napi-rs not sucking in this regard. this is *probably* a micro-optimization, but will make it easier to later on do parallel encoding of all rectangles

- guac encoding is weird. This is kind of a painpoint of napi-rs but it's bearable
2024-08-20 06:14:08 -04:00
modeco80
55566fbd3a cvm-rs: Switch thread pool to rayon
Much less underhanded than using an IO library's capability to do so. Also, rayon will make encoding multiple jpegs in parallel *much* easier.

tbh if i do that I may also switch to napi-rs, it seems a bit less painful and supports much more async shenigans.

(Also, it will actually bind classes properly... something Neon really sucks at unless you look at strange documentation.)
2024-08-20 04:11:29 -04:00
modeco80
a521f4c873 Queue rect updates for each frame (and.. maybe? do rects in parallel)
both superqemu and vncvm have supported this but I never did it for some reason. its noticably faster than before. testing seems to imply that its actually slightly faster without the batcher enabled (maybe because it's actually able to split the work now if I had to guess)
2024-08-20 01:05:44 -04:00
Elijah R
2b50d4c834 fix turn passwords when auth is enabled 2024-08-09 22:38:32 -04:00