Commit Graph

65 Commits

Author SHA1 Message Date
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
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
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
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
Elijah R
dbb0e92559 elijah forgets to run yarn build episode ?? 2024-08-05 01:07:30 -04:00
Elijah R
d34f8e28fd bump superqemu 2024-08-05 01:04:04 -04:00
Elijah R
b7a02f9874 fix vnc on windows 2024-08-04 18:28:33 -04:00
Elijah R
64d4774d00 chore: comment config.example.toml and format code with prettier/cargo 2024-08-04 15:50:00 -04:00
Elijah R
5aa842bb3e switch to mariadb library
ok mdmck you can stop putting eggs in my mailbox now
2024-08-04 15:32:43 -04:00
Elijah R
b0c23c3cdf Add internal banning (cvmban) using MySQL 2024-08-04 15:32:43 -04:00
MDMCK10
d16c045b04 Remove unused config options 2024-08-04 21:07:59 +02:00
Elijah R
11380f00cf unfuck vncvm 2024-08-01 18:13:06 -04:00
dependabot[bot]
4ace8ef04e Bump ws from 8.16.0 to 8.17.1
Bumps [ws](https://github.com/websockets/ws) from 8.16.0 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.16.0...8.17.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-30 14:20:32 -04:00
modeco80
432e75d42a cvmts: Use npm versions of superqemu/nodejs-rfb.
We publish them now, so let's use them in cvmts!

Additionally, this removes the 'shared' module entirely, since it has little purpose anymore. The logger is replaced with pino (because superqemu uses pino for logging itself).
2024-07-16 08:29:52 -04:00
modeco80
e28bb3a9d7 remove connect/view gating (for now) 2024-07-11 20:49:49 -04:00
modeco80
ddf4d97511 qemu: more refactoring
qmp client is now much more robust (and doesn't fight over itself as much). this should
hopefully completely eliminate the case where display connects but qmp is half connected.

i also forgot QemuDisplay actually emits an event on connection, so we can just use that to
wait for when the display connects. which allows us to set the started state there instead of praying
when the qmp client connects that we are connected to the display roughly at the same time.

i also gated some stuff to require vm state in the server. this is a bit rickity, but does seem to work.
2024-07-11 20:33:50 -04:00
modeco80
25b32b23b7 qemu: More fun refactoring
The QMP client has been refactored slightly, mostly just to clean up its
edges slightly.

QemuVM however has seen a big refactor, especially connecting to QMP.
Flattening out this logic is something I should have done a long time ago.

This seemingly has finally hammered out the bugs, although time will tell.
2024-07-11 03:24:22 -04:00
modeco80
227a171110 qemu: Completely rewrite QMP client from scratch
It sucked. The new one is using Sans I/O principles, so it does not
directly do I/O or talk to a net.Socket directly (instead, QemuVM implements
the layer to do I/O). This means in the future this library could actually
be tested, but for now, I'm not bothering with that.

There's also some other cleanups that were bothering me.
2024-07-10 22:20:12 -04:00
modeco80
048f08b00b actually make vm swich displays properly or whatever 2024-07-10 18:43:35 -04:00
modeco80
bee25b5381 Fix the ability for IPData refcount to go negative 2024-07-10 18:32:05 -04:00
Elijah R
a2f450b374 move binprotocol to submodule (server) 2024-06-25 21:24:08 -04:00
Elijah R
3384e47e20 use msgpackr instead of @ygoe/msgpack 2024-06-25 20:09:34 -04:00
Elijah R
fe830afdeb add support for binary JPEG (server) 2024-06-25 19:56:28 -04:00
modeco80
2cc2c6ddf2 cvmts: "fix" panics in cvm-rs 2024-06-23 02:55:05 -04:00
Elijah R
1a5a0cd407 add geoip country flag support 2024-06-23 02:24:03 -04:00
Elijah R
85a86327f4 add missing XFF warning, remove ipdata check from WSServer because CollabVMServer already does that 2024-06-23 02:24:03 -04:00
modeco80
dda72cad91 cvmts: quth => auth 2024-06-22 21:27:28 -04:00
modeco80
09d41617ed prettier reformat for merge (and remove jpeg-turbo Again) 2024-06-22 21:26:49 -04:00
modeco80
b8ed177885 cvm-rs: merge guac and jpeg libs together into one
doesn't really need to be two seperate libraries. also preperation for other funnies

the build script has been replaced with a much saner justfile which uses much saner "yarn workspace" invocations instead of blindly cding all over the place
2024-06-22 21:14:05 -04:00
modeco80
87a377a10f cvmts: replace jpeg-turbo native module with new rust module
This module also does threadpooling internally, so we don't need Piscina anymore (which I'm pretty sure was actually bottlenecking.)
2024-06-20 03:20:56 -04:00
modeco80
39521a4b1d misc stuff from production
(also refactors qemu a bit)
2024-06-19 23:30:29 -04:00
modeco80
97de887518 cvmts: Actually unref ipdata on disconnect 2024-06-19 18:26:27 -04:00
modeco80
fa23aa7432 cvmts: nope I have to fix it properly 2024-06-19 18:20:41 -04:00
modeco80
e798ff5c86 bandaid fix time 2024-06-19 18:16:16 -04:00
modeco80
0d34bb1c8e cvmts/qemu: support snapshots properly 2024-06-19 18:03:10 -04:00