Compare commits

...

598 Commits

Author SHA1 Message Date
mattmcclaskey
fdc4a63eda update novnc ref 2022-09-16 18:34:46 +00:00
Matthew McClaskey
b1d1ca6c6d Merge branch 'release/0.9.3.1' into 'bugfix/KASM-3196_clip_0.9.3.2_hotfix'
Release/0.9.3.1

See merge request kasm-technologies/internal/KasmVNC!67
2022-09-13 00:08:36 +00:00
Matthew McClaskey
6151f98ec6 Merge branch 'bugfix/KASM-3196_clip_0.9.3.2_hotfix' into 'release/0.9.3.1'
# Conflicts:
#   .gitmodules
2022-09-13 00:07:36 +00:00
mmcclaskey
99f879ffb7 KASM-3196 seamless clip fix 2022-09-12 19:56:41 +00:00
mattmcclaskey
a5b9d75d63 KASM-3119 correct code review issues on MR 2022-09-07 12:54:07 +00:00
Dmitry Maksyoma
3e3462a4de Fix Kali build by using gcc 11 2022-09-07 18:15:04 +12:00
mattmcclaskey
1e4ca3563c KASM-3119 send full frame on permission changes 2022-09-06 17:48:44 +00:00
Matthew McClaskey
924329900d Merge branch 'bugfix/KASM-2798_memory_leak' into 'master'
Resolve KASM-2798 "Bugfix/ memory leak"

Closes KASM-2798

See merge request kasm-technologies/internal/KasmVNC!51
2022-06-24 17:27:33 +00:00
Lauri Kasanen
4e134b578c Resolve KASM-2798 "Bugfix/ memory leak" 2022-06-24 17:27:33 +00:00
Justin Travis
61f08d4986 Merge branch 'feature/KASM-2779-jammy-images' into 'master'
Resolve KASM-2779 "Feature/ jammy images"

Closes KASM-2779

See merge request kasm-technologies/internal/KasmVNC!49
2022-06-22 21:11:00 +00:00
ryan.kuba
c32521ba64 KASM-2779 fork off workin jammy bin and pin opensuse to 15.3 2022-06-22 16:38:12 -04:00
Matthew McClaskey
8542a5fb31 Merge branch 'feature/KASM-2634_UI_updates' into 'master'
Resolve KASM-2634 "Feature/ ui updates"

Closes KASM-2634

See merge request kasm-technologies/internal/KasmVNC!48
2022-06-12 18:12:17 +00:00
Matthew McClaskey
4cc81ddb3d Resolve KASM-2634 "Feature/ ui updates" 2022-06-12 18:12:17 +00:00
Dmitry Maksyoma
32d6b4804a Jammy build 2022-06-08 22:46:03 +12:00
Matthew McClaskey
ac7605f316 Merge branch 'feature/KASM-2753_websocket_logs' into 'master'
Detailed log errors for the /websockify path

Closes KASM-2753

See merge request kasm-technologies/internal/KasmVNC!46
2022-06-06 18:59:52 +00:00
Lauri Kasanen
87e39f896c Detailed log errors for the /websockify path 2022-06-06 17:36:00 +03:00
Matthew McClaskey
f22d8347ed Merge branch 'feature/KASM-2662_logging_scheme' into 'master'
New logging setup

Closes KASM-2662

See merge request kasm-technologies/internal/KasmVNC!45
2022-05-25 18:04:33 +00:00
Lauri Kasanen
bf2bf679b6 New logging setup 2022-05-25 18:04:33 +00:00
Matthew McClaskey
330eb47142 Merge branch 'feature/KASM-2665_bad_pw_403' into 'master'
Return 403 for too large Auth headers (attack)

Closes KASM-2665

See merge request kasm-technologies/internal/KasmVNC!44
2022-05-24 14:55:05 +00:00
Lauri Kasanen
661e9ef329 Return 403 for too large Auth headers (attack) 2022-05-24 14:55:05 +00:00
Matthew McClaskey
786670354f Merge branch 'feature/KASM-2619_x_forward_for' into 'master'
Add support for X-Forwarded-For

Closes KASM-2619

See merge request kasm-technologies/internal/KasmVNC!43
2022-05-24 11:04:59 +00:00
Lauri Kasanen
a6842bb46a Add support for X-Forwarded-For 2022-05-24 11:04:58 +00:00
Matthew McClaskey
2959156a25 Merge branch 'toggle-game-mode' into 'master'
Toggle game mode

See merge request kasm-technologies/internal/KasmVNC!42
2022-05-03 17:30:12 +00:00
Matthew McClaskey
774a61ace7 Toggle game mode 2022-05-03 17:30:12 +00:00
Matthew McClaskey
d829572a9c Merge branch 'bugfix/KASM-2482_large_downloads' into 'master'
Use 64-bit var for the served file size

Closes KASM-2482

See merge request kasm-technologies/internal/KasmVNC!40
2022-04-18 12:30:43 +00:00
Matthew McClaskey
891bef0877 Merge branch 'fix-suse-barebones-test' into 'master'
OpenSuse: fix testing image by installing dependencies

See merge request kasm-technologies/internal/KasmVNC!41
2022-04-18 12:00:15 +00:00
Dmitry Maksyoma
9f6c160d1e OpenSuse: fix testing image by installing dependencies 2022-04-13 17:15:57 +12:00
Lauri Kasanen
d581eb798d Use 64-bit var for the served file size 2022-04-11 18:53:45 +03:00
Matthew McClaskey
bdf0a4dde9 Merge branch 'feature/KASM-1883_x_proxy' into 'master'
Resolve KASM-1883 "Feature/ x proxy"

Closes KASM-1883

See merge request kasm-technologies/internal/KasmVNC!33
2022-04-07 13:01:14 +00:00
Dmitry Maksyoma
fc894a7096 Resolve KASM-1883 "Feature/ x proxy" 2022-04-07 13:01:14 +00:00
Matthew McClaskey
7078884c12 Merge branch 'feature/KASM-2459_vnc_lite_rm' into 'master'
remove vnc_lite.html

Closes KASM-2459

See merge request kasm-technologies/internal/KasmVNC!39
2022-04-06 19:02:44 +00:00
matt
d70edd9eb7 remove vnc_lite.html 2022-04-05 16:02:37 +00:00
matt
1e265277f8 update novnc ref 2022-04-05 12:59:16 +00:00
Matthew McClaskey
b73d3fc786 Merge branch 'feature/KASM-2445_clipboard_ids' into 'master'
Log and send clipboard op ids

See merge request kasm-technologies/internal/KasmVNC!37
2022-04-05 12:52:39 +00:00
Matthew McClaskey
b2e878e79e Log and send clipboard op ids 2022-04-05 12:52:38 +00:00
Matthew McClaskey
6e84e10317 Merge branch 'feature/KASM-2437-opensuse-15-images' into 'master'
Resolve KASM-2437 "Feature/ opensuse 15 images"

Closes KASM-2437

See merge request kasm-technologies/internal/KasmVNC!38
2022-04-04 16:31:55 +00:00
Ryan Kuba
d050236248 Resolve KASM-2437 "Feature/ opensuse 15 images" 2022-04-04 16:31:55 +00:00
Matthew McClaskey
92c449d87b Merge branch 'improve-bump-package-version-to-update-rpm-changelog' into 'master'
Improve bump package version to update rpm changelog

See merge request kasm-technologies/internal/KasmVNC!34
2022-03-31 14:37:02 +00:00
ryan.kuba
73ed994b21 support loop in version bumping for RPMs 2022-03-30 09:20:26 -07:00
Matthew McClaskey
74a4b5fd9f Merge branch 'feature/KASM-2249-oracle-8-bins' into 'master'
build el8 x86_64 and aarch64 rpms

See merge request kasm-technologies/internal/KasmVNC!36
2022-03-29 13:19:11 +00:00
ryan.kuba
7506e0881f build el8 x86_64 and aarch64 rpms 2022-03-26 12:49:18 -07:00
Matt
ce78879132 Update noVNC ref 2022-03-25 19:05:56 +00:00
Matthew McClaskey
08f5000b9f Merge branch 'feature/KASM-2335_IME_support' into 'master'
Resolve KASM-2335 "Feature/ ime support"

Closes KASM-2335

See merge request kasm-technologies/internal/KasmVNC!30
2022-03-25 16:18:17 +00:00
Matthew McClaskey
3f89e5c117 Resolve KASM-2335 "Feature/ ime support" 2022-03-25 16:18:16 +00:00
Dmitry Maksyoma
d6d13b59cb Refactor: extract bump-package-version-deb(1) 2022-03-25 23:59:47 +13:00
Dmitry Maksyoma
3ee95e3150 bump-package-version updates rpm changelog 2022-03-25 23:59:01 +13:00
Matthew McClaskey
0c020f2e79 Merge branch 'bump-package-version-to-0.9.3' into 'master'
rpm/deb: bump package versions to 0.9.3-beta

See merge request kasm-technologies/internal/KasmVNC!32
2022-03-22 10:25:28 +00:00
Matthew McClaskey
8a5915aeab Merge branch 'fix-users-wgetting-wrong-package' into 'master'
README: point users to releases page for their packages

See merge request kasm-technologies/internal/KasmVNC!29
2022-03-22 10:07:56 +00:00
Dmitry Maksyoma
8a4b4548f3 rpm/deb: bump package versions to 0.9.3-beta 2022-03-22 22:22:10 +13:00
Matthew McClaskey
c89a966ed6 Merge branch 'feature/KASM-2376_rfb_spec' into 'master'
Resolve KASM-2376 "Feature/ rfb spec"

Closes KASM-2376

See merge request kasm-technologies/internal/KasmVNC!31
2022-03-21 19:13:57 +00:00
Lauri Kasanen
78ee565ab3 Document kasm protocol 2022-03-14 10:45:27 +02:00
Dmitry Maksyoma
94791bc9fa README: point users to releases page for their packages 2022-03-11 16:26:20 +13:00
Matthew McClaskey
eda0d899cd add rfb specification 2022-03-09 20:21:56 +00:00
Matthew McClaskey
a734a613c8 Merge branch 'feature/KASM-2368_ip_blacklist' into 'master'
Have BlacklistThreshold 0 disable the blacklist

Closes KASM-2368

See merge request kasm-technologies/internal/KasmVNC!28
2022-03-07 11:02:10 +00:00
Lauri Kasanen
e6b4f40ed7 Have BlacklistThreshold 0 disable the blacklist 2022-03-04 10:48:19 +02:00
Matthew McClaskey
6a9dfdc593 Merge branch 'feature/KASM-2301_debug_docs' into 'master'
Resolve KASM-2301 "Feature/ debug docs"

Closes KASM-2301

See merge request kasm-technologies/internal/KasmVNC!27
2022-02-23 11:23:44 +00:00
Matthew McClaskey
cee7ae86cf Resolve KASM-2301 "Feature/ debug docs" 2022-02-23 11:23:44 +00:00
Matthew McClaskey
8bf5ae9ef7 Merge branch 'feature/KASM-2301-upload-debug-packages' into 'master'
Resolve KASM-2301 "Feature/ upload debug packages"

Closes KASM-2301

See merge request kasm-technologies/internal/KasmVNC!26
2022-02-11 14:57:25 +00:00
Dmitry Maksyoma
49890cf8da Resolve KASM-2301 "Feature/ upload debug packages" 2022-02-11 14:57:25 +00:00
Matthew McClaskey
974a06bb8c Merge branch 'bugfix/KASM-2287_remove_user_transaction' into 'master'
Bulk update_user and remove_user should check for all users' existence

Closes KASM-2287

See merge request kasm-technologies/internal/KasmVNC!25
2022-01-31 14:53:29 +00:00
Matthew McClaskey
c3551f807c Merge branch 'feature/KASM-2242_clipboard_behavior' into 'master'
Resolve KASM-2242 "Feature/ clipboard behavior"

Closes KASM-2242

See merge request kasm-technologies/internal/KasmVNC!24
2022-01-31 14:50:59 +00:00
Matthew McClaskey
3c6226f03d Resolve KASM-2242 "Feature/ clipboard behavior" 2022-01-31 14:50:59 +00:00
Lauri Kasanen
e3afc937e5 Bulk update_user and remove_user should check for all users' existence 2022-01-31 12:41:37 +02:00
Justin Travis
fa22ed925f Merge branch 'feature/KASM-2238_freeze_session' into 'master'
Resolve KASM-2238 "Feature/ freeze session"

Closes KASM-2238

See merge request kasm-technologies/internal/KasmVNC!23
2022-01-28 12:24:38 +00:00
Justin Travis
42d7ff015d Resolve KASM-2238 "Feature/ freeze session" 2022-01-28 12:24:38 +00:00
Matthew McClaskey
13331295ac Merge branch 'feature/KASM-2194_bulk_user_mgmt' into 'master'
Resolve KASM-2194 "Feature/ bulk user mgmt"

Closes KASM-2194

See merge request kasm-technologies/internal/KasmVNC!22
2022-01-24 16:42:29 +00:00
Matthew McClaskey
99680f23ff Resolve KASM-2194 "Feature/ bulk user mgmt" 2022-01-24 16:42:29 +00:00
Matthew McClaskey
93e89bd8be Merge branch 'feature/KASM-2244_kali_arm' into 'master'
KASM-2244 Kali Arm

Closes KASM-2244

See merge request kasm-technologies/internal/KasmVNC!21
2022-01-19 16:06:51 +00:00
Justin Travis
c0401101ab KASM-2244 Kali Arm 2022-01-18 19:27:32 -05:00
Matthew McClaskey
4f7a42f41e Merge branch 'update_user2' into 'master'
fix accidental removal in update_user

See merge request kasm-technologies/internal/KasmVNC!20
2022-01-18 17:24:40 +00:00
matt
e6cc132874 fix accidental removal in update_user 2022-01-18 16:59:54 +00:00
Matthew McClaskey
8422168154 Merge branch 'update_user' into 'master'
Update user

See merge request kasm-technologies/internal/KasmVNC!19
2022-01-17 17:10:24 +00:00
Matthew McClaskey
03729ca66e Update user 2022-01-17 17:10:24 +00:00
Matthew McClaskey
ca7949537a Merge branch 'feature/KASM-2119_focal' into 'master'
Focal build in default

Closes KASM-2119

See merge request kasm-technologies/internal/KasmVNC!18
2021-12-10 19:46:39 +00:00
Matthew McClaskey
6dd0dd58d4 Focal build in default 2021-12-10 19:46:39 +00:00
Matthew McClaskey
2959b47a86 Merge branch 'httpblacklist' into 'master'
Httpblacklist

