Compare commits

...

696 Commits

Author SHA1 Message Date
Dmitry Maksyoma
d94b30c2fa Specs: improve spec runner 2021-12-07 20:57:34 +13:00
Dmitry Maksyoma
8e040e58a1 Specs: extract spec_helper.py 2021-12-07 20:40:12 +13:00
Dmitry Maksyoma
c0229f8470 Specs: improve run-specs(1) 2021-12-07 20:38:40 +13:00
Dmitry Maksyoma
dcccd1d1f2 YAML config improvements 2021-12-07 19:27:22 +13:00
Dmitry Maksyoma
c2f302cdc6 YAML config: add websocket_port 2021-12-05 23:06:10 +13:00
Dmitry Maksyoma
becfa90a2c vncserver: update /etc YAML config 2021-12-05 22:50:24 +13:00
Dmitry Maksyoma
e5233f27bd YAML config: improve config structure and keys 2021-12-04 21:18:43 +13:00
Dmitry Maksyoma
377269129c vncserver: YAML config draft 2021-12-02 20:35:04 +13:00
Dmitry Maksyoma
8ea6704fcd vncserver: add -dry-run option 2021-11-30 00:36:33 +13:00
Dmitry Maksyoma
a9888b9ca7 Flesh out YAML config spike 2021-11-30 00:18:32 +13:00
Dmitry Maksyoma
71b3515d6c vncserver test env: fix r alias 2021-11-30 00:15:22 +13:00
Dmitry Maksyoma
b1ee23dc62 Update kasmweb to be the same as master 2021-11-21 21:15:20 +13:00
Dmitry Maksyoma
a675f411cc vncserver test env: kill leftover processes on "k" command 2021-11-21 20:43:40 +13:00
Dmitry Maksyoma
35e0157431 vncserver test env: remove unnecessary packages 2021-11-21 20:40:18 +13:00
Dmitry Maksyoma
6fa5b9271f Merge branch 'master' into KASM-1810_yaml_config 2021-11-21 20:35:54 +13: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
Dmitry Maksyoma
e4ad356c7d vncserver dev env: no screensaver 2021-11-12 20:53:07 +13: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
Dmitry Maksyoma
f79c3b3b11 YAML config WIP 2021-11-05 22:43:32 +13:00
Dmitry Maksyoma
8e96d4cac5 vncserver dev env: add aliases to start/kill/restart Xvnc 2021-11-05 22:42:10 +13:00
Dmitry Maksyoma
ab4642aa87 vncserver: fix default config 2021-11-02 20:21:56 +13:00
Dmitry Maksyoma
7ad6810d7f vncserver YAML config: support true and false values 2021-11-02 20:09:27 +13:00
Dmitry Maksyoma
42021dd29a vncserver: YAML config spike 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
11d3958702 Deb/Rpm: add List::Util dependency 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
27f0ed29ca vncserver: fix case of -websocketPort not specified 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
628033af45 Deb/Rpm: set package versions to 0.9.3~beta 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
3fac7c4947 Refactor vnc_startup.sh 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
2ecf9a25ed vnc_startup.sh: select XFCE by default 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
a4a8d3aad5 vnc_startup.sh: remove temporary hack 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
d6132154fb vncserver test image: Python specs require a newer Python
Newer Python is available in Ubuntu Focal.
2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
219e2c5cb1 Don't check www.x.org certificate for now (wget) 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
7cced9dd05 vncserver: fix -websocketPort being ignored 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
f3681c87f9 vncserver: fix -debug 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
303fde284e vncserver: fix display :0 being ignored on CLI 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
8cd49ebbf8 vncserver: fix heredoc to work on CentOS 2021-11-02 19:51:43 +13:00
Dmitry Maksyoma
bc2e2512e3 vncserver: YAML config spike 2021-10-28 22:05:26 +13: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
Dmitry Maksyoma
aefbb4d143 vncserver: update comment 2021-10-14 22:04:28 +13:00
Dmitry Maksyoma
b34fe08786 vncserver refactor: use standard way of calling functions
For somebody coming from Python/Ruby/JavaScript, foo() is easier to
understand than &foo. Also, less noise.
2021-10-14 21:47:26 +13:00
Dmitry Maksyoma
ee3b7f9aa5 vncserver: add easy -debug option to pass -log to Xvnc 2021-10-13 22:45:47 +13:00
Dmitry Maksyoma
f7254e9708 vncserver: fix -select-de 2021-10-13 22:38:40 +13: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
Dmitry Maksyoma
e3a41bc055 vncserver: use IP when printing browser url 2021-10-09 18:59:53 +13: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
Dmitry Maksyoma
1bda8ab452 Specs: add comments 2021-10-06 23:56:34 +13:00
Dmitry Maksyoma
02ef620f67 vncserver: print browser url to connect to
Add 0.0.0.0 as default interface. Xvnc fails if -interface isn't passed.
2021-10-06 23:44:35 +13:00
mmcclaskey
3f3d31312c Update README 2021-10-04 10:48:14 -04:00
Dmitry Maksyoma
e453c7d73b vncserver: swallow -interface and pass through to Xvnc 2021-10-04 22:52:59 +13: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
Dmitry Maksyoma
ca42870585 Specs: refactor 2021-09-21 22:27:15 +12:00
Dmitry Maksyoma
0b53e9f0a6 Specs: extract start_xvnc_pexpect() 2021-09-21 22:15:00 +12:00
Dmitry Maksyoma
3f69b7bd33 Specs: extract clean_kasm_users() 2021-09-21 22:13:34 +12:00
Dmitry Maksyoma
4cb75459ed Specs: run vncserver with debug on 2021-09-21 21:45:28 +12:00
Dmitry Maksyoma
8a424a0463 Update README 2021-09-19 00:32:22 +12:00
Dmitry Maksyoma
a9d85aa99b Update README 2021-09-19 00:29:15 +12:00
Dmitry Maksyoma
cca1dabb71 Update README 2021-09-19 00:25:28 +12:00
Dmitry Maksyoma
183917d046 Update README 2021-09-19 00:14:30 +12:00
Dmitry Maksyoma
a31601de9a Update README 2021-09-18 23:24:29 +12:00
Dmitry Maksyoma
e21366cc7b Update README 2021-09-18 23:02:37 +12:00
Dmitry Maksyoma
76a5b18748 vncserver: remove obsolete code 2021-09-18 22:56:19 +12:00
Dmitry Maksyoma
04379056af vncserver: refactor 2021-09-18 22:50:49 +12:00
Dmitry Maksyoma
49908e1867 vncserver: detect select-de.sh location 2021-09-18 22:46:01 +12:00
Dmitry Maksyoma
df4a5ac910 Put select-de.sh in /usr/lib 2021-09-18 22:45:23 +12:00
Dmitry Maksyoma
606075ddc0 vncserver: refactor 2021-09-18 22:31:32 +12:00
Dmitry Maksyoma
17fa6911c1 vncserver: extract IsDebian() 2021-09-18 22:30:34 +12:00
Dmitry Maksyoma
5f7d3ad43a Specs: pexpect starts Xvnc now 2021-09-18 22:09:50 +12:00
Dmitry Maksyoma
f857d47ccf vncserver: fix generated xstartup indentation 2021-09-17 06:09:33 +12:00
Dmitry Maksyoma
3b3c8d0881 vncserver: refactor 2021-09-17 03:39:40 +12:00
Dmitry Maksyoma
fe3569c6e8 vncserver: check user is in ssl-cert group on Debian-based distros 2021-09-16 22:57:35 +12:00
Dmitry Maksyoma
90d9cbe65b Specs: WIP 2021-09-16 22:25:11 +12:00
Dmitry Maksyoma
f0e63b2e3d Specs: require Python 3.8 2021-09-16 22:23:55 +12:00
Dmitry Maksyoma
b5eaf71248 Specs: unfocus tests 2021-09-16 19:23:17 +12:00
Dmitry Maksyoma
e643cf4115 Specs: improve test 2021-09-16 18:38:09 +12:00
Dmitry Maksyoma
df35fadc9b Specs: test specifying custom user name for guided user creation 2021-09-16 18:37:08 +12:00
Dmitry Maksyoma
a27ad89677 Spec: add user creation test 2021-09-16 18:33:17 +12:00
Dmitry Maksyoma
04e93956b5 vncserver test image: add strace 2021-09-16 18:32:32 +12:00
Dmitry Maksyoma
5de1b80ca7 Spec refactoring 2021-09-16 17:16:55 +12:00
Dmitry Maksyoma
d3e209c9ba vncserver test image based on Ubuntu Focal 2021-09-16 17:13:54 +12:00
Dmitry Maksyoma
ff8ab63aab Spec: extract start_xvnc(), kill only if running 2021-09-15 19:20:05 +12:00
Dmitry Maksyoma
a51444257a Spec: no overwrite is possible on the first run 2021-09-15 18:51:07 +12:00
Dmitry Maksyoma
e23e5cc63b Spec refactoring 2021-09-15 18:48:22 +12:00
Dmitry Maksyoma
043438e2e0 Spec: vncserver 2nd run tests 2021-09-15 18:47:08 +12:00
Dmitry Maksyoma
8152596519 Spec refactoring 2021-09-15 18:39:39 +12:00
Dmitry Maksyoma
fe2bd6c6d6 Specs: extract select_de() 2021-09-15 18:16:27 +12:00
Dmitry Maksyoma
5d0e8b1b03 Spec refactoring 2021-09-15 18:15:42 +12:00
Dmitry Maksyoma
9faf87389f vncserver: no xstartup overwrite confirmation if it doesn't exist 2021-09-15 18:01:47 +12:00
Dmitry Maksyoma
ec948ab20f Spec refactoring 2021-09-15 17:56:28 +12:00
Dmitry Maksyoma
2fa381a3fe Spec add "first run" test 2021-09-15 17:55:48 +12:00
Dmitry Maksyoma
9161015aca Spec refactoring 2021-09-15 17:47:28 +12:00
Dmitry Maksyoma
3fe52a84ba Spec refactoring 2021-09-15 17:39:35 +12:00
Dmitry Maksyoma
0c26c4cb85 Specs: fix file/dir removal 2021-09-15 17:39:15 +12:00
Dmitry Maksyoma
177da18fc8 vncserver: update Bionic image 2021-09-15 17:22:38 +12:00
Dmitry Maksyoma
0b495fd3f9 Specs: clean environment before each test 2021-09-14 20:40:57 +12:00
Dmitry Maksyoma
0011fa6afd Specs: extract check_de_was_setup_to_run() 2021-09-14 20:24:37 +12:00
Dmitry Maksyoma
ed78c9dcc5 Specs: extract kill_xvnc() 2021-09-14 20:20:55 +12:00
Dmitry Maksyoma
dca392eafd Specs: extract add_kasmvnc_user_docker() 2021-09-14 20:19:06 +12:00
Dmitry Maksyoma
28c06893e3 Specs: add -select-de test spike 2021-09-14 20:16:44 +12:00
Dmitry Maksyoma
0f23baa647 Specs: run_cmd() add **kwargs 2021-09-14 20:12:27 +12:00
Dmitry Maksyoma
d1f0d6f7e7 Spec refactoring 2021-09-14 19:27:53 +12:00
Dmitry Maksyoma
d522457723 Add spec runner 2021-09-14 19:10:33 +12:00
matt
159d752795 Update noVNC commit 2021-09-10 18:11:35 +00:00
Dmitry Maksyoma
d8bbb9884d vncserver: spec creates password file 2021-09-10 23:35:47 +12:00
Dmitry Maksyoma
7cb1ea9ebc vncserver: Python spec spike 2021-09-10 23:15:32 +12:00
Dmitry Maksyoma
dbd54fe35c vncserver: add -select-de 2021-09-10 22:31:48 +12: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
6287114cbf Merge branch 'master' into KASM-1609_select_de_to_run 2021-09-10 03:22:29 +12:00
Dmitry Maksyoma
f999acc490 vncserver: extract ForgetSelectedDe() 2021-09-09 20:46:49 +12:00
Dmitry Maksyoma
71c420fc86 Deb/Rpm: add Perl Switch dependency 2021-09-09 20:45:56 +12:00
Dmitry Maksyoma
f766c3a8c0 Fix test-vncserver 2021-09-09 20:26:53 +12:00
Dmitry Maksyoma
c96d38bbe5 select-de.sh: refactor 2021-09-09 20:26:22 +12:00
Dmitry Maksyoma
c2a5876127 select-de.sh: use exec with XFCE 2021-09-09 20:24:30 +12:00
Dmitry Maksyoma
64c190e2bb select-de.sh: fix -s <DE> 2021-09-09 20:22:41 +12:00
Dmitry Maksyoma
4ed2c57ce3 select-de.sh: fix MATE DE 2021-09-09 20:08:11 +12:00
Dmitry Maksyoma
3a528b94e6 select-de.sh: -s supports mangled DE names like CiNnAmOn 2021-09-09 00:31:43 +12:00
Dmitry Maksyoma
fbdda196b8 select-de.sh: make -s <DE> work 2021-09-09 00:31:05 +12:00
Dmitry Maksyoma
75b42e4f3f select-de.sh: assume -y if -s <DE> was given 2021-09-09 00:25:21 +12:00
Dmitry Maksyoma
003958dd9f select-de.sh: fix -s 2021-09-09 00:21:25 +12:00
Dmitry Maksyoma
69a9ba66cd vncserver test env: install MATE 2021-09-09 00:20:23 +12:00
Dmitry Maksyoma
279e91dcb1 select-de.sh: add -y, --assume-yes option 2021-09-08 23:51:53 +12: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
Dmitry Maksyoma
102d9b9a6c Merge branch 'master' into KASM-1609_select_de_to_run 2021-08-20 22:46:08 +12:00
Dmitry Maksyoma
3eb1ffd94b vncserver: -select-de spike 2021-08-20 22:35:12 +12:00
Dmitry Maksyoma
551f292144 vncserver: CLI optional option arg support (-select-de=[DE]) 2021-08-20 22:33:34 +12:00
Dmitry Maksyoma
36ffbe1572 test-vncserver: ns alias for netstat -nltp 2021-08-20 22:27:30 +12:00
Dmitry Maksyoma
c775f7198b select-de.sh: process --select-de with arg spike 2021-08-20 22:26:50 +12:00
Dmitry Maksyoma
0fa98100f8 select-de.sh: process --select-de spike 2021-08-19 21:47:23 +12:00
Dmitry Maksyoma
b0ffc6a27e vncserver: use unique -websocketPort for each display 2021-08-18 23:51:47 +12:00
Dmitry Maksyoma
fa7b3492da test-vncserver: export port for display :2 2021-08-18 23:49:05 +12:00
Dmitry Maksyoma
4a4e1d65b8 vncserver: Dockerfile and script for testing 2021-08-18 23:39:29 +12:00
Dmitry Maksyoma
cb08058d34 vncserver: print empty line before guided user creation 2021-08-18 23:34:26 +12: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
b4612d548f Merge branch 'master' into KASM-1609_select_de_to_run 2021-08-17 00:06:36 +12:00
Dmitry Maksyoma
9ec4cba184 Slash a minute off tarball build 2021-08-17 00:00:55 +12:00
Dmitry Maksyoma
d0fe229684 vncserver: refactor 2021-08-16 23:17:51 +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
Dmitry Maksyoma
ded3840f6b vncserver: extract PrintLogFilenameAndConfiguredUsersAndStuff() 2021-08-13 19:17:44 +12:00
Dmitry Maksyoma
c6f7d2eff0 vncserver: refactor 2021-08-13 19:17:30 +12:00
Dmitry Maksyoma
7e854294a2 vncserver: refactor 2021-08-13 19:06:24 +12:00
Dmitry Maksyoma
5635096978 vncserver: refactor 2021-08-13 19:02:25 +12:00
Dmitry Maksyoma
34565c5950 vncserver: extract AllowXProgramsToConnectToXvnc() 2021-08-13 19:00:35 +12:00
Dmitry Maksyoma
3522000d1f vncserver: extract PrepareLoggingAndXvncKillingFramework() 2021-08-13 18:49:01 +12:00
Dmitry Maksyoma
3f23bddb6b vncserver: refactor 2021-08-13 18:43:08 +12:00
Dmitry Maksyoma
b350557afd vncserver: refactor 2021-08-13 18:32:02 +12:00
Dmitry Maksyoma
7dc12ccb8a vncserver: refactor 2021-08-13 18:27:46 +12:00
Dmitry Maksyoma
f187aa9540 vncserver: remove obsolete code 2021-08-13 18:26:22 +12:00
Dmitry Maksyoma
79a21347f1 vncserver: extract DefineLogAndPidFilesForDisplayNumber() 2021-08-13 18:17:44 +12:00
Dmitry Maksyoma
0c1423f0b1 vncserver: remove obsolete code 2021-08-13 18:09:05 +12:00
Dmitry Maksyoma
1e21e09754 vncserver: remove obsolete code 2021-08-13 18:02:35 +12:00
Dmitry Maksyoma
6e0d272946 vncserver: enable "say" 2021-08-13 17:57:32 +12:00
Dmitry Maksyoma
c64e83732d vncserver: fix indentation 2021-08-13 01:24:39 +12:00
Dmitry Maksyoma
acb9793841 vncserver: refactor 2021-08-13 01:18:09 +12:00
Dmitry Maksyoma
9a6ea64e0f vncserver: refactor 2021-08-13 00:24:30 +12:00
Dmitry Maksyoma
68554d84d6 vncserver: refactor 2021-08-13 00:16:32 +12:00
Dmitry Maksyoma
ac51bd1d57 vncserver: refactor 2021-08-13 00:10:40 +12:00
Dmitry Maksyoma
3ef297a7cd vncserver: refactor 2021-08-13 00:07:59 +12:00
Dmitry Maksyoma
0ca46888a0 vncserver: replace -kill sleep with a faster busyloop 2021-08-12 23:33:57 +12:00
Dmitry Maksyoma
8ca36e349e vncserver: extract StartXvncOrExit() 2021-08-10 22:21:52 +12:00
Dmitry Maksyoma
cc90fe9ff6 vncserver: slice start time from 3 seconds to ~170ms 2021-08-10 22:18:31 +12:00
Dmitry Maksyoma
2b4f01f5ae vncserver: extract EnsureAtLeastOneKasmUserExists() 2021-08-10 21:45:41 +12:00
Dmitry Maksyoma
65f957695e vncserver: extract DeleteLogLeftFromPreviousXvncRun() 2021-08-10 21:32:13 +12:00
Dmitry Maksyoma
06e9e92ee1 vncserver: refactor 2021-08-10 21:19:07 +12:00
Dmitry Maksyoma
13f4ce0fba vncserver: refactor 2021-08-10 21:11:51 +12:00
Dmitry Maksyoma
349a33e402 vncserver: refactor 2021-08-10 20:59:50 +12:00
Dmitry Maksyoma
a44241971e vncserver: extract PrepareDefaultsForPassingToXvnc() 2021-08-09 23:38:20 +12:00
Dmitry Maksyoma
b26a20d44d vncserver: refactor 2021-08-09 23:28:52 +12:00
Dmitry Maksyoma
f15aae2db8 vncserver: refactor 2021-08-09 23:26:16 +12:00
Dmitry Maksyoma
895f8bc10d vncserver: refactor 2021-08-09 23:24:30 +12:00
Dmitry Maksyoma
649868241c vncserver: refactor 2021-08-09 23:24:10 +12:00
Dmitry Maksyoma
8a3cf76f82 vncserver: refactor 2021-08-09 23:02:17 +12:00
Dmitry Maksyoma
cfac63aec5 vncserver: refactor 2021-08-09 23:00:51 +12:00
Dmitry Maksyoma
59f990b372 vncserver: extract ParseAndProcessCliOptions() 2021-08-09 22:57:56 +12:00
Dmitry Maksyoma
aa5fd48852 vncserver: extract SetGlobalVariables() 2021-08-09 22:53:42 +12:00
Dmitry Maksyoma
a2a748a582 vncserver: extract DetectEnvironment() 2021-08-09 22:48:00 +12:00
Dmitry Maksyoma
5f3fcddcde vncserver: refactor 2021-08-09 22:42:21 +12:00
Dmitry Maksyoma
fa4308c542 vncserver: print user permissions 2021-08-06 22:25:09 +12:00
Dmitry Maksyoma
db2901e673 vncserver: print configured Kasm users 2021-08-06 22:08:58 +12:00
Dmitry Maksyoma
a0f09dea15 vncserver: refactor 2021-08-06 22:00:26 +12:00
Dmitry Maksyoma
21b42e462b vncserver: extract CheckCliOptionsForBeingValid() 2021-08-06 21:27:06 +12: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
Dmitry Maksyoma
27f7f823fe vncserver: fix DISPLAY detection 2021-08-06 00:08:48 +12:00
Dmitry Maksyoma
93d2c6c716 vncserver: guide user to create a KasmVNC user 2021-08-05 18:40:22 +12:00
Lauri Kasanen
a9b66833a9 Change frame stats API json formatting 2021-08-03 14:41:54 +03:00
Dmitry Maksyoma
fa342f624f vncserver: extract AtLeastOneUserConfigured() 2021-08-03 20:32:09 +12:00
Dmitry Maksyoma
a6e9f94e27 vncserver: load .kasmpasswd users 2021-08-03 00:16:16 +12:00
Dmitry Maksyoma
ffb88ee8e6 vncserver: extract $kasmPasswdFile 2021-08-02 23:48:05 +12:00
Dmitry Maksyoma
c99d82fd8b vncserver: refactor 2021-08-02 23:38:00 +12:00
Dmitry Maksyoma
69a2f9a13b vncserver: extract CreateUserConfigIfNeeded() 2021-08-02 23:26:17 +12:00
Dmitry Maksyoma
08ede14dfe vncserver: refactor 2021-08-02 23:23:31 +12:00
Dmitry Maksyoma
79c9c7157b vncserver: remove obsolete comment 2021-08-02 23:20:24 +12:00
Dmitry Maksyoma
8f58d9bc92 vncserver: split IfXvncDidntStartTryFixingFontPathAndStartXvncAgain() 2021-08-02 23:19:36 +12:00
Dmitry Maksyoma
7ee1522143 vncserver: extract WaitForXvncToStart() 2021-08-02 23:05:29 +12: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
Dmitry Maksyoma
df5d3e506d vncserver: extract WarnUserXvncNotStartedAndExit() 2021-08-02 00:27:11 +12:00
Dmitry Maksyoma
7954cc506c vncserver: extract IsXvncRunning() 2021-08-01 22:46:12 +12:00
Dmitry Maksyoma
84764bac80 vncserver: refactor 2021-08-01 22:37:43 +12:00
Dmitry Maksyoma
bc54f75226 vncserver: extract IfXvncDidntStartTryFixingFontPathAndStartXvncAgain() 2021-08-01 22:36:58 +12:00
Dmitry Maksyoma
42eadfe784 vncserver: convert tabs -> spaces 2021-08-01 22:27:35 +12:00
Dmitry Maksyoma
1bea4d0a41 vncserver: extract StartXAndRecordPID() 2021-08-01 22:23:51 +12:00
Dmitry Maksyoma
6181c249d7 vncserver: extract ConstructXvncCmd() 2021-08-01 21:57:36 +12:00
Dmitry Maksyoma
4a63e93582 vncserver: extract SetupXauthorityFile() and others 2021-08-01 21:36:55 +12:00
Dmitry Maksyoma
f6667e99be vncserver: remove obsolete code 2021-08-01 21:11:43 +12:00
Dmitry Maksyoma
d6fa4b55d7 vncserver: extract DisableVncAuth() 2021-08-01 21:11:19 +12:00
Dmitry Maksyoma
dc1850f1e7 vncserver: remove obsolete code 2021-08-01 21:07:54 +12:00
Dmitry Maksyoma
a6b3eb1f24 vncserver: extract LoadSystemThenUserThenMandatoryConfigs() 2021-08-01 21:04:19 +12:00
Dmitry Maksyoma
efbf401c8e vncserver: refactor 2021-08-01 20:53:07 +12:00
Dmitry Maksyoma
c79da47c21 vncserver: extract DetectDisplayNumberFromCliArgs() 2021-07-31 01:11:26 +12:00
Dmitry Maksyoma
55525a627b vncserver: fix formatting 2021-07-31 00:39:20 +12:00
Dmitry Maksyoma
c435e6ba7d vncserver: refactor 2021-07-31 00:37:00 +12:00
Dmitry Maksyoma
59d53dbb19 vncserver: extract AskUserToChooseDeOrManualXstartup() 2021-07-31 00:30:21 +12:00
Dmitry Maksyoma
8da1612d4c vncserver: extract CreateDotVncDir() 2021-07-31 00:23:45 +12:00
Dmitry Maksyoma
a560276817 vncserver: extract ProcessCliOptions() 2021-07-31 00:19:37 +12:00
Dmitry Maksyoma
2cb5098060 vncserver: extract DetectFontPath 2021-07-31 00:09:31 +12:00
Dmitry Maksyoma
ed51231b4e vncserver: remove obsolete code 2021-07-31 00:02:42 +12:00
Dmitry Maksyoma
f903fd6c9d vncserver: refactor 2021-07-31 00:02:01 +12:00
Dmitry Maksyoma
a3b9a96df7 vncserver: extract DetectUserName 2021-07-31 00:01:45 +12:00
Dmitry Maksyoma
5811e14b42 vncserver: extract DetectBinariesDir() 2021-07-30 23:55:44 +12:00
Dmitry Maksyoma
fc732f3603 vncserver: refactor 2021-07-30 23:40:51 +12: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
Dmitry Maksyoma
b330856d67 vncserver: improve readability 2021-07-28 22:28:51 +12:00
Dmitry Maksyoma
1165159180 vncserver: extract DetectDisplay() and RunXstartup() 2021-07-28 22:18:59 +12:00
Dmitry Maksyoma
25e761326f vncserver: extract CreateXstartup() 2021-07-28 22:04:56 +12:00
Dmitry Maksyoma
53c545a9ad vncserver: better test env detection 2021-07-28 22:01:45 +12: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
Dmitry Maksyoma
7c28908722 vncserver: ask to choose DE spike 2021-07-25 23:21:05 +12:00
Dmitry Maksyoma
6bdcbc32b1 vncserver: enable local testing
It uses the dir it was ran from to find other binaries. If I run it
locally as unix/vncserver, I want to use /usr/bin for other binaries.
2021-07-25 23:07:29 +12:00
Dmitry Maksyoma
fe736c8a2b Easy start script: split shell code into modules 2021-07-24 14:53:34 +12:00
Dmitry Maksyoma
b13698eb56 Easy start script: code formatting 2021-07-22 01:48:14 +12:00
Dmitry Maksyoma
7941e10b0a Easy start script: document --help in README 2021-07-22 00:27:35 +12:00
Dmitry Maksyoma
fc1aa63a44 Easy start script: use long GNU options -k, --kill, etc 2021-07-22 00:20:34 +12:00
Dmitry Maksyoma
1bd14fe881 Update xstartup modification documentation in README 2021-07-21 23:56:13 +12:00
Dmitry Maksyoma
8deac5cfa7 Easy start script: add -select-de to README 2021-07-21 23:55:26 +12:00
Dmitry Maksyoma
ba942e102e Easy start script: remove obsolete code 2021-07-21 22:48:36 +12:00
Dmitry Maksyoma
c4cc856e56 Revert "vncserver: add magic text to signify that the file can be replaced"
This reverts commit b8fd6a28a4.
2021-07-21 19:20:38 +12:00
Dmitry Maksyoma
7d842fe3d2 Easy start script: warn xstartup will be overwritten 2021-07-21 19:18:07 +12:00
Dmitry Maksyoma
7c4896ac66 Easy start script: refactor 2021-07-21 19:10:49 +12:00
Dmitry Maksyoma
24336b236a Early start script: add -select-de support 2021-07-21 19:08:20 +12:00
Dmitry Maksyoma
8a11d171d5 Easy start script: fail if unsupported option is given 2021-07-21 19:03:30 +12:00
Dmitry Maksyoma
892c285963 Easy start script: refactor and correct option processing 2021-07-21 18:53:24 +12:00
Dmitry Maksyoma
26cc3845b0 Easy start script: sort DEs presented to user 2021-07-19 00:07:20 +12:00
Dmitry Maksyoma
f046e3340c Easy start script: remember DE choice 2021-07-18 23:30:37 +12:00
Dmitry Maksyoma
bd144b71bf Easy start script: add manual xstartup choice 2021-07-18 23:30:13 +12:00
Dmitry Maksyoma
66d999beaf Refactor easy start script 2021-07-18 23:16:03 +12:00
Dmitry Maksyoma
3584d8c3cb Refactor easy start script 2021-07-18 23:05:11 +12:00
Dmitry Maksyoma
f8bcfcc493 Easy start script: add did_user_forbid_replacing_xstartup() 2021-07-18 23:04:36 +12:00
Dmitry Maksyoma
22654f7ab6 Easy start script: handle incorrect DE number selection 2021-07-18 22:20:20 +12:00
Dmitry Maksyoma
33327c1159 Easy start script: can choose DE and run it via xstartup 2021-07-18 01:04:33 +12:00
Dmitry Maksyoma
aeec23bd68 test-deb: add temporary volume of . 2021-07-18 01:03:56 +12:00
Dmitry Maksyoma
34a389f714 Add temporary DE installations to Buster dockerfile 2021-07-18 01:03:00 +12:00
Dmitry Maksyoma
b8fd6a28a4 vncserver: add magic text to signify that the file can be replaced 2021-07-18 01:02:04 +12:00
Dmitry Maksyoma
240b1342fd Easy start script: DE -> Desktop Environment 2021-07-17 18:28:32 +12:00
Lauri Kasanen
811e7cde3a Use case-insensitive search for the websocket headers 2021-07-12 15:44:24 +03:00
Dmitry Maksyoma
640a195e3e Easy start script: choose DE to run spike 2021-07-03 18:13:59 +12: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
430 changed files with 11500 additions and 92916 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"