See merge request kasm-technologies/internal/KasmVNC!17
2021-12-07 17:01:14 +00:00
Lauri Kasanen
49174b1586 Threaded context 2021-12-06 13:41:07 +02:00
Lauri Kasanen
bb364badd3 Apply blacklist options to httpd basicauth 2021-12-06 12:07:32 +02:00
j-travis
dc4e4ce348 Merge pull request #78 from kasmtech/bugfix/KASM-2108_mobile_ipc
KASM-2108 Update noVNC commit
2021-11-15 20:36:13 -05:00
Mariusz Marciniak
b842460724 KASM-2108 Update noVNC commit 2021-11-15 20:14:49 -05:00
matt
26f1b52b70 KASM-2075 update novnc to head of master 2021-11-09 19:04:07 +00:00
j-travis
8c2c099342 Merge pull request #76 from kasmtech/feature/KASM-2001_mobile_keyboard
KASM-2001 Update noVNC commit
2021-11-08 21:05:40 -05:00
Mariusz Marciniak
314e7e9615 KASM-2001 Update noVNC commit 2021-11-08 20:44:56 -05:00
Dmitry Maksyoma
77b97415ef Add bump-package-version(1) and document it (#74) 2021-11-05 10:05:13 -04:00
mmcclaskey
dd276e5e87 Default sendprimary to off (#73)
Co-authored-by: Lauri Kasanen <cand@gmx.com>
2021-10-25 14:40:54 -04:00
mmcclaskey
a9434a300d Feature/kasm 2029 pipeline tweaks (#72)
* update to Gitlab CI pipeline builds
2021-10-20 15:24:22 -04:00
mmcclaskey
6219b85ba8 Feature/kasm 786 arm support (#71)
* KASM-786 ARM Support, with CI pipelines for debian and ubuntu supported operating systems
2021-10-19 15:44:36 -04:00
mmcclaskey
d3add8150c Bugfix/kasm 2004 download spaces (#70)
* Handle spaces in download files, dirlisting

* Disallow / in percent urls

Co-authored-by: Lauri Kasanen <cand@gmx.com>
2021-10-18 07:38:57 -04:00
mmcclaskey
5b28a168d0 Chromeclip (#69)
* Initial binary clipboard support

* Rename -DLP_Clip_Types to -DLP_ClipTypes

* Better handling of websocket frames

* Copy-paste bug in SSE2 scaling to under 0.5x

* Remove old text clipboard

* Bind text to binary clipboard

* Move binclip clear to probing phase

* Off-by-one in sse2 scaling

* Add a clarifying log message for INCR clipboard transfers

* WIP: Update novnc commit

* Fix CentOS pipeline

* webpack fix

* Update novnc commit

* Change some DLP defaults

* update novnc commit

Co-authored-by: Lauri Kasanen <cand@gmx.com>
Co-authored-by: matt <matt@kasmweb.com>
2021-10-15 15:57:58 -04:00
mmcclaskey
e6d1b8c3c8 Fix a nonexistent username + empty password passing through (#68)
Co-authored-by: Lauri Kasanen <cand@gmx.com>
2021-10-14 13:57:59 -04:00
mmcclaskey
620dbe558c [skip CI] Update README 2021-10-14 08:23:00 -04:00
j-travis
bcad19542e Merge pull request #63 from kasmtech/feature/KASM-1871_scroll_sensitivity
KASM-1871 Add smooth scrolling
2021-10-12 14:24:01 -04:00
Justin Travis
24e21325ef KASM-1871 Pull in submodule from tip of master 2021-10-12 13:37:40 -04:00
Mariusz Marciniak
0a45fcc700 KASM-1871 Add smooth scrolling
Previously all scrolling relied on "clicking" the up/down or left/right scroll buttons
which made it unprecise and to always scroll at the same speed.

Now we pass the scroll delta directly to the xorg input driver so the scroll is more responsinve and adaptive.
2021-10-07 14:08:20 +02:00
mmcclaskey
3f3d31312c Update README 2021-10-04 10:48:14 -04:00
j-travis
e857b86924 Merge pull request #60 from kasmtech/bugfix/KASM-1985_centos_ca_certs
KASM-1985 Address build failures by updating Centos CA certs
2021-10-03 13:55:51 -04:00
Justin Travis
e470021ca6 KASM-1985 Address build failures by updating Centos CA certs 2021-10-03 13:33:04 -04:00
mmcclaskey
5a1f9b9ae2 Update README download link 2021-09-29 13:47:14 -04:00
mmcclaskey
93e47e5d54 Bugfix/kasm 1912 websocket crash (#57)
* Copy-paste bug in SSE2 scaling to under 0.5x

* Better handling of websocket frames

* KASM-1912 websocket crash, scaling bug

Co-authored-by: Lauri Kasanen <cand@gmx.com>
Co-authored-by: matt <matt@kasmweb.com>
2021-09-24 08:25:35 -04:00
mmcclaskey
dd26c40844 KASM-1970 fix broken pipeline (#56)
Allow jobs to fail if they are not required for the greater KAsm. Later we should modify this to not allow a fail fo rrelease branches
2021-09-23 18:49:52 -04:00
mmcclaskey
3f680a7b80 KASM-1913 webp mode tweaks (#55)
Co-authored-by: matt <matt@kasmweb.com>
2021-09-23 14:04:19 -04:00
matt
159d752795 Update noVNC commit 2021-09-10 18:11:35 +00:00
mmcclaskey
0cb2c0ba9f Sse scaling (#52)
* Add CPUID functions for runtime dispatch
* Add SSE2 scaling
2021-09-09 13:55:33 -04:00
mmcclaskey
dc21d5f97c Add a set of self-microbenchmarks (#51)
Co-authored-by: Lauri Kasanen <cand@gmx.com>
2021-09-09 12:46:57 -04:00
Dmitry Maksyoma
91eb953f62 Feature/kasm 1838 libjpeg turbo from source (#49)
New build option with latest stable libjpeg-turbo library
2021-09-07 08:11:21 -04:00
mmcclaskey
6f2805e186 Merge pull request #47 from kasmtech/bugfix/KASM-1815_DO_websocket
Bugfix/kasm 1815 do websocket
2021-08-18 05:22:54 -04:00
Lauri Kasanen
d80eb39686 Fix DigitalOcean load balancer websocket connection (they too used wrong case in a header) 2021-08-17 13:30:33 +03:00
Lauri Kasanen
4b28667e90 Fix possible missing clipboard deinit 2021-08-17 13:13:51 +03:00
mmcclaskey
5341bc6fba Merge pull request #46 from kasmtech/speed-up-deb-build
Slash a minute off tarball build
2021-08-16 11:17:37 -04:00
Dmitry Maksyoma
9ec4cba184 Slash a minute off tarball build 2021-08-17 00:00:55 +12:00
mmcclaskey
643a0cfed6 Merge pull request #45 from kasmtech/multiple
Add pid to the internal socket name, clarify websocketport bind error
2021-08-15 05:47:05 -04:00
Lauri Kasanen
9ca850a108 Add pid to the internal socket name, clarify websocketport bind error 2021-08-13 12:15:17 +03:00
matt
ec6bd697a8 update novnc ref 2021-08-05 14:48:41 -04:00
matt
544a9fc592 KASM-1512 api stats KASM-1790 cursor 2021-08-05 11:12:03 -04:00
mmcclaskey
7b5838a1ea Merge pull request #43 from kasmtech/apistats
Apistats
2021-08-05 11:03:35 -04:00
Lauri Kasanen
a9b66833a9 Change frame stats API json formatting 2021-08-03 14:41:54 +03:00
Lauri Kasanen
e208d5bb5f Bottleneck clear should wait instead of try 2021-08-02 13:56:54 +03:00
Lauri Kasanen
f57e6e644b Add some more frame stats granularity, skip frame stats on no-data calls 2021-08-02 13:47:48 +03:00
Lauri Kasanen
c1ed769780 Clear disconnected clients from the bottleneck stats api 2021-08-02 12:45:51 +03:00
matt
fae8aa9051 switched novnc commit 2021-07-29 14:04:39 -04:00
Lauri Kasanen
438271d68b Add support for vmware cursor 2021-07-29 18:02:57 +03:00
Lauri Kasanen
fb9dd56703 Initial /api/get_frame_stats 2021-07-27 15:33:48 +03:00
Lauri Kasanen
32e8d40472 Implement /api/get_bottleneck_stats 2021-07-26 18:58:29 +03:00
Lauri Kasanen
811e7cde3a Use case-insensitive search for the websocket headers 2021-07-12 15:44:24 +03:00
mmcclaskey
72affbfcf4 [skip CI] Readme updates 2021-06-25 10:04:26 -04:00
mmcclaskey
b362110b07 [skip CI] update readme 2021-06-25 05:59:14 -04:00
Lauri Kasanen
29e0e2bd2e Fix animated cursor resize crash 2021-06-15 15:40:14 +03:00
Lauri Kasanen
9144045718 Append the microsecond-level connection time to the abstract socket name, making it always unique 2021-05-10 19:16:28 +03:00
Lauri Kasanen
7a695c976e Writer perms were checked in multiple places, consolidate and fix a missing case 2021-05-10 11:02:20 +03:00
matt
aefdb1392f KASM-1511 istouch bugfix 2021-04-26 05:58:04 -04:00
Lauri Kasanen
14e08a2067 Add trailing slash in dir listing 2021-04-22 11:33:05 +03:00
matt
f64bd4f1a4 Correct spelling of License file 2021-04-20 15:41:38 -04:00
Kasm
0b6334369c Merge pull request #36 from kasmtech/upstreamsync_sans_novnc
Upstream Syncs
2021-04-20 14:51:25 -04:00
matt
b8c69a7560 update noVNC submodule commit 2021-04-20 09:46:01 -04:00
matt
e84a37fb3d switched submodule commit id 2021-04-20 08:11:20 -04:00
matt
23935145a8 update submodule branch 2021-04-18 06:55:26 -04:00
matt
7f7b177b1a Update noVNC to latest master 2021-04-18 06:45:32 -04:00
Kasm
adcf902733 Merge pull request #35 from kasmtech/deb-installation-instructions-readme [skip CI]
Deb installation instructions readme
2021-04-13 12:04:28 -04:00
Kasm
ce2f2adc59 [skip CI] Updates to install instructions 2021-04-13 11:33:30 -04:00
matt
80d401af51 [skip CI] updates to docs 2021-04-13 10:23:00 -04:00
Kasm
5c832ed93d [skip CI] updates to readme 2021-04-13 09:07:49 -04:00
Kasm
55f888b923 Update README.md
minor grammar tweaks
2021-04-13 08:59:37 -04:00
Dmitry Maksyoma
bbdf6c4361 Update README.md 2021-04-13 23:04:52 +12:00
Dmitry Maksyoma
90d1702702 Update README.md 2021-04-13 22:57:10 +12:00
Lauri Kasanen
95d34f7e58 Fix some local->remote clipboard merge misses 2021-04-13 13:49:43 +03:00
Dmitry Maksyoma
e7f8caa752 Building: describe how to build and test packages 2021-04-13 22:48:41 +12:00
Dmitry Maksyoma
f532e3244b Add deb/rpm package build instructions 2021-04-13 21:59:51 +12:00
Dmitry Maksyoma
2f47aca1db README: remove obsolete info 2021-04-13 21:46:19 +12:00
Dmitry Maksyoma
15571e4720 README.md formatting 2021-04-13 07:28:33 +12:00
Dmitry Maksyoma
232f20e917 Improve README.md 2021-04-13 07:28:26 +12:00
Dmitry Maksyoma
a9bf5bdcf8 Update README: deb installation only 2021-04-13 07:28:17 +12:00
Lauri Kasanen
a1cf454f06 Sync utf8 clipboard support 2021-04-12 12:38:24 +03:00
matt
04461b9d4c fixes 2021-04-11 21:35:13 +00:00
matt
0d482f9a9b Update noVNC commit 2021-04-01 08:18:59 -04:00
matt
a7773bee6b Updated submodule ref 2021-03-31 15:06:27 -04:00
matt
75cef8b726 [skip CI] build fixes 2021-03-31 07:54:59 -04:00
matt
380bc0e7f8 merged master in 2021-03-31 05:21:35 -04:00
matt
999cfbb806 Added kasm novnc as submod 2021-03-30 15:32:18 -04:00
matt
12a0c0d8af removed novnc 2021-03-30 15:25:35 -04:00
Lauri Kasanen
7bfcb19ee1 Fixups 2021-03-29 13:25:16 +03:00
Quentin Dreyer
df9ca2e0ce chore: sync with W3C documentation
https://www.w3.org/TR/uievents-key/
2021-03-29 12:50:39 +03:00
Pierre Ossman
4fda2526f4 Send combination keysyms for some Japanese keys
Windows doesn't give us stable symbols for a bunch of Japanese IM keys,
instead alternating between two symbols. This state is not synchronised
with the IM running on the remote server so to have stable behaviour we
have to collapse these multiple symbols in to a single keysym.
2021-03-29 12:50:22 +03:00
Pierre Ossman
102257cb32 Fix typo for ZenkakuHankaku key 2021-03-29 12:50:16 +03:00
Pierre Ossman
77509c1e56 Use toggle keysym for Eisu key
This matches how the key behaves on a Linux system.
2021-03-29 12:50:12 +03:00
Pierre Ossman
9e0a5d26af Update keycode mappings to latest version
This update fixes Korean layouts.
2021-03-29 12:48:56 +03:00
Pierre Ossman
c6c2661121 Add workaround for Firefox PNG rounding bug 2021-03-29 12:48:06 +03:00
Pierre Ossman
8b8201fd73 Remove Firefox Alt workaround
The bug got fixed way back in Firefox 63, and it is also misbehaving
with modern Firefox as they no longer consider AltGr an Alt-key.
2021-03-29 12:48:02 +03:00
Pierre Ossman
33a113a475 Handle empty rects in RAW decoder as well
It was overlooked in the previous commit because we couldn't feed
empty data messages through the test framework.
2021-03-29 12:47:49 +03:00
Samuel Mannehed
6d1cebc24a Ignore recording variables in our linter 2021-03-29 12:47:43 +03:00
Pierre Ossman
fcd7836a83 Approximate comparison of JPEG result
The browsers have various rounding errors so we need to compare the
output data only approximately and not exactly.
2021-03-29 12:47:38 +03:00
Pierre Ossman
073737c8ac Handle empty rects from the server
These are very pointless for the server to send, but not a violation of
the protocol so we need to be able to handle them. We've seen this
happen in real world scenarios a few times.
2021-03-29 12:47:30 +03:00
Samuel Mannehed
16c72ba0a7 Fix call to _recvMessage()
Missed to rename this one in commit ea858bfa275d85541ac26d035967959714e8e255
2021-03-29 12:45:49 +03:00
Samuel Mannehed
d3c9ff8b12 Fix names of recording variables
The name of these variables must match how they were set when the
recording was created.

Reverts part of 95632e413d75030c49577c0e5cf1003208a5ba09
2021-03-29 12:45:41 +03:00
Pierre Ossman
4bc4c1d7f6 noVNC 1.2.0 2021-03-29 12:45:36 +03:00
Pierre Ossman
d8ba9a61e2 Update generated JS files for translations 2021-03-29 12:45:31 +03:00
Samuel Mannehed
0e2a25476f Update Swedish translation 2021-03-29 12:45:28 +03:00
Pierre Ossman
b3b4acaaa3 noVNC 1.2.0 beta 2021-03-29 12:45:08 +03:00
Pierre Ossman
201f2517f7 Remove note about clipboard ISO 8859-1 restriction
We now support full Unicode, provided the server also supports the
proper extension.
2021-03-29 12:44:59 +03:00
Pierre Ossman
f51167a2ce Update translation template file 2021-03-29 12:44:54 +03:00
Pierre Ossman
87b3a630cf Remove redundant VERSION file
We want to avoid having this in multiple places.
2021-03-29 12:44:42 +03:00
Pierre Ossman
7412dde8ee Handle quick Cursor detach after mouse up
This timer might fire after the Cursor object has detached from a DOM
element, causing crashes. This will likely not happen in real scenarios,
but the tests are quick enough to trigger this.
2021-03-29 12:44:25 +03:00
Pierre Ossman
3ef6e1333b Remove default Karma options
No need to mention things where we already use the default value.
2021-03-29 12:43:59 +03:00
Samuel Mannehed
b84220f319 Add lint rule for function declaration indentation 2021-03-29 12:41:44 +03:00
Pierre Ossman
42d437ad25 Start fake test clock at real clock time
Some code relies on the clock having a somewhat sane value, so let's not
start at 0.
2021-03-29 12:41:15 +03:00
Pierre Ossman
d5b84d9185 Avoid fractional pixel sizes from Display 2021-03-29 12:41:06 +03:00
Pierre Ossman
6db1c2bf0d Avoid printing the Websock buffer in tests
It takes forever and just messes up the output.
2021-03-29 12:40:09 +03:00
Pierre Ossman
ae1bc396bf Standardise on a single blit function
Keep everything simpler by always blitting in the same pixel format.
It's up to the decoders to convert if they need to.
2021-03-29 12:39:31 +03:00
Pierre Ossman
c7a7ce70be Fix bad BasicCompression check in Tight decoder 2021-03-29 12:37:29 +03:00
Pierre Ossman
55178c76b8 Test correct handling of alpha
The forth byte of a pixel is undefined in most encodings, so make sure
the decoders don't leak that through as an alpha channel.
2021-03-29 12:36:47 +03:00
Pierre Ossman
5752bf8ab7 Add tests for the Tight decoders 2021-03-29 12:36:42 +03:00
Pierre Ossman
6fd1035fb1 Split decoder tests to separate files 2021-03-29 12:36:35 +03:00
Pierre Ossman
212e0f1a10 Move tile handling to Hextile decoder
It is only used there so no need for it to be in the general
Display class.
2021-03-29 12:36:23 +03:00
Samuel Mannehed
69b945fc87 Standardize on camelCase in Display 2021-03-29 12:35:23 +03:00
Samuel Mannehed
b837bd6f59 Add camelCase rule to eslint 2021-03-29 12:34:42 +03:00
Samuel Mannehed
670eefbc97 Standardize on camelCase in Base64 2021-03-29 12:34:31 +03:00
Samuel Mannehed
b2d8db3f7b Standardize on camelCase in Decoders 2021-03-29 12:34:29 +03:00
Samuel Mannehed
a3e2b1e46e Standardize on camelCase in Logging 2021-03-29 12:34:25 +03:00
Samuel Mannehed
472ede66ea Standardize on camelCase in Websock 2021-03-29 12:34:23 +03:00
Samuel Mannehed
da228af778 Standardize on camelCase in tests 2021-03-29 12:34:13 +03:00
Samuel Mannehed
59f5648592 Remove unused properties and variables
The code that used these were removed in the following commits:

* 9ff86fb718477515ede2d6457f06643935d76bcd (RFB._mouse_arr)
* bb6965f2e60c2301dd638383bdc792d1f10af942 (old_requestAnimationFrame)
* 490d471c53b1791398d6c30f0efce54925939f33 (Display._c_forceCanvas)
2021-03-29 12:27:54 +03:00
Samuel Mannehed
19c473f792 Properly limit mouse moves to once every 17 ms
Previous attempt in c958269 had a number of issues, this is a full
rewrite, complete with improved unit tests.

Fixes github issue #1402
2021-03-29 12:26:12 +03:00
Samuel Mannehed
8a8fa1d906 Stop send mouse clicks while dragging in view only 2021-03-29 12:23:20 +03:00
Samuel Mannehed
5a81223d96 Standardize on camelCase for functions in RFB 2021-03-29 12:23:12 +03:00
Samuel Mannehed
eff38d47f9 Standardize on camelCase for variables in RFB 2021-03-29 12:21:50 +03:00
Samuel Mannehed
1de3769fd3 Remove unused mouse_arr variable 2021-03-29 12:16:38 +03:00
Samuel Mannehed
749ddce5b9 Add unit tests for mouse move limit 2021-03-29 12:16:01 +03:00
Samuel Mannehed
d420aa6413 Shorten rows to max 80 chars in mouse.js 2021-03-29 12:15:56 +03:00
Samuel Mannehed
93e42772bc Fix wording in comment 2021-03-29 12:15:49 +03:00
Uwe Klatt
9098478faf Limit mouse move events to one every 17 ms 2021-03-29 12:15:39 +03:00
Samuel Mannehed
4710ec1822 Fix indentation for focus check 2021-03-29 12:15:34 +03:00
Samuel Mannehed
02b9b268ff Don't fade the control bar if it has focus
Fixes github issue #1369
2021-03-29 12:15:29 +03:00
Samuel Mannehed
a015e33111 Hide the clipboard when not connected
Fixes github issue #1367.
2021-03-29 12:15:25 +03:00
Ingo Blechschmidt
950d871b0e Document default setting of focusOnClick 2021-03-29 12:15:19 +03:00
Filip Stedronsky
02e7b006de rfb: VeNCrypt Plain SecurityType support
This allows using TigerVNC server with PAM authentication (e.g. agains
LDAP or other extensible authentication mechanisms)

Tested with TigerVNC server (Xvnc -SecurityTypes Plain -PlainUsers '*')

Should not break anything else, this method is tried last when all
other fail.

Tested in Firefox 74 and Chromium 80
2021-03-29 12:14:55 +03:00
Alex Tanskanen
95af51e28d Fix focus problem after closing the toolbar
Closing the toolbar would make the focus remain on the toolbar and
not in the session. The only way to switch focus was to click in the
session. This commit will automatically switch back focus to the session
after closing the toolbar.
2021-03-29 12:14:49 +03:00
Niko Lehto
64dfb8d1d6 Hide clipboard side bar button when view only mode
The clipboard side bar button serves no purpose if user uses 'View Only'
mode, this commit hides this button in those instances.
2021-03-29 12:14:25 +03:00
Alex Tanskanen
b173c8854a Fix crash with too large clipboard data
If too much text is copied in the session, String.fromCharCode.apply()
would crash in Safari on macOS and Chrome on Linux. This commit fixes
this issue by avoiding apply() altogether. Also added test to cover this
issue.
2021-03-29 12:14:19 +03:00
Pierre Ossman
888f24e7af Style all input types for consistent UI
At least all that the browsers will let us.
2021-03-29 12:14:14 +03:00
Niko Lehto
8be81165bd Add extended clipboard Pseudo-Encoding
Add extended clipboard pseudo-encoding to allow the use of unicode
characters in the clipboard.
2021-03-29 12:13:59 +03:00
Niko Lehto
509b5795a0 Export constants in inflate.js for easier usage 2021-03-29 12:09:49 +03:00
Niko Lehto
581fe511ad Fix bug where inflate would read too much data 2021-03-29 12:09:44 +03:00
Niko Lehto
9ca647667b Split api of inflate
Added ability to read data chunk wise.
2021-03-29 12:09:40 +03:00
Niko Lehto
dbe2930758 Handle errors from zlib/pako 2021-03-29 12:09:36 +03:00
Niko Lehto
b690ae4c2d Move error handling to Inflate class
Every call wants this check so this should be done inside the class.
2021-03-29 12:09:32 +03:00
Niko Lehto
5e4544d5fc Add missing copyright header for Inflator.js 2021-03-29 12:09:27 +03:00
Niko Lehto
0b19961b06 Remove unused inflate argument
The value true was an invalid flush argument so it was in practice
unused.
2021-03-29 12:09:21 +03:00
Niko Lehto
286694869b Add util for unsigned and signed int. conversion
Will be used in later commit in extended clipboard handling.
2021-03-29 12:09:10 +03:00
Niko Lehto
fdeefcfab4 Add deflator helper class for deflating data
Wraps pako's deflate for easier usage.
2021-03-29 12:09:05 +03:00
Niko Lehto
24cf1f0f9a Make clipBoardPasteFrom() test more specific
Don't rely on clientCutText() to test clipboardPasteFrom().
2021-03-29 12:08:58 +03:00
Alvin Townsend
d01f6e6d27 Correcting path to package.json for running at a path other than root. 2021-03-29 12:08:52 +03:00
Samuel Mannehed
c1160d1468 Fix color channels for VMware alpha cursors
The red and blue channels were incorrectly swapped.
2021-03-29 12:08:36 +03:00
Juanjo Diaz
1c38b6f120 Remove generated HTML by Cursor when it detaches 2021-03-29 12:08:01 +03:00
Samuel Mannehed
70dd0058ac Simplify encodeUTF8/decodeUTF8 unittests 2021-03-29 12:07:57 +03:00
Samuel Mannehed
a4c5c38b53 Add unit tests for encodeUTF8 and decodeUTF8 2021-03-29 12:07:52 +03:00
Samuel Mannehed
789308212b Remove unused python scripts 2021-03-29 12:07:48 +03:00
Samuel Mannehed
ce5fe304cb Fix chinese translation for "Disconnect"
Thanks for @wavezhang, @litongjava, and @bhzhu203 for helping out.
2021-03-29 12:07:41 +03:00
Samuel Mannehed
781075c841 Update chinese translation strings
Thanks to @QQ2017 and @wavezhang for helping out with correcting these.
2021-03-29 12:07:36 +03:00
Samuel Mannehed
2f43cead79 Add comment for browser and platform detection 2021-03-29 12:07:32 +03:00
Samuel Mannehed
e7a5aa271e Add short description at the top of browser.js 2021-03-29 12:07:23 +03:00
Samuel Mannehed
ad206180d2 Properly detect scrollbar gutter
As a rule, instead of hard-coding a behavior on specific platforms we
should do dynamic detection.

This commit moves away from always hiding scrollbars on Android and iOS
and instead detects the rendered width of scrollbars in the browser.
2021-03-29 12:07:09 +03:00
Pierre Ossman
89dd199317 Allow cursor to be updated while connecting
We haven't got a server provided cursor at this point, but we might
have done something local, e.g. enabled the dot cursor.
2021-03-29 12:06:42 +03:00
Pierre Ossman
8be70e5ae0 Handle slow loading of images
Internet Explorer seems to flag images as loaded prematurely, which
can result in rendering bugs. We can detect this by looking at the
dimensions though.
2021-03-29 12:06:28 +03:00
Samuel Mannehed
ce94d92e18 Build in the behavior to ignore decodeUTF8 errors
Makes the code clearer and more explicit in intent.
2021-03-29 12:03:54 +03:00
Samuel Mannehed
c3ef9ff557 Peter is no longer part of the noVNC team 2021-03-29 12:02:16 +03:00
Chris \"Koying\" Browet
c0276776e9 Add support for Unix Tight auth 2021-03-29 12:02:05 +03:00
VanyM
10f4aa9e7b Add try catch in every place that uses decodeUTF8 2021-03-29 12:02:00 +03:00
Samuel Mannehed
b2dc76ee18 Add encodeUTF8 function to core/util/strings.js 2021-03-29 12:01:15 +03:00
Pierre Ossman
12cdad066e Make Cursor.detach() safe to call when not attached
Avoids having checks in higher layers.
2021-03-29 12:01:10 +03:00
Samuel Mannehed
a850be4afa Fix chinese translation errors
Thanks to @QQ2017 for providing the translation strings
2021-03-29 12:01:07 +03:00
Samuel Mannehed
354d544843 Simplify logic for status hierarchy
Removes unnecessary variable
2021-03-29 12:01:02 +03:00
Samuel Mannehed
0bf9403a36 Ensure warning status timeouts are honored
When showing a new status popup we want to set a timer for how long to
show it. In cases where we show many statuses in a fast succession we
need to remove any running timeouts when showing a new one.

There are exceptions when new statuses won't be shown, and thats if a
more severe status is already showing, i.e and error or a warning.

Warnings can still have timeouts. There was a bug that occured when we
tried to show a normal status while a warning was showing. The bug
caused the warning status timeout to be removed even if the normal
status was never shown. We should only remove running timeouts if we're
actually going to show a new status.
2021-03-29 12:00:47 +03:00
Pierre Ossman
29db8997ec Don't use arrow functions in legacy loader
The browsers that need the legacy code do not support such fancy
modern things.
2021-03-29 12:00:38 +03:00
Pierre Ossman
46f15667f7 Load support scripts first
E.g. SystemJS requires the Promise polyfill, so make sure all our
support files are loaded first.
2021-03-29 11:59:59 +03:00
Pierre Ossman
edb5fee88b Upgrade to latest babel
There has been a lot of renaming and restructuring in babel, so we need
to modify our code to handle the latest version. We also need to adjust
the way we build our babel worker as babel itself no longer runs in older
browsers such as Internet Explorer.
2021-03-29 11:59:50 +03:00
Pierre Ossman
23871b42d1 Always include Promise polyfill for legacy browsers
It is now used by our general code and not just by the conversion
routines, so we need to make sure it is always included for the
old browsers.
2021-03-29 11:58:26 +03:00
Pierre Ossman
d6d875ef3b Clean up handling of untransformed files
This control flow is difficult enough as it is to follow. Move the
handling of the untransformed files to a separate block to make it
slightly easier to understand.
2021-03-29 11:58:20 +03:00
Pierre Ossman
6c84631bbc Remove redundant "no copy" check
We also check this list as a filter to walkDir(), so no need for the
extra check here.
2021-03-29 11:58:13 +03:00
wavezhang
6bb87ee2b2 Update zh_CN.po
fix spell errors, improve translations
2021-03-29 11:57:31 +03:00
Alex Tanskanen
15c74e7dc9 Fix missing caps lock events on iOS
Caps Lock on iOS only trigged key release or key press events.
When it's clicked it would only send keydown, and next time
it would only send keyup and so on. It should send both a key press
and a key release.

Also added the unit tests for macOS since those were missing.

Co-Authored-By: Alex Tanskanen <aleta@cendio.se>
2021-03-29 11:57:26 +03:00
Samuel Mannehed
f1be4be653 Add README to app/locale warning not to modify 2021-03-29 11:57:09 +03:00
Alex Tanskanen
b5f1a00282 Add "macOS shuffle" to iOS as well
Since iOS functions like macOS with regards to Alt behaving like AltGr,
we need the same workaround on iOS as well.
2021-03-29 11:57:05 +03:00
Pierre Ossman
740a8217ab Handle missing Shift events on Windows
This is a bug in the OS that leaks through to the browsers. We need
to fake a Shift release here to avoid Shift getting stuck in the remote
session.
2021-03-29 11:57:00 +03:00
Pierre Ossman
796de9653f Send NumLock on macOS, even though the key is Clear
There is no obvious choice what works best here, but this is what
TigerVNC has been doing for years without complaints. Let's follow
them until we get reports that this doesn't work well.
2021-03-29 11:56:55 +03:00
Pierre Ossman
6916c83b48 Fix typo for MailSend key 2021-03-29 11:56:49 +03:00
Pierre Ossman
d10d7167f6 Update to latest UI Events key specification 2021-03-29 11:56:45 +03:00
Pierre Ossman
a8dc933701 Fix AltGr for a few more keys in IE and Edge
Some keys apparently send 'Unidentified' rather than an unshifted value.
Make sure those are also handled. Examples are \ and | on a Swedish
keyboard.
2021-03-29 11:56:40 +03:00
Samuel Mannehed
d61bf69c33 Keep the virtual keyboard after using extra keys
If using the extra keys always gives focus to the screen then an
on-screen keyboard would be closed. When using on-screen keyboards we
instead want to give focus to our virtual keyboard input element.
2021-03-29 11:56:34 +03:00
Pierre Ossman
62fca18cb9 Revert iOS keyup workaround
It seems Apple has fixed their buggy keyup events, so remove the
workaround and allow keys to be kept pressed again.

This is a revert of 9e99ce126ca8f6f350fa015c0e58d35103c62f7e.
2021-03-29 11:56:31 +03:00
Pierre Ossman
dc3ddc8efc Handle broken numpad delete key in Chrome 2021-03-29 11:56:24 +03:00
Pierre Ossman
e497b53d09 Explain why Clear maps to KP_Begin 2021-03-29 11:56:11 +03:00
Pierre Ossman
7dc51fa7a5 Try to handle Meta key properly
The standards have unfortunatly caused some confusion between the Windows
key and the original Meta key. Try to handle the common case sanely at least.
2021-03-29 11:56:08 +03:00
Samuel Mannehed
443858cf83 Move focus to the screen when using extra keys
A regression from 2afda54 and friends was that you couldn't use the
extra keys and then directly use the keyboard, you would have to click
in the session first.

This commit restores the correct behavior and also adds a visual queue
to the fact that the screen got the focus by fading the controlbar.
2021-03-29 11:56:01 +03:00
Samuel Mannehed
6b39933658 Add missing scancode for sendTab 2021-03-29 11:55:55 +03:00
Samuel Mannehed
6067290169 Rename document.capturedElem to captureElement
To better fit most naming.
2021-03-29 11:55:52 +03:00
Pierre Ossman
a8699ab8cb Improve Windows key image
The previous one didn't have sharp lines, or follow pixel boundaries
properly.
2021-03-29 11:55:45 +03:00
Samuel Mannehed
996895268e Hide the emulated cursor when target is null
Makes it easier to understand what happens when a real element isn't
passed as a target to updateVisibility(). Also makes the code more
robust to future changes.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:38 +03:00
Samuel Mannehed
fb14c2dec9 Fix disappearing cursor after click
In the cursor emulation when deciding if the cursor should be hidden -
Instead of checking what's under the cursor, we check the element that
has capture.

This introduced another bug in the cursor emulation. The cursor did not
always disappear properly when using our cursor emulation together with
our setCapture polyfill. More specifically, we saw a problem when a
capture ended on an element without cursor emulation.

We solved this by introducing another visibility check on a timer in
the cursor emulation. However this led to yet another problem where
this timer conflicted with the timer in the setCapture polyfill.

We removed the timeout in the setCapture polyfill and created a
variable to make sure that all the events remaining in the queue can be
completed.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:28 +03:00
Samuel Mannehed
83d5e5bffd Check next elem at mouseleave in cursor emulation
It's not obvious that we want to hide the cursor when we get a leave,
it depends on the element that we're leaving to. This makes the code
more robust.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:20 +03:00
Samuel Mannehed
19dfb7901c Rename variables in setCapture proxy
The names of many variables were too similar. To make the code easier
to follow we renamed:

* _captureElem to _capturedElem
* _captureElemChanged() to _capturedElemChanged()
* captureElem to proxyElem
* elem to target

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:13 +03:00
Pierre Ossman
6acf3c9e62 Never show drag icon if clipping is disabled
Toggling the enabled state is a remnant from an earlier version
of the code where we could determine if the the session is actually
clipped, and not just that the setting is enabled.

Right now we only change things based on the setting, so let's
completely hide the button when clipping is disabled.
2021-03-29 11:54:51 +03:00
Samuel Mannehed
0dcb896920 Update copyright to 2019 for modified files 2021-03-29 11:54:44 +03:00
Samuel Mannehed
d88aefba4e Code comments for how the receieve queue works 2021-03-29 11:54:33 +03:00
Samuel Mannehed
b0c54f6b24 Clarify why we ENABLE_COPYWITHIN is false 2021-03-29 11:54:26 +03:00
Samuel Mannehed
6342a117ff Clarify comments for broken alt in FF on Windows 2021-03-29 11:54:18 +03:00
Niko Lehto
766fc43855 Add support for VMware cursor encoding
Supports both classic cursor type and alpha cursor type. In classic
mode the server can send 'inverted' pixels for the cursor, our code
does not support this but handles these pixels as opaque black.

Co-authored-by: Samuel Mannehed <samuel@cendio.se>
2021-03-29 11:53:24 +03:00
Niko Lehto
19f0803636 Fix url cursor detection on Edge
_supportCursorURIs was set to true even when Edge didn't support
URIs because the fallback value "default" was used.
2021-03-29 11:51:50 +03:00
Niko Lehto
3c3ac34eb8 Test unicode desktop names 2021-03-29 11:51:18 +03:00
Niko Lehto
8c43287afb Add support for DesktopName extension
This extension allows session name to be changed during runtime.
2021-03-29 11:50:44 +03:00
Pierre Ossman
c16cc6e2b9 Set viewport size for autoscale tests
We were incorrectly relying on the viewport being indirectly set
for us. Make sure we are explicit in what we want for these tests.
2021-03-29 11:49:41 +03:00
Pierre Ossman
c211f31113 Remove pointless Display.clear()
It served no meaningful purpose and it had bugs. So let's remove it
rather than try to fix it.
2021-03-29 11:49:36 +03:00
Pierre Ossman
4cc536636a Remove unused Display.logo attribute 2021-03-29 11:49:21 +03:00
Pierre Ossman
734bdd3746 Deprecate showDotCursor option for RFB constructor
It is not relevant for the connection stage so it should not have
been a constructor argument to begin with. Ship with a warning for
a release before we remove it.
2021-03-29 11:47:35 +03:00
Pierre Ossman
8218a0cb2a Make sure showDotCursor can be modified before connecting
The cursor object is only attached to our canvas whilst connecting,
so we need to make sure we don't try to update anything when were
not connected or we'll get a crash.
2021-03-29 11:46:22 +03:00
Pierre Ossman
2525174260 Regenerate module loader after tool upgrades 2021-03-29 11:46:12 +03:00
Jesper Alf Dam
b0896c8859 When compacting the receive buffer don't copy unused buffer space
When compacting the receive buffer, we should only copy the bytes
between _rQi and _rQlen (the index of the first unread byte, and the
next write position).

Previously, we copied everything for _rQi up untill the end of the
buffer.
2021-03-29 11:45:23 +03:00
Jesper Alf Dam
09de4b8349 Don't compact the receive buffer unless we've actually run out of space
Previously, we would compact the buffer (moving unread data to the
start of the buffer) as follows:

- after processing a message, if there are zero unread bytes, just reset
  the indices for first and last unread byte to zero
- else, if at least 1/8th of the buffer is used, copy remaining data to the beginning of the buffer

The second option is never actually necessary, as before inserting new data
into the array, we already check if there's enough free space, and
compact the buffer first if necessary. So we've been doing a lot of
copies that weren't actually needed. Let's not do that any more.
2021-03-29 11:45:00 +03:00
Jesper Alf Dam
d4747a8c80 Avoid recursion in Alt check on Firefox
The Firefox workaround which checks for missing Alt key events may
synthesise new KeyboardEvents. On these events, checkAlt should not be
recursively triggered. Otherwise, we get "too much recursion" errors
whenever the Alt key is pressed.
2021-03-29 11:44:49 +03:00
Pierre Ossman
5b73c1ca23 Fix trivial lint issues in translation tools
Indentation, missing semicolon, etc.
2021-03-29 11:44:42 +03:00
Pierre Ossman
f21fb95bb9 Remove unused import from module loader 2021-03-29 11:44:23 +03:00
Pierre Ossman
7b02f3d8b8 Avoid deprecated called.once from sinon-chai
It's been removed in newer versions and will break eventually.
2021-03-29 11:44:04 +03:00
Samuel Mannehed
03a333fb18 Add missing parentheses for arrow func arg
Our lint tests expect this when an arrow functino has a body with
curly braces.
2021-03-29 11:43:15 +03:00
Samuel Mannehed
54253efaa0 Add documentation for the option showDotCursor
This is not only a property, it's also a parameter to the constructor.
2021-03-29 11:43:09 +03:00
Samuel Mannehed
8b859f4598 Remove the default value of wsProtocols
Using the 'binary' protocol by default is very non-standard.
2021-03-29 11:42:58 +03:00
Shira Maximov
8c5b5f17eb Add support in websocket sub-protocols 2021-03-29 11:42:28 +03:00
Juanjo Diaz
71fa476514 Add version number to UI 2021-03-29 11:40:55 +03:00
Samuel Mannehed
4fd1f19f3b Update link to websock.js API 2021-03-29 11:40:48 +03:00
Lee Yarwood
257aabecb0 launch.sh: Check for a local websockify directory
Previously launch.sh would check both for the existence of a local
websockify file and /websockify/run file.

This initial check should really be for a local websockify directory
as in packaged environments a file could very well be the actual
executable leading to launch.sh incorrectly attempting to use a local
version of websockify.
2021-03-29 11:40:40 +03:00
Pierre Ossman
74161066af Add support for separate key file in launch script 2021-03-29 11:40:25 +03:00
Samuel Mannehed
e2d86788ba Revert "Fullscreen from iframe (#1236)" (#1247)
This reverts commit 19cdc15aa314760446866a1bcc2db99a80479683.
2021-03-29 11:39:56 +03:00
Pierre Ossman
4c635f65d3 Remove server pixel format warnings
These are harmless and really only for debugging. So remove them
as they tend to trick people in to thinking something is wrong.
We already print the entire server pixel format earlier anyway in
case we need the details.
2021-03-29 11:39:47 +03:00
Ján Jockusch
1d4ada6815 Fullscreen from iframe (#1236)
* First attempt to make the fullscreen button work inside an iframe.

* Cleaner distinction between document element and document.

* Scoping corrections. Auto-detect correct iframe.

* Added comments to the relevant sections.

* IE issue fixed.

* Same source issue solved. fullscreenToggle now checks if it is permitted to inspect other iframes.
2021-03-29 11:39:32 +03:00
Samuel Mannehed
d3ec2aa4d1 noVNC 1.1.0 2021-03-29 11:39:20 +03:00
Samuel Mannehed
10c334303a Update generated JS files for translations 2021-03-29 11:39:13 +03:00
Samuel Mannehed
c4987024ef Update Dutch translations
Co-authored-by: Arend Lapere <arend.lapere@gmail.com>
2021-03-29 11:39:04 +03:00
Samuel Mannehed
04d7bef2ae Update Swedish translations 2021-03-29 11:38:58 +03:00
Samuel Mannehed
12565dc4ac Allow autoscale() with zero height or width
Commit 6e7e6f9 stopped the function from running if width or height was
zero, this commit reverts that change. This commit also makes the
resulting canvas 0x0 if autoscale is called with zero. By adding this
special case we can avoid division by zero in the calculations.
2021-03-29 11:38:52 +03:00
Pierre Ossman
46b7d1db95 Fix up errors and warnings in vnc_playback.html
Remove the styling, as it isn't really needed, and fix some minor
things that the w3c validator complains about.
2021-03-29 11:38:25 +03:00
Samuel Mannehed
0045f07965 Remove invalid HTML attributes from textarea 2021-03-29 11:37:52 +03:00
Samuel Mannehed
d1fdb877ef Fix invalid input type 'input' 2021-03-29 11:37:36 +03:00
Samuel Mannehed
e62e12fbfe Input type image is not allowed to have values 2021-03-29 11:37:18 +03:00
Samuel Mannehed
50183c7caa Add default language 2021-03-29 11:36:20 +03:00
Samuel Mannehed
79ab05192b Add check for bad values for Display.autoscale() 2021-03-29 11:36:08 +03:00
Juanjo Diaz
c6c278f9d5 Replace unnecessary function supportsCursorURIs by a constant variable 2021-03-29 11:35:44 +03:00
Juanjo Diaz
37c17ddbf9 Move support check from display to browser 2021-03-29 11:35:38 +03:00
Dmitriy Shweew
c755008d15 Add Russian translation (#1211)
By Dmitriy Shweew (shweew)
2021-03-29 11:35:31 +03:00
Juanjo Diaz
075eed5cbb Convert DES into a class 2021-03-29 11:35:23 +03:00
Juanjo Diaz
7b7295fd4e Use default argument for base64 2021-03-29 11:35:16 +03:00
Juanjo Diaz
5964156a6f Remove unnecessary context from eventtarget 2021-03-29 11:35:11 +03:00
Juanjo Diaz
1ff792cf4b Remove unnecessary constructor parameter from Cursor 2021-03-29 11:35:06 +03:00
Juanjo Diaz
3043216b63 Remove intermediate variable from mouse 2021-03-29 11:34:56 +03:00
Pierre Ossman
499b251716 Remove error handling in clientCutText()
It is not necessary as Websock.flush() is guaranteed to succeed and
give us some space. It also remove the call to _fail(), which was
invalid at this place as clientCutText() is not a method on RFB.
2021-03-29 11:34:50 +03:00
Pierre Ossman
d20f751441 Throw correct Error object
We've already defined the name Error as a logging function, so we
need to be more explicit when we want to refer to the exception
class.
2021-03-29 11:34:45 +03:00
Pierre Ossman
915901848d Send data one byte at a time in tests
This makes sure we don't have code assuming that everything is
neatly packaged in a single WebSocket message.
2021-03-29 11:34:38 +03:00
Pierre Ossman
ee2423ed2b Clean up RFB._rfb_auth_schema assignment 2021-03-29 11:34:29 +03:00
Pierre Ossman
ce6d66f030 Fix security failure reason handling of slow data
Things would break if the security result and security reason did
not arrive in the same WebSocket message.
2021-03-29 11:34:21 +03:00
Pierre Ossman
41e6fedba6 Fix version handshake to handle slow data 2021-03-29 11:34:08 +03:00
Pierre Ossman
642a67f76f Use arrow function to avoid bind 2021-03-29 11:34:00 +03:00
Pierre Ossman
d7198cbe5d Consume data properly in Hextile decoder
We accidentally removed the code updating the data index in 8a189a6,
resulting in the decoder newer consuming any data. So the data would
be parsed as the next rect, causing weird errors.
2021-03-29 11:33:25 +03:00
lhchavez
25b8e64adb Add support for notifying clients about pointer movements
This change adds support for the VMware Mouse Position
pseudo-encoding[1], which is used to notify VNC clients when X11 clients
call `XWarpPointer()`[2]. This function is called by SDL (and other
similar libraries)  when they detect that the server does not support
native relative motion, like some RFB clients.

With this, RFB clients can choose to adjust the local cursor position
under certain circumstances to match what the server has set. For
instance, if pointer lock has been enabled on the client's machine and
the cursor is not being drawn locally, the local position of the cursor
is irrelevant, so the RFB client can use what the server sends as the
canonical absolute position of the cursor. This ultimately enables the
possibility of games (especially FPS games) to behave how users expect
(if the clients implement the corresponding change).

Part of: #619

1: https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#vmware-cursor-position-pseudo-encoding
2: https://tronche.com/gui/x/xlib/input/XWarpPointer.html
3: https://hg.libsdl.org/SDL/file/28e3b60e2131/src/events/SDL_mouse.c#l804
2021-03-29 11:27:54 +03:00
Pierre Ossman
d8caab699d Add missing headers for TCP_CORK
We didn't include the proper headers to get the correct define, so
corking was never enabled.
2021-03-29 11:04:00 +03:00
Pierre Ossman
da83ecf86a Drop other selection on ownership change
Otherwise we might end up owners of something we cannot deliver data on,
which can hang applications.
2021-03-29 11:03:38 +03:00
Pierre Ossman
189f503b98 Fix handling of bad update requests
We computed a safe area if a client gave us a bogus one, but we didn't
actually use it. Fix this properly and make sure we don't pass on bad
coordinates further.
2021-03-29 11:00:41 +03:00
Pierre Ossman
f54dc7829a Update keycode maps to latest version
Mainly fixes for Japanese and Korean keyboard layouts.
2021-03-29 10:57:41 +03:00
Pierre Ossman
fde088ce65 Improved bandwidth monitoring
Now measures over an entire update, which should hopefully give us more
stable values. They are still small values for fast networks though so
increase precision in the values we keep.
2021-03-29 10:52:51 +03:00
Pierre Ossman
a55f142c98 Don't shuffle input buffer unless actually needed 2021-03-29 10:50:16 +03:00
Pierre Ossman
25995e2490 Remove unused bufSize argument from streams 2021-03-29 10:49:25 +03:00
Pierre Ossman
281d65292a Remove special functions from JPEG compressor
We can do what we want with the standard methods.
2021-03-29 10:48:55 +03:00
Pierre Ossman
57a3c3bba8 Simplify stream availability handling
Just have a simply number of bytes argument to avoid a lot of
complexity.
2021-03-29 10:48:26 +03:00
Pierre Ossman
92c7695981 Create common base classes for buffered streams
Most streams are backed by a memory buffer. Create common base classes
for this functionality to avoid code duplication.
2021-03-29 10:11:16 +03:00
Pierre Ossman
7f90205cf2 Add stream avail() methods
Makes it more readable to write code that needs to know how much
data/space is available in a stream.
2021-03-29 10:08:40 +03:00
Pierre Ossman
910fd8fa3e Remove unused stream methods
They were accidentally left unused in fbad8a9 so they haven't been used
in some time.
2021-03-29 10:04:04 +03:00
Pierre Ossman
c97828471c Use proper constants for socket shutdown()
For readability.
2021-03-29 10:03:05 +03:00
Pierre Ossman
c5b7137f2b Flush data on close
There might be some final handshake data that is still stuck in the
buffers, so make a best effort attempt at getting it to the client.
2021-03-29 10:02:31 +03:00
Pierre Ossman
a3c0ce55c9 Support calling methods from timers
We can't safely use the normal timers in base classes as we cannot
guarantee that subclasses will call the base class' handleTimeout()
properly if the subclass overrides it.
2021-03-29 09:58:18 +03:00
Kasm
02721a0270 Merge pull request #34 from kasmtech/bugfix/freezing
Apply patch for 1.20.x
2021-03-28 07:54:47 -04:00
matt
29415a8c7d Apply patch for 1.20.x 2021-03-26 19:53:04 +00:00
Kasm
0638245ff9 Merge pull request #33 from kasmtech/vncserver-remove-basicauth
Vncserver remove basicauth
2021-03-26 13:40:53 -04:00
Dmitry Maksyoma
9b3e1f73f5 Deb/rpm: update barebones images 2021-03-26 01:10:43 +13:00
Dmitry Maksyoma
da4ff4fa70 Merge branch 'master' into vncserver-remove-basicauth 2021-03-25 23:16:22 +13:00
Kasm
1e8451ce21 Merge pull request #32 from kasmtech/squashed_buster_release
CI building and uploading to S3, prepare deb release
2021-03-25 06:13:31 -04:00
Dmitry Maksyoma
4e8750e37a Disable passing of basicauth in vncserver 2021-03-25 23:05:20 +13:00
Dmitry Maksyoma
ca326ee1f1 Revert "Update README: deb installation only"
This reverts commit 213f91c1a7.
2021-03-25 22:27:47 +13:00
Dmitry Maksyoma
40facbcc46 Revert "Improve README.md"
This reverts commit e5cd3d6753.
2021-03-25 22:27:47 +13:00
Dmitry Maksyoma
963ea6b6d3 Revert "README.md formatting"
This reverts commit fc12e38571.
2021-03-25 22:27:47 +13:00
Dmitry Maksyoma
f758fc5021 CI: build all distros and upload to S3 2021-03-25 22:27:27 +13:00
Lauri Kasanen
1632f4888d Enable basicauth by default, remove the option to supply it on the command line 2021-03-25 11:25:30 +02:00
matt
93d3bf052d Removed old line 2021-03-22 11:36:33 +00:00
matt
7b3f6876b4 Fixed syntax error 2021-03-22 11:23:49 +00:00
matt
46e03289be Manually merged region changes 2021-03-22 10:36:39 +00:00
Dmitry Maksyoma
56fd118c43 CI: extract after_script 2021-03-18 23:17:52 +13:00
Dmitry Maksyoma
9a9b14daf1 CI: extract before_script 2021-03-18 23:01:28 +13:00
Dmitry Maksyoma
349ed4cb41 CI: remove tarballs from artifacts 2021-03-18 22:42:40 +13:00
Lauri Kasanen
c3e30dcea1 Add support for DLP_Region 2021-03-15 13:48:56 +02:00
Dmitry Maksyoma
fc12e38571 README.md formatting 2021-03-15 22:38:08 +13:00
Dmitry Maksyoma
e5cd3d6753 Improve README.md 2021-03-15 22:37:48 +13:00
Dmitry Maksyoma
7bffbb53da vncserver: remove securitytypes mention from man page
securitytypes is no longer used.
2021-03-15 22:27:19 +13:00
Dmitry Maksyoma
df92791550 Gitlab CI: build all distros if branch has "release" or "testing" in it 2021-03-15 21:59:39 +13:00
Dmitry Maksyoma
25c32c96e5 Deb: fix Ubuntu Focal (vnc_startup.sh XFCE start issue) 2021-03-14 23:38:48 +13:00
Dmitry Maksyoma
213f91c1a7 Update README: deb installation only 2021-03-14 23:25:53 +13:00
Dmitry Maksyoma
ed4c514bcb Deb: test images have lsb-release now
To ensure it's the right image, I double-check with lsb_release.
2021-03-14 23:24:14 +13:00
Dmitry Maksyoma
2005b86a92 Deb: make easy-start script easier to modify 2021-03-14 21:19:08 +13:00
Dmitry Maksyoma
d73ffc8a38 Deb: example script can now -kill, -d (debug), --help 2021-03-14 21:01:04 +13:00
Dmitry Maksyoma
a73b890c92 Code formatting 2021-03-13 23:51:33 +13:00
Dmitry Maksyoma
8c2e8c9acb Deb: add example script to easily run kasmvncserver 2021-03-13 21:54:06 +13:00
Dmitry Maksyoma
b48fa8a262 vncpasswd man: update the top level description 2021-03-13 21:51:54 +13:00
Dmitry Maksyoma
6f803f744d vncpasswd man: update to be current regarding password length 2021-03-13 21:48:59 +13:00
Dmitry Maksyoma
79682d3dee vncpasswd man: add overview 2021-03-13 20:17:23 +13:00
Dmitry Maksyoma
2b8374f544 Update vncpasswd manual page 2021-03-13 20:07:06 +13:00
Lauri Kasanen
fed991d697 Return 401 unauth for non-owner trying /api/ 2021-03-04 13:59:29 +02:00
Lauri Kasanen
1269fddadf Add a more specific error for a nonexistent screenshot 2021-03-04 13:43:05 +02:00
Dmitry Maksyoma
56ed2855bd Testing: keep foo-owner as -o and -w
Changing permissions to just -w removed -o.
2021-03-04 23:22:28 +13:00
Lauri Kasanen
688e749fda Tentative build fix for newer gccs 2021-03-03 15:33:58 +02:00
Lauri Kasanen
980eedd33b Add HTTP GET APIs for creating, removing users and giving control 2021-03-03 14:55:14 +02:00
Dmitry Maksyoma
43658a27f7 Deb: provide an easy way to start KasmVNC with default options
...via kasmvncserver-start.
2021-03-03 23:27:02 +13:00
Dmitry Maksyoma
e61885a448 Deb: remove obsolete code 2021-03-03 23:09:52 +13:00
Dmitry Maksyoma
8eb7e06d6c Deb: update Debian Buster barebones test to work 2021-03-03 22:47:48 +13:00
Dmitry Maksyoma
62eae815b6 Remove obsolete comment 2021-03-03 22:04:09 +13:00
Lauri Kasanen
3f6524ee30 Add support for owner screenshot HTTP GET API 2021-03-02 15:23:32 +02:00
Kasm
784a9c611d Merge pull request #26 from kasmtech/multiuser_and_new_ui
Packaging changes, multiuser passwd, clipboard (UI) changes
2021-03-01 10:46:20 -05:00
Dmitry Maksyoma
05ea1b99ee Merge branch 'KASM-1298_manually_merge_offline_changes' into multiuser_and_new_ui 2021-02-28 22:55:47 +13:00
Dmitry Maksyoma
101695970b Reapply "Use crypt_r in threaded code" 2021-02-28 22:53:06 +13:00
Dmitry Maksyoma
6d0a020f4f Move build-and-test-* to builder/ 2021-02-28 21:28:14 +13:00
Dmitry Maksyoma
5e5467a3b0 Add build-and-test-deb and -rpm
It builds tarball, deb/rpm pckage, and runs the test image. It doesn't
detect source changes, so it'll always build tarball and the package.
2021-02-28 21:24:59 +13:00
Dmitry Maksyoma
9fb709087d Add verbose logging via KASMVNC_VERBOSE_LOGGING env var
Running "KASMVNC_VERBOSE_LOGGING=1 builder/test-deb debian buster" will
turn on verbose logging of kasmvncserver.
2021-02-28 21:21:49 +13:00
Dmitry Maksyoma
e0c056f36b Add rw, ro and owner users on container startup 2021-02-28 21:03:02 +13:00
Dmitry Maksyoma
7a1c1edeb4 Deb/rpm: change test user password to "foobar"
kasmvncpasswd validates password, so "bar" would be too short.
2021-02-28 20:48:17 +13:00
Dmitry Maksyoma
489c68f7cc Merge branch 'users' into packages_and_multiuser_passwd 2021-02-28 19:50:27 +13:00
Dmitry Maksyoma
01d448f018 Deb: run test image, instead of just printing command 2021-02-28 19:46:18 +13:00
Kasm
f981b1e88a Update ui.js 2021-02-26 10:10:00 -05:00
Kasm
e79b454fb5 Merge pull request #22 from kasmtech/create_fedora_package
Create fedora package
2021-02-25 07:27:24 -05:00
Lauri Kasanen
59fe8ad9db kasmvncpasswd: Nicer behavior when piping a password, add example in help 2021-02-25 13:15:02 +02:00
Dmitry Maksyoma
78768d52ff VNC Docker startup: commented out verbose logging for ease of use 2021-02-25 23:14:50 +13:00
Dmitry Maksyoma
e9626fdacf VNC Docker startup: use new kasmvncpasswd with multiple users support 2021-02-25 23:13:32 +13:00
Dmitry Maksyoma
9084409a20 Merge branch 'users' into packages_and_multiuser_passwd 2021-02-25 22:10:40 +13:00
Dmitry Maksyoma
a5e3a47f48 Merge branch 'master' into create_fedora_package 2021-02-25 22:00:38 +13:00
Dmitry Maksyoma
fbfdf21612 Deb: Debian Bullseye XFCE works now 2021-02-25 21:58:10 +13:00
Dmitry Maksyoma
d7916b081b Deb: Kali XFCE works now 2021-02-25 21:33:38 +13:00
Dmitry Maksyoma
fbe05cee86 Fix random 401 Forbidden on Ubuntu 20 and other newer releases 2021-02-25 21:23:21 +13:00
Dmitry Maksyoma
120dcbeaba Deb: fix code formatting 2021-02-25 21:22:56 +13:00
Lauri Kasanen
6052f28537 Use crypt_r in threaded code 2021-02-24 14:46:48 +02:00
Dmitry Maksyoma
b3ec357e99 Rpm: extract rpm-related install to the spec 2021-02-24 22:53:43 +13:00
Dmitry Maksyoma
a865b6e6eb Deb/Rpm: all file copying to packages is done in debian/ atm 2021-02-24 21:20:33 +13:00
Dmitry Maksyoma
9301fe9d33 Deb/Rpm: add package description 2021-02-24 21:19:49 +13:00
Dmitry Maksyoma
7f9a50562d Deb: fix build dependencies install 2021-02-24 21:16:53 +13:00
Dmitry Maksyoma
ece969fd05 Rpm: group kasmvnc -> kasmvnc-cert
I feel it'd be confusing to use kasmvnc group to provide access to the
TSL certificate. Groups like that control whether you can run software,
e.g. "docker" group. Using "-cert" clearly shows it's just for
certificate access. Not unlide ssl-cert group in Debian.
2021-02-22 22:28:30 +13:00
Dmitry Maksyoma
969c64ced3 Packages: Ubuntu 20 and Fedora 33 barebones tests 2021-02-22 21:25:02 +13:00
Dmitry Maksyoma
f6e2675c02 Rpm: initial Fedora support 2021-02-22 21:24:16 +13:00
Dmitry Maksyoma
0d62f6b7aa Rpm: don't use update-alternatives
Even if I set rpm as conflicting with TigerVNC, update-alternatives
breaks in post-install. That is because files like /usr/bin/vncserver
are left from TigerVNC, when post-install runs.

So, I chose to use /usr/bin/vncserver without update-alternatives.
2021-02-22 21:21:21 +13:00
Dmitry Maksyoma
9e7d57cc3c tarball: include Xvnc.1 man page 2021-02-19 22:58:38 +13:00
Dmitry Maksyoma
24ea2d6c45 Deb: switch Buster barebones to use no WM 2021-02-18 22:32:09 +13:00
Dmitry Maksyoma
6575bbe1b3 Rpm: run xterm w/o WM in CentOS 7 barebones test 2021-02-18 22:00:34 +13:00
Kasm
c401a21c7c Merge pull request #20 from kasmtech/create_ubuntu20_package
Debian, Ubuntu, Kali, CentOS support
2021-02-17 08:25:01 -05:00
Dmitry Maksyoma
5159cb9ae1 build-tarball: only rebuild www if it was changed 2021-02-16 22:21:48 +13:00
Dmitry Maksyoma
7bcf8ebf1f Update GitLab pipeline to use new build/ structure 2021-02-14 19:20:13 +13:00
Dmitry Maksyoma
c151f479f4 Merge branch 'master' into create_ubuntu20_package 2021-02-14 18:59:53 +13:00
Dmitry Maksyoma
4f561568a3 Rpm: make rpmlint happier 2021-02-12 23:07:53 +13:00
Dmitry Maksyoma
0aeffaf2ef Rpm: run rpmlint after building rpm 2021-02-12 23:07:03 +13:00
Dmitry Maksyoma
0d0f8afceb Update FSF address in licences to please rpmlint 2021-02-12 23:06:40 +13:00
Dmitry Maksyoma
e9e7ecd74d Rpm: create certificate on postinst, remove on postrm 2021-02-12 18:11:27 +13:00
Dmitry Maksyoma
b97633ca10 Rpm: automate rpm building with build-rpm 2021-02-11 21:50:14 +13:00
Dmitry Maksyoma
d658f2b8a3 Deb: trim cruft from Makefile 2021-02-11 20:46:05 +13:00
Dmitry Maksyoma
69efc52614 Rpm: add test-rpm-barebones with Openbox
Twm wasn't available.
2021-02-11 20:45:01 +13:00
Dmitry Maksyoma
49996f91e6 Rpm: trim cruft in spec file 2021-02-11 20:44:08 +13:00
Dmitry Maksyoma
a8507afb21 Rpm: add runtime dependencies 2021-02-11 20:43:21 +13:00
matt
c81df7f198 KASM-1298 manually merged in offline changes 2021-02-07 11:12:18 +00:00
Dmitry Maksyoma
90101a7e91 Rpm: CentOS dfart. Rpm building isn't automated yet. 2021-02-05 23:49:47 +13:00
Dmitry Maksyoma
a6512a7801 Docker copy will ignore builder/build, where debs are 2021-02-05 23:40:44 +13:00
Kasm
57f4e0a856 Merge pull request #18 from kasmtech/gitlab-pipeline-produce-deb
Gitlab pipeline produce deb
2021-02-03 12:51:27 -05:00
Dmitry Maksyoma
b98a9eb5fa Pkg build: patch with quilt if it's present 2021-01-29 22:52:10 +13:00
Dmitry Maksyoma
b224addece Deb: add first quilt patch 2021-01-29 22:12:43 +13:00
Dmitry Maksyoma
9fbda8e518 Deb: add Bullseye support 2021-01-29 21:29:04 +13:00
Dmitry Maksyoma
2e98b08cec Deb: add Kali kali-rolling support 2021-01-28 23:46:21 +13:00
Dmitry Maksyoma
9eb9664bcf Pkg test: refactor for readability 2021-01-28 23:44:25 +13:00
Dmitry Maksyoma
ead31ae2e7 Pkg test: use dpkg to find libnss_wrapper.so 2021-01-28 23:35:57 +13:00
Dmitry Maksyoma
6d6ebffeae Package building: compile with debug symbols for deb purposes 2021-01-28 22:45:36 +13:00
Dmitry Maksyoma
070458d302 Deb: release numbers (18.04) -> codenames (bionic) 2021-01-28 22:10:46 +13:00
Dmitry Maksyoma
e5b8d4df11 Deb: add barebones testing image for Debian 10 2021-01-26 21:45:33 +13:00
Dmitry Maksyoma
7a6067e081 Deb: add Xorg-related dependencies 2021-01-26 21:44:56 +13:00
Dmitry Maksyoma
acd9f18f64 Deb: remove python dependency
Programs in www/utils are no longer included, and nothing else uses it.
2021-01-22 22:10:02 +13:00
Dmitry Maksyoma
c5061e67b4 Deb: Debian 10 support 2021-01-22 21:54:22 +13:00
Dmitry Maksyoma
b6f16eabb7 Deb: woraroudn dbgsym package that's created now 2021-01-22 21:53:52 +13:00
Dmitry Maksyoma
0851741360 Deb: Debian 10 building requires package libsm6 2021-01-22 21:52:05 +13:00
Dmitry Maksyoma
3c3eed0e46 Deb: exclude www/utils, instead of individual files 2021-01-21 23:35:56 +13:00
Dmitry Maksyoma
f7e6d8d039 Deb: build-deb doesn't fail if Lintian complains
For now, disable Lintian warnings. In the future, a flag may be used to
determine this behaviour.
2021-01-21 22:09:43 +13:00
Dmitry Maksyoma
39e5cbc182 Fix build-tarball: use dir shared between GitLab runner and Docker 2021-01-21 22:09:32 +13:00
Dmitry Maksyoma
e456357c68 Deb: empty postrm -> postrm.ex 2021-01-21 00:24:59 +13:00
Dmitry Maksyoma
85f2ed4f71 Gitignore deb building tmp files 2021-01-21 00:20:02 +13:00
Dmitry Maksyoma
2b9a4d0d8b Deb: remove /etc/kasmvnc and cert generation as we use snakeoil now 2021-01-21 00:14:30 +13:00
Dmitry Maksyoma
a479b2fcd4 Use snakeoil certificate if available 2021-01-20 23:56:50 +13:00
Dmitry Maksyoma
c32137fa17 Merge branch 'master' into create_ubuntu20_package 2021-01-20 23:39:29 +13:00
Lauri Kasanen
0d47d4890a Enable TLS 1.1 and 1.2 2021-01-20 22:49:32 +13:00
Dmitry Maksyoma
a6d37c2a31 Deb: update test-deb to use debs in <os>_<os_ver> dirs 2021-01-19 23:23:33 +13:00
Dmitry Maksyoma
fbeed1da72 Deb: put debs under <os>_<os_ver> directories 2021-01-19 23:02:49 +13:00
Dmitry Maksyoma
35cf095a31 Deb: create Ubuntu 20.04 tarball and deb 2021-01-19 22:44:32 +13:00
Kasm
dd3364822d Update build-tarball 2021-01-18 13:46:24 -06:00
Kasm
c1691b6895 Update .gitlab-ci.yml 2021-01-18 13:30:05 -06:00
Kasm
ec5a73c8ec Update .gitlab-ci.yml 2021-01-18 13:26:37 -06:00
Kasm
7e5c8c9ad3 Update .gitlab-ci.yml 2021-01-18 13:17:10 -06:00
Kasm
48bc79162a Added gitlab pipeline 2021-01-18 13:12:23 -06:00
Kasm
41d518eda4 Merge pull request #16 from kasmtech/create_ubuntu_packages
Create Ubuntu 18.04 package
2021-01-18 13:02:38 -06:00
matt
2813e7fe09 Fixes to webcode for Kasm CDI 2021-01-18 18:58:31 +00:00
Lauri Kasanen
a4e70ff56b Remove less-than-256-colors indexed limit for small rects 2021-01-15 13:08:20 +02:00
Lauri Kasanen
83c83f43ef Add a parameter for separate SSL key 2021-01-15 13:07:53 +02:00
Dmitry Maksyoma
a4369e8897 Deb: apt -> apt-get, cause apt doesn't have a stable interface 2021-01-15 22:49:28 +13:00
Dmitry Maksyoma
5ffe76f08d Deb: don't install libjpeg-dev on deb test image
Dependencies should be pulled by the package.
2021-01-15 22:48:32 +13:00
Dmitry Maksyoma
1486f3f4c2 Deb: use /etc/kasmvnc/server.pem cert in builder/test-deb 2021-01-14 23:15:17 +13:00
Dmitry Maksyoma
b8c380d17f Deb: move self-signed cert to /etc/kasmvnc 2021-01-14 22:13:46 +13:00
Dmitry Maksyoma
fc91e4d622 Don't use "sodu docker", just "docker" 2021-01-14 21:25:41 +13:00
Dmitry Maksyoma
2a64e062c4 Gitignore builder/www, builder/build 2021-01-14 19:07:04 +13:00
Dmitry Maksyoma
955183dcf0 Use/build ./builder/www when building tarball 2021-01-14 19:04:43 +13:00
Dmitry Maksyoma
d98157f3fc Merge remote-tracking branch 'origin/webpack2' into create_ubuntu_packages 2021-01-12 23:26:59 +13:00
Dmitry Maksyoma
945f9a07a3 Deb: exclude .eslintrc 2021-01-12 22:22:21 +13:00
matt
4394ab6edd Merge branch 'webpack2' of https://github.com/kasmtech/KasmVNC into webpack2 2021-01-10 19:05:17 +00:00
matt
76f8d905f0 added dockerfile build process for www 2021-01-10 19:03:13 +00:00
matt
de4ddcb154 Fix auth error and build permissions 2021-01-10 16:24:09 +00:00
arsenmanukyan94
b9cdecc34c update gitignore 2021-01-09 13:38:10 +00:00
matt
d71734a206 initial commit of webpack 2021-01-08 12:48:07 +00:00
Dmitry Maksyoma
2b801e3397 Deb: remove obsolete code 2021-01-08 00:42:37 +13:00
Dmitry Maksyoma
543796d6a4 Deb: automated build chain draft ready 2021-01-07 23:28:58 +13:00
Dmitry Maksyoma
4558750348 Deb: remove a TODO comment 2021-01-07 23:27:39 +13:00
Dmitry Maksyoma
be854aef68 Add www dir detection to vnc_startup.sh 2021-01-07 23:10:04 +13:00
Dmitry Maksyoma
59382451dc Deb: build-deb now builds a .deb for Ubuntu 18
It builds the builder image first, then proceeeds to building .deb
inside it, and the result is put into the parent (../) directory.
2021-01-07 21:57:53 +13:00
Dmitry Maksyoma
702f817845 Deb: add build-tarball and build-deb commands WIP 2021-01-07 00:36:52 +13:00
Dmitry Maksyoma
5154f86b60 Deb: add lots of libraries as build dependencies
This way, no need to copy that over multiple dockerfiles, and is a best
practice.
2021-01-07 00:32:30 +13:00
Dmitry Maksyoma
d82d67762e Merge branch 'feature/12_ubuntu_20' into create_ubuntu_packages 2021-01-05 23:36:21 +13:00
Dmitry Maksyoma
f1b3e0f6de Deb: remove redundant code 2021-01-03 23:35:23 +13:00
Dmitry Maksyoma
c6d3c5271c Deb: exclude Node scripts from the package 2021-01-03 23:29:04 +13:00
Dmitry Maksyoma
eaa5c24439 Generate self-signed cert in /etc/ssl/private/kasmvnc.pem
I piggyback on ssl-cert package that's got ssl-cert group and the
directory /etc/ssl/private, the group can read files from (but not list
files there). Thus, by adding a user to ssl-cert group, they can read
both ssl-cert certificates and the KasmVNC certificate.o

Note: currently, KasmVNC only supports one file that must contain both
private and public keys. For this reason, I didn't use the snakeoil
certificate from ssl-cert, as it's split into two files.
2021-01-03 23:12:21 +13:00
Dmitry Maksyoma
a7e7deaf99 Deb: add as vncserver, etc alternative 2020-12-31 01:09:51 +13:00
Dmitry Maksyoma
f8c3d981bf Deb: update dependencies, add Provides: vnc-server 2020-12-31 01:09:11 +13:00
Dmitry Maksyoma
a1089dd356 Deb: XkasmVnc -> Xkasmvnc 2020-12-31 01:08:31 +13:00
Dmitry Maksyoma
1f266ad206 Add dependencies on python and xorg to .deb 2020-12-29 23:28:03 +13:00
Dmitry Maksyoma
54f163a44c Exclude .git* files from .deb 2020-12-29 23:27:32 +13:00
Dmitry Maksyoma
251b8a6388 -beta -> ~beta for .deb 2020-12-29 22:01:27 +13:00
Dmitry Maksyoma
fccd9d29cd Update debian/copyright to include libwebp license 2020-12-29 21:52:49 +13:00
Dmitry Maksyoma
bab0412bc5 Add man pages and improve file locations in .deb 2020-12-29 21:32:31 +13:00
Dmitry Maksyoma
0b4804a3a9 Properly name binaries in .deb 2020-12-29 21:12:58 +13:00
Dmitry Maksyoma
f1291cb520 Draft .deb build system ready 2020-12-29 20:47:16 +13:00
Dmitry Maksyoma
dabf7d4d5e Clean up Makefile I use to fake-build source 2020-12-27 00:10:30 +13:00
Dmitry Maksyoma
86c6ae566c Debian package spike. Using ../release as bin/ source. 2020-12-26 00:33:19 +13:00
matt
55f9755dbd Added build docker images for debian and others 2020-12-24 19:54:58 +00:00
Lauri Kasanen
481b063eb7 Fix missing init for DLP timestamps 2020-12-03 12:29:38 +02:00
Kasm
ef23f13045 Update README.md
missing step in instructions
2020-11-04 15:25:23 -05:00
matt
28d19cd556 Disable VNC password, fix bug when running inside Kasm VDI 2020-10-29 19:24:59 +00:00
Lauri Kasanen
531705c05c Remove set-desktop-size perms from read-only clients 2020-10-14 15:50:28 +03:00
Lauri Kasanen
1f69d1584a Prevent read-only clients from changing kasm settings 2020-10-14 15:44:48 +03:00
Lauri Kasanen
a27744bca6 Enable TLS 1.1 and 1.2 2020-10-14 14:39:33 +03:00
Lauri Kasanen
36deba3a75 Correct non-basicauth and command-line user:pass being read-only 2020-10-14 14:27:08 +03:00
Lauri Kasanen
0c83a86bc8 Dynamically apply permissions 2020-10-13 13:38:18 +03:00
Lauri Kasanen
263d05a296 Apply read-only perms upon connecting 2020-10-12 15:11:49 +03:00
Lauri Kasanen
9a5afc5a62 Handle the new, multi-user kasmpasswd format auth 2020-10-12 14:58:11 +03:00
Lauri Kasanen
30b9a82c08 kasmvncpasswd: Add delete support 2020-10-12 13:34:18 +03:00
Kasm
e23bd08167 Delete index.html 2020-10-12 06:29:06 -04:00
matt
8fc49afcae Add sym link for index.html 2020-10-12 10:21:29 +00:00
mmcclaskey
730fdcb15c Merge pull request #10 from kasmtech/docker
Docker
2020-10-11 13:46:09 -04:00
mmcclaskey
9f8fa7bf8b Update README.md 2020-10-11 13:44:40 -04:00
mmcclaskey
7bc0b29413 Update README.md 2020-10-11 13:41:11 -04:00
mmcclaskey
2afe7b5fa5 Create README.md 2020-10-11 13:33:35 -04:00
mmcclaskey
097fe0815c Added Containerized example Doom 2020-10-11 17:22:42 +00:00
Kasm
9c50cae9fd Update README.md
updated install instructions
2020-10-11 08:16:40 -04:00
Lauri Kasanen
896950ea13 kasmvncpasswd: Add support for multiple users 2020-10-09 15:36:03 +03:00
Kasm
e7016550fc Merge pull request #8 from kasmtech/stats
Stats
2020-10-05 15:35:18 -04:00
Kasm
d80ae411ac Update README.md 2020-10-05 15:18:58 -04:00
matt
0a68500ee3 updated readme and vncserver 2020-10-05 19:10:59 +00:00
Lauri Kasanen
80513c8616 Change "recent" to be 10s from 60s, and in its own variable 2020-10-02 14:44:33 +03:00
Lauri Kasanen
1db77ee6bd Add some basicauth logging (most debug/verbose only) 2020-10-02 14:43:19 +03:00
Lauri Kasanen
279c41fc32 Add option to pass the password in an encrypted file, kasmvncpasswd utility 2020-10-01 14:37:51 +03:00
Lauri Kasanen
ae07707e66 Don't log BasicAuth 2020-10-01 13:07:32 +03:00
Lauri Kasanen
bb71cd4ec4 Have stats react faster to big cpu lag spikes 2020-10-01 13:00:34 +03:00
Lauri Kasanen
99fe70bbd6 Add a debug-level print on the last ~second's maximum encoding time 2020-09-28 14:37:19 +03:00
Lauri Kasanen
b30318a68f Change stats format to JSON array style 2020-09-28 14:26:38 +03:00
kasmtech
88a9bed022 UI mods to display stats 2020-09-28 09:43:59 +00:00
matt
d031c2182f Updated xorg version, static link webp 2020-09-27 19:18:10 +00:00
Lauri Kasanen
d5bdef121a Add support for bottleneck stats 2020-09-21 15:51:56 +03:00
Pierre Ossman
45e44a66e5 Tolerate specifying -BoolParam 0 and similar
This is needed by vncserver which doesn't know which parameters are
boolean, and it cannot use the -Param=Value form as that isn't tolerated
by the Xorg code.
2020-09-21 13:54:41 +03:00
Pierre Ossman
3528e358cc Free memory from getaddrinfo()
We handled this in the failure scenario, but not in the vastly more
common successful case.
2020-09-21 13:52:01 +03:00
Mark Mielke
f814a93214 vncserver: Remove legacy HP-UX support
The check for existence of `/usr/spool/sockets/X11/<n>` has been
removed. This file is only relevant on HP-UX, and TigerVNC dropped
support for HP-UX in commit 31e5aa3.
2020-09-21 13:51:13 +03:00
Pierre Ossman
285bcfb141 Run maketarball through bash
It uses bash-isms so a POSIX shell will not work correctly.
2020-09-21 13:48:54 +03:00
Andrew Yoder
c312417d81 Correction to socket error connection message 2020-09-21 13:47:04 +03:00
Mark Mielke
80a637c793 Fix division by zero exception in SSecurityPlain.
If using SSecurityPlain and the user specifies an empty username
and password, it will invoke InStream::checkNoWait(0) which will
cause a division by zero when calculating the number of available
items.

Enhance InStream::check() to behave properly when asked for
zero items, or zero sized items.

Add comments to InStream::check(), InStream::checkNoWait(),
and InStream::readBytes() to document expected behaviour
when requested to check or read zero items, or an item with
zero size.
2020-09-21 13:46:38 +03:00
Pierre Ossman
27d6677a31 Don't clear complex objects using memset()
This is fine for simple structs but not class based objects.
2020-09-21 13:43:40 +03:00
Pierre Ossman
e2cea31e87 Silence clang deprecated warnings on macOS
We still target a very old version of macOS, which tends to make clang
very upset, so we need to turn off depercation warnings.
2020-09-21 13:43:22 +03:00
Pierre Ossman
47bba8a1e6 Fix JpegCompressor::overrun() type change
The method it overloads got tweaked some time ago, so we need to make
sure this method follows suit.
2020-09-21 13:42:29 +03:00
Pierre Ossman
e5b02f996e Catch errors resizing framebuffer 2020-09-21 13:37:53 +03:00
Pierre Ossman
9eca28a084 Add final line break to FatalError() calls
It expects the callers to include this, so make sure we're consistently
providing one.
2020-09-21 13:37:31 +03:00
Samuel Mannehed
77cc62ecc0 Bump up Windows version from Vista to Windows 7 2020-09-21 13:36:48 +03:00
Pierre Ossman
04037ef779 Also link in math library in static build
It's included by default in dynamic builds so we need to make sure it
isn't lost when switching to static.
2020-09-21 13:33:48 +03:00
Pierre Ossman
a2099e5e40 Avoid using RegionInit() because of empty rects
It creates an invalid region if given an empty rect. Fortunately
RegionInitBoxes() handles that just fine, so use that instead.
2020-09-21 13:29:49 +03:00
Pierre Ossman
f528483975 Stop using legacy region macros
We no longer support such old X servers so start using the current
functions.
2020-09-21 13:29:24 +03:00
Pierre Ossman
a00e40c340 Handle empty changes for every operation
It seems like many of the X11 operations can end up with no pixels
actually changing. So instead of discovering and adding workarounds for
each individually we'll just check very region added if it's empty.
2020-09-21 13:28:33 +03:00
Pierre Ossman
a4e0dbf7db Remove 8-bit support from documentation
We removed support in the code ages ago, but overlooked this part of the
documentation. Also remove some dead code in Xvnc on the same theme.
2020-09-21 13:27:19 +03:00
Pierre Ossman
da406d0cac Include error code in getaddrinfo() exceptions 2020-09-21 13:26:51 +03:00
Pierre Ossman
9240f0b85c Avoid using insecure variable length arrays 2020-09-21 13:26:39 +03:00
Alex Tanskanen
03639406dc Throw GAIException() for getaddrinfo errors
Created a new subclass of Exception called GAIException() that will
handle error messages from getaddrinfo() instead of letting Exception()
handle it. GAIException() will make use of gai_strerror() to map the
error code to text. On Windows, gai_strerrorW() must be used if the text
is encoded with UTF-8.
2020-09-21 13:26:15 +03:00
Alex Tanskanen
209712b18f Fix typo in SocketException message 2020-09-21 13:25:51 +03:00
Alex Tanskanen
57427d5d33 Make system error messeges in Windows 10 use UTF-8
The previous error messages did not support Unicode characters. This
commit will use UTF-8 encoding to be able to display error messages in
every language.
2020-09-21 13:25:38 +03:00
Pierre Ossman
06f3413446 Remove support for old Xorg versions
No current distribution ship anything this ancient anyway.
2020-09-21 13:25:11 +03:00
Pierre Ossman
fab177579f Fix C linking when doing static builds 2020-09-21 13:21:06 +03:00
Pierre Ossman
f38e474993 Fix error check for zlib calls
There are multiple "okay" return values, not just Z_OK. Make sure we
don't bail out needlessly.
2020-09-21 13:18:11 +03:00
Lauri Kasanen
49f9ce8e5b Remove remnants of the old HTTP server 2020-09-21 13:17:11 +03:00
Linus Heckemann
6e5a837c21 xserver: add no-op input thread init function
This allows Xvnc to build with xorg-server 1.20.7, which requires OS
layers to implement a ddxInputThreadInit function when configured with
--enable-input-thread (the default).

relevant xorg-server commit: e3f26605d85d987da434640f52646d728f1fe919
2020-09-21 13:07:43 +03:00
Pierre Ossman
a11a55aeec Include Carbon when statically linking gettext on macOS
As gettext needs some stuff from Carbon and we don't want to rely on it
being pulled in as a side effect.
2020-09-21 13:07:18 +03:00
Pierre Ossman
06fd7ac061 Use sys/time.h on Windows as well
Modern MinGW seems to provide this, so simplify things a bit. This also
side steps some of the issue of the windows.h/winsock2.h include
ordering.
2020-09-21 13:05:50 +03:00
Pierre Ossman
b7dc4a16fe Handle pending data in TLS buffers
There might be more bytes left in the current TLS record, even if
there is nothing on the underlying stream. Make sure we properly
return this when we aren't being requested to block.
2020-09-21 13:00:41 +03:00
Pierre Ossman
3ee909ffe6 Don't background the main session command
When used with -fg we expect the startup script to remain running until
the session is over. This will not happen if the session command is put
in the background using &.
2020-09-21 12:59:06 +03:00
Pierre Ossman
c3279914c1 Fix link order of nettle and hogweed
Hogweed needs nettle, not the other way around. So make sure they
are specified in the correct order for the static link to succeed.
2020-09-21 12:58:11 +03:00
Pierre Ossman
ed73ac2aa7 Handle pixel formats with odd shift values
Our fast paths assume that each channel fits in to a separate byte.
That means the shift needs to be a multiple of 8. Start actually
checking this so that a client cannot trip us up and possibly cause
incorrect code exection.

Issue found by Pavel Cheremushkin from Kaspersky Lab.
2020-09-21 12:56:53 +03:00
Pierre Ossman
ae6cbd19e9 Be defensive about overflows in stream objects
We use a lot of lengths given to us over the network, so be more
paranoid about them causing an overflow as otherwise an attacker
might trick us in to overwriting other memory.

This primarily affects the client which often gets lengths from the
server, but there are also some scenarios where the server might
theoretically be vulnerable.

Issue found by Pavel Cheremushkin from Kaspersky Lab.
2020-09-21 12:56:23 +03:00
Pierre Ossman
259f1055cb Use size_t for lengths in stream objects
Provides safety against them accidentally becoming negative because
of bugs in the calculations.

Also does the same to CharArray and friends as they were strongly
connection to the stream objects.
2020-09-21 12:55:59 +03:00
Pierre Ossman
346fccb96c Remove unused FixedMemOutStream 2020-09-21 12:48:20 +03:00
Pierre Ossman
1d5aaf54f8 Add sanity checks for PixelFormat shift values
Otherwise we might be tricked in to reading and writing things at
incorrect offsets for pixels which ultimately could result in an
attacker writing things to the stack or heap and executing things
they shouldn't.

This only affects the server as the client never uses the pixel
format suggested by th server.

Issue found by Pavel Cheremushkin from Kaspersky Lab.
2020-09-21 12:47:56 +03:00
Pierre Ossman
9f7abaea3a Fix depth sanity test in PixelFormat 2020-09-21 12:47:22 +03:00
Pierre Ossman
1224cbdc21 Handle empty Tight gradient rects
We always assumed there would be one pixel per row so a rect with
a zero width would result in us writing to unknown memory.

This could theoretically be used by a malicious server to inject
code in to the viewer process.

Issue found by Pavel Cheremushkin from Kaspersky Lab.
2020-09-21 12:46:27 +03:00
Pierre Ossman
6a3f711878 Add write protection to OffsetPixelBuffer
No one should every try to write to this buffer. Enforce that by
throwing an exception if any one tries to get a writeable pointer
to the data.
2020-09-21 12:45:51 +03:00
Pierre Ossman
3282836baf Make ZlibInStream more robust against failures
Move the checks around to avoid missing cases where we might access
memory that is no longer valid. Also avoid touching the underlying
stream implicitly (e.g. via the destructor) as it might also no
longer be valid.

A malicious server could theoretically use this for remote code
execution in the client.

Issue found by Pavel Cheremushkin from Kaspersky Lab
2020-09-21 12:40:12 +03:00
Lauri Kasanen
ac06594b12 Add .gitignore 2020-09-21 12:33:19 +03:00
Kasm
5da407c11f Update README.md 2020-09-20 09:11:28 -04:00
Kasm
313961153c Update install.sh
Modified installer to use release on GitHub
2020-09-20 09:04:35 -04:00
491 changed files with 21154 additions and 94980 deletions

View File

@@ -0,0 +1,20 @@
#!/usr/bin/ruby
package_name = ARGV.first
DEB_PACKAGE_REGEX = %r!(?<os>[^/]+)/kasmvncserver_.+?_(?<arch>.+?).(?<format>deb)!
RPM_PACKAGE_REGEX = %r!(?<os>[^/]+)/kasmvncserver-.+?\.(?<arch>[^.]+).(?<format>rpm)!
if matches = package_name.match(DEB_PACKAGE_REGEX)
else matches = package_name.match(RPM_PACKAGE_REGEX)
end
os = matches["os"]
arch = matches["arch"]
package_format = matches["format"]
puts <<-EXPORT
export PACKAGE_OS=#{os}
export OS_ARCH=#{arch}
export PACKAGE_FORMAT=#{package_format}
EXPORT

25
.ci/next_release_version Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
version_from_tags() {
git tag | sort -r | head -1 | sed -e 's/^v//' -e 's/\-.\+//' | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'
}
branch_name="$1"
if [ -z "$branch_name" ]; then
echo >&2 "Usage: `basename $0` <branch_name>"
exit 1
fi
if echo "$branch_name" | grep -Pq '^release/([\d.]+)$'; then
RELEASE_BRANCH=1
fi
if [ -n "$RELEASE_BRANCH" ]; then
RELEASE_VERSION=$(echo "$branch_name" | sed 's!release/!!');
else
RELEASE_VERSION="$(version_from_tags)"
fi
echo "$RELEASE_VERSION"

91
.ci/upload.sh Normal file
View File

@@ -0,0 +1,91 @@
#!/bin/bash
is_kasmvnc() {
local package="$1";
echo "$package" | grep -q 'kasmvncserver_'
}
detect_deb_package_arch() {
local deb_package="$1"
echo "$deb_package" | sed -e 's/.\+_\([^.]\+\)\.\(d\?\)deb/\1/'
}
find_deb_package() {
local dbgsym_package="$1"
echo "$dbgsym_package" | sed -e 's/-dbgsym//; s/ddeb/deb/'
}
fetch_xvnc_md5sum() {
local deb_package="$1"
deb_package=$(realpath "$deb_package")
local tmpdir=$(mktemp -d)
cd "$tmpdir"
dpkg-deb -e "$deb_package"
cat DEBIAN/md5sums | grep bin/Xkasmvnc | cut -d' ' -f 1
}
function prepare_upload_filename() {
local package="$1";
if ! is_kasmvnc "$package"; then
export upload_filename="$package"
return
fi
.ci/detect_os_arch_package_format "$package" > /tmp/os_arch_package_format;
source /tmp/os_arch_package_format;
detect_release_branch
detect_revision "$package" "$OS_ARCH"
if [ -n "$REVISION" ]; then
REVISION="_${REVISION}"
fi
if [ -n "$RELEASE_BRANCH" ]; then
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
else
export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')";
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
fi
};
function upload_to_s3() {
local package="$1";
local upload_filename="$2";
local s3_bucket="$3";
# Transfer to S3
python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${s3_bucket}" "$package" "${upload_filename}";
# Use the Gitlab API to tell Gitlab where the artifact was stored
export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${upload_filename}";
};
function prepare_to_run_scripts_and_s3_uploads() {
export DEBIAN_FRONTEND=noninteractive;
apt-get update;
apt-get install -y ruby2.7 git wget;
apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev;
git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git;
};
detect_release_branch() {
if echo $CI_COMMIT_REF_NAME | grep -Pq '^release/([\d.]+)$'; then
export RELEASE_BRANCH=1;
fi
}
detect_revision() {
local package="$1"
local arch="$2"
REVISION=
if ! echo "$package" | grep -q '+'; then
return
fi
REVISION=$(echo "$package" | sed "s/_${arch}.\+//" | sed 's/.\++//')
}

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
*.[ao]
*.mo
*.la
*.lo
.deps
.libs
CMakeFiles
CMakeCache.txt
*.cmake
Makefile
Makefile.in
config.h
builder/build/
builder/www/
# Deb building artefacts
debian/.debhelper/
debian/files
debian/kasmvncserver.substvars
debian/kasmvncserver/
.pc
.vscode/

401
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,401 @@
image: docker
services:
- docker:dind
variables:
KASMVNC_COMMIT_ID: $CI_COMMIT_SHA
GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared
GIT_SUBMODULE_STRATEGY: normal
GIT_FETCH_EXTRA_FLAGS: --tags
# E.g. BUILD_JOBS: build_debian_buster,build_ubuntu_bionic. This will include
# arm builds, because build_debian_buster_arm matches build_debian_buster.
# "BUILD_JOBS: none" won't build any build jobs, nor www.
BUILD_JOBS: all
stages:
- www
- build
- upload
.prepare_build: &prepare_build
- pwd
- apk add bash
- mkdir -p "$GITLAB_SHARED_DIND_DIR" && chmod 777 "$GITLAB_SHARED_DIND_DIR"
.prepare_www: &prepare_www
- tar -zxf output/www/kasm_www.tar.gz -C builder/
.prepare_artfacts: &prepare_artfacts
- cp -r builder/build/* output/
- rm output/*.tar.gz
build_www:
stage: www
allow_failure: false
before_script:
- *prepare_build
script:
- webpacked_www=$PWD/builder/www
- src_www=kasmweb
- docker build -t kasmweb/www -f builder/dockerfile.www.build .
- docker run --rm -v $PWD/builder/www:/build kasmweb/www:latest
- mkdir -p output/www
- cd builder
- tar -zcvf ../output/www/kasm_www.tar.gz www
only:
variables:
- $BUILD_JOBS !~ /^none$/
artifacts:
paths:
- output/
build_ubuntu_bionic:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu bionic
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_bionic_arm:
stage: build
allow_failure: false
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu bionic
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_bionic_libjpeg_turbo:
stage: build
allow_failure: false
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu bionic +libjpeg-turbo_latest
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_focal:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu focal;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_focal_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu focal;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_jammy:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu jammy;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_jammy_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu jammy;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_buster:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian buster;
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_buster_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian buster;
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bullseye:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bullseye;
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bullseye_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bullseye;
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_kali_rolling:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package kali kali-rolling;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_kali_rolling_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package kali kali-rolling;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_centos7:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package centos core
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_8:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 8;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_8_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 8;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_opensuse_15:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package opensuse 15;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_opensuse_15_arm:
stage: build
allow_failure: true
tags:
- arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package opensuse 15;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
upload:
stage: upload
image: ubuntu:focal
before_script:
- . .ci/upload.sh
script:
- prepare_to_run_scripts_and_s3_uploads
- S3_CRASHPAD_BUILD_DIRECTORY="kasmvnc/crashpad/${CI_COMMIT_SHA}"
- for dbgsym_package in `find output/ -type f -name '*dbgsym*deb'`; do
deb_package=$(find_deb_package "$dbgsym_package");
xvnc_md5sum=$(fetch_xvnc_md5sum "$deb_package");
upload_filename="${S3_CRASHPAD_BUILD_DIRECTORY}/${xvnc_md5sum}/kasmvncserver-dbgsym.deb";
echo;
echo "File to upload $upload_filename";
upload_to_s3 "$dbgsym_package" "$upload_filename" "$S3_BUCKET";
rm "$dbgsym_package";
done
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
- for package in `find output/ -type f -name '*.deb' -or -name '*.rpm'`; do
prepare_upload_filename "$package";
upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename";
echo;
echo "File to upload $upload_filename";
upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET";
UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm)##');
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}";
done

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "kasmweb"]
path = kasmweb
url = https://github.com/kasmtech/noVNC.git
branch = release/0.9.3.2

108
ACKNOWLEDGEMENTS.md Normal file
View File

@@ -0,0 +1,108 @@
### License & Legal
Incomplete and generally out of date copyright list::
Copyright (C) 2020 Kasm Technologies LLC
Copyright (C) 1999 AT&T Laboratories Cambridge
Copyright (C) 2002-2005 RealVNC Ltd.
Copyright (C) 2000-2006 TightVNC Group
Copyright (C) 2005-2006 Martin Koegler
Copyright (C) 2005-2006 Sun Microsystems, Inc.
Copyright (C) 2006 OCCAM Financial Technology
Copyright (C) 2000-2008 Constantin Kaplinsky
Copyright (C) 2004-2017 Peter Astrand for Cendio AB
Copyright (C) 2010 Antoine Martin
Copyright (C) 2010 m-privacy GmbH
Copyright (C) 2009-2011 D. R. Commander
Copyright (C) 2009-2011 Pierre Ossman for Cendio AB
Copyright (C) 2004, 2009-2011 Red Hat, Inc.
Copyright (C) 2009-2018 TigerVNC Team
All Rights Reserved.
This software is distributed under the GNU General Public Licence as published
by the Free Software Foundation. See the file LICENSE.TXT for the conditions
under which this software is made available. KasmVNC also contains code from
other sources. See the Acknowledgements section below, and the individual
source files, for details of the conditions under which they are made
available.
### Acknowledgements
This distribution contains zlib compression software. This is:
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
This distribution contains public domain DES software by Richard Outerbridge.
This is:
Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
(GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
This distribution contains software from the X Window System. This is:
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

View File

@@ -16,6 +16,7 @@ include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckCXXCompilerFlag)
include(CheckCSourceRuns)
include(CMakeMacroLibtoolFile)
@@ -103,9 +104,9 @@ if(NOT DEFINED BUILD_WINVNC)
set(BUILD_WINVNC 1)
endif()
# Minimum version is Windows Vista/2008 (6.0)
# Minimum version is Windows 7
if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0600)
add_definitions(-D_WIN32_WINNT=0x0601)
endif()
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
@@ -208,6 +209,9 @@ if(ENABLE_PAM)
endif()
set(HAVE_PAM ${ENABLE_PAM})
# Check for SSE2
check_cxx_compiler_flag(-msse2 COMPILER_SUPPORTS_SSE2)
# Generate config.h and make sure the source finds it
configure_file(config.h.in config.h)
add_definitions(-DHAVE_CONFIG_H)

108
DEBUGGING.md Normal file
View File

@@ -0,0 +1,108 @@
# Debugging
In the case where KasmVNC crashes and a backtrace is produced. Developers need a way to make the backtrace useful for debugging. This document covers where the backtrace is logged and how to use a debug symbol package and gdb to gain more information from the backtrace, such as filename, function name, and line number.
## Test Symbolization
If you want to induce a crash to test that you can symbolize a backtrace you can start KasmVNC and then issue the following command.
killall -SEGV Xvnc
This will cause KasmVNC to terminate with a backtrace similar to the following. You will find the backtrace in the log file at $HOME/.vnc/$HOSTNAME:$DISPLAY.log where HOME is your user's profile path, HOSTNAME is the hostname of the system, and DISPLAY is the assigned display number for the session.
(EE)
(EE) Backtrace:
(EE) 0: /usr/bin/Xvnc (xorg_backtrace+0x4d) [0x5e48dd]
(EE) 1: /usr/bin/Xvnc (0x400000+0x1e8259) [0x5e8259]
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f5a57ef6000+0x12980) [0x7f5a57f08980]
(EE) 3: /lib/x86_64-linux-gnu/libc.so.6 (epoll_wait+0x57) [0x7f5a552eca47]
(EE) 4: /usr/bin/Xvnc (ospoll_wait+0x37) [0x5e8d07]
(EE) 5: /usr/bin/Xvnc (WaitForSomething+0x1c3) [0x5e2813]
(EE) 6: /usr/bin/Xvnc (Dispatch+0xa7) [0x597007]
(EE) 7: /usr/bin/Xvnc (dix_main+0x36e) [0x59b1fe]
(EE) 8: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xe7) [0x7f5a551ecbf7]
(EE) 9: /usr/bin/Xvnc (_start+0x2a) [0x46048a]
(EE)
(EE) Received signal 11 sent by process 17182, uid 0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)
## Debug Symbol Package
In order to make use of this backtrace, you will need to symbolize the backtrace. Each build of KasmVNC produced by our pipelines comes with a corresponding debug symbol package that can be downloaded. You need two pieces of information to get the package, the git commit ID of KasmVNC and the MD5 sum of Xkasmvnc binary on your system.
The git commit ID can be found using Xvnc -version:
ubuntu@matt-dev-vm-1:~$ Xvnc -version
Xvnc KasmVNC 0.9.94002f39917dca0ad82ac0c29a75c723b538b32b - built Feb 17 2022 15:21:01
Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)
See http://kasmweb.com for information on KasmVNC.
Underlying X server release 12010000, The X.Org Foundation
The MD5 sum can be obtained using the md5sum command:
md5sum /usr/bin/Xkasmvnc
57ee7028239c5a737c0aeee4a34138c3 /usr/bin/Xkasmvnc
With these two pieces of information, you can get the debug symbol package at https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/crashpad/[COMMITID]/[MD5SUM]/kasmvncserver-dbgsym.deb, in the above example it would be.
[https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/crashpad/94002f39917dca0ad82ac0c29a75c723b538b32b/57ee7028239c5a737c0aeee4a34138c3/kasmvncserver-dbgsym.deb](https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/crashpad/94002f39917dca0ad82ac0c29a75c723b538b32b/57ee7028239c5a737c0aeee4a34138c3/kasmvncserver-dbgsym.deb "https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/crashpad/94002f39917dca0ad82ac0c29a75c723b538b32b/57ee7028239c5a737c0aeee4a34138c3/kasmvncserver-dbgsym.deb")
Use wget or curl to download the debug symbol package and then install it.
wget https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/crashpad/94002f39917dca0ad82ac0c29a75c723b538b32b/57ee7028239c5a737c0aeee4a34138c3/kasmvncserver-dbgsym.deb
sudo dpkg -i kasmvncserver-dbgsym.deb
## Symbolize a Backtrace
With the KasmVNC binary and debug symbol package installed on the system, you can use gdb or addr2line to get more information, such as the filename, function name, and line number that the backtrace line is referring to.
Here is a single line from a backtrace. The following example shows how to retrieve additional information that can help with debugging the crash.
(EE) 8: /usr/bin/Xvnc (0x400000+0x13e674) [**0x53e674**]
echo info line ***0x53eaaa** | gdb -q /usr/bin/Xkasmvnc
(gdb) Line 223 of "/src/common/network/webudp/Wu.cpp" starts at address 0x53e674 <WuClientSendPendingDTLS(WuClient*, Wu const*, Wu const*)+68>
The following script will search the provide file for a backtrace and symbolize the entire backtrace.
#!/bin/bash
FILENAME=$1
grep "(EE)" $FILENAME | while read -r line ; do
BACKTRACE=$(echo $line | grep -Po '\[[0-9a-f]x[a-f0-9]{1,}' | sed -r 's#\[##')
echo $line
if ! [ -z $BACKTRACE ] ; then
SYMBOLIZED=$(echo "info line *${BACKTRACE}" | gdb /usr/bin/Xkasmvnc | grep "(gdb)" | grep -vP "\(gdb\)\s*quit$")
echo " ${SYMBOLIZED}"
fi
done
Using this script on the above example backtrace produces the following output.
ubuntu@hostname-1:~$ bash symbolize.sh ~/.vnc/hostname-1\:10.log
(EE)
(EE) Backtrace:
(EE) 0: /usr/bin/Xvnc (xorg_backtrace+0x4d) [0x5e48dd]
(gdb) Line 130 of "backtrace.c" starts at address 0x5e48dd <xorg_backtrace+77> and ends at 0x5e4900 <xorg_backtrace+112>.
(EE) 1: /usr/bin/Xvnc (0x400000+0x1e8259) [0x5e8259]
(gdb) Line 138 of "osinit.c" starts at address 0x5e8259 <OsSigHandler+41> and ends at 0x5e8275 <OsSigHandler+69>.
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f5a57ef6000+0x12980) [0x7f5a57f08980]
(gdb) No line number information available for address 0x7f5a57f08980
(EE) 3: /lib/x86_64-linux-gnu/libc.so.6 (epoll_wait+0x57) [0x7f5a552eca47]
(gdb) No line number information available for address 0x7f5a552eca47
(EE) 4: /usr/bin/Xvnc (ospoll_wait+0x37) [0x5e8d07]
(gdb) Line 643 of "ospoll.c" starts at address 0x5e8d07 <ospoll_wait+55> and ends at 0x5e8d09 <ospoll_wait+57>.
(EE) 5: /usr/bin/Xvnc (WaitForSomething+0x1c3) [0x5e2813]
(gdb) Line 210 of "WaitFor.c" starts at address 0x5e2813 <WaitForSomething+451> and ends at 0x5e2819 <WaitForSomething+457>.
(EE) 6: /usr/bin/Xvnc (Dispatch+0xa7) [0x597007]
(gdb) Line 421 of "dispatch.c" starts at address 0x596ffb <Dispatch+155> and ends at 0x59700b <Dispatch+171>.
(EE) 7: /usr/bin/Xvnc (dix_main+0x36e) [0x59b1fe]
(gdb) Line 278 of "main.c" starts at address 0x59b1fe <dix_main+878> and ends at 0x59b203 <dix_main+883>.
(EE) 8: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xe7) [0x7f5a551ecbf7]
(gdb) No line number information available for address 0x7f5a551ecbf7
(EE) 9: /usr/bin/Xvnc (_start+0x2a) [0x46048a]
(gdb) No line number information available for address 0x46048a <_start+42>
(EE)
(EE) Received signal 11 sent by process 17182, uid 0
(EE)
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)

View File

@@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

197
README.md
View File

@@ -1,11 +1,11 @@
# KasmVNC - Linux Web Remote Desktop
[![Kasm Technologies](https://kasm-static-content.s3.amazonaws.com/368_kasm_logo_.jpg "Kasm Logo")](https://kasmweb.com)
[Kasm Technologies LLC](https://www.kasmweb.com) developed Kasm Server, a Containerized Desktop Infrastructure (CDI) solution. Kasm started with TigerVNC and eventually forked it to create KasmVNC. KasmVNC is used within the overal Kasm CDI infrastructure, however, you can use KasmVNC for individual servers. KasmVNC has different goals than TigerVNC:
<a href="https://kasmweb.com"><img src="https://kasm-static-content.s3.amazonaws.com/logo_kasm.png" width="300"><a/>
[Kasm Technologies](https://www.kasmweb.com) developed Kasm Workspaces, the Containerized Streaming Platform. Kasm has open-sourced the Workspace docker images, which include containerized [full desktops and apps](https://github.com/kasmtech/workspaces-images) and [base images](https://github.com/kasmtech/workspaces-core-images) intended for developers to create custimized streaming containers. These containers can be used standalone or within the [Kasm Workspaces Platform](https://www.kasmweb.com) which provides a full Enterprise feature set. KasmVNC is used as the streaming tech for our container images, however, you can use KasmVNC for individual servers. While the term VNC is in the name, KasmVNC is not intended to remain compliant with the RFB spec and has different goals than other VNC projects:
- Web-based - KasmVNC is designed to provide a web accessible remote desktop. It comes with a web server and websocket server built in. There is no need to install other components. Simply run and navigate to your desktop's URL on the port you specify. While you can still tun on the legacy VNC port, it is disabled by default.
- Security - KasmVNC defaults to HTTPS and allows for HTTP Basic Auth. VNC Password authentication is limited by specification to 8 characters and is not suffecient for use on an internet accessible remote desktop. Our goal is to create a by default secure, web based experience.
- Security - The RFB specification (VNC) limits the password field to 8 characters, so while the client may take a longer password, only the first 8 characters are sent. KasmVNC defaults to HTTPS with HTTP Basic Auth and disables the legacy VNC authentication method which is not sufficiently secure for internet accessible systems.
- Simplicity - KasmVNC aims at being simple to deploy and configure.
# New Features!
@@ -13,182 +13,95 @@
- Webp image compression for better bandwidth usage
- Automatic mixing of webp and jpeg based on CPU availability on server
- Multi-threaded image encoding for smoother frame rate for servers with more cores
- Full screen video detection, goes into configurable video mode for better full screen videoo playback performance.
- Dynamic jpeg/webp image coompression quality settings based on screen change rates
- Seemless clipboard support
- [Full screen video detection](https://github.com/kasmtech/KasmVNC/wiki/Video-Rendering-Options#video-mode), goes into configurable video mode for better full screen videoo playback performance.
- [Dynamic jpeg/webp image coompression](https://github.com/kasmtech/KasmVNC/wiki/Video-Rendering-Options#dynamic-image-quality) quality settings based on screen change rates
- Seemless clipboard support (on Chromium based browsers)
- Allow client to set/change most configuration settings
- Data Loss Prevention features
- [Data Loss Prevention features](https://github.com/kasmtech/KasmVNC/wiki/Data-Loss-Prevention)
- Key stroke logging
- Clipboard logging
- Max clipboard transfer size up and down
- Min time between clipboard operations required
- Keyboard input rate limit
- Screen region selection
- Deb packages for Debian, Ubuntu, and Kali Linux included in release.
- RPM packages for CentOS, Fedora. RPM packages are currently not updatable and not released, though you can build and install them. See build documentation.
- Web [API](https://github.com/kasmtech/KasmVNC/wiki/API) added for remotely controlling and getting information from KasmVNC
- Multi-User with ability to pass control to other users.
- Web UI uses a webpack for faster load times.
- Network and CPU bottleneck statistics
Future Goals:
- Support uploads and downloads
- Json configuration file
- Pre-build Packages for all major Linux distributions
- CI pipelines to create releases
### Installation
We are currently developing releasable packages for major operating sytems. The install script available with releases will install dependencies, compile webp, and pull down and install the pre-compiled KasmVNC tarball. Currently, only Ubuntu 18.04 LTS is pre-compiled.
This installer assumes you already have a desktop environment installed, but have never configured a VNC server.
#### Debian-based
```sh
# download install script from releases
sudo ./install.sh
# Please choose the package for your distro here (under Assets):
# https://github.com/kasmtech/KasmVNC/releases
wget <package_url>
# change owner of pre-installed cert to your user
sudo chown $USER /usr/local/share/kasmvnc/certs/self.pem
sudo apt-get install ./kasmvncserver_*.deb
# create required files
touch ~/.Xresources
# start kasmvnc to generate the required files and then kill it
# it will prompt to set the vnc password
vncserver :1 -interface 0.0.0.0
vncserver -kill :1
# We provide an example script to run KasmVNC at #
# /usr/share/doc/kasmvncserver/examples/kasmvncserver-easy-start. It runs a VNC
# server on display :10 and on interface 0.0.0.0. If you're happy with those
# defaults you can just use it as is:
sudo ln -s /usr/share/doc/kasmvncserver/examples/kasmvncserver-easy-start /usr/bin/
# overwrite the VNC password to nothing. KasmVNC uses HTTPS basic authentication
echo '' | vncpasswd -f > $HOME/.vnc/passwd
# Add your user to the ssl-cert group
sudo addgroup $USER ssl-cert
# You will need to re-connect in order to pick up the group change
# modify vncstartup to launch your environment of choice, in this example LXDE
# Create ~/.vnc directory and corresponding files.
kasmvncserver-easy-start -d && kasmvncserver-easy-start -kill
# Modify vncstartup to launch your environment of choice, in this example LXDE
# This may be optional depending on your system configuration
echo '/usr/bin/lxsession -s LXDE &' >> ~/.vnc/xstartup
# launch KasmVNC
vncserver $DISPLAY -depth 24 -geometry 1280x1050 -basicAuth kasm_user:password -websocketPort 8443 -cert /usr/local/share/kasmvnc/certs/self.pem -sslOnly -FrameRate=24 -interface 0.0.0.0
# Start KasmVNC with debug logging:
kasmvncserver-easy-start -d
# Tail the logs
tail -f ~/.vnc/`hostname`:10.log
```
The options for vncserver in the example above:
Now navigate to your system at https://[ip-address]:8443/
To stop a running KasmVNC:
```sh
kasmvncserver-easy-start -kill
```
The options for vncserver:
| Argument | Description |
| -------- | ----------- |
| depth | Color depth, for jpeg/webp should be 24bit |
| geometry | Screensize, this will automatically be adjusted when the client connects. |
| basicAuth | Username and password seperated by a semi-colon. |
| websocketPort | The port to use for the web socket. Use a high port to avoid having to run as root. |
| cert | SSL cert to use for HTTPS |
| sslOnly | Disable HTTP |
| interface | Which interface to bind the web server to. |
### Development
Would you like to contribute to KasmVNC? Please reachout to us at info@kasmweb.com
Would you like to contribute to KasmVNC? Please reachout to us at info@kasmweb.com. We have investigated or are working on the following, if you have experience in these fields and would like to help please let us know.
We need help, especially in packaging KasmVNC for various operating systems. We would love to have standard debian or RMP packages and host our own repo, however, that all requires a lot of experience, proper testing, and pipeline development for automated builds.
Real-time H264 encoding using NVIDIA and Intel encoding technology.
We also need help with Windows, which is not currently supported. While KasmVNC can technically be built for Windows 10, it is unusably slow, due to all the changes that occured in Windows since the original Windows support was added in the chain of VNC forked projects.
Windows version of KasmVNC. We have been able to get it to compile for Windows and increased the performance, but still not releasable. Experienced Windows developers with a background in cross compiling would help.
ARM version of KasmVNC, we have had requests for this and at one point we did have an ARM build of KasmVNC but it takes dev cycles to mainain and bring it back to life.
### Compiling From Source
See the builder/README.md. We containerize our build systems to ensure highly repeatable builds.
See the [builder/README.md](https://github.com/kasmtech/KasmVNC/blob/master/builder/README.md). We containerize our build systems to ensure highly repeatable builds.
License & Legal
----
Incomplete and generally out of date copyright list::
Copyright (C) 2020 Kasm Technologies LLC
Copyright (C) 1999 AT&T Laboratories Cambridge
Copyright (C) 2002-2005 RealVNC Ltd.
Copyright (C) 2000-2006 TightVNC Group
Copyright (C) 2005-2006 Martin Koegler
Copyright (C) 2005-2006 Sun Microsystems, Inc.
Copyright (C) 2006 OCCAM Financial Technology
Copyright (C) 2000-2008 Constantin Kaplinsky
Copyright (C) 2004-2017 Peter Astrand for Cendio AB
Copyright (C) 2010 Antoine Martin
Copyright (C) 2010 m-privacy GmbH
Copyright (C) 2009-2011 D. R. Commander
Copyright (C) 2009-2011 Pierre Ossman for Cendio AB
Copyright (C) 2004, 2009-2011 Red Hat, Inc.
Copyright (C) 2009-2018 TigerVNC Team
All Rights Reserved.
This software is distributed under the GNU General Public Licence as published
by the Free Software Foundation. See the file LICENCE.TXT for the conditions
under which this software is made available. KasmVNC also contains code from
other sources. See the Acknowledgements section below, and the individual
source files, for details of the conditions under which they are made
available.
### Acknoledgements
This distribution contains zlib compression software. This is:
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
This distribution contains public domain DES software by Richard Outerbridge.
This is:
Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
(GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
This distribution contains software from the X Window System. This is:
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
### License and Acknowledgements
See the [LICENSE.TXT](https://github.com/kasmtech/KasmVNC/blob/master/LICENSE.TXT) and [ACKNOWLEDGEMENTS.MD](https://github.com/kasmtech/KasmVNC/blob/master/LICENSE.TXT)

View File

@@ -1,30 +0,0 @@
image: ubuntu:xenial
pipelines:
default:
- step:
name: Build and Package
services:
- docker
script:
- export BASE_DIR="$(readlink -f .)"
- export RELEASE_VERSION=1.9
- export BUILD_FILE="kasmvnc_${RELEASE_VERSION}.${BITBUCKET_COMMIT}.tar.gz"
- export S3_BUILD_DIRECTORY="kasmvnc/${BITBUCKET_COMMIT}"
- export SANITIZED_BRANCH="$(echo $BITBUCKET_BRANCH | sed 's/\//_/g')"
- apt-get update
- apt-get install -y git python3 python3-pip python3-boto3 curl
- echo $SANITIZED_BRANCH
- docker build -t kasmvncbuilder:latest -f builder/dockerfile.build .
- docker run -v $BITBUCKET_CLONE_DIR:/build kasmvncbuilder:latest
- ls -la $BITBUCKET_CLONE_DIR
- ls -la $BITBUCKET_CLONE_DIR/kasmvnc-Linux-x86_64-*.tar.gz
- git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git
- python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${S3_BUCKET}" $BITBUCKET_CLONE_DIR/kasmvnc-Linux-x86_64-*.tar.gz "${S3_BUILD_DIRECTORY}/${BUILD_FILE}"
- export S3_URL="https://${S3_BUCKET}.s3.amazonaws.com/${S3_BUILD_DIRECTORY}/${BUILD_FILE}"
- export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${BUILD_FILE}\", \"url\":\"${S3_URL}\"}"
- echo ${BITBUCKET_REPO_OWNER}
- echo ${BITBUCKET_REPO_SLUG}
- echo ${BITBUCKET_COMMIT}
- echo ${BB_AUTH_STRING}
- echo ${BUILD_STATUS}
- curl -H "Content-Type:application/json" -X POST --user "${BB_AUTH_STRING}" -d "${BUILD_STATUS}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/commit/${BITBUCKET_COMMIT}/statuses/build"

View File

@@ -1,22 +1,141 @@
REQIUREMENTS
## REQIUREMENTS
Docker CE
# build the docker image
cd /src_code_root
sudo docker build -t kasmvncbuilder:18.04 -f builder/dockerfile.build .
# Build a deb/rpm package
```
# builder/build-package <os> <os_codename> <build_tag>
# os_codename is what "lsb_release -c" outputs, e.g. buster, focal.
#
# build_tag allows building multiple versions of deb package (rpm not supported)
# targeting a single distro release (e.g. Ubuntu Bionic). If build_tag is given,
# the package name will include build_tag as part of Debian revision. For
# example:
# * with build_tag: kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb
# * without build_tag: kasmvncserver_0.9.1~beta-1_amd64.deb
# You need to have .build and .deb.build for the build_tag.
#
# Packages will be placed under builder/build/
# run the builder
sudo docker run -v /tmp:/build kasmvncbuilder:18.04
builder/build-package ubuntu bionic
builder/build-package ubuntu focal
builder/build-package debian buster
builder/build-package debian bullseye
builder/build-package kali kali-rolling
builder/build-package centos core # CentOS 7
builder/build-package fedora thirtythree
```
# tar will be on /tmp of host
cp /tmp/kasmvnc*.tar.gz builder/
# Build and test a package
```
builder/build-and-test-deb ubuntu focal
builder/build-and-test-rpm centos core
```
# build test desktop container with new binary installed
cd builder
sudo docker build -t kasmvnctester:18.04 -f dockerfile.test .
# run an instance of the new destkop
sudo docker run -d -p 80:6901 -p 5901:5901 -e VNCOPTIONS="-detectScrolling -PreferBandwidth -DynamicQualityMin=0" kasmvnctester:latest
Open browser and point to https://localhost:443/ or https://\<ip-address\>:443/
open browser and point to http://IPAddress/vnc_lite.html
default password is "vncpassword" or use a VNC client
3 default users are created:
* 'foo' with default password 'foobar'. It can use mouse and keyboard.
* 'foo-ro' with default password 'foobar'. It can only view.
* 'foo-owner' with default password 'foobar'. It can manage other users.
# Test a package
If you want to test deb/rpm package you've already built, please use this:
```
builder/test-deb ubuntu focal
```
It will install the package inside a new container and run KasmVNC.
Open browser and point to https://localhost:443/ or https://\<ip-address\>:443/
# Package development
## deb/rpm package building and testing
First, a tarball is built, and then its files are copied to deb/rpm package as
it is being built.
Package testing stage installs the deb/rpm package in a fresh docker container
and runs KasmVNC.
```
builder/build-tarball debian buster
builder/build-deb debian buster
builder/test-deb debian buster
```
Use `build-and-test-deb` to perform the whole dev lifecycle, but to iterate
quickly, you'll need to skip building the tarball (which takes a long time), and
just build your deb/rpm with `build-deb` and test with `test-deb`.
`build-rpm` and `test-rpm` are also available.
## Ensuring packages have all dependencies they need.
If you're working on a deb/rpm package, testing that it has all the necessary
dependencies is done via testing in a barebones environment (read: no XFCE). In
this way we can be sure that runtime dependencies aren't met accidentally by
packages installed with XFCE.
```
builder/test-deb-barebones ubuntu focal
```
# Preparing a release
Deb and rpm packages need their versions bumped to the new release version. It
can be done with:
```
builder/bump-package-version 0.9.4-beta
```
This will update corresponding package files, use `git diff` to see changes.
If you've ran the command and curious about Debian version specifics, here's an
explanation:
Deb version will be `0.9.4~beta-1`. `~` (and not `-`) is required by packaging
guidelines, and `-1` is Debian package revision for `0.9.4` upstream release. If
a Debian-specific patch was later added on top of `0.9.4`, it'd be `-2` for the
next Debian version. Rpm has a corresponding revision in its .spec file.
# CI development
S3 upload code is extracted to various files in `.ci`. It's possible to iterate
locally by doing stuff like this:
```
bash -c '
. .ci/upload.sh;
prepare_upload_filename "bionic/kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb";
echo $upload_filename;'
```
# ARM
KasmVNC is supported on ARM, however, the build process needs to be broken into two parts with one occuring on a x64 system and the other on an ARM system. All our testing and official builds are done on AWS Graviton instances.
### Build www code on x86 System
The www code is webpacked for performance and thus requires building. There are NPM packages, phantomjs, which do not have an ARM build. Therefore, this must be built on x86 and then copied over to the ARM system for final packaging.
```
cd ~/KasmVNC
mkdir builder/www
sudo docker build -t kasmweb/www -f builder/dockerfile.www.build .
sudo docker run --rm -v $PWD/builder/www:/build kasmweb/www:latest
cd builder
tar -zcvf /tmp/kasm_www.tar.gz www
```
Now transfer ```kasm_www.tar.gz``` to the ARM system.
### Build KasmVNC ARM
These instructions assume KasmVNC has been cloned at $HOME and ```kasm_www.tar.gz``` has been placed at $HOME as well, adjust for your environment.
```
cd ~
tar -zxf kasm_www.tar.gz -C KasmVNC/builder/
cd KasmVNC
sudo builder/build-package ubuntu bionic
```
The resulting deb package can be found under ~/KasmVNC/builder/build/bionic
Replace ```bionic``` with ```focal``` to build for Ubuntu 20.04LTS. At this time, only Ubuntu Bionic has been tested, however, other Debian based builds we support should also work.

16
builder/build-and-test-deb Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -e
os="$1"
codename="$2"
if [[ -z "$os" ]] || [[ -z "$codename" ]]; then
echo "Usage: $0 <os> <codename>" >&2
exit 1
fi
cd "$(dirname "$0")"
./build-tarball "$os" "$codename" && ./build-deb "$os" "$codename" && \
./test-deb "$os" "$codename"

16
builder/build-and-test-rpm Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -e
os="$1"
codename="$2"
if [[ -z "$os" ]] || [[ -z "$codename" ]]; then
echo "Usage: $0 <os> <codename>" >&2
exit 1
fi
cd "$(dirname "$0")"
./build-tarball "$os" "$codename" && ./build-rpm "$os" "$codename" && \
./test-rpm "$os" "$codename"

21
builder/build-deb Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
L_GID=$(id -g)
builder_image=debbuilder_${os}:${os_codename}${build_tag_for_images}
docker build --build-arg KASMVNC_PACKAGE_DIR="builder/build/${os_codename}" \
--build-arg L_UID="$L_UID" \
-t "$builder_image" -f \
builder/dockerfile.${os}_${os_codename}${build_tag}.deb.build .
deb_output_dir=$(cd .. && echo $PWD)
docker run --rm -v "$deb_output_dir":/src -e BUILD_TAG="$build_tag" \
--user "$L_UID:$L_GID" \
"$builder_image" /bin/bash -c \
'/src/*/builder/build-deb-inside-docker'

34
builder/build-deb-inside-docker Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
prepare_docker_copy_of_debian_dir_and_cd_to_id() {
cd "$(dirname "$0")/.."
local mounted_src_dir="$PWD"
local docker_src_dir="$HOME/src"
mkdir "$docker_src_dir"
cd "$docker_src_dir"
cp -a "$mounted_src_dir/debian/" .
ln -s "$mounted_src_dir/builder" .
}
prepare_docker_copy_of_debian_dir_and_cd_to_id
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
os_codename=$(lsb_release -cs)
os_dir="builder/build/${os_codename}"
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
echo 'libjpeg 62 libjpeg-turbo (>= 2.1.1)' > debian/shlibs.local
debian_revision="$(echo $BUILD_TAG | tr _ -)"
sed -i -e "1 s/)/$debian_revision)/" debian/changelog
fi
dpkg-buildpackage -us -uc -b
mkdir -p "$os_dir"
cp ../*dbgsym*deb "$os_dir"
cp ../*.deb "$os_dir"
lintian ../*.deb || true

29
builder/build-package Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
os="$1"
codename="$2"
build_tag="$3"
detect_package_format() {
package_format=rpm
if ls builder/dockerfile*"$os"* | grep -q .deb.build; then
package_format=deb
fi
}
warn_build_tag_not_supported_for_rpm_and_exit() {
if [[ "$build_tag" && "$package_format" = "rpm" ]]; then
echo >&2 "<build_tag> isn't supported for rpm"
exit 1
fi
}
cd "$(dirname "$0")/.."
detect_package_format
warn_build_tag_not_supported_for_rpm_and_exit
builder/build-tarball "$os" "$codename" "$build_tag"
builder/build-${package_format} "$os" "$codename" "$build_tag"

26
builder/build-rpm Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -e
warn_build_tag_not_supported_for_rpm_and_exit() {
local build_tag="$1"
if [[ -n "$build_tag" ]]; then
echo >&2 "<build_tag> isn't supported for rpm"
exit 1
fi
}
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
warn_build_tag_not_supported_for_rpm_and_exit "$build_tag"
docker build -t kasmvnc_rpmbuilder_${os}:${os_codename} -f \
builder/dockerfile.${os}_${os_codename}.rpm.build .
source_dir=$(echo $PWD)
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
L_GID=$(id -g)
docker run --rm -v "$source_dir":/src --user $L_UID:$L_GID \
kasmvnc_rpmbuilder_${os}:${os_codename} /bin/bash -c \
'/src/builder/build-rpm-inside-docker'

35
builder/build-rpm-inside-docker Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
set -e
prepare_build_env() {
rpmdev-setuptree
copy_spec_and_tar_with_binaries
}
copy_spec_and_tar_with_binaries() {
cp /tmp/kasmvncserver.spec ~/rpmbuild/SPECS/
cp /src/builder/build/kasmvnc.${os}_${os_codename}.tar.gz \
~/rpmbuild/SOURCES/
}
copy_rpm_to_build_dir() {
cd /src/builder && \
mkdir -p "$os_dir" && cp ~/rpmbuild/RPMS/*/*.rpm ${os_dir}
}
cd "$(dirname "$0")/.."
if [ -z ${KASMVNC_BUILD_OS_CODENAME+x} ]; then
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
os_codename=$(lsb_release -cs | tr '[:upper:]' '[:lower:]')
else
os=${KASMVNC_BUILD_OS}
os_codename=${KASMVNC_BUILD_OS_CODENAME}
fi
os_dir="build/${os}_${os_codename}"
prepare_build_env
rpmbuild -ba ~/rpmbuild/SPECS/kasmvncserver.spec
copy_rpm_to_build_dir
rpmlint "$os_dir"/*.rpm || true

47
builder/build-tarball Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
build_www_dir() {
local webpacked_www=$PWD/builder/www
local src_www=kasmweb
if [ "$src_www" -nt "$webpacked_www" ]; then
docker build -t kasmweb/www -f builder/dockerfile.www.build .
docker run --rm -v $PWD/builder/www:/build kasmweb/www:latest
fi
}
move_libjpeg_turbo_to_os_specific_dir() {
chown $L_UID:$L_GID $shared_with_docker_dir/${os_codename}/*
mkdir -p $PWD/builder/build/${os_codename}/
mv $shared_with_docker_dir/${os_codename}/libjpeg-turbo*.deb \
$PWD/builder/build/${os_codename}/
}
shared_with_docker_dir=${GITLAB_SHARED_DIND_DIR:-/tmp}
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
build_www_dir
builder_image=kasmvncbuilder:$os_codename${build_tag_for_images}
docker build -t "$builder_image" \
-f builder/dockerfile.${os}_${os_codename}${build_tag}.build .
mkdir -p builder/build
docker run -v $shared_with_docker_dir:/build -e BUILD_TAG="$build_tag" \
-e KASMVNC_COMMIT_ID="$KASMVNC_COMMIT_ID" \
--rm "$builder_image"
L_GID=$(id -g)
L_UID=$(id -u)
tarball_name="kasmvnc.${os}_${os_codename}.tar.gz"
tarball_name_with_build_tag="kasmvnc.${os}_${os_codename}${build_tag}.tar.gz"
chown $L_UID:$L_GID $shared_with_docker_dir/$tarball_name
mv $shared_with_docker_dir/$tarball_name \
$PWD/builder/build/"$tarball_name_with_build_tag"
if [ "$build_tag" = "+libjpeg-turbo_latest" ]; then
move_libjpeg_turbo_to_os_specific_dir
fi

View File

@@ -1,13 +1,50 @@
#!/bin/sh -e
#!/bin/bash
set -e
detect_quilt() {
if which quilt 1>/dev/null; then
QUILT_PRESENT=1
export QUILT_PATCHES=debian/patches
fi
}
ensure_crashpad_can_fetch_line_number_by_address() {
if [ ! -f /etc/centos-release ]; then
export LDFLAGS="$LDFLAGS -no-pie"
fi
}
fail_on_gcc_12() {
if [[ -n "$CC" && -n "$CXX" ]]; then
return;
fi
if gcc --version | head -1 | grep -q 12; then
cat >&2 <<EOF
Error: gcc 12 detected. It has a bug causing the build to fail because of a
-Warray-bounds bug. Please use gcc 11 in the build Dockerfile:
ENV CC=gcc-11
ENV CXX=g++-11
RUN <install gcc 11>
EOF
exit 1
fi
}
# For build-dep to work, the apt sources need to have the source server
#sudo apt-get build-dep xorg-server
#sudo apt-get install cmake git libjpeg-dev libgnutls-dev
fail_on_gcc_12
# Ubuntu applies a million patches, but here we use upstream to simplify matters
cd /tmp
wget https://www.x.org/archive//individual/xserver/xorg-server-1.18.4.tar.bz2
# default to the version of x in Ubuntu 18.04, otherwise caller will need to specify
XORG_VER=${XORG_VER:-"1.19.6"}
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##')
wget https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2
#git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git
#cd kasmvnc
@@ -20,24 +57,37 @@ sed -i -e '/find_package(FLTK/s@^@#@' \
-e '/add_subdirectory(tests/s@^@#@' \
CMakeLists.txt
cmake .
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF
make -j5
tar -C unix/xserver -xvf /tmp/xorg-server-1.18.4.tar.bz2 --strip-components=1
tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.bz2 --strip-components=1
cd unix/xserver
patch -Np1 -i ../xserver118.patch
patch -Np1 -i ../xserver${XORG_PATCH}.patch
case "$XORG_VER" in
1.20.*)
if [ -f ../xserver120.7.patch ]; then
patch -Np1 -i ../xserver120.7.patch
fi ;;
esac
autoreconf -i
# Configuring Xorg is long and has many distro-specific paths.
# The distro paths start after prefix and end with the font path,
# everything after that is based on BUILDING.txt to remove unneeded
# components.
ensure_crashpad_can_fetch_line_number_by_address
# remove gl check for opensuse
if [ "${KASMVNC_BUILD_OS}" == "opensuse" ]; then
sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure
fi
./configure --prefix=/opt/kasmweb \
--with-xkb-path=/usr/share/X11/xkb \
--with-xkb-output=/var/lib/xkb \
--with-xkb-bin-directory=/usr/bin \
--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \
--with-pic --without-dtrace --disable-static --disable-dri \
--without-dtrace --disable-dri \
--disable-static \
--disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \
--disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \
--disable-config-hal --disable-config-udev \
@@ -52,15 +102,28 @@ ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc
cd ..
mkdir -p man/man1
touch man/man1/Xserver.1
touch man/man1/Xvnc.1
cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1
mkdir lib
cd lib
ln -s /usr/lib/x86_64-linux-gnu/dri dri
if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then
ln -s /usr/lib/x86_64-linux-gnu/dri dri
elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then
ln -s /usr/lib/aarch64-linux-gnu/dri dri
else
ln -s /usr/lib64/dri dri
fi
cd /src
sed $'s#pushd $TMPDIR/inst#CWD=$(pwd)\\\ncd $TMPDIR/inst#' release/maketarball > release/maketarball2
sed $'s#popd#cd $CWD#' release/maketarball2 > release/maketarball3
mv release/maketarball3 release/maketarball
detect_quilt
if [ -n "$QUILT_PRESENT" ]; then
quilt push -a
echo 'Patches applied!'
fi
make servertarball
cp kasmvnc*.tar.gz /build/
cp kasmvnc*.tar.gz /build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
mkdir -p /build/${KASMVNC_BUILD_OS_CODENAME}/
cp /libjpeg-turbo/libjpeg*.deb /build/${KASMVNC_BUILD_OS_CODENAME}/
fi

17
builder/build_www.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
# clear previous build
rm -rf /build/*
# build webpack
npm run build
# remove node stuff from directory
rm -rf node_modules/
# copy all to build dir
cp -R ./* /build/
# remove unneccesary files
cd /build
rm *.md
rm AUTHORS
rm vnc.html

29
builder/bump-package-version Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -eo pipefail
update_version_to_meet_packaging_standards() {
new_version=$(echo "$new_version" |
sed -e 's/\([0-9]\)-\([a-zA-Z]\)/\1~\2/')
}
bump_rpm() {
builder/bump-package-version-rpm "$new_version"
}
bump_deb() {
builder/bump-package-version-deb "$new_version"
}
new_version="$1"
if [[ -z "$new_version" ]]; then
echo >&2 "Usage: $(basename "$0") <new_version>"
exit 1
fi
cd "$(dirname "$0")/.."
update_version_to_meet_packaging_standards
bump_rpm
bump_deb

View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -eo pipefail
new_version="$1"
add_debian_revision_to_new_version() {
echo "$new_version-1"
}
bump_deb() {
local image="debbump_package_version:dev"
local L_UID=$(id -u)
local L_GID=$(id -g)
local debian_version=$(add_debian_revision_to_new_version)
docker build -t "$image" -f builder/dockerfile.bump-package-version .
docker run --rm -v "$PWD":/src --user "$L_UID:$L_GID" \
"$image" /bin/bash -c \
"cd /src && builder/bump-package-version-inside-docker-deb $debian_version"
}
bump_deb

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
new_version="$1"
update_version() {
dch --newversion $new_version 'New upstream release.'
}
mark_as_released() {
dch --release ""
}
update_version
mark_as_released

View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -eo pipefail
new_version="$1"
specs="centos/kasmvncserver.spec
oracle/kasmvncserver.spec
opensuse/kasmvncserver.spec"
bump_version() {
sed -i "s/^Version:.\+/Version: $new_version/" "$1"
}
detect_release_version() {
release_version=$(sed -ne 's/^Release:\s\+//p' "$1" | sed -e 's/%.\+$//')
}
bump_changelog() {
detect_release_version "$1"
local date=$(date +'%a %b %d %Y')
local changelog_version="$new_version-$release_version"
local new_changelog_entry="* $date KasmTech <info@kasmweb.com> - $changelog_version\n- Upstream release"
sed -i -e "s/%changelog/%changelog\n$new_changelog_entry/" "$1"
}
IFS=$'\n'
for spec_file in $specs; do
bump_version $spec_file
bump_changelog $spec_file
done

View File

@@ -1,29 +0,0 @@
FROM ubuntu:18.04
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzvf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && ./configure && make && make install
# Fix for older required libs
RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY . /src
RUN chown -R docker:docker /src
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,6 @@
FROM debian:buster
ENV DEBEMAIL="Kasm Technologies LLC <info@kasmweb.com>"
RUN apt-get update && \
apt-get -y install vim devscripts

View File

@@ -0,0 +1,18 @@
FROM centos:centos7
RUN yum install -y xterm
RUN yum install -y vim less
RUN yum install -y redhat-lsb-core
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN yum localinstall -y /tmp/*.rpm
RUN useradd -m foo
USER foo:kasmvnc-cert
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | kasmvncpasswd -w -u \"$VNC_USER\" && vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /etc/pki/tls/private/kasmvnc.pem -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@@ -0,0 +1,31 @@
FROM centos:centos7
ENV KASMVNC_BUILD_OS centos
ENV KASMVNC_BUILD_OS_CODENAME core
RUN yum install -y ca-certificates
RUN yum install -y build-dep xorg-server libxfont-dev sudo
RUN yum install -y gcc cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN yum install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev openssl-devel
RUN yum install -y make
RUN yum group install -y "Development Tools"
RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel pam-devel \
gnutls-devel libX11-devel libXtst-devel libXcursor-devel
RUN yum install -y mesa-dri-drivers
RUN yum install -y ca-certificates
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,12 @@
FROM centos:centos7
RUN yum install -y rpm* gpg* rng-tools rpmlint
RUN yum install -y tree vim less
RUN yum install -y redhat-lsb-core
COPY centos/*.spec /tmp
RUN yum-builddep -y /tmp/*.spec
RUN useradd -m docker && echo "docker:docker" | chpasswd
USER docker

View File

@@ -0,0 +1,61 @@
FROM centos:centos7
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=centos \
KASMVNC_BUILD_OS_CODENAME=core
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN yum install -y openssl xterm gettext wget
RUN yum install -y centos-release-scl-rh && yum install -y nss_wrapper
RUN yum install -y xorg-x11-server xorg-x11-xauth xorg-x11-xkb-utils \
xkeyboard-config xorg-x11-server-utils
RUN yum install -y epel-release && yum groupinstall xfce -y
RUN yum erase -y pm-utils xscreensaver*
RUN yum install -y redhat-lsb-core
RUN yum install -y vim less
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN yum localinstall -y /tmp/*.rpm
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:kasmvnc-cert
WORKDIR $HOME
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,30 @@
FROM debian:bullseye-slim
ENV KASMVNC_BUILD_OS debian
ENV KASMVNC_BUILD_OS_CODENAME bullseye
ENV XORG_VER 1.20.10
ENV DEBIAN_FRONTEND noninteractive
RUN grep '^deb' /etc/apt/sources.list | sed 's#^deb#deb-src#' >> /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,19 @@
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,54 @@
FROM debian:bullseye-slim
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=debian \
KASMVNC_BUILD_OS_CODENAME=buster
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal dbus-x11 xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,19 @@
FROM debian:buster-slim
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
RUN apt-get update && apt-get -y install xterm
COPY startup/deb/kasmvncserver-easy-start /usr/local/bin
RUN useradd -m foo
USER foo:ssl-cert
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | \
kasmvncpasswd -w -u $VNC_USER $HOME/.kasmpasswd && \
kasmvncserver-easy-start && tail -f $HOME/.vnc/*.log"

View File

@@ -0,0 +1,30 @@
FROM debian:buster
ENV KASMVNC_BUILD_OS debian
ENV KASMVNC_BUILD_OS_CODENAME buster
ENV XORG_VER 1.20.10
ENV DEBIAN_FRONTEND noninteractive
RUN grep '^deb' /etc/apt/sources.list | sed 's#^deb#deb-src#' >> /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,19 @@
FROM debian:buster
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,54 @@
FROM debian:buster-slim
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=debian \
KASMVNC_BUILD_OS_CODENAME=buster
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,18 @@
FROM fedora:33
RUN dnf install -y xterm
RUN dnf install -y vim less
RUN yum install -y redhat-lsb-core
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN dnf localinstall -y /tmp/*.rpm
RUN useradd -m foo
USER foo:kasmvnc-cert
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | kasmvncpasswd -w -u \"$VNC_USER\" && vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /etc/pki/tls/private/kasmvnc.pem -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@@ -0,0 +1,38 @@
FROM fedora:33
ENV KASMVNC_BUILD_OS fedora
ENV KASMVNC_BUILD_OS_CODENAME thirtythree
ENV XORG_VER 1.20.10
# RUN dnf install -y build-dep xorg-server libxfont-dev sudo
RUN dnf install -y gcc cmake git gnutls-devel vim wget
#tightvncserver
RUN dnf install -y libjpeg-turbo-devel libpng-devel libtiff-devel giflib-devel openssl-devel
#libavcodec-dev
RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
RUN dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
RUN dnf -y install ffmpeg-devel
RUN dnf install -y make
RUN dnf group install -y "Development Tools"
RUN dnf install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
RUN dnf install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel libXtst-devel \
libXcursor-devel
RUN dnf install -y mesa-dri-drivers
RUN dnf install -y bzip2 redhat-lsb-core
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,13 @@
FROM fedora:33
RUN dnf install -y fedora-packager fedora-review
RUN dnf install -y tree vim less
RUN dnf install -y redhat-lsb-core
RUN dnf install -y dnf-plugins-core
COPY centos/*.spec /tmp
RUN dnf builddep -y /tmp/*.spec
RUN useradd -m docker && echo "docker:docker" | chpasswd
USER docker

View File

@@ -0,0 +1,64 @@
FROM fedora:33
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=fedora \
KASMVNC_BUILD_OS_CODENAME=thirtythree
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN dnf install -y openssl xterm gettext wget
RUN dnf install -y nss_wrapper
RUN dnf install -y xorg-x11-xauth xorg-x11-xkb-utils \
xkeyboard-config xorg-x11-server-utils
# xorg-x11-server-Xorg
# RUN dnf install -y @xfce-desktop-environment
RUN dnf group install -y lxde-desktop
RUN dnf erase -y pm-utils xscreensaver*
RUN dnf install -y redhat-lsb-core
RUN dnf install -y vim less
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
# RUN dnf remove -y tigervnc-server-minimal
RUN dnf localinstall -y --allowerasing /tmp/*.rpm
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:kasmvnc-cert
WORKDIR $HOME
RUN mkdir ~/.vnc && echo '/usr/bin/lxsession -s LXDE &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,33 @@
FROM kalilinux/kali-rolling:latest
ENV KASMVNC_BUILD_OS kali
ENV KASMVNC_BUILD_OS_CODENAME kali-rolling
ENV XORG_VER 1.20.10
ENV DEBIAN_FRONTEND noninteractive
ENV CC=gcc-11
ENV CXX=g++-11
RUN grep '^deb' /etc/apt/sources.list | sed 's#^deb#deb-src#' >> /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install gcc-11 g++-11
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make -j$(nproc) && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,19 @@
FROM kalilinux/kali-rolling:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,54 @@
FROM kalilinux/kali-rolling:latest
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_VER=18.04
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal dbus-x11 xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,39 @@
FROM opensuse/leap:15.3
# base tools
RUN zypper -n install -y \
less \
vim \
xterm
# deps and rpm install
RUN zypper -n install -y \
libglvnd \
libgnutls30 \
libgomp1 \
libjpeg8 \
libnettle6 \
libpixman-1-0 \
libXdmcp6 \
libXfont2-2 \
libxkbcommon-x11-0 \
openssl \
perl \
x11-tools \
xauth \
xkbcomp \
xkeyboard-config && \
mkdir -p /etc/pki/tls/private
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN zypper install -y --allow-unsigned-rpm /tmp/*.rpm
RUN useradd -m foo
USER foo:kasmvnc-cert
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | kasmvncpasswd -w -u \"$VNC_USER\" && vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 6901 -cert /etc/pki/tls/private/kasmvnc.pem -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@@ -0,0 +1,59 @@
FROM opensuse/leap:15.3
ENV KASMVNC_BUILD_OS opensuse
ENV KASMVNC_BUILD_OS_CODENAME 15
ENV XORG_VER 1.20.3
# Install depends
RUN zypper install -ny \
bdftopcf \
bigreqsproto-devel \
cmake \
ffmpeg-4-libavcodec-devel \
fonttosfnt \
font-util \
gcc \
gcc-c++ \
giflib-devel \
git \
gzip \
lbzip2 \
libbz2-devel \
libGLw-devel \
libgnutls-devel \
libjpeg8-devel \
libopenssl-devel \
libpng16-devel \
libtiff-devel \
libXfont2-devel \
libxkbcommon-x11-devel \
make \
Mesa-dri \
Mesa-libglapi-devel \
mkfontdir \
mkfontscale \
patch \
tigervnc \
wget \
xcmiscproto-devel \
xorg-x11-devel \
xorg-x11-server-sdk \
xorg-x11-util-devel \
zlib-devel
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -u 1000 docker && \
groupadd -g 1000 docker && \
usermod -a -G docker docker
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,24 @@
FROM opensuse/leap:15.3
ENV KASMVNC_BUILD_OS opensuse
ENV KASMVNC_BUILD_OS_CODENAME 15
RUN zypper -n install -y \
gpg* \
less \
lsb-release \
rng-tools \
rpm-build \
rpmdevtools \
rpmlint \
tree \
vim
COPY opensuse/*.spec /tmp
RUN zypper -n install $(grep BuildRequires /tmp/*.spec | cut -d' ' -f2 | xargs)
RUN useradd -u 1000 -m -d /home/docker docker && \
groupadd -g 1000 docker && \
usermod -a -G docker docker
USER docker

View File

@@ -0,0 +1,20 @@
FROM oraclelinux:8
RUN dnf install -y \
less \
redhat-lsb-core \
vim \
xterm
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN dnf localinstall -y /tmp/*.rpm
RUN useradd -m foo
USER foo:kasmvnc-cert
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | kasmvncpasswd -w -u \"$VNC_USER\" && vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /etc/pki/tls/private/kasmvnc.pem -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@@ -0,0 +1,61 @@
FROM oraclelinux:8
ENV KASMVNC_BUILD_OS oracle
ENV KASMVNC_BUILD_OS_CODENAME 8
ENV XORG_VER 1.20.10
# Install from stock repos
RUN dnf install -y \
bzip2-devel \
ca-certificates \
cmake \
dnf-plugins-core \
gcc \
gcc-c++ \
git \
gnutls-devel \
libjpeg-turbo-devel \
libpng-devel \
libtiff-devel \
make \
mesa-dri-drivers \
openssl-devel \
openssl-devel \
patch \
tigervnc-server \
wget \
xorg-x11-font-utils \
zlib-devel
# Enable additional repos (epel, powertools, and fusion)
RUN dnf config-manager --set-enabled ol8_codeready_builder
RUN dnf install -y oracle-epel-release-el8
RUN dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
# Install from new repos
RUN dnf install -y \
ffmpeg-devel \
giflib-devel \
lbzip2 \
libXfont2-devel \
libxkbfile-devel \
xorg-x11-server-devel \
xorg-x11-xkb-utils-devel \
xorg-x11-xtrans-devel \
libXrandr-devel \
libXtst-devel \
libXcursor-devel
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,21 @@
FROM oraclelinux:8
ENV KASMVNC_BUILD_OS oracle
ENV KASMVNC_BUILD_OS_CODENAME 8
RUN dnf install -y \
gpg* \
less \
redhat-lsb-core \
rng-tools \
rpm* \
rpmlint \
tree \
vim
COPY oracle/*.spec /tmp
RUN dnf builddep -y /tmp/*.spec
RUN useradd -m docker && echo "docker:docker" | chpasswd
USER docker

View File

@@ -1,12 +0,0 @@
FROM kasmweb/desktop-deluxe:develop
ENV VNCOPTIONS "-PreferBandwidth -DynamicQualityMin=3 -DynamicQualityMax=7 -detectScrolling"
USER root
COPY kasmvnc-Linux-x86_64-*.tar.gz /tmp/
RUN tar -xzvf /tmp/kasmvnc-Linux-x86_64-*.tar.gz --strip 1 -C /
USER 1000
CMD ["--tail-log"]

View File

@@ -14,8 +14,7 @@ RUN cd /tmp/libwebp-1.0.2 && ./configure && make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY . /src
RUN chown -R docker:docker /src
COPY --chown=docker:docker . /src/
USER docker

View File

@@ -0,0 +1,39 @@
FROM ubuntu:18.04
ENV KASMVNC_BUILD_OS ubuntu
ENV KASMVNC_BUILD_OS_CODENAME bionic
ENV XORG_VER 1.20.10
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get install -y cmake nasm gcc
RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -G"Unix Makefiles" && make deb
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" && make && make install
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
# Fix for older required libs
#RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
# wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,23 @@
FROM ubuntu:bionic
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo*deb /tmp
RUN apt-get install /tmp/libjpeg-turbo*deb
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ENV LD_LIBRARY_PATH="/opt/libjpeg-turbo/lib64/:$LD_LIBRARY_PATH"
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,58 @@
FROM ubuntu:bionic
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64/:/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo_*.deb /tmp
RUN apt-get install /tmp/libjpeg-turbo*deb
ARG BUILD_DEBIAN_REVISION
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*$BUILD_DEBIAN_REVISION*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,34 @@
FROM ubuntu:18.04
ENV KASMVNC_BUILD_OS ubuntu
ENV KASMVNC_BUILD_OS_CODENAME bionic
ENV XORG_VER 1.20.10
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
# Fix for older required libs
#RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
# wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,17 @@
FROM ubuntu:bionic
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,54 @@
FROM ubuntu:bionic
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,51 @@
FROM ubuntu:18.04
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext libjpeg-dev wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
COPY build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz /tmp/
RUN tar -xzvf /tmp/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz --strip 1 -C /
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,15 @@
FROM ubuntu:focal
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
RUN apt-get update && apt-get -y install xterm lsb-release
RUN useradd -m foo && addgroup foo ssl-cert
USER foo
RUN mkdir ~/.vnc && echo '/usr/bin/xterm &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "echo -e \"$VNC_PW\n$VNC_PW\n\" | kasmvncpasswd -w -u \"$VNC_USER\" && vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@@ -0,0 +1,30 @@
FROM ubuntu:focal
ENV KASMVNC_BUILD_OS ubuntu
ENV KASMVNC_BUILD_OS_CODENAME focal
ENV XORG_VER 1.20.8
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,19 @@
FROM ubuntu:focal
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,57 @@
FROM ubuntu:focal
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,51 @@
FROM ubuntu:focal
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=focal
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext libjpeg-dev wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
COPY build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz /tmp/
RUN tar -xzvf /tmp/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz --strip 1 -C /
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,30 @@
FROM ubuntu:jammy
ENV KASMVNC_BUILD_OS ubuntu
ENV KASMVNC_BUILD_OS_CODENAME jammy
ENV XORG_VER 1.20.8
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,19 @@
FROM ubuntu:jammy
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,57 @@
FROM ubuntu:jammy
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,51 @@
FROM ubuntu:jammy
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=jammy
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext libjpeg-dev wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
COPY build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz /tmp/
RUN tar -xzvf /tmp/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz --strip 1 -C /
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -0,0 +1,10 @@
FROM node:12-buster
COPY kasmweb/ /src/www/
COPY builder/build_www.sh /src/
WORKDIR /src/www
RUN npm install
ENTRYPOINT [ "/src/build_www.sh" ]

View File

@@ -1,79 +0,0 @@
set -e
OS_ID='unknown'
OS_VERSION_ID='unknown'
SUPPORTED='false'
if [[ $EUID -ne 0 ]]; then
echo "This script must ran with sudo"
exit 1
fi
function install_deps_ubuntu_18(){
# install deps and build tools
sudo apt-get update
sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev build-essential cmake libxfont-dev
wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb
sudo dpkg -i libxfont1*.deb
rm /tmp/libxfont1*.deb
}
function build_webp(){
# build webp
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
tar -xzvf /tmp/libwebp-*
cd /tmp/libwebp-1.0.2
./configure
make
sudo make install
cd /
rm -rf /tmp/libwebp*
sudo ldconfig
}
function install_kasmvnc(){
# install kasmvnc
wget -qO- https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/c0ab0111ae47a39720f26a7dd7ac54a3681540f8/kasmvnc_1.9.c0ab0111ae47a39720f26a7dd7ac54a3681540f8.tar.gz | sudo tar xz --strip 1 -C /
#install cert
sudo mkdir /usr/local/share/kasmvnc/certs
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /usr/local/share/kasmvnc/certs/self.pem -out /usr/local/share/kasmvnc/certs/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
}
cd /tmp
# Get the OS and version
if [ -f /etc/os-release ] ; then
OS_ID="$(awk -F= '/^ID=/{print $2}' /etc/os-release)"
OS_VERSION_ID="$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release)"
fi
if [ "${OS_ID}" == "ubuntu" ] && ( [ "${OS_VERSION_ID}" == '"16.04"' ] || [ "${OS_VERSION_ID}" == '"18.04"' ] || [ "${OS_VERSION_ID}" == '"20.04"' ]) ; then
if [ "${OS_VERSION_ID}" == '"18.04"' ] ; then
SUPPORTED='true'
install_deps_ubuntu_18
build_webp
install_kasmvnc
fi
fi
if [ "${OS_ID}" == "debian" ] && ( [ "${OS_VERSION_ID}" == '"9"' ] || [ "${OS_VERSION_ID}" == '"10"' ] ) ; then
#TODO: Add support for debian
echo 'Debian is currently not supported'
fi
if [ "${OS_ID}" == '"centos"' ] && ( [ "${OS_VERSION_ID}" == '"7"' ] || [ "${OS_VERSION_ID}" == '"8"' ] ) ; then
#TODO: Add support for Centos
echo 'CentOS is currently not supported'
fi
if [ "${SUPPORTED}" == "false" ] ; then
echo "Installation Not Supported for this Operating System. You must compile KasmVNC from source."
exit -1
fi
echo "Installation is complete"
echo "Follow the instructions to complete setup"

13
builder/os_ver_cli.sh Normal file
View File

@@ -0,0 +1,13 @@
default_os=ubuntu
default_os_codename=bionic
os=${1:-$default_os}
os_codename=${2:-$default_os_codename}
build_tag="${3:-}"
if [[ -n "$build_tag" ]]; then
build_tag_for_images="_${build_tag#+}"
build_debian_revision="$(echo $build_tag | tr _ -)"
fi
os_image="$os:$os_codename"
echo "Building for $os_image"

View File

@@ -0,0 +1,46 @@
#!/bin/bash
set -e
display=:10
interface=0.0.0.0
cert_group=ssl-cert
if [[ "$1" = "--help" ]]; then
cat >&2 <<-USAGE
Usage: `basename $0` [options]
-d Debug output
-kill Kill vncserver
--help show this help
USAGE
exit
fi
if [[ "$1" = "-d" ]]; then
log_option="-log *:stderr:100"
fi
action=start
if [[ "$1" = "-kill" ]]; then
action=kill
fi
if groups | grep -qvw ssl-cert; then
cat <<-EOF
Can't access TLS certificate.
Please add your user to $cert_group via 'addgroup <user> ssl-cert'
EOF
exit 1
fi
if [[ "$action" = "kill" ]]; then
vncserver -kill $display
exit
fi
vncserver $display -interface $interface
vncserver -kill $display
vncserver $display -depth 24 -geometry 1280x1050 -websocketPort 8443 \
-cert /etc/ssl/certs/ssl-cert-snakeoil.pem \
-key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 \
-interface $interface -httpd /usr/share/kasmvnc/www $log_option

View File

@@ -0,0 +1,46 @@
detect_libnss_wrapper() {
if $(which dpkg &>/dev/null); then
libnss_wrapper_file=$(dpkg -S libnss_wrapper.so | awk -F' ' '{ print $2 }')
return
fi
if [ -r /usr/lib/libnss_wrapper.so ]; then
libnss_wrapper_file=/usr/lib/libnss_wrapper.so
elif [ -r /usr/lib64/libnss_wrapper.so ]; then
libnss_wrapper_file=/usr/lib64/libnss_wrapper.so
else
echo "no libnss_wrapper.so installed!"
exit 1
fi
}
# Set current user in nss_wrapper
USER_ID=$(id -u)
GROUP_ID=$(id -g)
echo "USER_ID: $USER_ID, GROUP_ID: $GROUP_ID"
# Attempt to set the username to the kasm username
USERNAME=${VNC_USER:-default}
# Make the username posix compliant
USERNAME=$(echo "$USERNAME" | sed -r 's#[^a-zA-Z0-9\._\-]#_#g')
if ! echo "$USERNAME" | grep -qP "^[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*"; then
USERNAME="default"
fi
export PS1="$USERNAME:\w\$ "
if [ x"$USER_ID" != x"0" ]; then
NSS_WRAPPER_PASSWD=/tmp/passwd
NSS_WRAPPER_GROUP=/etc/group
cat /etc/passwd > $NSS_WRAPPER_PASSWD
echo "${USERNAME}:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/bin/bash" >> $NSS_WRAPPER_PASSWD
export NSS_WRAPPER_PASSWD
export NSS_WRAPPER_GROUP
detect_libnss_wrapper
echo "nss_wrapper location: $libnss_wrapper_file"
export LD_PRELOAD="$libnss_wrapper_file"
fi

112
builder/startup/vnc_startup.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/bash
### every exit != 0 fails the script
set -e
# should also source $STARTUPDIR/generate_container_user
source $HOME/.bashrc
## correct forwarding of shutdown signal
cleanup () {
kill -s SIGTERM $!
exit 0
}
trap cleanup SIGINT SIGTERM
detect_www_dir() {
local package_www_dir="/usr/share/kasmvnc/www"
if [[ -d "$package_www_dir" ]]; then
package_www_dir_option="-httpd $package_www_dir"
fi
}
detect_cert_location() {
local tarball_cert="$HOME/.vnc/self.pem"
local deb_cert="/etc/ssl/certs/ssl-cert-snakeoil.pem"
local deb_key="/etc/ssl/private/ssl-cert-snakeoil.key"
local rpm_cert="/etc/pki/tls/private/kasmvnc.pem"
if [[ -f "$deb_cert" ]]; then
cert_option="-cert $deb_cert -key $deb_key"
elif [[ -f "$rpm_cert" ]]; then
cert_option="-cert $rpm_cert"
else
cert_option="-cert $tarball_cert"
fi
}
add_vnc_user() {
local username="$1"
local password="$2"
local permission_option="$3"
echo "Adding user $username"
echo -e "$password\n$password" | kasmvncpasswd $permission_option \
-u "$username" $HOME/.kasmpasswd
}
## resolve_vnc_connection
VNC_IP=$(hostname -i)
# first entry is control, second is view (if only one is valid for both)
mkdir -p "$HOME/.vnc"
PASSWD_PATH="$HOME/.vnc/passwd"
add_vnc_user "$VNC_USER" "$VNC_PW" "-w"
add_vnc_user "$VNC_USER-ro" "$VNC_PW"
add_vnc_user "$VNC_USER-owner" "$VNC_PW" "-o"
add_vnc_user "$VNC_USER-to-delete" "$VNC_PW"
kasmvncpasswd -n -u "$VNC_USER-owner" -w -o $HOME/.kasmpasswd
kasmvncpasswd -d -u "$VNC_USER-to-delete" $HOME/.kasmpasswd
chmod 0600 $HOME/.kasmpasswd
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $HOME/.vnc/self.pem -out $HOME/.vnc/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
vncserver :1 -interface 0.0.0.0
vncserver -kill :1
if [[ -f $PASSWD_PATH ]]; then
rm -f $PASSWD_PATH
fi
#echo "$VNC_PW" | vncpasswd -f > $PASSWD_PATH
#echo "$VNC_VIEW_ONLY_PW" | vncpasswd -f >> $PASSWD_PATH
#chmod 600 $PASSWD_PATH
unset VNC_VIEW_ONLY_PW
unset VNC_PW
if [[ $DEBUG == true ]]; then
echo -e "\n------------------ start VNC server ------------------------"
echo "remove old vnc locks to be a reattachable container"
fi
vncserver -kill $DISPLAY &> $HOME/.vnc/vnc_startup.log \
|| rm -rfv /tmp/.X*-lock /tmp/.X11-unix &> $HOME/.vnc/vnc_startup.log \
|| echo "no locks present"
detect_www_dir
detect_cert_location
[ -n "$KASMVNC_VERBOSE_LOGGING" ] && verbose_logging_option="-log *:stderr:100"
echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..."
vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT $cert_option -sslOnly -interface 0.0.0.0 $VNCOPTIONS $package_www_dir_option $verbose_logging_option #&> $STARTUPDIR/no_vnc_startup.log
PID_SUN=$!
echo -e "start window manager\n..."
$STARTUPDIR/window_manager_startup.sh #&> $STARTUPDIR/window_manager_startup.log
## log connect options
echo -e "\n\n------------------ VNC environment started ------------------"
echo -e "\nVNCSERVER started on DISPLAY= $DISPLAY \n\t=> connect via VNC viewer with $VNC_IP:$VNC_PORT"
echo -e "\nnoVNC HTML client started:\n\t=> connect via http://$VNC_IP:$NO_VNC_PORT/?password=...\n"
echo "WEB PID: $PID_SUB"
# tail vncserver logs
tail -f $HOME/.vnc/*$DISPLAY.log &
eval "$@"
wait $PID_SUB
echo "Exiting Kasm container"

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
echo -e "\n------------------ Xfce4 window manager startup------------------"
### disable screen saver and power management
xset -dpms &
xset s noblank &
xset s off &
if [ "$SINGLE_APPLICATION" -eq "1" ]; then
echo "Configured of Single Application Mode"
sed -i "s/O|SHMC/|/g" $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
#xfwm4 --daemon
fi

16
builder/test-deb Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
. ./os_ver_cli.sh
tester_image=kasmvnctester_${os}:$os_codename${build_tag_for_images}
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
--build-arg BUILD_DEBIAN_REVISION="$build_debian_revision" \
-t "$tester_image" \
-f dockerfile.${os}_${os_codename}${build_tag}.deb.test .
docker run -it -p 443:8443 --rm \
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
"$tester_image"

14
builder/test-deb-barebones Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
os="${1:-debian}"
os_codename="${2:-buster}"
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.barebones.deb.test .
echo
docker run -it -p 443:8443 --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_barebones_${os}:$os_codename

17
builder/test-rpm Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
. ./os_ver_cli.sh
echo kasmvnctester_${os}:$os_codename
docker build --build-arg \
KASMVNC_PACKAGE_DIR="build/${os}_${os_codename}" \
-t kasmvnctester_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.rpm.test .
docker run -it -p 443:8443 --rm \
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_${os}:$os_codename

13
builder/test-rpm-barebones Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
os="${1:-centos}"
os_codename="${2:-core}"
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os}_${os_codename}" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.barebones.rpm.test .
docker run -it -p 443:8443 --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_barebones_${os}:$os_codename

108
centos/kasmvncserver.spec Normal file
View File

@@ -0,0 +1,108 @@
Name: kasmvncserver
Version: 0.9.3~beta
Release: 1%{?dist}
Summary: VNC server accessible from a web browser
License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync
Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl
Conflicts: tigervnc-server, tigervnc-server-minimal
%description
VNC stands for Virtual Network Computing. It is, in essence, a remote
display system which allows you to view a computing `desktop' environment
not only on the machine where it is running, but from anywhere on the
Internet and from a wide variety of machine architectures.
KasmVNC has different goals than TigerVNC:
Web-based - KasmVNC is designed to provide a web accessible remote desktop.
It comes with a web server and web-socket server built in. There is no need to
install other components. Simply run and navigate to your desktop's URL on the
port you specify. While you can still tun on the legacy VNC port, it is
disabled by default.
Security - KasmVNC defaults to HTTPS and allows for HTTP Basic Auth. VNC
Password authentication is limited by specification to 8 characters and is not
sufficient for use on an internet accessible remote desktop. Our goal is to
create a by default secure, web based experience.
Simplicity - KasmVNC aims at being simple to deploy and configure.
%prep
%install
rm -rf $RPM_BUILD_ROOT
TARGET_OS=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
TARGET_OS_CODENAME=$(lsb_release -cs | tr '[:upper:]' '[:lower:]')
TARBALL=$RPM_SOURCE_DIR/kasmvnc.${TARGET_OS}_${TARGET_OS_CODENAME}.tar.gz
TAR_DATA=$(mktemp -d)
tar -xzf "$TARBALL" -C "$TAR_DATA"
SRC=$TAR_DATA/usr/local
SRC_BIN=$SRC/bin
DESTDIR=$RPM_BUILD_ROOT
DST_MAN=$DESTDIR/usr/share/man/man1
mkdir -p $DESTDIR/usr/bin $DESTDIR/usr/share/man/man1 \
$DESTDIR/usr/share/doc/kasmvncserver
cp $SRC_BIN/Xvnc $DESTDIR/usr/bin;
cp $SRC_BIN/vncserver $DESTDIR/usr/bin;
cp $SRC_BIN/vncconfig $DESTDIR/usr/bin;
cp $SRC_BIN/kasmvncpasswd $DESTDIR/usr/bin;
cp $SRC_BIN/kasmxproxy $DESTDIR/usr/bin;
cd $DESTDIR/usr/bin && ln -s kasmvncpasswd vncpasswd;
cp -r $SRC/share/doc/kasmvnc*/* $DESTDIR/usr/share/doc/kasmvncserver/
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
--exclude www/utils/ --exclude .eslintrc \
$SRC/share/kasmvnc $DESTDIR/usr/share
cp $SRC/man/man1/Xvnc.1 $DESTDIR/usr/share/man/man1/;
cp $SRC/share/man/man1/vncserver.1 $DST_MAN;
cp $SRC/share/man/man1/vncconfig.1 $DST_MAN;
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
cp $SRC/share/man/man1/kasmxproxy.1 $DST_MAN;
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
/usr/bin/*
/usr/share/man/man1/*
/usr/share/kasmvnc/www
%license /usr/share/doc/kasmvncserver/LICENSE.TXT
%doc /usr/share/doc/kasmvncserver/README.md
%changelog
* Tue Mar 22 2022 KasmTech <info@kasmweb.com> - 0.9.3~beta-1
* Fri Feb 12 2021 KasmTech <info@kasmweb.com> - 0.9.1~beta-1
- Initial release of the rpm package.
%post
kasmvnc_group="kasmvnc-cert"
create_kasmvnc_group() {
if ! getent group "$kasmvnc_group" >/dev/null; then
groupadd --system "$kasmvnc_group"
fi
}
make_self_signed_certificate() {
local cert_file=/etc/pki/tls/private/kasmvnc.pem
[ -f "$cert_file" ] && return 0
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout "$cert_file" \
-out "$cert_file" -subj \
"/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
chgrp "$kasmvnc_group" "$cert_file"
chmod 640 "$cert_file"
}
create_kasmvnc_group
make_self_signed_certificate
%postun
rm -f /etc/pki/tls/private/kasmvnc.pem

View File

@@ -62,11 +62,11 @@ configure_file(release/maketarball.in release/maketarball)
set(TARBALL_DEPENDS vncpasswd vncconfig)
add_custom_target(tarball sh release/maketarball
add_custom_target(tarball bash release/maketarball
DEPENDS ${TARBALL_DEPENDS}
SOURCES release/maketarball)
add_custom_target(servertarball sh release/maketarball server
add_custom_target(servertarball bash release/maketarball server
DEPENDS ${TARBALL_DEPENDS}
SOURCES release/maketarball)
@@ -76,5 +76,5 @@ endif() #UNIX
# Common
#
install(FILES ${CMAKE_SOURCE_DIR}/LICENCE.TXT DESTINATION ${DOC_DIR})
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT DESTINATION ${DOC_DIR})
install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${DOC_DIR})

View File

@@ -27,6 +27,9 @@ if(BUILD_STATIC)
# gettext is included in libc on many unix systems
if(NOT LIBC_HAS_DGETTEXT)
set(GETTEXT_LIBRARIES "-Wl,-Bstatic -lintl -liconv -Wl,-Bdynamic")
if(APPLE)
set(GETTEXT_LIBRARIES "${GETTEXT_LIBRARIES} -framework Carbon")
endif()
endif()
if(GNUTLS_FOUND)
@@ -44,7 +47,7 @@ if(BUILD_STATIC)
set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -ltasn1")
endif()
if(NETTLE_LIBRARY)
set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lnettle -lhogweed -lgmp")
set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lhogweed -lnettle -lgmp")
endif()
if(GCRYPT_LIBRARY)
set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lgcrypt -lgpg-error")
@@ -118,7 +121,7 @@ endif()
if(BUILD_STATIC_GCC)
# This ensures that we don't depend on libstdc++ or libgcc_s
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nodefaultlibs")
set(STATIC_BASE_LIBRARIES "-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic")
set(STATIC_BASE_LIBRARIES "")
if(ENABLE_ASAN AND NOT WIN32 AND NOT APPLE)
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lm -lpthread")
endif()
@@ -136,7 +139,8 @@ if(BUILD_STATIC_GCC)
# these things again
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt")
else()
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lgcc -lgcc_eh -lc")
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lm -lgcc -lgcc_eh -lc")
endif()
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${STATIC_BASE_LIBRARIES}")
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${STATIC_BASE_LIBRARIES}")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic ${STATIC_BASE_LIBRARIES}")
endif()

View File

@@ -0,0 +1,85 @@
/* Copyright (C) 2021 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
#include <map>
#include <string>
#include <network/Blacklist.h>
#include <rfb/Blacklist.h>
static std::map<std::string, unsigned> hits;
static std::map<std::string, time_t> blacklist;
static pthread_mutex_t hitmutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t blmutex = PTHREAD_MUTEX_INITIALIZER;
unsigned char bl_isBlacklisted(const char *addr) {
const unsigned char count = blacklist.count(addr);
if (!count)
return 0;
const time_t now = time(NULL);
const unsigned timeout = rfb::Blacklist::initialTimeout;
if (pthread_mutex_lock(&blmutex))
abort();
if (now - timeout > blacklist[addr]) {
blacklist.erase(addr);
pthread_mutex_unlock(&blmutex);
if (pthread_mutex_lock(&hitmutex))
abort();
hits.erase(addr);
pthread_mutex_unlock(&hitmutex);
return 0;
} else {
blacklist[addr] = now;
pthread_mutex_unlock(&blmutex);
return 1;
}
}
void bl_addFailure(const char *addr) {
if (!rfb::Blacklist::threshold)
return;
if (pthread_mutex_lock(&hitmutex))
abort();
const unsigned num = ++hits[addr];
pthread_mutex_unlock(&hitmutex);
if (num >= (unsigned) rfb::Blacklist::threshold) {
if (pthread_mutex_lock(&blmutex))
abort();
blacklist[addr] = time(NULL);
pthread_mutex_unlock(&blmutex);
}
}

View File

@@ -0,0 +1,33 @@
/* Copyright (C) 2021 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef __NETWORK_BLACKLIST_H__
#define __NETWORK_BLACKLIST_H__
#ifdef __cplusplus
extern "C" {
#endif
unsigned char bl_isBlacklisted(const char *);
void bl_addFailure(const char *);
#ifdef __cplusplus
} // extern C
#endif
#endif // __NETWORK_TCP_SOCKET_H__

View File

@@ -1,10 +1,15 @@
include_directories(${CMAKE_SOURCE_DIR}/common)
include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd)
set(NETWORK_SOURCES
GetAPIMessager.cxx
Blacklist.cxx
Socket.cxx
TcpSocket.cxx
cJSON.c
jsonescape.c
websocket.c
websockify.c)
websockify.c
${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd/kasmpasswd.c)
if(NOT WIN32)
set(NETWORK_SOURCES ${NETWORK_SOURCES} UnixSocket.cxx)

139
common/network/GetAPI.h Normal file
View File

@@ -0,0 +1,139 @@
/* Copyright (C) 2021 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef __NETWORK_GET_API_H__
#define __NETWORK_GET_API_H__
#include <kasmpasswd.h>
#include <pthread.h>
#include <network/GetAPIEnums.h>
#include <rfb/PixelBuffer.h>
#include <rfb/PixelFormat.h>
#include <stdint.h>
#include <map>
#include <string>
#include <vector>
namespace network {
class GetAPIMessager {
public:
GetAPIMessager(const char *passwdfile_);
// from main thread
void mainUpdateScreen(rfb::PixelBuffer *pb);
void mainUpdateBottleneckStats(const char userid[], const char stats[]);
void mainClearBottleneckStats(const char userid[]);
void mainUpdateServerFrameStats(uint8_t changedPerc, uint32_t all,
uint32_t jpeg, uint32_t webp, uint32_t analysis,
uint32_t jpegarea, uint32_t webparea,
uint16_t njpeg, uint16_t nwebp,
uint16_t enc, uint16_t scale, uint16_t shot,
uint16_t w, uint16_t h);
void mainUpdateClientFrameStats(const char userid[], uint32_t render, uint32_t all,
uint32_t ping);
void mainUpdateUserInfo(const uint8_t ownerConn, const uint8_t numUsers);
// from network threads
uint8_t *netGetScreenshot(uint16_t w, uint16_t h,
const uint8_t q, const bool dedup,
uint32_t &len, uint8_t *staging);
uint8_t netAddUser(const char name[], const char pw[],
const bool read, const bool write, const bool owner);
uint8_t netRemoveUser(const char name[]);
uint8_t netUpdateUser(const char name[], const uint64_t mask,
const char password[],
const bool read, const bool write, const bool owner);
uint8_t netAddOrUpdateUser(const struct kasmpasswd_entry_t *entry);
void netGetUsers(const char **ptr);
void netGetBottleneckStats(char *buf, uint32_t len);
void netGetFrameStats(char *buf, uint32_t len);
void netResetFrameStatsCall();
uint8_t netServerFrameStatsReady();
enum USER_ACTION {
NONE,
WANT_FRAME_STATS_SERVERONLY,
WANT_FRAME_STATS_ALL,
WANT_FRAME_STATS_OWNER,
WANT_FRAME_STATS_SPECIFIC,
};
uint8_t netRequestFrameStats(USER_ACTION what, const char *client);
uint8_t netOwnerConnected();
uint8_t netNumActiveUsers();
uint8_t netGetClientFrameStatsNum();
struct action_data {
enum USER_ACTION action;
kasmpasswd_entry_t data;
};
pthread_mutex_t userMutex;
std::vector<action_data> actionQueue;
private:
const char *passwdfile;
pthread_mutex_t screenMutex;
rfb::ManagedPixelBuffer screenPb;
uint16_t screenW, screenH;
uint64_t screenHash;
std::vector<uint8_t> cachedJpeg;
uint16_t cachedW, cachedH;
uint8_t cachedQ;
std::map<std::string, std::string> bottleneckStats;
pthread_mutex_t statMutex;
struct clientFrameStats_t {
uint32_t render;
uint32_t all;
uint32_t ping;
};
struct serverFrameStats_t {
uint32_t all;
uint32_t jpeg;
uint32_t webp;
uint32_t analysis;
uint32_t jpegarea;
uint32_t webparea;
uint16_t njpeg;
uint16_t nwebp;
uint16_t enc;
uint16_t scale;
uint16_t shot;
uint16_t w;
uint16_t h;
uint8_t changedPerc;
uint8_t inprogress;
};
std::map<std::string, clientFrameStats_t> clientFrameStats;
serverFrameStats_t serverFrameStats;
pthread_mutex_t frameStatMutex;
uint8_t ownerConnected;
uint8_t activeUsers;
pthread_mutex_t userInfoMutex;
};
}
#endif // __NETWORK_GET_API_H__

View File

@@ -0,0 +1,30 @@
/* Copyright (C) 2021 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef __NETWORK_GET_API_ENUMS_H__
#define __NETWORK_GET_API_ENUMS_H__
// Enums that need accessibility from both C and C++.
enum USER_UPDATE_MASK {
USER_UPDATE_WRITE_MASK = 1 << 0,
USER_UPDATE_OWNER_MASK = 1 << 1,
USER_UPDATE_PASSWORD_MASK = 1 << 2,
USER_UPDATE_READ_MASK = 1 << 3,
};
#endif

View File

@@ -0,0 +1,792 @@
/* Copyright (C) 2021 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <network/GetAPI.h>
#include <network/jsonescape.h>
#include <rfb/ConnParams.h>
#include <rfb/EncodeManager.h>
#include <rfb/LogWriter.h>
#include <rfb/JpegCompressor.h>
#include <rfb/xxhash.h>
#include <stdio.h>
#include <stdlib.h>
using namespace network;
using namespace rfb;
static LogWriter vlog("GetAPIMessager");
struct TightJPEGConfiguration {
int quality;
int subsampling;
};
static const struct TightJPEGConfiguration conf[10] = {
{ 15, subsample4X }, // 0
{ 29, subsample4X }, // 1
{ 41, subsample4X }, // 2
{ 42, subsample2X }, // 3
{ 62, subsample2X }, // 4
{ 77, subsample2X }, // 5
{ 79, subsampleNone }, // 6
{ 86, subsampleNone }, // 7
{ 92, subsampleNone }, // 8
{ 100, subsampleNone } // 9
};
GetAPIMessager::GetAPIMessager(const char *passwdfile_): passwdfile(passwdfile_),
screenW(0), screenH(0), screenHash(0),
cachedW(0), cachedH(0), cachedQ(0),
ownerConnected(0), activeUsers(0) {
pthread_mutex_init(&screenMutex, NULL);
pthread_mutex_init(&userMutex, NULL);
pthread_mutex_init(&statMutex, NULL);
pthread_mutex_init(&frameStatMutex, NULL);
pthread_mutex_init(&userInfoMutex, NULL);
serverFrameStats.inprogress = 0;
}
// from main thread
void GetAPIMessager::mainUpdateScreen(rfb::PixelBuffer *pb) {
if (pthread_mutex_trylock(&screenMutex))
return;
int stride;
const rdr::U8 * const buf = pb->getBuffer(pb->getRect(), &stride);
if (pb->width() != screenW || pb->height() != screenH) {
screenHash = 0;
screenW = pb->width();
screenH = pb->height();
screenPb.setPF(pb->getPF());
screenPb.setSize(screenW, screenH);
cachedW = cachedH = cachedQ = 0;
cachedJpeg.clear();
}
const uint64_t newHash = XXH64(buf, pb->area() * 4, 0);
if (newHash != screenHash) {
cachedW = cachedH = cachedQ = 0;
cachedJpeg.clear();
screenHash = newHash;
rdr::U8 *rw = screenPb.getBufferRW(screenPb.getRect(), &stride);
memcpy(rw, buf, screenW * screenH * 4);
screenPb.commitBufferRW(screenPb.getRect());
}
pthread_mutex_unlock(&screenMutex);
}
void GetAPIMessager::mainUpdateBottleneckStats(const char userid[], const char stats[]) {
if (pthread_mutex_trylock(&statMutex))
return;
bottleneckStats[userid] = stats;
pthread_mutex_unlock(&statMutex);
}
void GetAPIMessager::mainClearBottleneckStats(const char userid[]) {
if (pthread_mutex_lock(&statMutex))
return;
bottleneckStats.erase(userid);
pthread_mutex_unlock(&statMutex);
}
void GetAPIMessager::mainUpdateServerFrameStats(uint8_t changedPerc,
uint32_t all, uint32_t jpeg, uint32_t webp, uint32_t analysis,
uint32_t jpegarea, uint32_t webparea,
uint16_t njpeg, uint16_t nwebp,
uint16_t enc, uint16_t scale, uint16_t shot,
uint16_t w, uint16_t h) {
if (pthread_mutex_lock(&frameStatMutex))
return;
serverFrameStats.changedPerc = changedPerc;
serverFrameStats.all = all;
serverFrameStats.jpeg = jpeg;
serverFrameStats.webp = webp;
serverFrameStats.analysis = analysis;
serverFrameStats.jpegarea = jpegarea;
serverFrameStats.webparea = webparea;
serverFrameStats.njpeg = njpeg;
serverFrameStats.nwebp = nwebp;
serverFrameStats.enc = enc;
serverFrameStats.scale = scale;
serverFrameStats.shot = shot;
serverFrameStats.w = w;
serverFrameStats.h = h;
pthread_mutex_unlock(&frameStatMutex);
}
void GetAPIMessager::mainUpdateClientFrameStats(const char userid[], uint32_t render,
uint32_t all, uint32_t ping) {
if (pthread_mutex_lock(&frameStatMutex))
return;
clientFrameStats_t s;
s.render = render;
s.all = all;
s.ping = ping;
clientFrameStats[userid] = s;
pthread_mutex_unlock(&frameStatMutex);
}
void GetAPIMessager::mainUpdateUserInfo(const uint8_t ownerConn, const uint8_t numUsers) {
if (pthread_mutex_lock(&userInfoMutex))
return;
ownerConnected = ownerConn;
activeUsers = numUsers;
pthread_mutex_unlock(&userInfoMutex);
}
// from network threads
uint8_t *GetAPIMessager::netGetScreenshot(uint16_t w, uint16_t h,
const uint8_t q, const bool dedup,
uint32_t &len, uint8_t *staging) {
uint8_t *ret = NULL;
len = 0;
if (w > screenW)
w = screenW;
if (h > screenH)
h = screenH;
if (!screenW || !screenH)
vlog.error("Screenshot requested but no screenshot exists (screen hasn't been viewed)");
if (!w || !h || q > 9 || !staging)
return NULL;
if (pthread_mutex_lock(&screenMutex))
return NULL;
if (w == cachedW && h == cachedH && q == cachedQ) {
if (dedup) {
// Return the hash of the unchanged image
sprintf((char *) staging, "%" PRIx64, screenHash);
ret = staging;
len = 16;
} else {
// Return the cached image
len = cachedJpeg.size();
ret = staging;
memcpy(ret, &cachedJpeg[0], len);
vlog.info("Returning cached screenshot");
}
} else {
// Encode the new JPEG, cache it
JpegCompressor jc;
int quality, subsampling;
quality = conf[q].quality;
subsampling = conf[q].subsampling;
jc.clear();
int stride;
if (w != screenW || h != screenH) {
float xdiff = w / (float) screenW;
float ydiff = h / (float) screenH;
const float diff = xdiff < ydiff ? xdiff : ydiff;
const uint16_t neww = screenW * diff;
const uint16_t newh = screenH * diff;
const PixelBuffer *scaled = progressiveBilinearScale(&screenPb, neww, newh, diff);
const rdr::U8 * const buf = scaled->getBuffer(scaled->getRect(), &stride);
jc.compress(buf, stride, scaled->getRect(),
scaled->getPF(), quality, subsampling);
cachedJpeg.resize(jc.length());
memcpy(&cachedJpeg[0], jc.data(), jc.length());
delete scaled;
vlog.info("Returning scaled screenshot");
} else {
const rdr::U8 * const buf = screenPb.getBuffer(screenPb.getRect(), &stride);
jc.compress(buf, stride, screenPb.getRect(),
screenPb.getPF(), quality, subsampling);
cachedJpeg.resize(jc.length());
memcpy(&cachedJpeg[0], jc.data(), jc.length());
vlog.info("Returning normal screenshot");
}
cachedQ = q;
cachedW = w;
cachedH = h;
len = cachedJpeg.size();
ret = staging;
memcpy(ret, &cachedJpeg[0], len);
}
pthread_mutex_unlock(&screenMutex);
return ret;
}
uint8_t GetAPIMessager::netAddUser(const char name[], const char pw[],
const bool read, const bool write,
const bool owner) {
if (strlen(name) >= USERNAME_LEN) {
vlog.error("Username too long");
return 0;
}
if (strlen(pw) >= PASSWORD_LEN) {
vlog.error("Password too long");
return 0;
}
if (!passwdfile)
return 0;
uint8_t ret = 1;
action_data act;
memcpy(act.data.user, name, USERNAME_LEN);
act.data.user[USERNAME_LEN - 1] = '\0';
memcpy(act.data.password, pw, PASSWORD_LEN);
act.data.password[PASSWORD_LEN - 1] = '\0';
act.data.owner = owner;
act.data.write = write;
act.data.read = read;
if (pthread_mutex_lock(&userMutex))
return 0;
// This needs to be handled locally for proper interactivity
// (consider adding users when nobody is connected).
// The mutex and atomic rename keep things in sync.
struct kasmpasswd_t *set = readkasmpasswd(passwdfile);
unsigned s;
for (s = 0; s < set->num; s++) {
if (!strcmp(set->entries[s].user, name)) {
vlog.error("Can't create user %s, already exists", name);
ret = 0;
goto out;
}
}
s = set->num++;
set->entries = (struct kasmpasswd_entry_t *) realloc(set->entries,
set->num * sizeof(struct kasmpasswd_entry_t));
set->entries[s] = act.data;
writekasmpasswd(passwdfile, set);
vlog.info("User %s created", name);
out:
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return ret;
}
uint8_t GetAPIMessager::netRemoveUser(const char name[]) {
if (strlen(name) >= USERNAME_LEN) {
vlog.error("Username too long");
return 0;
}
if (pthread_mutex_lock(&userMutex))
return 0;
struct kasmpasswd_t *set = readkasmpasswd(passwdfile);
bool found = false;
unsigned s;
for (s = 0; s < set->num; s++) {
if (!strcmp(set->entries[s].user, name)) {
set->entries[s].user[0] = '\0';
found = true;
break;
}
}
if (found) {
writekasmpasswd(passwdfile, set);
vlog.info("User %s removed", name);
} else {
vlog.error("Tried to remove nonexistent user %s", name);
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return 0;
}
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return 1;
}
uint8_t GetAPIMessager::netUpdateUser(const char name[], const uint64_t mask,
const char password[],
const bool read, const bool write, const bool owner) {
if (strlen(name) >= USERNAME_LEN) {
vlog.error("Username too long");
return 0;
}
if (strlen(password) >= PASSWORD_LEN) {
vlog.error("Password too long");
return 0;
}
if (!mask) {
vlog.error("Update_user without any updates?");
return 0;
}
if (pthread_mutex_lock(&userMutex))
return 0;
struct kasmpasswd_t *set = readkasmpasswd(passwdfile);
bool found = false;
unsigned s;
for (s = 0; s < set->num; s++) {
if (!strcmp(set->entries[s].user, name)) {
if (mask & USER_UPDATE_READ_MASK)
set->entries[s].read = read;
if (mask & USER_UPDATE_WRITE_MASK)
set->entries[s].write = write;
if (mask & USER_UPDATE_OWNER_MASK)
set->entries[s].owner = owner;
if (mask & USER_UPDATE_PASSWORD_MASK)
strcpy(set->entries[s].password, password);
found = true;
break;
}
}
if (found) {
writekasmpasswd(passwdfile, set);
vlog.info("User %s permissions updated", name);
} else {
vlog.error("Tried to update nonexistent user %s", name);
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return 0;
}
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return 1;
}
uint8_t GetAPIMessager::netAddOrUpdateUser(const struct kasmpasswd_entry_t *entry) {
if (pthread_mutex_lock(&userMutex))
return 0;
struct kasmpasswd_t *set = readkasmpasswd(passwdfile);
unsigned s;
bool updated = false;
for (s = 0; s < set->num; s++) {
if (!strcmp(set->entries[s].user, entry->user)) {
set->entries[s] = *entry;
updated = true;
vlog.info("User %s updated", entry->user);
break;
}
}
if (!updated) {
s = set->num++;
set->entries = (struct kasmpasswd_entry_t *) realloc(set->entries,
set->num * sizeof(struct kasmpasswd_entry_t));
set->entries[s] = *entry;
vlog.info("User %s created", entry->user);
}
writekasmpasswd(passwdfile, set);
pthread_mutex_unlock(&userMutex);
free(set->entries);
free(set);
return 1;
}
void GetAPIMessager::netGetUsers(const char **outptr) {
/*
[
{ "user": "username", "write": true, "owner": true },
{ "user": "username", "write": true, "owner": true }
]
*/
char *buf;
char escapeduser[USERNAME_LEN * 2];
if (pthread_mutex_lock(&userMutex)) {
*outptr = (char *) calloc(1, 1);
return;
}
struct kasmpasswd_t *set = readkasmpasswd(passwdfile);
buf = (char *) calloc(set->num, 80);
FILE *f = fmemopen(buf, set->num * 80, "w");
fprintf(f, "[\n");
unsigned s;
for (s = 0; s < set->num; s++) {
JSON_escape(set->entries[s].user, escapeduser);
fprintf(f, " { \"user\": \"%s\", \"read\": %s, \"write\": %s, \"owner\": %s }",
escapeduser,
set->entries[s].read ? "true" : "false",
set->entries[s].write ? "true" : "false",
set->entries[s].owner ? "true" : "false");
if (s == set->num - 1)
fprintf(f, "\n");
else
fprintf(f, ",\n");
}
free(set->entries);
free(set);
fprintf(f, "]\n");
fclose(f);
pthread_mutex_unlock(&userMutex);
*outptr = buf;
}
void GetAPIMessager::netGetBottleneckStats(char *buf, uint32_t len) {
/*
{
"username.1": {
"192.168.100.2:14908": [ 100, 100, 100, 100 ],
"192.168.100.3:14918": [ 100, 100, 100, 100 ]
},
"username.2": {
"192.168.100.5:14904": [ 100, 100, 100, 100 ]
}
}
*/
std::map<std::string, std::string>::const_iterator it;
const char *prev = NULL;
FILE *f;
if (pthread_mutex_lock(&statMutex)) {
buf[0] = 0;
return;
}
// Conservative estimate
if (len < bottleneckStats.size() * 60) {
buf[0] = 0;
goto out;
}
f = fmemopen(buf, len, "w");
fprintf(f, "{\n");
for (it = bottleneckStats.begin(); it != bottleneckStats.end(); it++) {
// user@127.0.0.1_1627311208.791752::websocket
const char *id = it->first.c_str();
const char *data = it->second.c_str();
const char *at = strchr(id, '@');
if (!at)
continue;
const unsigned userlen = at - id;
if (prev && !strncmp(prev, id, userlen)) {
// Same user
fprintf(f, ",\n\t\t\"%s\": %s", at + 1, data);
} else {
// New one
if (prev) {
fprintf(f, "\n\t},\n");
}
fprintf(f, "\t\"%.*s\": {\n", userlen, id);
fprintf(f, "\t\t\"%s\": %s", at + 1, data);
}
prev = id;
}
if (!bottleneckStats.size())
fprintf(f, "}\n");
else
fprintf(f, "\n\t}\n}\n");
fclose(f);
out:
pthread_mutex_unlock(&statMutex);
}
void GetAPIMessager::netGetFrameStats(char *buf, uint32_t len) {
/*
{
"frame" : {
"resx": 1024,
"resy": 1280,
"changed": 75,
"server_time": 23
},
"server_side" : [
{ "process_name": "Analysis", "time": 20 },
{ "process_name": "TightWEBPEncoder", "time": 20, "count": 64, "area": 12 },
{ "process_name": "TightJPEGEncoder", "time": 20, "count": 64, "area": 12 }
],
"client_side" : [
{
"client": "123.1.2.1:1211",
"client_time": 20,
"ping": 20,
"processes" : [
{ "process_name": "scanRenderQ", "time": 20 }
]
}
}
}
*/
std::map<std::string, clientFrameStats_t>::const_iterator it;
unsigned i = 0;
FILE *f;
if (pthread_mutex_lock(&frameStatMutex)) {
buf[0] = 0;
return;
}
const unsigned num = clientFrameStats.size();
// Conservative estimate
if (len < 1024) {
buf[0] = 0;
goto out;
}
f = fmemopen(buf, len, "w");
fprintf(f, "{\n");
fprintf(f, "\t\"frame\" : {\n"
"\t\t\"resx\": %u,\n"
"\t\t\"resy\": %u,\n"
"\t\t\"changed\": %u,\n"
"\t\t\"server_time\": %u\n"
"\t},\n",
serverFrameStats.w,
serverFrameStats.h,
serverFrameStats.changedPerc,
serverFrameStats.all);
fprintf(f, "\t\"server_side\" : [\n"
"\t\t{ \"process_name\": \"Analysis\", \"time\": %u },\n"
"\t\t{ \"process_name\": \"Screenshot\", \"time\": %u },\n"
"\t\t{ \"process_name\": \"Encoding_total\", \"time\": %u, \"videoscaling\": %u },\n"
"\t\t{ \"process_name\": \"TightJPEGEncoder\", \"time\": %u, \"count\": %u, \"area\": %u },\n"
"\t\t{ \"process_name\": \"TightWEBPEncoder\", \"time\": %u, \"count\": %u, \"area\": %u }\n"
"\t],\n",
serverFrameStats.analysis,
serverFrameStats.shot,
serverFrameStats.enc,
serverFrameStats.scale,
serverFrameStats.jpeg,
serverFrameStats.njpeg,
serverFrameStats.jpegarea,
serverFrameStats.webp,
serverFrameStats.nwebp,
serverFrameStats.webparea);
fprintf(f, "\t\"client_side\" : [\n");
for (it = clientFrameStats.begin(); it != clientFrameStats.end(); it++, i++) {
const char *id = it->first.c_str();
const clientFrameStats_t &s = it->second;
fprintf(f, "\t\t\{\n"
"\t\t\t\"client\": \"%s\",\n"
"\t\t\t\"client_time\": %u,\n"
"\t\t\t\"ping\": %u,\n"
"\t\t\t\"processes\" : [\n"
"\t\t\t\t{ \"process_name\": \"scanRenderQ\", \"time\": %u }\n"
"\t\t\t]\n"
"\t\t}",
id,
s.all,
s.ping,
s.render);
if (i == num - 1)
fprintf(f, "\n");
else
fprintf(f, ",\n");
}
fprintf(f, "\t]\n}\n");
fclose(f);
serverFrameStats.inprogress = 0;
out:
pthread_mutex_unlock(&frameStatMutex);
}
void GetAPIMessager::netResetFrameStatsCall() {
if (pthread_mutex_lock(&frameStatMutex))
return;
serverFrameStats.inprogress = 0;
pthread_mutex_unlock(&frameStatMutex);
}
uint8_t GetAPIMessager::netRequestFrameStats(USER_ACTION what, const char *client) {
// Return 1 for success
action_data act;
act.action = what;
if (client) {
strncpy(act.data.password, client, PASSWORD_LEN);
act.data.password[PASSWORD_LEN - 1] = '\0';
}
// In progress already?
bool fail = false;
if (pthread_mutex_lock(&frameStatMutex))
return 0;
if (serverFrameStats.inprogress) {
fail = true;
vlog.error("Frame stats request already in progress, refusing another");
} else {
clientFrameStats.clear();
memset(&serverFrameStats, 0, sizeof(serverFrameStats_t));
serverFrameStats.inprogress = 1;
}
pthread_mutex_unlock(&frameStatMutex);
if (fail)
return 0;
// Send it in
if (pthread_mutex_lock(&userMutex))
return 0;
actionQueue.push_back(act);
pthread_mutex_unlock(&userMutex);
return 1;
}
uint8_t GetAPIMessager::netOwnerConnected() {
uint8_t ret;
if (pthread_mutex_lock(&userInfoMutex))
return 0;
ret = ownerConnected;
pthread_mutex_unlock(&userInfoMutex);
return ret;
}
uint8_t GetAPIMessager::netNumActiveUsers() {
uint8_t ret;
if (pthread_mutex_lock(&userInfoMutex))
return 0;
ret = activeUsers;
pthread_mutex_unlock(&userInfoMutex);
return ret;
}
uint8_t GetAPIMessager::netGetClientFrameStatsNum() {
uint8_t ret;
if (pthread_mutex_lock(&frameStatMutex))
return 0;
ret = clientFrameStats.size();
pthread_mutex_unlock(&frameStatMutex);
return ret;
}
uint8_t GetAPIMessager::netServerFrameStatsReady() {
uint8_t ret;
if (pthread_mutex_lock(&frameStatMutex))
return 0;
ret = serverFrameStats.w != 0;
pthread_mutex_unlock(&frameStatMutex);
return ret;
}

View File

@@ -25,6 +25,9 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#define errorNumber WSAGetLastError()
#define SHUT_RD SD_RECEIVE
#define SHUT_WR SD_SEND
#define SHUT_RDWR SD_BOTH
#else
#define errorNumber errno
#define closesocket close
@@ -94,7 +97,7 @@ Socket::~Socket()
void Socket::shutdown()
{
isShutdown_ = true;
::shutdown(getFd(), 2);
::shutdown(getFd(), SHUT_RDWR);
}
bool Socket::isShutdown() const
@@ -149,7 +152,7 @@ void SocketListener::shutdown()
closesocket(fd);
fd = -1;
#else
::shutdown(fd, 2);
::shutdown(fd, SHUT_RDWR);
#endif
}

View File

@@ -74,6 +74,8 @@ namespace network {
virtual ~ConnectionFilter() {}
};
class GetAPIMessager;
class SocketListener {
public:
SocketListener(int fd);
@@ -93,6 +95,8 @@ namespace network {
void setFilter(ConnectionFilter* f) {filter = f;}
int getFd() {return fd;}
virtual GetAPIMessager *getMessager() { return NULL; }
protected:
SocketListener();

View File

@@ -1,15 +1,15 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
*
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
@@ -38,11 +38,17 @@
#include <sys/un.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <wordexp.h>
#include <sys/types.h>
#include <unistd.h>
#include "websocket.h"
#include <network/GetAPI.h>
#include <network/TcpSocket.h>
#include <rfb/LogWriter.h>
#include <rfb/Configuration.h>
#include <rfb/ServerCore.h>
#ifdef WIN32
#include <os/winerrno.h>
@@ -121,11 +127,20 @@ WebSocket::WebSocket(int sock) : Socket(sock)
}
char* WebSocket::getPeerAddress() {
return rfb::strDup("websocket");
struct sockaddr_un addr;
socklen_t len = sizeof(struct sockaddr_un);
if (getpeername(getFd(), (struct sockaddr *) &addr, &len) != 0) {
vlog.error("unable to get peer name for socket");
return rfb::strDup("websocket");
}
return rfb::strDup(addr.sun_path + 1);
}
char* WebSocket::getPeerEndpoint() {
return rfb::strDup("websocket");
char buf[1024];
sprintf(buf, "%s::websocket", getPeerAddress());
return rfb::strDup(buf);
}
// -=- TcpSocket
@@ -151,8 +166,7 @@ TcpSocket::TcpSocket(const char *host, int port)
hints.ai_next = NULL;
if ((result = getaddrinfo(host, NULL, &hints, &ai)) != 0) {
throw Exception("unable to resolve host by name: %s",
gai_strerror(result));
throw GAIException("unable to resolve host by name", result);
}
sock = -1;
@@ -220,7 +234,7 @@ TcpSocket::TcpSocket(const char *host, int port)
if (err == 0)
throw Exception("No useful address for host");
else
throw SocketException("unable connect to socket", err);
throw SocketException("unable to connect to socket", err);
}
// Take proper ownership of the socket
@@ -420,10 +434,118 @@ int TcpListener::getMyPort() {
extern settings_t settings;
static uint8_t *screenshotCb(void *messager, uint16_t w, uint16_t h, const uint8_t q,
const uint8_t dedup,
uint32_t *len, uint8_t *staging)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netGetScreenshot(w, h, q, dedup, *len, staging);
}
static uint8_t adduserCb(void *messager, const char name[], const char pw[],
const uint8_t read, const uint8_t write, const uint8_t owner)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netAddUser(name, pw, read, write, owner);
}
static uint8_t removeCb(void *messager, const char name[])
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRemoveUser(name);
}
static uint8_t updateUserCb(void *messager, const char name[], const uint64_t mask,
const char password[],
const uint8_t read, const uint8_t write, const uint8_t owner)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netUpdateUser(name, mask, password, read, write, owner);
}
static uint8_t addOrUpdateUserCb(void *messager, const struct kasmpasswd_entry_t *entry)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netAddOrUpdateUser(entry);
}
static void getUsersCb(void *messager, const char **ptr)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
msgr->netGetUsers(ptr);
}
static void bottleneckStatsCb(void *messager, char *buf, uint32_t len)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
msgr->netGetBottleneckStats(buf, len);
}
static void frameStatsCb(void *messager, char *buf, uint32_t len)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
msgr->netGetFrameStats(buf, len);
}
static void resetFrameStatsCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
msgr->netResetFrameStatsCall();
}
static uint8_t requestFrameStatsNoneCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRequestFrameStats(GetAPIMessager::WANT_FRAME_STATS_SERVERONLY, NULL);
}
static uint8_t requestFrameStatsOwnerCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRequestFrameStats(GetAPIMessager::WANT_FRAME_STATS_OWNER, NULL);
}
static uint8_t requestFrameStatsAllCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRequestFrameStats(GetAPIMessager::WANT_FRAME_STATS_ALL, NULL);
}
static uint8_t requestFrameStatsOneCb(void *messager, const char *client)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRequestFrameStats(GetAPIMessager::WANT_FRAME_STATS_SPECIFIC, client);
}
static uint8_t ownerConnectedCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netOwnerConnected();
}
static uint8_t numActiveUsersCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netNumActiveUsers();
}
static uint8_t getClientFrameStatsNumCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netGetClientFrameStatsNum();
}
static uint8_t serverFrameStatsReadyCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netServerFrameStatsReady();
}
WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
socklen_t listenaddrlen,
bool sslonly, const char *cert,
const char *basicauth,
bool sslonly, const char *cert, const char *certkey,
bool disablebasicauth,
const char *httpdir)
{
int one = 1;
@@ -464,7 +586,7 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
if (bind(sock, &sa.u.sa, listenaddrlen) == -1) {
int e = errorNumber;
closesocket(sock);
throw SocketException("failed to bind socket", e);
throw SocketException("failed to bind socket, is someone else on our -websocketPort?", e);
}
listen(sock); // sets the internal fd
@@ -474,21 +596,31 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
//
internalSocket = socket(AF_UNIX, SOCK_STREAM, 0);
char sockname[32];
sprintf(sockname, ".KasmVNCSock%u", getpid());
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, ".KasmVNCSock");
strcpy(addr.sun_path, sockname);
addr.sun_path[0] = '\0';
if (bind(internalSocket, (struct sockaddr *) &addr,
sizeof(sa_family_t) + sizeof(".KasmVNCSock"))) {
sizeof(sa_family_t) + strlen(sockname))) {
throw SocketException("failed to bind socket", errorNumber);
}
listen(internalSocket);
settings.basicauth = basicauth;
settings.passwdfile = NULL;
wordexp_t wexp;
if (!wordexp(rfb::Server::kasmPasswordFile, &wexp, WRDE_NOCMD))
settings.passwdfile = strdup(wexp.we_wordv[0]);
wordfree(&wexp);
settings.disablebasicauth = disablebasicauth;
settings.cert = cert;
settings.key = "";
settings.key = certkey;
settings.ssl_only = sslonly;
settings.verbose = vlog.getLevel() >= vlog.LEVEL_DEBUG;
settings.httpdir = NULL;
@@ -497,6 +629,27 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
settings.listen_sock = sock;
settings.messager = messager = new GetAPIMessager(settings.passwdfile);
settings.screenshotCb = screenshotCb;
settings.adduserCb = adduserCb;
settings.removeCb = removeCb;
settings.updateUserCb = updateUserCb;
settings.addOrUpdateUserCb = addOrUpdateUserCb;
settings.getUsersCb = getUsersCb;
settings.bottleneckStatsCb = bottleneckStatsCb;
settings.frameStatsCb = frameStatsCb;
settings.resetFrameStatsCb = resetFrameStatsCb;
settings.requestFrameStatsNoneCb = requestFrameStatsNoneCb;
settings.requestFrameStatsOwnerCb = requestFrameStatsOwnerCb;
settings.requestFrameStatsAllCb = requestFrameStatsAllCb;
settings.requestFrameStatsOneCb = requestFrameStatsOneCb;
settings.ownerConnectedCb = ownerConnectedCb;
settings.numActiveUsersCb = numActiveUsersCb;
settings.getClientFrameStatsNumCb = getClientFrameStatsNumCb;
settings.serverFrameStatsReadyCb = serverFrameStatsReadyCb;
pthread_t tid;
pthread_create(&tid, NULL, start_server, NULL);
}
@@ -603,8 +756,7 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
snprintf (service, sizeof (service) - 1, "%d", port);
service[sizeof (service) - 1] = '\0';
if ((result = getaddrinfo(addr, service, &hints, &ai)) != 0)
throw rdr::Exception("unable to resolve listening address: %s",
gai_strerror(result));
throw GAIException("unable to resolve listening address", result);
try {
createTcpListeners(listeners, ai);
@@ -612,6 +764,8 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
freeaddrinfo(ai);
throw;
}
freeaddrinfo(ai);
}
void network::createTcpListeners(std::list<SocketListener*> *listeners,
@@ -664,8 +818,8 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
const struct addrinfo *ai,
bool sslonly, const char *cert,
const char *basicauth,
bool sslonly, const char *cert, const char *certkey,
bool disablebasicauth,
const char *httpdir)
{
const struct addrinfo *current;
@@ -692,7 +846,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
try {
new_listeners.push_back(new WebsocketListener(current->ai_addr,
current->ai_addrlen,
sslonly, cert, basicauth,
sslonly, cert, certkey, disablebasicauth,
httpdir));
} catch (SocketException& e) {
// Ignore this if it is due to lack of address family support on
@@ -720,7 +874,8 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
const char *addr,
bool sslonly,
const char *cert,
const char *basicauth,
const char *certkey,
bool disablebasicauth,
const char *httpdir)
{
if (addr && !strcmp(addr, "local")) {
@@ -748,7 +903,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
ai[1].ai_addrlen = sizeof(sa[1].u.sin6);
ai[1].ai_next = NULL;
createWebsocketListeners(listeners, ai, sslonly, cert, basicauth, httpdir);
createWebsocketListeners(listeners, ai, sslonly, cert, certkey, disablebasicauth, httpdir);
} else {
struct addrinfo *ai, hints;
char service[16];
@@ -771,11 +926,13 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
gai_strerror(result));
try {
createWebsocketListeners(listeners, ai, sslonly, cert, basicauth, httpdir);
createWebsocketListeners(listeners, ai, sslonly, cert, certkey, disablebasicauth, httpdir);
} catch(...) {
freeaddrinfo(ai);
throw;
}
freeaddrinfo(ai);
}
}
@@ -913,8 +1070,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
}
if ((result = getaddrinfo (p, NULL, &hints, &ai)) != 0) {
throw Exception("unable to resolve host by name: %s",
gai_strerror(result));
throw GAIException("unable to resolve host by name", result);
}
memcpy (&pattern.address.u.sa, ai->ai_addr, ai->ai_addrlen);