71
.ci/upload.sh Normal file
View File

@@ -0,0 +1,71 @@
#!/bin/bash
is_kasmvnc() {
local package="$1";
echo "$package" | grep -q 'kasmvncserver_'
}
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";
# Transfer to S3
python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${S3_BUCKET}" "$package" "${S3_BUILD_DIRECTORY}/${upload_filename}";
# Use the Gitlab API to tell Gitlab where the artifact was stored
export S3_URL="https://${S3_BUCKET}.s3.amazonaws.com/${S3_BUILD_DIRECTORY}/${upload_filename}";
export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${upload_filename}\", \"url\":\"${S3_URL}\"}";
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=build-url&target_url=${S3_URL}";
};
function prepare_to_run_scripts_and_s3_uploads() {
export DEBIAN_FRONTEND=noninteractive;
apt-get update;
apt-get install -y ruby2.7 git;
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/.\++//')
}

10
.gitignore vendored
View File

@@ -11,3 +11,13 @@ CMakeCache.txt
Makefile
Makefile.in
config.h
builder/build/
builder/www/
# Deb building artefacts
debian/.debhelper/
debian/files
debian/kasmvncserver.substvars
debian/kasmvncserver/
.pc

240
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,240 @@
image: docker
services:
- docker:dind
variables:
GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared
GIT_SUBMODULE_STRATEGY: normal
GIT_FETCH_EXTRA_FLAGS: --tags
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
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
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
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
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:
- $CI_COMMIT_MESSAGE =~ /\[full [Cc][Ii]\]/
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:
- $CI_COMMIT_MESSAGE =~ /\[full [Cc][Ii]\]/
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]\]/
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]\]/
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]\]/
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]\]/
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;
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
artifacts:
paths:
- output/
upload:
stage: upload
image: ubuntu:focal
before_script:
- . .ci/upload.sh
script:
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
- prepare_to_run_scripts_and_s3_uploads
- 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";
echo;
echo "File to upload $upload_filename";
upload_to_s3 "$package" "$upload_filename";
UPLOAD_NAME=$(echo $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 = master

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)
@@ -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)

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.