View File

@@ -90,7 +90,8 @@ namespace network {
class WebsocketListener : public SocketListener {
public:
WebsocketListener(const struct sockaddr *listenaddr, socklen_t listenaddrlen,
bool sslonly, const char *cert, const char *basicauth,
bool sslonly, const char *cert, const char *certkey,
bool disablebasicauth,
const char *httpdir);
virtual int getMyPort();
@@ -99,8 +100,12 @@ namespace network {
int internalSocket;
virtual GetAPIMessager *getMessager() { return messager; }
protected:
virtual Socket* createSocket(int fd);
private:
GetAPIMessager *messager;
};
void createLocalTcpListeners(std::list<SocketListener*> *listeners,
@@ -110,7 +115,8 @@ namespace network {
const char *addr,
bool sslonly,
const char *cert,
const char *basicauth,
const char *certkey,
bool disablebasicauth,
const char *httpdir);
void createTcpListeners(std::list<SocketListener*> *listeners,
const char *addr,
@@ -121,7 +127,8 @@ namespace network {
const struct addrinfo *ai,
bool sslonly,
const char *cert,
const char *basicauth,
const char *certkey,
bool disablebasicauth,
const char *httpdir);
typedef struct vnc_sockaddr {

View File

@@ -69,7 +69,7 @@ UnixSocket::UnixSocket(const char *path)
}
if (result == -1)
throw SocketException("unable connect to socket", err);
throw SocketException("unable to connect to socket", err);
setFd(sock);
}

3114
common/network/cJSON.c Normal file

File diff suppressed because it is too large Load Diff

295
common/network/cJSON.h Normal file
View File

@@ -0,0 +1,295 @@
/*
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// 2fc55f6 from Jan 20, 2022
#ifndef cJSON__h
#define cJSON__h
#ifdef __cplusplus
extern "C"
{
#endif
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
#define __WINDOWS__
#endif
#ifdef __WINDOWS__
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
For *nix builds that support visibility attribute, you can define similar behavior by
setting default visibility to hidden by adding
-fvisibility=hidden (for gcc)
or
-xldscope=hidden (for sun cc)
to CFLAGS
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
*/
#define CJSON_CDECL __cdecl
#define CJSON_STDCALL __stdcall
/* export symbols by default, this is necessary for copy pasting the C and header file */
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
#define CJSON_EXPORT_SYMBOLS
#endif
#if defined(CJSON_HIDE_SYMBOLS)
#define CJSON_PUBLIC(type) type CJSON_STDCALL
#elif defined(CJSON_EXPORT_SYMBOLS)
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
#elif defined(CJSON_IMPORT_SYMBOLS)
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
#endif
#else /* !__WINDOWS__ */
#define CJSON_CDECL
#define CJSON_STDCALL
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
#else
#define CJSON_PUBLIC(type) type
#endif
#endif
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 7
#define CJSON_VERSION_PATCH 15
#include <stddef.h>
/* cJSON Types: */
#define cJSON_Invalid (0)
#define cJSON_False (1 << 0)
#define cJSON_True (1 << 1)
#define cJSON_NULL (1 << 2)
#define cJSON_Number (1 << 3)
#define cJSON_String (1 << 4)
#define cJSON_Array (1 << 5)
#define cJSON_Object (1 << 6)
#define cJSON_Raw (1 << 7) /* raw json */
#define cJSON_IsReference 256
#define cJSON_StringIsConst 512
/* The cJSON structure: */
typedef struct cJSON
{
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
struct cJSON *next;
struct cJSON *prev;
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
struct cJSON *child;
/* The type of the item, as above. */
int type;
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
char *valuestring;
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
int valueint;
/* The item's number, if type==cJSON_Number */
double valuedouble;
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
char *string;
} cJSON;
typedef struct cJSON_Hooks
{
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
void *(CJSON_CDECL *malloc_fn)(size_t sz);
void (CJSON_CDECL *free_fn)(void *ptr);
} cJSON_Hooks;
typedef int cJSON_bool;
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
* This is to prevent stack overflows. */
#ifndef CJSON_NESTING_LIMIT
#define CJSON_NESTING_LIMIT 1000
#endif
/* returns the version of cJSON as a string */
CJSON_PUBLIC(const char*) cJSON_Version(void);
/* Supply malloc, realloc and free functions to cJSON */
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
/* Render a cJSON entity to text for transfer/storage. */
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
/* Render a cJSON entity to text for transfer/storage without any formatting. */
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
/* Delete a cJSON entity and all subentities. */
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
/* Returns the number of items in an array (or object). */
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
/* Get item "string" from object. Case insensitive. */
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
/* Check item type and return its value */
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
/* These functions check the type of an item */
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
/* These calls create a cJSON item of the appropriate type. */
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
/* raw json */
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
/* Create a string where valuestring references a string so
* it will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
/* Create an object/array that only references it's elements so
* they will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
/* These utilities create an Array of count items.
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
/* Append item to the specified array/object. */
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
* writing to `item->string` */
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
/* Remove/Detach items from Arrays/Objects. */
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
/* Update array items. */
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
/* Duplicate a cJSON item */
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
* The item->next and ->prev pointers are always zero on return from Duplicate. */
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
* The input pointer json cannot point to a read-only address area, such as a string constant,
* but should point to a readable and writable address area. */
CJSON_PUBLIC(void) cJSON_Minify(char *json);
/* Helper functions for creating and adding items to an object at the same time.
* They return the added item or NULL on failure. */
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
/* helper for the cJSON_SetNumberValue macro */
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
/* Macro for iterating over an array or object */
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
CJSON_PUBLIC(void) cJSON_free(void *object);
#ifdef __cplusplus
}
#endif
#endif

25
common/network/datelog.h Normal file
View File

@@ -0,0 +1,25 @@
/* Copyright (C) 2022 Kasm
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef NETWORK_DATELOG_H
#define NETWORK_DATELOG_H
// 2022-05-18 19:51:26
#define DATELOGFMT "%Y-%m-%d %H:%M:%S"
#endif

Some files were not shown because too many files have changed in this diff Show More