15
Pipfile Normal file
View File

@@ -0,0 +1,15 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
mamba = "*"
expects = "*"
"path.py" = "*"
pexpect = "*"
[dev-packages]
[requires]
python_version = "3.8"

136
Pipfile.lock generated Normal file
View File

@@ -0,0 +1,136 @@
{
"_meta": {
"hash": {
"sha256": "6745d5e5d90e44a18d73a0e23bc3d3e68acb950af0b87df50b45272d25b9e615"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"args": {
"hashes": [
"sha256:a785b8d837625e9b61c39108532d95b85274acd679693b71ebb5156848fcf814"
],
"version": "==0.1.0"
},
"clint": {
"hashes": [
"sha256:05224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa"
],
"version": "==0.5.1"
},
"coverage": {
"hashes": [
"sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c",
"sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6",
"sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45",
"sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a",
"sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03",
"sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529",
"sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a",
"sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a",
"sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2",
"sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6",
"sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759",
"sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53",
"sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a",
"sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4",
"sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff",
"sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502",
"sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793",
"sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb",
"sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905",
"sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821",
"sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b",
"sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81",
"sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0",
"sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b",
"sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3",
"sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184",
"sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701",
"sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a",
"sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82",
"sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638",
"sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5",
"sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083",
"sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6",
"sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90",
"sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465",
"sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a",
"sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3",
"sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e",
"sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066",
"sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf",
"sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b",
"sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae",
"sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669",
"sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873",
"sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b",
"sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6",
"sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb",
"sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160",
"sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c",
"sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079",
"sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d",
"sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==5.5"
},
"expects": {
"hashes": [
"sha256:419902ccafe81b7e9559eeb6b7a07ef9d5c5604eddb93000f0642b3b2d594f4c"
],
"index": "pypi",
"version": "==0.9.0"
},
"mamba": {
"hashes": [
"sha256:75cfc6dfd287dcccaf86dd753cf48e0a7337487c7c3fafda05a6a67ded6da496"
],
"index": "pypi",
"version": "==0.11.2"
},
"path": {
"hashes": [
"sha256:2de925e8d421f93bcea80d511b81accfb6a7e6b249afa4a5559557b0cf817097",
"sha256:340054c5bb459fc9fd40e7eb6768c5989f3e599d18224238465b5333bc8faa7d"
],
"markers": "python_version >= '3.6'",
"version": "==16.2.0"
},
"path.py": {
"hashes": [
"sha256:8d885e8b2497aed005703d94e0fd97943401f035e42a136810308bff034529a8",
"sha256:a43e82eb2c344c3fd0b9d6352f6b856f40b8b7d3d65cc05978b42c3715668496"
],
"index": "pypi",
"version": "==12.5.0"
},
"pexpect": {
"hashes": [
"sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937",
"sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"
],
"index": "pypi",
"version": "==4.8.0"
},
"ptyprocess": {
"hashes": [
"sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35",
"sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"
],
"version": "==0.7.0"
}
},
"develop": {}
}

195
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,59 +13,73 @@
- 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
- 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. Use the install script found in this project under builder/install/install.sh, currently Ubuntu 18.04LTS is the only operating system with pre-compiled binaries.
#### Debian-based
```sh
# install dependencies
sudo apt-get -y install libjpeg-dev
wget https://github.com/kasmtech/KasmVNC/releases/download/v0.9.2-beta/kasmvncserver_ubuntu_bionic_0.9.2_amd64.deb
# install KasmVNC
wget https://github.com/kasmtech/KasmVNC/releases/download/v0.9.1-beta/KasmVNC_0.9.1-beta_Ubuntu_18.04.tar.gz | sudo tar xz --strip 1 -C /
sudo apt-get install ./kasmvncserver_0.9.1~beta-1_amd64.deb
# Generate an SSL Cert and change owner
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"
sudo chown $USER /usr/local/share/kasmvnc/certs/self.pem
# 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
# start kasmvnc and set password for remote access
vncserver :1 -interface 0.0.0.0
# stop kasmvnc to make config changes
vncserver -kill :1
# Run KasmVNC on display :10 and on interface 0.0.0.0:
KASMVNC_OPTIONS=':10 -depth 24 -geometry 1280x1050
-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'
vncserver $KASMVNC_OPTIONS
# modify vncstartup to launch your environment of choice, in this example LXDE
echo '/usr/bin/lxsession -s LXDE &' >> ~/.vnc/xstartup
# On the first run, vncserver will ask you to create a KasmVNC user and choose a desktop
# environment you want to run. It can detect Cinnamon, Mate, LXDE, KDE, Gnome,
# XFCE. You can also choose to manually edit xstartup.
# After you chose a desktop environment or to manually edit xstartup,
# vncserver won't ask you again, unless you run it as:
vncserver $KASMVNC_OPTIONS -select-de
# The KasmVNC username is automatically set to your system username, you can mofify it if you wish
vi ~/.vnc/config
# You can select a specific Desktop Environment like this:
vncserver $KASMVNC_OPTIONS -select-de mate
# launch KasmVNC
vncserver $DISPLAY -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /usr/local/share/kasmvnc/certs/self.pem -sslOnly -FrameRate=24 -interface 0.0.0.0
# Tail the logs
tail -f ~/.vnc/`hostname`:10.log
```
Now navigate to your system at https://[ip-address]:8443/vnc.html
Now navigate to your system at https://[ip-address]:8443/
The options for vncserver in the example above:
To stop the KasmVNC you started earlier on display 10:
```sh
vncserver -kill :10
```
The options for vncserver:
| Argument | Description |
| -------- | ----------- |
@@ -77,119 +91,16 @@ The options for vncserver in the example above:
| 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 --rm 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'

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

@@ -0,0 +1,33 @@
#!/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 ../*.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'

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

@@ -0,0 +1,30 @@
#!/bin/bash
set -e
prepare_build_env() {
rpmdev-setuptree
copy_spec_and_tar_with_binaries
}
copy_spec_and_tar_with_binaries() {
cp /src/centos/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")/.."
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
os_codename=$(lsb_release -cs | tr '[:upper:]' '[:lower:]')
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

46
builder/build-tarball Executable file
View File

@@ -0,0 +1,46 @@
#!/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" \
--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,5 +1,12 @@
#!/bin/sh -e
detect_quilt() {
if which quilt 1>/dev/null; then
QUILT_PRESENT=1
export QUILT_PATCHES=debian/patches
fi
}
# For build-dep to work, the apt sources need to have the source server
#sudo apt-get build-dep xorg-server
@@ -7,7 +14,10 @@
# 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.19.6.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 --no-check-certificate 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,13 +30,20 @@ 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.19.6.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 ../xserver119.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,
@@ -53,15 +70,26 @@ 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
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

18
builder/build_www.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/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
rm vnc_lite.html

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

@@ -0,0 +1,41 @@
#!/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/')
}
add_debian_revision_to_new_version() {
echo "$new_version-1"
}
bump_rpm() {
sed -i "s/^Version:.\+/Version: $new_version/" centos/kasmvncserver.spec
}
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"
}
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,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,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,29 @@
FROM centos:centos7
ENV KASMVNC_BUILD_OS centos
ENV KASMVNC_BUILD_OS_CODENAME core
RUN yum update -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
RUN yum install -y mesa-dri-drivers
# 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,62 @@
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 yum localinstall -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
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 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 -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 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 -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,62 @@
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 apt-get update && apt-get install -y task-cinnamon-desktop
RUN apt-get update && apt-get install -y task-gnome-desktop
RUN mkdir -p /usr/share/man/man1
RUN apt-get update && apt-get install -y apt-utils openjdk-11-jre
RUN apt-get update && apt-get install -y task-lxde-desktop
RUN apt-get update && apt-get install -y task-mate-desktop
RUN apt-get update && apt-get install -y task-kde-desktop
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,37 @@
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
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,30 @@
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
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 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 -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 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

@@ -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
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

@@ -1,5 +1,9 @@
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 && \
@@ -11,7 +15,7 @@ RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libg
# 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 && tar -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
@@ -24,8 +28,7 @@ RUN cd /tmp/libwebp-1.0.2 && \
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
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 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 -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,54 @@
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
ENV VNC_PORT 8443
ENV VNC_PORT2 8444
ENV VNC_PORT3 8445
EXPOSE $VNC_PORT
EXPOSE $VNC_PORT2
EXPOSE $VNC_PORT3
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN apt-get update && apt-get -y install net-tools
# RUN mkdir -p /usr/share/man/man1
# RUN apt-get update && apt-get install -y apt-utils openjdk-11-jre
RUN apt-get update && apt-get install -y ubuntu-mate-desktop
RUN apt-get update && apt-get install -y lxde
RUN apt-get update && apt-get install -y lxqt
RUN apt-get update && apt-get install -y kde-full
RUN apt-get update && apt-get install -y cinnamon
RUN apt-get update && apt-get install -y ubuntu-gnome-desktop
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get purge -y clipit magnus kgpg
RUN apt-get update && apt-get install -y python3-pip
RUN apt-get update && apt-get install -y strace
RUN useradd -m docker
ENV USER docker
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
ENV HOME /home/docker
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
RUN pip3 install --user pipenv
RUN echo 'PATH="/src/unix:~/.local/bin/:$PATH"' >> ~/.bashrc
RUN echo 'alias s="sh /src/s"' >> ~/.bashrc
RUN echo 'alias k="vncserver -kill :1; pkill baloo_file; pkill gpg-agent; pkill ssh-agent; pkill xiccd"' >> ~/.bashrc
RUN echo 'alias r="k; s"' >> ~/.bashrc
RUN echo 'alias go="sh /src/s; vncserver -kill :1"' >> ~/.bashrc
RUN echo 'alias ns="netstat -nltp"' >> ~/.bashrc
RUN echo 'alias mamba="pipenv run mamba spec/"' >> ~/.bashrc
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENTRYPOINT ["bash", "-ic", "cd /src && pipenv install; exec bash"]

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" ]

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,50 @@
#!/bin/bash
debug() {
if [ -z "$debug" ]; then return; fi
echo "$@"
}
enable_debug() {
debug=1
log_option="-log *:stderr:100"
}
kill_vnc_server() {
vncserver -kill $display
}
process_cli_options() {
for option in "$@"; do
case "$option" in
--help)
show_help
exit
;;
-d|--debug)
enable_debug
;;
-k|--kill)
kill_vnc_server
exit
;;
-s|--select-de)
action=select-de-and-start
;;
*)
echo >&2 "Unsupported argument: $option"
exit 1
esac
done
}
show_help() {
cat >&2 <<-USAGE
Usage: $(basename "$0") [options]
-d, --debug Debug output
-k, --kill Kill vncserver
-s, --select-de Select desktop environent to run
--help Show this help
USAGE
}

View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
display=:10
interface=0.0.0.0
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

258
builder/startup/deb/select-de.sh Executable file
View File

@@ -0,0 +1,258 @@
#!/bin/bash
set -e
xstartup_script=~/.vnc/xstartup
de_was_selected_file="$HOME/.vnc/.de-was-selected"
debug() {
if [ -z "$debug" ]; then return; fi
echo "$@"
}
enable_debug() {
debug=1
}
process_cli_options() {
while [ $# -gt 0 ]; do
local option="$1"
shift
case "$option" in
--help|-h)
show_help
exit
;;
-d|--debug)
enable_debug
;;
-y|--assume-yes)
assume_yes=1
;;
-s|--select-de)
action=select-de
if [[ -n "$1" && "${1:0:1}" != "-" ]]; then
selected_de="$1"
assume_yes_for_xstartup_overwrite=1
if [ "$selected_de" = "manual" ]; then
selected_de="$manual_xstartup_choice"
fi
shift
fi
;;
*)
echo >&2 "Unsupported argument: $option"
exit 1
esac
done
}
show_help() {
cat >&2 <<-USAGE
Usage: $(basename "$0") [options]
-d, --debug Debug output
-y, --assume-yes Automatic "yes" to prompts
-s, --select-de Select desktop environent to run
--help Show this help
USAGE
}
add_uppercase_desktop_environment_keys() {
local de_cmd
for de in "${!all_desktop_environments[@]}"; do
de_cmd=${all_desktop_environments[$de]};
all_desktop_environments[${de^^}]="$de_cmd"
done
}
process_cli_options "$@"
manual_xstartup_choice="Manually edit xstartup"
declare -A all_desktop_environments=(
[Cinnamon]="exec cinnamon-session"
[Mate]="XDG_CURRENT_DESKTOP=MATE exec dbus-launch --exit-with-session mate-session"
[LXDE]="exec lxsession"
[Lxqt]="exec startlxqt"
[KDE]="exec startkde"
[Gnome]="XDG_CURRENT_DESKTOP=GNOME exec dbus-launch --exit-with-session /usr/bin/gnome-session"
[XFCE]="exec xfce4-session")
readarray -t sorted_desktop_environments < <(for de in "${!all_desktop_environments[@]}"; do echo "$de"; done | sort)
all_desktop_environments[$manual_xstartup_choice]=""
sorted_desktop_environments+=("$manual_xstartup_choice")
add_uppercase_desktop_environment_keys
detected_desktop_environments=()
declare -A numbered_desktop_environments
print_detected_desktop_environments() {
declare -i i=1
echo "Please choose Desktop Environment to run:"
for detected_de in "${detected_desktop_environments[@]}"; do
echo "[$i] $detected_de"
numbered_desktop_environments[$i]=$detected_de
i+=1
done
}
detect_desktop_environments() {
for de_name in "${sorted_desktop_environments[@]}"; do
if [[ "$de_name" = "$manual_xstartup_choice" ]]; then
detected_desktop_environments+=("$de_name")
continue;
fi
local executable=${all_desktop_environments[$de_name]}
executable=($executable)
executable=${executable[-1]}
if detect_desktop_environment "$de_name" "$executable"; then
detected_desktop_environments+=("$de_name")
fi
done
}
ask_user_to_choose_de() {
while : ; do
print_detected_desktop_environments
read -r de_number_to_run
de_name_from_number "$de_number_to_run"
if [[ -n "$de_name" ]]; then
break;
fi
echo "Incorrect number: $de_number_to_run"
echo
done
}
remember_de_choice() {
touch "$de_was_selected_file"
}
de_was_selected_on_previous_run() {
[[ -f "$de_was_selected_file" ]]
}
detect_desktop_environment() {
local de_name="$1"
local executable="$2"
if command -v "$executable" &>/dev/null; then
return 0
fi
return 1
}
did_user_forbid_replacing_xstartup() {
grep -q -v KasmVNC-safe-to-replace-this-file "$xstartup_script"
}
de_cmd_from_name() {
de_cmd=${all_desktop_environments[${de_name^^}]}
}
de_name_from_number() {
local de_number_to_run="$1"
de_name=${numbered_desktop_environments[$de_number_to_run]}
}
warn_xstartup_will_be_overwriten() {
if [[ -n "$assume_yes" || -n "$assume_yes_for_xstartup_overwrite" ]]; then
return 0
fi
if [ ! -f "$xstartup_script" ]; then
return 0
fi
echo -n "WARNING: $xstartup_script will be overwritten y/N?"
read -r do_overwrite_xstartup
if [[ "$do_overwrite_xstartup" = "y" || "$do_overwrite_xstartup" = "Y" ]]; then
return 0
fi
return 1
}
setup_de_to_run_via_xstartup() {
warn_xstartup_will_be_overwriten
generate_xstartup "$de_name"
}
generate_xstartup() {
local de_name="$1"
de_cmd_from_name
cat <<-SCRIPT > "$xstartup_script"
#!/bin/sh
$de_cmd
SCRIPT
chmod +x "$xstartup_script"
}
user_asked_to_select_de() {
[[ "$action" = "select-de" ]]
}
user_specified_de() {
[ -n "$selected_de" ]
}
check_de_name_is_valid() {
local selected_de="$1"
local de_cmd=${all_desktop_environments["${selected_de^^}"]:-}
if [ -z "$de_cmd" ]; then
echo >&2 "'$selected_de': not supported Desktop Environment"
return 1
fi
}
de_installed() {
local de_name="${1^^}"
for de in "${detected_desktop_environments[@]}"; do
if [ "${de^^}" = "$de_name" ]; then
return 0
fi
done
return 1
}
check_de_installed() {
local de_name="$1"
if ! de_installed "$de_name"; then
echo >&2 "'$de_name': Desktop Environment not installed"
return 1
fi
}
if user_asked_to_select_de || ! de_was_selected_on_previous_run; then
if user_specified_de; then
check_de_name_is_valid "$selected_de"
fi
detect_desktop_environments
if user_specified_de; then
check_de_installed "$selected_de"
de_name="$selected_de"
else
ask_user_to_choose_de
fi
debug "You selected $de_name desktop environment"
if [[ "$de_name" != "$manual_xstartup_choice" ]]; then
setup_de_to_run_via_xstartup
fi
remember_de_choice
fi

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

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

@@ -0,0 +1,109 @@
#!/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"
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="-debug"
echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..."
vncserver $DISPLAY -select-de xfce -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

15
builder/test-vncserver Executable file
View File

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

106
centos/kasmvncserver.spec Normal file
View File

@@ -0,0 +1,106 @@
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, perl-Switch, rpmfusion-free-release, perl-Hash-Merge-Simple, perl-Scalar-List-Utils
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 $DESTDIR/usr/lib
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 -r $SRC/lib/kasmvnc/ $DESTDIR/usr/lib/kasmvncserver
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;
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
/usr/bin/*
/usr/lib/kasmvncserver
/usr/share/man/man1/*
/usr/share/kasmvnc/www
%license /usr/share/doc/kasmvncserver/LICENSE.TXT
%doc /usr/share/doc/kasmvncserver/README.md
%changelog
* 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

@@ -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

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

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

@@ -0,0 +1,134 @@
/* 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 <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 write);
uint8_t netRemoveUser(const char name[]);
uint8_t netGiveControlTo(const char name[]);
void netGetBottleneckStats(char *buf, uint32_t len);
void netGetFrameStats(char *buf, uint32_t len);
uint8_t netServerFrameStatsReady();
enum USER_ACTION {
//USER_ADD, - handled locally for interactivity
USER_REMOVE,
USER_GIVE_CONTROL,
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,631 @@
/* 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 <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;
}
#define USERNAME_LEN sizeof(((struct kasmpasswd_entry_t *)0)->user)
#define PASSWORD_LEN sizeof(((struct kasmpasswd_entry_t *)0)->password)
uint8_t GetAPIMessager::netAddUser(const char name[], const char pw[], const bool write) {
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;
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 = 0;
act.data.write = write;
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, act.data.user)) {
vlog.error("Can't create user %s, already exists", act.data.user);
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", act.data.user);
out:
pthread_mutex_unlock(&userMutex);
return 1;
}
uint8_t GetAPIMessager::netRemoveUser(const char name[]) {
if (strlen(name) >= USERNAME_LEN) {
vlog.error("Username too long");
return 0;
}
action_data act;
act.action = USER_REMOVE;
memcpy(act.data.user, name, USERNAME_LEN);
act.data.user[USERNAME_LEN - 1] = '\0';
if (pthread_mutex_lock(&userMutex))
return 0;
actionQueue.push_back(act);
pthread_mutex_unlock(&userMutex);
return 1;
}
uint8_t GetAPIMessager::netGiveControlTo(const char name[]) {
if (strlen(name) >= USERNAME_LEN) {
vlog.error("Username too long");
return 0;
}
action_data act;
act.action = USER_GIVE_CONTROL;
memcpy(act.data.user, name, USERNAME_LEN);
act.data.user[USERNAME_LEN - 1] = '\0';
if (pthread_mutex_lock(&userMutex))
return 0;
actionQueue.push_back(act);
pthread_mutex_unlock(&userMutex);
return 1;
}
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);
}
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,9 +38,13 @@
#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>
@@ -123,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
@@ -421,10 +434,98 @@ 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 write)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netAddUser(name, pw, write);
}
static uint8_t removeCb(void *messager, const char name[])
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netRemoveUser(name);
}
static uint8_t givecontrolCb(void *messager, const char name[])
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
return msgr->netGiveControlTo(name);
}
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 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;
@@ -465,7 +566,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
@@ -475,13 +576,16 @@ 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);
}
@@ -494,9 +598,9 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
settings.passwdfile = strdup(wexp.we_wordv[0]);
wordfree(&wexp);
settings.basicauth = basicauth;
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;
@@ -505,6 +609,24 @@ 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.givecontrolCb = givecontrolCb;
settings.bottleneckStatsCb = bottleneckStatsCb;
settings.frameStatsCb = frameStatsCb;
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);
}
@@ -673,8 +795,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;
@@ -701,7 +823,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
@@ -729,7 +851,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")) {
@@ -757,7 +880,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];
@@ -780,7 +903,7 @@ 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;

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

@@ -9,8 +9,10 @@
*/
#define _GNU_SOURCE
#include <ctype.h>
#include <pthread.h>
#include <unistd.h>
#include <crypt.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -29,6 +31,7 @@
#include <openssl/md5.h> /* md5 hash */
#include <openssl/sha.h> /* sha1 hash */
#include "websocket.h"
#include "kasmpasswd.h"
/*
* Global state
@@ -58,29 +61,103 @@ void fatal(char *msg)
exit(1);
}
/* resolve host with also IP address parsing */
int resolve_host(struct in_addr *sin_addr, const char *hostname)
{
if (!inet_aton(hostname, sin_addr)) {
struct addrinfo *ai, *cur;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
if (getaddrinfo(hostname, NULL, &hints, &ai))
return -1;
for (cur = ai; cur; cur = cur->ai_next) {
if (cur->ai_family == AF_INET) {
*sin_addr = ((struct sockaddr_in *)cur->ai_addr)->sin_addr;
freeaddrinfo(ai);
return 0;
}
}
freeaddrinfo(ai);
return -1;
}
return 0;
}
/* resolve host with also IP address parsing */
int resolve_host(struct in_addr *sin_addr, const char *hostname)
{
if (!inet_aton(hostname, sin_addr)) {
struct addrinfo *ai, *cur;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
if (getaddrinfo(hostname, NULL, &hints, &ai))
return -1;
for (cur = ai; cur; cur = cur->ai_next) {
if (cur->ai_family == AF_INET) {
*sin_addr = ((struct sockaddr_in *)cur->ai_addr)->sin_addr;
freeaddrinfo(ai);
return 0;
}
}
freeaddrinfo(ai);
return -1;
}
return 0;
}
static const char *parse_get(const char * const in, const char * const opt, unsigned *len) {
const char *start = in;
const char *end = strchrnul(start, '&');
const unsigned optlen = strlen(opt);
*len = 0;
while (1) {
if (!strncmp(start, opt, optlen)) {
const char *arg = strchr(start, '=');
if (!arg)
return "";
arg++;
*len = end - arg;
return arg;
}
if (!*end)
break;
end++;
start = end;
end = strchrnul(start, '&');
}
return "";
}
static void percent_decode(const char *src, char *dst, const uint8_t filter) {
while (1) {
if (!*src)
break;
if (*src != '%') {
*dst++ = *src++;
} else {
src++;
if (!src[0] || !src[1])
break;
char hex[3];
hex[0] = src[0];
hex[1] = src[1];
hex[2] = '\0';
src += 2;
*dst = strtol(hex, NULL, 16);
if (filter) {
// Avoid directory traversal
if (*dst == '/')
*dst = '_';
}
dst++;
}
}
*dst = '\0';
}
static void percent_encode(const char *src, char *dst) {
while (1) {
if (!*src)
break;
if (isalnum(*src) || *src == '.' || *src == ',') {
*dst++ = *src++;
} else {
*dst++ = '%';
sprintf(dst, "%02X", *src);
dst += 2;
src++;
}
}
*dst = '\0';
}
/*
* SSL Wrapper Code
@@ -106,7 +183,7 @@ ssize_t ws_send(ws_ctx_t *ctx, const void *buf, size_t len) {
ws_ctx_t *alloc_ws_ctx() {
ws_ctx_t *ctx;
if (! (ctx = malloc(sizeof(ws_ctx_t))) )
if (! (ctx = calloc(sizeof(ws_ctx_t), 1)) )
{ fatal("malloc()"); }
if (! (ctx->cin_buf = malloc(BUFSIZE)) )
@@ -160,12 +237,14 @@ ws_ctx_t *ws_socket_ssl(ws_ctx_t *ctx, int socket, char * certfile, char * keyfi
}
ctx->ssl_ctx = SSL_CTX_new(TLSv1_server_method());
ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method());
if (ctx->ssl_ctx == NULL) {
ERR_print_errors_fp(stderr);
fatal("Failed to configure SSL context");
}
SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
if (SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, use_keyfile,
SSL_FILETYPE_PEM) <= 0) {
sprintf(msg, "Unable to load private key file %s\n", use_keyfile);
@@ -305,7 +384,7 @@ int decode_hixie(char *src, size_t srclength,
*left = srclength;
if (srclength == 2 &&
(src[0] == '\xff') &&
(src[0] == '\xff') &&
(src[1] == '\x00')) {
// client sent orderly close frame
*opcode = 0x8; // Close frame
@@ -323,7 +402,7 @@ int decode_hixie(char *src, size_t srclength,
return len;
}
retlen += len;
start = end + 2; // Skip '\xff' end and '\x00' start
start = end + 2; // Skip '\xff' end and '\x00' start
framecount++;
} while (end < (src+srclength-1));
if (framecount > 1) {
@@ -396,7 +475,7 @@ int decode_hybi(unsigned char *src, size_t srclength,
int i = 0, len, framecount = 0;
size_t remaining = 0;
unsigned int target_offset = 0, hdr_length = 0, payload_length = 0;
*left = srclength;
frame = src;
@@ -496,7 +575,7 @@ int decode_hybi(unsigned char *src, size_t srclength,
snprintf(cntstr, 3, "%d", framecount);
traffic(cntstr);
}
*left = remaining;
return target_offset;
}
@@ -512,7 +591,7 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) {
headers->key3[0] = '\0';
if ((strlen(handshake) < 92) || (bcmp(handshake, "GET ", 4) != 0) ||
(!strstr(handshake, "Upgrade: websocket"))) {
(!strcasestr(handshake, "Upgrade: websocket"))) {
return 0;
}
start = handshake+4;
@@ -529,19 +608,19 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) {
headers->host[end-start] = '\0';
headers->origin[0] = '\0';
start = strstr(handshake, "\r\nOrigin: ");
start = strcasestr(handshake, "\r\nOrigin: ");
if (start) {
start += 10;
} else {
start = strstr(handshake, "\r\nSec-WebSocket-Origin: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Origin: ");
if (!start) { return 0; }
start += 24;
}
end = strstr(start, "\r\n");
strncpy(headers->origin, start, end-start);
headers->origin[end-start] = '\0';
start = strstr(handshake, "\r\nSec-WebSocket-Version: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Version: ");
if (start) {
// HyBi/RFC 6455
start += 25;
@@ -551,21 +630,21 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) {
ws_ctx->hixie = 0;
ws_ctx->hybi = strtol(headers->version, NULL, 10);
start = strstr(handshake, "\r\nSec-WebSocket-Key: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Key: ");
if (!start) { return 0; }
start += 21;
end = strstr(start, "\r\n");
strncpy(headers->key1, start, end-start);
headers->key1[end-start] = '\0';
start = strstr(handshake, "\r\nConnection: ");
if (!start) { return 0; }
start += 14;
end = strstr(start, "\r\n");
strncpy(headers->connection, start, end-start);
headers->connection[end-start] = '\0';
start = strstr(handshake, "\r\nSec-WebSocket-Protocol: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Protocol: ");
if (!start) { return 0; }
start += 26;
end = strstr(start, "\r\n");
@@ -583,14 +662,14 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) {
strncpy(headers->key3, start, 8);
headers->key3[8] = '\0';
start = strstr(handshake, "\r\nSec-WebSocket-Key1: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Key1: ");
if (!start) { return 0; }
start += 22;
end = strstr(start, "\r\n");
strncpy(headers->key1, start, end-start);
headers->key1[end-start] = '\0';
start = strstr(handshake, "\r\nSec-WebSocket-Key2: ");
start = strcasestr(handshake, "\r\nSec-WebSocket-Key2: ");
if (!start) { return 0; }
start += 22;
end = strstr(start, "\r\n");
@@ -692,6 +771,7 @@ def:
static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[]) {
char buf[4096];
char enc[PATH_MAX * 3 + 1];
unsigned i;
// Redirect?
@@ -725,7 +805,15 @@ static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[
if (!strcmp(names[i]->d_name, ".") || !strcmp(names[i]->d_name, ".."))
continue;
sprintf(buf, "<li><a href=\"%s\">%s</a></li>", names[i]->d_name, names[i]->d_name);
percent_encode(names[i]->d_name, enc);
if (names[i]->d_type == DT_DIR)
sprintf(buf, "<li><a href=\"%s/\">%s/</a></li>", enc,
names[i]->d_name);
else
sprintf(buf, "<li><a href=\"%s\">%s</a></li>", enc,
names[i]->d_name);
ws_send(ws_ctx, buf, strlen(buf));
}
@@ -762,13 +850,15 @@ static void servefile(ws_ctx_t *ws_ctx, const char *in) {
len = strlen(path);
}
wserr("Requested file '%s'\n", path);
sprintf(fullpath, "%s/%s", settings.httpdir, path);
percent_decode(path, buf, 1);
wserr("Requested file '%s'\n", buf);
sprintf(fullpath, "%s/%s", settings.httpdir, buf);
DIR *dir = opendir(fullpath);
if (dir) {
closedir(dir);
dirlisting(ws_ctx, fullpath, path);
dirlisting(ws_ctx, fullpath, buf);
return;
}
@@ -810,6 +900,309 @@ nope:
ws_send(ws_ctx, buf, strlen(buf));
}
static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in) {
char buf[4096], path[4096], args[4096] = "";
uint8_t ret = 0; // 0 = continue checking
if (strncmp(in, "GET ", 4)) {
wserr("non-GET request, rejecting\n");
return 0;
}
in += 4;
const char *end = strchr(in, ' ');
unsigned len = end - in;
if (len < 1 || len > 1024 || strstr(in, "../")) {
wserr("Request too long (%u) or attempted dir traversal attack, rejecting\n", len);
return 0;
}
end = memchr(in, '?', len);
if (end) {
len = end - in;
end++;
const char *argend = strchr(end, ' ');
strncpy(args, end, argend - end);
args[argend - end] = '\0';
}
memcpy(path, in, len);
path[len] = '\0';
if (strstr(args, "password=")) {
wserr("Requested owner api '%s' with args (skipped, includes password)\n", path);
} else {
wserr("Requested owner api '%s' with args '%s'\n", path, args);
}
#define entry(x) if (!strcmp(path, x))
const char *param;
entry("/api/get_screenshot") {
uint8_t q = 7, dedup = 0;
uint16_t w = 4096, h = 4096;
param = parse_get(args, "width", &len);
if (len && isdigit(param[0]))
w = atoi(param);
param = parse_get(args, "height", &len);
if (len && isdigit(param[0]))
h = atoi(param);
param = parse_get(args, "quality", &len);
if (len && isdigit(param[0]))
q = atoi(param);
param = parse_get(args, "deduplicate", &len);
if (len && isalpha(param[0])) {
if (!strncmp(param, "true", len))
dedup = 1;
}
uint8_t *staging = malloc(1024 * 1024 * 8);
settings.screenshotCb(settings.messager, w, h, q, dedup, &len, staging);
if (len == 16) {
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: %u\r\n"
"\r\n", len);
ws_send(ws_ctx, buf, strlen(buf));
ws_send(ws_ctx, staging, len);
wserr("Screenshot hadn't changed and dedup was requested, sent hash\n");
ret = 1;
} else if (len) {
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: image/jpeg\r\n"
"Content-length: %u\r\n"
"\r\n", len);
ws_send(ws_ctx, buf, strlen(buf));
ws_send(ws_ctx, staging, len);
wserr("Sent screenshot %u bytes\n", len);
ret = 1;
}
free(staging);
if (!len) {
wserr("Invalid params to screenshot\n");
goto nope;
}
} else entry("/api/create_user") {
char decname[1024] = "", decpw[1024] = "";
uint8_t write = 0;
param = parse_get(args, "name", &len);
if (len) {
memcpy(buf, param, len);
buf[len] = '\0';
percent_decode(buf, decname, 0);
}
param = parse_get(args, "password", &len);
if (len) {
memcpy(buf, param, len);
buf[len] = '\0';
percent_decode(buf, decpw, 0);
struct crypt_data cdata;
cdata.initialized = 0;
const char *encrypted = crypt_r(decpw, "$5$kasm$", &cdata);
strcpy(decpw, encrypted);
}
param = parse_get(args, "write", &len);
if (len && isalpha(param[0])) {
if (!strncmp(param, "true", len))
write = 1;
}
if (!decname[0] || !decpw[0])
goto nope;
if (!settings.adduserCb(settings.messager, decname, decpw, write)) {
wserr("Invalid params to create_user\n");
goto nope;
}
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: 6\r\n"
"\r\n"
"200 OK");
ws_send(ws_ctx, buf, strlen(buf));
ret = 1;
} else entry("/api/remove_user") {
char decname[1024] = "";
param = parse_get(args, "name", &len);
if (len) {
memcpy(buf, param, len);
buf[len] = '\0';
percent_decode(buf, decname, 0);
}
if (!decname[0])
goto nope;
if (!settings.removeCb(settings.messager, decname)) {
wserr("Invalid params to remove_user\n");
goto nope;
}
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: 6\r\n"
"\r\n"
"200 OK");
ws_send(ws_ctx, buf, strlen(buf));
wserr("Passed remove_user request to main thread\n");
ret = 1;
} else entry("/api/give_control") {
char decname[1024] = "";
param = parse_get(args, "name", &len);
if (len) {
memcpy(buf, param, len);
buf[len] = '\0';
percent_decode(buf, decname, 0);
}
if (!decname[0])
goto nope;
if (!settings.givecontrolCb(settings.messager, decname)) {
wserr("Invalid params to give_control\n");
goto nope;
}
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: 6\r\n"
"\r\n"
"200 OK");
ws_send(ws_ctx, buf, strlen(buf));
wserr("Passed give_control request to main thread\n");
ret = 1;
} else entry("/api/get_bottleneck_stats") {
char statbuf[4096];
settings.bottleneckStatsCb(settings.messager, statbuf, 4096);
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: %lu\r\n"
"\r\n", strlen(statbuf));
ws_send(ws_ctx, buf, strlen(buf));
ws_send(ws_ctx, statbuf, strlen(statbuf));
wserr("Sent bottleneck stats to API caller\n");
ret = 1;
} else entry("/api/get_frame_stats") {
char statbuf[4096], decname[1024];
unsigned waitfor;
param = parse_get(args, "client", &len);
if (len) {
memcpy(buf, param, len);
buf[len] = '\0';
percent_decode(buf, decname, 0);
} else {
wserr("client param required\n");
goto nope;
}
if (!decname[0])
goto nope;
if (!strcmp(decname, "none")) {
waitfor = 0;
if (!settings.requestFrameStatsNoneCb(settings.messager))
goto nope;
} else if (!strcmp(decname, "auto")) {
waitfor = settings.ownerConnectedCb(settings.messager);
if (!waitfor) {
if (!settings.requestFrameStatsNoneCb(settings.messager))
goto nope;
} else {
if (!settings.requestFrameStatsOwnerCb(settings.messager))
goto nope;
}
} else if (!strcmp(decname, "all")) {
waitfor = settings.numActiveUsersCb(settings.messager);
if (!settings.requestFrameStatsAllCb(settings.messager))
goto nope;
} else {
waitfor = 1;
if (!settings.requestFrameStatsOneCb(settings.messager, decname))
goto nope;
}
while (1) {
usleep(10 * 1000);
if (settings.serverFrameStatsReadyCb(settings.messager))
break;
}
if (waitfor) {
unsigned waits;
for (waits = 0; waits < 20; waits++) { // wait up to 2s
if (settings.getClientFrameStatsNumCb(settings.messager) >= waitfor)
break;
usleep(100 * 1000);
}
}
settings.frameStatsCb(settings.messager, statbuf, 4096);
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: %lu\r\n"
"\r\n", strlen(statbuf));
ws_send(ws_ctx, buf, strlen(buf));
ws_send(ws_ctx, statbuf, strlen(statbuf));
wserr("Sent frame stats to API caller\n");
ret = 1;
}
#undef entry
return ret;
nope:
sprintf(buf, "HTTP/1.1 400 Bad Request\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"\r\n"
"400 Bad Request");
ws_send(ws_ctx, buf, strlen(buf));
return 1;
}
ws_ctx_t *do_handshake(int sock) {
char handshake[4096], response[4096], sha1[29], trailer[17];
char *scheme, *pre;
@@ -878,8 +1271,8 @@ ws_ctx_t *do_handshake(int sock) {
usleep(10);
}
const char *colon;
if ((colon = strchr(settings.basicauth, ':'))) {
unsigned char owner = 0;
if (!settings.disablebasicauth) {
const char *hdr = strstr(handshake, "Authorization: Basic ");
if (!hdr) {
handler_emsg("BasicAuth required, but client didn't send any. 401 Unauth\n");
@@ -904,43 +1297,61 @@ ws_ctx_t *do_handshake(int sock) {
tmp[len] = '\0';
len = ws_b64_pton(tmp, response, 256);
char authbuf[4096];
strncpy(authbuf, settings.basicauth, 4096);
authbuf[4095] = '\0';
char authbuf[4096] = "";
// Do we need to read it from the file?
char *resppw = strchr(response, ':');
if (resppw && *resppw)
resppw++;
if (!colon[1] && settings.passwdfile) {
if (resppw && *resppw) {
if (settings.passwdfile) {
if (resppw && *resppw && resppw - response < 32) {
char pwbuf[4096];
FILE *f = fopen(settings.passwdfile, "r");
if (f) {
handler_emsg("BasicAuth reading password from %s\n", settings.passwdfile);
const unsigned len = fread(pwbuf, 1, 4096, f);
fclose(f);
pwbuf[4095] = '\0';
if (len < 4096)
pwbuf[len] = '\0';
snprintf(authbuf, 4096, "%s%s", settings.basicauth, pwbuf);
authbuf[4095] = '\0';
const char *encrypted = crypt(resppw, "$5$kasm$");
*resppw = '\0';
snprintf(pwbuf, 4096, "%s%s", response, encrypted);
pwbuf[4095] = '\0';
strcpy(response, pwbuf);
} else {
fprintf(stderr, " websocket %d: Error: BasicAuth configured to read password from file %s, but the file doesn't exist\n",
struct kasmpasswd_t *set = readkasmpasswd(settings.passwdfile);
if (!set->num) {
fprintf(stderr, " websocket %d: Error: BasicAuth configured to read password from file %s, but the file doesn't exist or has no valid users\n",
wsthread_handler_id,
settings.passwdfile);
} else {
unsigned i;
char inuser[32];
unsigned char found = 0;
memcpy(inuser, response, resppw - response - 1);
inuser[resppw - response - 1] = '\0';
for (i = 0; i < set->num; i++) {
if (!strcmp(set->entries[i].user, inuser)) {
found = 1;
strcpy(ws_ctx->user, inuser);
snprintf(authbuf, 4096, "%s:%s", set->entries[i].user,
set->entries[i].password);
authbuf[4095] = '\0';
if (set->entries[i].owner)
owner = 1;
break;
}
}
if (!found)
handler_emsg("BasicAuth user %s not found\n", inuser);
}
free(set->entries);
free(set);
struct crypt_data cdata;
cdata.initialized = 0;
const char *encrypted = crypt_r(resppw, "$5$kasm$", &cdata);
*resppw = '\0';
snprintf(pwbuf, 4096, "%s%s", response, encrypted);
pwbuf[4095] = '\0';
strcpy(response, pwbuf);
} else {
// Client tried an empty password, just fail them
response[0] = '\0';
authbuf[0] = 'a';
authbuf[1] = '\0';
}
}
@@ -959,9 +1370,28 @@ ws_ctx_t *do_handshake(int sock) {
if (!parse_handshake(ws_ctx, handshake)) {
handler_emsg("Invalid WS request, maybe a HTTP one\n");
if (strstr(handshake, "/api/")) {
handler_emsg("HTTP request under /api/\n");
if (owner) {
if (ownerapi(ws_ctx, handshake))
goto done;
} else {
sprintf(response, "HTTP/1.1 401 Unauthorized\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"\r\n"
"401 Unauthorized");
ws_send(ws_ctx, response, strlen(response));
goto done;
}
}
if (settings.httpdir && settings.httpdir[0])
servefile(ws_ctx, handshake);
done:
free_ws_ctx(ws_ctx);
return NULL;
}
@@ -995,7 +1425,7 @@ ws_ctx_t *do_handshake(int sock) {
snprintf(response, sizeof(response), SERVER_HANDSHAKE_HIXIE, pre, headers->origin,
pre, scheme, headers->host, headers->path, pre, "base64", trailer);
}
//handler_msg("response: %s\n", response);
ws_send(ws_ctx, response, strlen(response));
@@ -1012,7 +1442,6 @@ void *subthread(void *ptr) {
const int csock = pass->csock;
wsthread_handler_id = pass->id;
free((void *) pass);
ws_ctx_t *ws_ctx;
@@ -1022,11 +1451,14 @@ void *subthread(void *ptr) {
goto out; // Child process exits
}
memcpy(ws_ctx->ip, pass->ip, sizeof(pass->ip));
proxy_handler(ws_ctx);
if (pipe_error) {
handler_emsg("Closing due to SIGPIPE\n");
}
out:
free((void *) pass);
if (ws_ctx) {
ws_socket_free(ws_ctx);
@@ -1062,12 +1494,13 @@ void *start_server(void *unused) {
error("ERROR on accept");
continue;
}
struct wspass_t *pass = calloc(1, sizeof(struct wspass_t));
inet_ntop(cli_addr.sin_family, &cli_addr.sin_addr, pass->ip, sizeof(pass->ip));
fprintf(stderr, " websocket %d: got client connection from %s\n",
settings.handler_id,
inet_ntoa(cli_addr.sin_addr));
pass->ip);
pthread_t tid;
struct wspass_t *pass = calloc(1, sizeof(struct wspass_t));
pass->id = settings.handler_id;
pass->csock = csock;
pthread_create(&tid, NULL, subthread, pass);

View File

@@ -1,4 +1,5 @@
#include <openssl/ssl.h>
#include <stdint.h>
#define BUFSIZE 65536
#define DBUFSIZE (BUFSIZE * 3) / 4 - 20
@@ -53,11 +54,15 @@ typedef struct {
char *cout_buf;
char *tin_buf;
char *tout_buf;
char user[32];
char ip[64];
} ws_ctx_t;
struct wspass_t {
int csock;
unsigned id;
char ip[64];
};
typedef struct {
@@ -66,10 +71,31 @@ typedef struct {
unsigned int handler_id;
const char *cert;
const char *key;
const char *basicauth;
uint8_t disablebasicauth;
const char *passwdfile;
int ssl_only;
const char *httpdir;
void *messager;
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);
uint8_t (*adduserCb)(void *messager, const char name[], const char pw[],
const uint8_t write);
uint8_t (*removeCb)(void *messager, const char name[]);
uint8_t (*givecontrolCb)(void *messager, const char name[]);
void (*bottleneckStatsCb)(void *messager, char *buf, uint32_t len);
void (*frameStatsCb)(void *messager, char *buf, uint32_t len);
uint8_t (*requestFrameStatsNoneCb)(void *messager);
uint8_t (*requestFrameStatsOwnerCb)(void *messager);
uint8_t (*requestFrameStatsAllCb)(void *messager);
uint8_t (*requestFrameStatsOneCb)(void *messager, const char *client);
uint8_t (*ownerConnectedCb)(void *messager);
uint8_t (*numActiveUsersCb)(void *messager);
uint8_t (*getClientFrameStatsNumCb)(void *messager);
uint8_t (*serverFrameStatsReadyCb)(void *messager);
} settings_t;
#ifdef __cplusplus

View File

@@ -20,6 +20,8 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include "websocket.h"
/*
@@ -42,11 +44,11 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) {
int maxfd, client = ws_ctx->sockfd;
unsigned int opcode, left, ret;
unsigned int tout_start, tout_end, cout_start, cout_end;
unsigned int tin_start, tin_end;
unsigned int tin_end;
ssize_t len, bytes;
tout_start = tout_end = cout_start = cout_end =
tin_start = tin_end = 0;
tin_end = 0;
maxfd = client > target ? client+1 : target+1;
while (1) {
@@ -163,7 +165,7 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) {
}
if (FD_ISSET(client, &rlist)) {
bytes = ws_recv(ws_ctx, ws_ctx->tin_buf + tin_end, BUFSIZE-1);
bytes = ws_recv(ws_ctx, ws_ctx->tin_buf + tin_end, BUFSIZE-1-tin_end);
if (pipe_error) { break; }
if (bytes <= 0) {
handler_emsg("client closed connection\n");
@@ -178,13 +180,13 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) {
printf("\n");
*/
if (ws_ctx->hybi) {
len = decode_hybi(ws_ctx->tin_buf + tin_start,
tin_end-tin_start,
len = decode_hybi(ws_ctx->tin_buf,
tin_end,
ws_ctx->tout_buf, BUFSIZE-1,
&opcode, &left);
} else {
len = decode_hixie(ws_ctx->tin_buf + tin_start,
tin_end-tin_start,
len = decode_hixie(ws_ctx->tin_buf,
tin_end,
ws_ctx->tout_buf, BUFSIZE-1,
&opcode, &left);
}
@@ -206,10 +208,13 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) {
break;
}
if (left) {
tin_start = tin_end - left;
//printf("partial frame from client");
const unsigned tin_start = tin_end - left;
//handler_emsg("partial frame from client, %u left, start %u end %u, lens %lu %lu\n",
// left, tin_start, tin_end, bytes, len);
memmove(ws_ctx->tin_buf, ws_ctx->tin_buf + tin_start, left);
tin_end = left;
} else {
tin_start = 0;
//handler_emsg("handled %lu/%lu bytes\n", bytes, len);
tin_end = 0;
}
@@ -222,17 +227,30 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) {
void proxy_handler(ws_ctx_t *ws_ctx) {
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';
struct timeval tv;
gettimeofday(&tv, NULL);
struct sockaddr_un myaddr;
myaddr.sun_family = AF_UNIX;
sprintf(myaddr.sun_path, ".%s@%s_%lu.%lu", ws_ctx->user, ws_ctx->ip,
tv.tv_sec, tv.tv_usec);
myaddr.sun_path[0] = '\0';
int tsock = socket(AF_UNIX, SOCK_STREAM, 0);
bind(tsock, (struct sockaddr *) &myaddr, sizeof(struct sockaddr_un));
handler_msg("connecting to VNC target\n");
if (connect(tsock, (struct sockaddr *) &addr,
sizeof(sa_family_t) + sizeof(".KasmVNCSock")) < 0) {
sizeof(sa_family_t) + strlen(sockname)) < 0) {
handler_emsg("Could not connect to target: %s\n",
strerror(errno));

View File

@@ -0,0 +1,69 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
* Copyright 2020 Pierre Ossman for Cendio AB
*
* 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 <rdr/BufferedInStream.h>
#include <rdr/Exception.h>
using namespace rdr;
static const size_t DEFAULT_BUF_SIZE = 8192;
BufferedInStream::BufferedInStream()
: bufSize(DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new U8[bufSize];
}
BufferedInStream::~BufferedInStream()
{
delete [] start;
}
size_t BufferedInStream::pos()
{
return offset + ptr - start;
}
bool BufferedInStream::overrun(size_t needed, bool wait)
{
if (needed > bufSize)
throw Exception("BufferedInStream overrun: "
"requested size of %lu bytes exceeds maximum of %lu bytes",
(long unsigned)needed, (long unsigned)bufSize);
// Do we need to shuffle things around?
if ((bufSize - (ptr - start)) < needed) {
memmove(start, ptr, end - ptr);
offset += ptr - start;
end -= ptr - start;
ptr = start;
}
while (avail() < needed) {
if (!fillBuffer(start + bufSize - end, wait))
return false;
}
return true;
}

View File

@@ -0,0 +1,54 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
* Copyright 2020 Pierre Ossman for Cendio AB
*
* 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.
*/
//
// Base class for input streams with a buffer
//
#ifndef __RDR_BUFFEREDINSTREAM_H__
#define __RDR_BUFFEREDINSTREAM_H__
#include <rdr/InStream.h>
namespace rdr {
class BufferedInStream : public InStream {
public:
virtual ~BufferedInStream();
virtual size_t pos();
private:
virtual bool fillBuffer(size_t maxSize, bool wait) = 0;
virtual bool overrun(size_t needed, bool wait);
private:
size_t bufSize;
size_t offset;
U8* start;
protected:
BufferedInStream();
};
} // end of namespace rdr
#endif

View File

@@ -0,0 +1,108 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
* Copyright 2011-2020 Pierre Ossman for Cendio AB
* Copyright 2017 Peter Astrand <astrand@cendio.se> for Cendio AB
*
* 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 <rdr/BufferedOutStream.h>
#include <rdr/Exception.h>
using namespace rdr;
static const size_t DEFAULT_BUF_SIZE = 16384;
BufferedOutStream::BufferedOutStream()
: bufSize(DEFAULT_BUF_SIZE), offset(0)
{
ptr = start = sentUpTo = new U8[bufSize];
end = start + bufSize;
}
BufferedOutStream::~BufferedOutStream()
{
// FIXME: Complain about non-flushed buffer?
delete [] start;
}
size_t BufferedOutStream::length()
{
return offset + ptr - sentUpTo;
}
size_t BufferedOutStream::bufferUsage()
{
return ptr - sentUpTo;
}
void BufferedOutStream::flush()
{
while (sentUpTo < ptr) {
size_t len;
len = bufferUsage();
if (!flushBuffer(false))
break;
offset += len - bufferUsage();
}
// Managed to flush everything?
if (sentUpTo == ptr)
ptr = sentUpTo = start;
}
void BufferedOutStream::overrun(size_t needed)
{
if (needed > bufSize)
throw Exception("BufferedOutStream overrun: "
"requested size of %lu bytes exceeds maximum of %lu bytes",
(long unsigned)needed, (long unsigned)bufSize);
// First try to get rid of the data we have
flush();
// Still not enough space?
while (needed > avail()) {
// Can we shuffle things around?
// (don't do this if it gains us less than 25%)
if (((size_t)(sentUpTo - start) > bufSize / 4) &&
(needed < bufSize - (ptr - sentUpTo))) {
memmove(start, sentUpTo, ptr - sentUpTo);
ptr = start + (ptr - sentUpTo);
sentUpTo = start;
} else {
size_t len;
len = bufferUsage();
// Have to get rid of more data, so allow the flush to wait...
flushBuffer(true);
offset += len - bufferUsage();
// Managed to flush everything?
if (sentUpTo == ptr)
ptr = sentUpTo = start;
}
}
}

View File

@@ -0,0 +1,65 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
* Copyright 2011-2020 Pierre Ossman for Cendio AB
*
* 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.
*/
//
// Base class for output streams with a buffer
//
#ifndef __RDR_BUFFEREDOUTSTREAM_H__
#define __RDR_BUFFEREDOUTSTREAM_H__
#include <rdr/OutStream.h>
namespace rdr {
class BufferedOutStream : public OutStream {
public:
virtual ~BufferedOutStream();
virtual size_t length();
virtual void flush();
size_t bufferUsage();
private:
// flushBuffer() requests that the stream be flushed. Returns true if it is
// able to progress the output (which might still not mean any bytes
// actually moved) and can be called again. If wait is true then it will
// block until all data has been written.
virtual bool flushBuffer(bool wait) = 0;
virtual void overrun(size_t needed);
private:
size_t bufSize;
size_t offset;
U8* start;
protected:
U8* sentUpTo;
protected:
BufferedOutStream();
};
}
#endif

View File

@@ -1,6 +1,8 @@
include_directories(${CMAKE_SOURCE_DIR}/common ${ZLIB_INCLUDE_DIRS})
add_library(rdr STATIC
BufferedInStream.cxx
BufferedOutStream.cxx
Exception.cxx
FdInStream.cxx
FdOutStream.cxx

View File

@@ -36,13 +36,6 @@
#include <unistd.h>
#endif
#ifndef vncmin
#define vncmin(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef vncmax
#define vncmax(a,b) (((a) > (b)) ? (a) : (b))
#endif
/* Old systems have select() in sys/time.h */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -53,31 +46,22 @@
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 8192,
MIN_BULK_SIZE = 1024 };
enum { DEFAULT_BUF_SIZE = 8192 };
FdInStream::FdInStream(int fd_, int timeoutms_, size_t bufSize_,
FdInStream::FdInStream(int fd_, int timeoutms_,
bool closeWhenDone_)
: fd(fd_), closeWhenDone(closeWhenDone_),
timeoutms(timeoutms_), blockCallback(0),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
timeoutms(timeoutms_), blockCallback(0)
{
ptr = end = start = new U8[bufSize];
}
FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_,
size_t bufSize_)
: fd(fd_), timeoutms(0), blockCallback(blockCallback_),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_)
: fd(fd_), timeoutms(0), blockCallback(blockCallback_)
{
ptr = end = start = new U8[bufSize];
}
FdInStream::~FdInStream()
{
delete [] start;
if (closeWhenDone) close(fd);
}
@@ -92,72 +76,15 @@ void FdInStream::setBlockCallback(FdInStreamBlockCallback* blockCallback_)
timeoutms = 0;
}
size_t FdInStream::pos()
bool FdInStream::fillBuffer(size_t maxSize, bool wait)
{
return offset + ptr - start;
}
size_t n = readWithTimeoutOrCallback((U8*)end, maxSize, wait);
if (n == 0)
return false;
end += n;
void FdInStream::readBytes(void* data, size_t length)
{
if (length < MIN_BULK_SIZE) {
InStream::readBytes(data, length);
return;
}
U8* dataPtr = (U8*)data;
size_t n = end - ptr;
if (n > length) n = length;
memcpy(dataPtr, ptr, n);
dataPtr += n;
length -= n;
ptr += n;
while (length > 0) {
n = readWithTimeoutOrCallback(dataPtr, length);
dataPtr += n;
length -= n;
offset += n;
}
}
size_t FdInStream::overrun(size_t itemSize, size_t nItems, bool wait)
{
if (itemSize > bufSize)
throw Exception("FdInStream overrun: max itemSize exceeded");
if (end - ptr != 0)
memmove(start, ptr, end - ptr);
offset += ptr - start;
end -= ptr - start;
ptr = start;
size_t bytes_to_read;
while ((size_t)(end - start) < itemSize) {
bytes_to_read = start + bufSize - end;
if (!timing) {
// When not timing, we must be careful not to read too much
// extra data into the buffer. Otherwise, the line speed
// estimation might stay at zero for a long time: All reads
// during timing=1 can be satisfied without calling
// readWithTimeoutOrCallback. However, reading only 1 or 2 bytes
// bytes is ineffecient.
bytes_to_read = vncmin(bytes_to_read, vncmax(itemSize*nItems, 8));
}
size_t n = readWithTimeoutOrCallback((U8*)end, bytes_to_read, wait);
if (n == 0) return 0;
end += n;
}
size_t nAvail;
nAvail = (end - ptr) / itemSize;
if (nAvail < nItems)
return nAvail;
return nItems;
return true;
}
//
@@ -175,10 +102,6 @@ size_t FdInStream::overrun(size_t itemSize, size_t nItems, bool wait)
size_t FdInStream::readWithTimeoutOrCallback(void* buf, size_t len, bool wait)
{
struct timeval before, after;
if (timing)
gettimeofday(&before, 0);
int n;
while (true) {
do {
@@ -215,48 +138,5 @@ size_t FdInStream::readWithTimeoutOrCallback(void* buf, size_t len, bool wait)
if (n < 0) throw SystemException("read",errno);
if (n == 0) throw EndOfStream();
if (timing) {
gettimeofday(&after, 0);
int newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 +
(after.tv_usec - before.tv_usec) / 100);
int newKbits = n * 8 / 1000;
// limit rate to between 10kbit/s and 40Mbit/s
if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;
if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4;
timeWaitedIn100us += newTimeWaited;
timedKbits += newKbits;
}
return n;
}
void FdInStream::startTiming()
{
timing = true;
// Carry over up to 1s worth of previous rate for smoothing.
if (timeWaitedIn100us > 10000) {
timedKbits = timedKbits * 10000 / timeWaitedIn100us;
timeWaitedIn100us = 10000;
}
}
void FdInStream::stopTiming()
{
timing = false;
if (timeWaitedIn100us < timedKbits/2)
timeWaitedIn100us = timedKbits/2; // upper limit 20Mbit/s
}
unsigned int FdInStream::kbitsPerSecond()
{
// The following calculation will overflow 32-bit arithmetic if we have
// received more than about 50Mbytes (400Mbits) since we started timing, so
// it should be OK for a single RFB update.
return timedKbits * 10000 / timeWaitedIn100us;
}

View File

@@ -23,7 +23,7 @@
#ifndef __RDR_FDINSTREAM_H__
#define __RDR_FDINSTREAM_H__
#include <rdr/InStream.h>
#include <rdr/BufferedInStream.h>
namespace rdr {
@@ -33,31 +33,21 @@ namespace rdr {
virtual ~FdInStreamBlockCallback() {}
};
class FdInStream : public InStream {
class FdInStream : public BufferedInStream {
public:
FdInStream(int fd, int timeoutms=-1, size_t bufSize=0,
bool closeWhenDone_=false);
FdInStream(int fd, FdInStreamBlockCallback* blockCallback,
size_t bufSize=0);
FdInStream(int fd, int timeoutms=-1, bool closeWhenDone_=false);
FdInStream(int fd, FdInStreamBlockCallback* blockCallback);
virtual ~FdInStream();
void setTimeout(int timeoutms);
void setBlockCallback(FdInStreamBlockCallback* blockCallback);
int getFd() { return fd; }
size_t pos();
void readBytes(void* data, size_t length);
void startTiming();
void stopTiming();
unsigned int kbitsPerSecond();
unsigned int timeWaited() { return timeWaitedIn100us; }
protected:
size_t overrun(size_t itemSize, size_t nItems, bool wait);
private:
virtual bool fillBuffer(size_t maxSize, bool wait);
size_t readWithTimeoutOrCallback(void* buf, size_t len, bool wait=true);
int fd;
@@ -65,11 +55,6 @@ namespace rdr {
int timeoutms;
FdInStreamBlockCallback* blockCallback;
bool timing;
unsigned int timeWaitedIn100us;
unsigned int timedKbits;
size_t bufSize;
size_t offset;
U8* start;
};

View File

@@ -35,6 +35,8 @@
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#endif
/* Old systems have select() in sys/time.h */
@@ -49,26 +51,19 @@
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 16384 };
FdOutStream::FdOutStream(int fd_, bool blocking_, int timeoutms_, size_t bufSize_)
: fd(fd_), blocking(blocking_), timeoutms(timeoutms_),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
FdOutStream::FdOutStream(int fd_, bool blocking_, int timeoutms_)
: fd(fd_), blocking(blocking_), timeoutms(timeoutms_)
{
ptr = start = sentUpTo = new U8[bufSize];
end = start + bufSize;
gettimeofday(&lastWrite, NULL);
}
FdOutStream::~FdOutStream()
{
try {
blocking = true;
flush();
while (sentUpTo != ptr)
flushBuffer(true);
} catch (Exception&) {
}
delete [] start;
}
void FdOutStream::setTimeout(int timeoutms_) {
@@ -79,82 +74,29 @@ void FdOutStream::setBlocking(bool blocking_) {
blocking = blocking_;
}
size_t FdOutStream::length()
{
return offset + ptr - sentUpTo;
}
int FdOutStream::bufferUsage()
{
return ptr - sentUpTo;
}
unsigned FdOutStream::getIdleTime()
{
return rfb::msSince(&lastWrite);
}
void FdOutStream::flush()
bool FdOutStream::flushBuffer(bool wait)
{
while (sentUpTo < ptr) {
size_t n = writeWithTimeout((const void*) sentUpTo,
ptr - sentUpTo,
blocking? timeoutms : 0);
size_t n = writeWithTimeout((const void*) sentUpTo,
ptr - sentUpTo,
(blocking || wait)? timeoutms : 0);
// Timeout?
if (n == 0) {
// If non-blocking then we're done here
if (!blocking)
break;
// Timeout?
if (n == 0) {
// If non-blocking then we're done here
if (!blocking && !wait)
return false;
throw TimedOut();
}
sentUpTo += n;
offset += n;
throw TimedOut();
}
// Managed to flush everything?
if (sentUpTo == ptr)
ptr = sentUpTo = start;
}
sentUpTo += n;
size_t FdOutStream::overrun(size_t itemSize, size_t nItems)
{
if (itemSize > bufSize)
throw Exception("FdOutStream overrun: max itemSize exceeded");
// First try to get rid of the data we have
flush();
// Still not enough space?
if (itemSize > (size_t)(end - ptr)) {
// Can we shuffle things around?
// (don't do this if it gains us less than 25%)
if (((size_t)(sentUpTo - start) > bufSize / 4) &&
(itemSize < bufSize - (ptr - sentUpTo))) {
memmove(start, sentUpTo, ptr - sentUpTo);
ptr = start + (ptr - sentUpTo);
sentUpTo = start;
} else {
// Have to get rid of more data, so turn off non-blocking
// for a bit...
bool realBlocking;
realBlocking = blocking;
blocking = true;
flush();
blocking = realBlocking;
}
}
size_t nAvail;
nAvail = (end - ptr) / itemSize;
if (nAvail < nItems)
return nAvail;
return nItems;
return true;
}
//

View File

@@ -26,38 +26,29 @@
#include <sys/time.h>
#include <rdr/OutStream.h>
#include <rdr/BufferedOutStream.h>
namespace rdr {
class FdOutStream : public OutStream {
class FdOutStream : public BufferedOutStream {
public:
FdOutStream(int fd, bool blocking=true, int timeoutms=-1, size_t bufSize=0);
FdOutStream(int fd, bool blocking=true, int timeoutms=-1);
virtual ~FdOutStream();
void setTimeout(int timeoutms);
void setBlocking(bool blocking);
int getFd() { return fd; }
void flush();
size_t length();
int bufferUsage();
unsigned getIdleTime();
private:
size_t overrun(size_t itemSize, size_t nItems);
virtual bool flushBuffer(bool wait);
size_t writeWithTimeout(const void* data, size_t length, int timeoutms);
int fd;
bool blocking;
int timeoutms;
size_t bufSize;
size_t offset;
U8* start;
U8* sentUpTo;
struct timeval lastWrite;
};

View File

@@ -30,7 +30,6 @@ FileInStream::FileInStream(const char *fileName)
file = fopen(fileName, "rb");
if (!file)
throw SystemException("fopen", errno);
ptr = end = b;
}
FileInStream::~FileInStream(void) {
@@ -40,50 +39,17 @@ FileInStream::~FileInStream(void) {
}
}
void FileInStream::reset(void) {
if (!file)
throw Exception("File is not open");
if (fseek(file, 0, SEEK_SET) != 0)
throw SystemException("fseek", errno);
ptr = end = b;
}
size_t FileInStream::pos()
bool FileInStream::fillBuffer(size_t maxSize, bool wait)
{
if (!file)
throw Exception("File is not open");
return ftell(file) + ptr - b;
}
size_t FileInStream::overrun(size_t itemSize, size_t nItems, bool wait)
{
if (itemSize > sizeof(b))
throw Exception("FileInStream overrun: max itemSize exceeded");
if (end - ptr != 0)
memmove(b, ptr, end - ptr);
end -= ptr - b;
ptr = b;
while ((size_t)(end - b) < itemSize) {
size_t n = fread((U8 *)end, b + sizeof(b) - end, 1, file);
if (n == 0) {
if (ferror(file))
throw SystemException("fread", errno);
if (feof(file))
throw EndOfStream();
return 0;
}
end += b + sizeof(b) - end;
size_t n = fread((U8 *)end, 1, maxSize, file);
if (n == 0) {
if (ferror(file))
throw SystemException("fread", errno);
if (feof(file))
throw EndOfStream();
return false;
}
end += n;
size_t nAvail;
nAvail = (end - ptr) / itemSize;
if (nAvail < nItems)
return nAvail;
return nItems;
return true;
}

View File

@@ -22,26 +22,21 @@
#include <stdio.h>
#include <rdr/InStream.h>
#include <rdr/BufferedInStream.h>
namespace rdr {
class FileInStream : public InStream {
class FileInStream : public BufferedInStream {
public:
FileInStream(const char *fileName);
~FileInStream(void);
void reset(void);
size_t pos();
protected:
size_t overrun(size_t itemSize, size_t nItems, bool wait = true);
private:
virtual bool fillBuffer(size_t maxSize, bool wait);
private:
U8 b[131072];
FILE *file;
};

View File

@@ -24,18 +24,14 @@
using namespace rdr;
const int DEFAULT_BUF_LEN = 16384;
static inline int min(int a, int b) {return a<b ? a : b;}
HexInStream::HexInStream(InStream& is, size_t bufSize_)
: bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_LEN), offset(0), in_stream(is)
HexInStream::HexInStream(InStream& is)
: in_stream(is)
{
ptr = end = start = new U8[bufSize];
}
HexInStream::~HexInStream() {
delete [] start;
}
@@ -76,44 +72,24 @@ decodeError:
}
size_t HexInStream::pos() {
return offset + ptr - start;
}
bool HexInStream::fillBuffer(size_t maxSize, bool wait) {
if (!in_stream.check(2, wait))
return false;
size_t HexInStream::overrun(size_t itemSize, size_t nItems, bool wait) {
if (itemSize > bufSize)
throw Exception("HexInStream overrun: max itemSize exceeded");
const U8* iptr = in_stream.getptr();
const U8* eptr = in_stream.getend();
size_t length = min((eptr - iptr)/2, maxSize);
if (end - ptr != 0)
memmove(start, ptr, end - ptr);
end -= ptr - start;
offset += ptr - start;
ptr = start;
while ((size_t)(end - ptr) < itemSize) {
size_t n = in_stream.check(2, 1, wait);
if (n == 0) return 0;
const U8* iptr = in_stream.getptr();
const U8* eptr = in_stream.getend();
size_t length = min((eptr - iptr)/2, start + bufSize - end);
U8* optr = (U8*) end;
for (size_t i=0; i<length; i++) {
int v = 0;
readHexAndShift(iptr[i*2], &v);
readHexAndShift(iptr[i*2+1], &v);
optr[i] = v;
}
in_stream.setptr(iptr + length*2);
end += length;
U8* optr = (U8*) end;
for (size_t i=0; i<length; i++) {
int v = 0;
readHexAndShift(iptr[i*2], &v);
readHexAndShift(iptr[i*2+1], &v);
optr[i] = v;
}
size_t nAvail;
nAvail = (end - ptr) / itemSize;
if (nAvail < nItems)
return nAvail;
in_stream.setptr(iptr + length*2);
end += length;
return nItems;
return true;
}

View File

@@ -19,29 +19,23 @@
#ifndef __RDR_HEX_INSTREAM_H__
#define __RDR_HEX_INSTREAM_H__
#include <rdr/InStream.h>
#include <rdr/BufferedInStream.h>
namespace rdr {
class HexInStream : public InStream {
class HexInStream : public BufferedInStream {
public:
HexInStream(InStream& is, size_t bufSize=0);
HexInStream(InStream& is);
virtual ~HexInStream();
size_t pos();
static bool readHexAndShift(char c, int* v);
static bool hexStrToBin(const char* s, char** data, size_t* length);
protected:
size_t overrun(size_t itemSize, size_t nItems, bool wait);
private:
virtual bool fillBuffer(size_t maxSize, bool wait);
private:
size_t bufSize;
U8* start;
size_t offset;
InStream& in_stream;
};

View File

@@ -25,8 +25,8 @@ const int DEFAULT_BUF_LEN = 16384;
static inline size_t min(size_t a, size_t b) {return a<b ? a : b;}
HexOutStream::HexOutStream(OutStream& os, size_t buflen)
: out_stream(os), offset(0), bufSize(buflen ? buflen : DEFAULT_BUF_LEN)
HexOutStream::HexOutStream(OutStream& os)
: out_stream(os), offset(0), bufSize(DEFAULT_BUF_LEN)
{
if (bufSize % 2)
bufSize--;
@@ -95,18 +95,10 @@ HexOutStream::flush() {
out_stream.flush();
}
size_t
HexOutStream::overrun(size_t itemSize, size_t nItems) {
if (itemSize > bufSize)
throw Exception("HexOutStream overrun: max itemSize exceeded");
void HexOutStream::overrun(size_t needed) {
if (needed > bufSize)
throw Exception("HexOutStream overrun: buffer size exceeded");
writeBuffer();
size_t nAvail;
nAvail = (end - ptr) / itemSize;
if (nAvail < nItems)
return nAvail;
return nItems;
}

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