5
0
mirror of git://git.proxmox.com/git/pve-http-server.git synced 2025-02-01 05:47:15 +03:00

100 Commits

Author SHA1 Message Date
Thomas Lamprecht
59cc81b5c8 bump version to 2.0-14
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:41:59 +02:00
Thomas Lamprecht
e6bd383f86 decode_urlencoded: cope with undefined values
Avoids syslog/journal warning like:
>  Use of uninitialized value $v in substitution (s///) at
>  /usr/share/perl5/PVE/APIServer/AnyEvent.pm line 648.

If one passes a "value-less" GET argument to a request, e.g.,
GET /?debug

Besides the fact that this allows us to even use such arguments it
also is a general improvement against a slight "syslog DOS attack",
because anybody can pass such parameters to the '/' page, and all
proxmox daemons providing a API/UI using libpve-http-server-perl
allow to do such requests unauthenticated (which itself is OK, as
else one could not show the login window at all). As each of such
request produces two log lines in the syslog/journal it's far from
ideal.

A simple reproducer of the possible outcome can be seen with the
following shell script using curl:

> PVEURL='127.0.0.1'
> ARGS='?a'; # send multiple args at once to amplify the per-connection cost
> for c in {a..z}; do for i in {0..9}; do ARGS="$ARGS&$c$i"; done; done
> while true; do curl --insecure --silent --output /dev/null "https://$PVEURL:8006$ARGS"; done

Not really bad, but not nice either, as logging is not too cheap this
has some resource usage cost and noise in the syslog is never nice.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 4a09623bbdb4306ca00685a0f80ce6f05fa42f3b)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:34:52 +02:00
Thomas Lamprecht
d7bc60f4e5 anyevent: rpcenv is optional and from our child instance
This fixes the simple-demo, which was regressed with commit
8782148642e4a09c5852781ec057017cc1145f17 were we falsely assumed that
we always have an rpcenv instance here, but actually that's just
optional as it comes from our child class instance

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(part. cherry picked from commit e52d940029c184fe76e7fd93bf5c09476b3a77bb)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:33:25 +02:00
Thomas Lamprecht
7bcfe16979 buildsys: also cleanup build directory on clean
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 8a29f1fce9dbcb25a46cd68caff0300a872afc07)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:32:31 +02:00
Thomas Lamprecht
2468a05142 buildsys: no need to include arch detection for arch-independent package
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit e6dc4ff34675b17aa63949987a0a7c66796cfab3)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:32:31 +02:00
Thomas Lamprecht
fd891f1bc7 buildsys: clean and distclean are phony targets
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 584d34a7de4c18b1237f6b443b812b76d1bf162f)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-09 14:32:31 +02:00
Thomas Lamprecht
a9fc6893f6 buildsys: use dpkg-dev makefile helpers for pkg info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-21 21:41:37 +02:00
Thomas Lamprecht
d8ff724d8d bump version to 2.0-13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-03 13:56:04 +02:00
Wolfgang Bumiller
090019fa13 forward Host header in proxy_request
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 12:16:38 +02:00
Wolfgang Bumiller
8782148642 store Host header in rpc environment
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 12:16:38 +02:00
Thomas Lamprecht
ea574439f7 tls: make dh to openssl 1.1 compatible
Effective the same approach used in libanyevent-perl 7.140-3[0]
Stretch is also compatible with this, and we can remove it for
buster/PVE 6 once the libanyevent-perl package transitioned to
from unstable to buster, until then do it ourself to have a
functioning api/proxy...

[0]: 7f3d5721bb

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-22 10:32:50 +01:00
Thomas Lamprecht
487cedb5a7 bump version to 2.0-12
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 07:08:11 +01:00
Stoiko Ivanov
7266fc2d97 Add short comment about users of read_proxy_config
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-02-26 07:05:33 +01:00
Stoiko Ivanov
c610c8597c move read_proxy_conf from PVE::API2Tools to new Utils module
move the read_proxy_conf method into a new perl module
'PVE::APIServer::Utils'.
It now takes the proxy_name (e.g. pveproxy, pmgproxy) as variable to be used
for the configfile location (/etc/default/$proxy_name)

This serves as preparation to make pmgproxy configurable in the same way as
pveproxy.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 07:05:12 +01:00
Stoiko Ivanov
fac83ab296 add ssl fallback values to AnyEvent->new
This allows for sharing the values between pveproxy and pmgproxy

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-02-26 07:01:51 +01:00
Thomas Lamprecht
025b303821 followup: adapt coding style to surrounding
compression is set to true by default, and we only want to be able to
switch it off, not force it on.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-21 10:44:28 +01:00
Stoiko Ivanov
404175ada2 Don't override explicit $nocomp with default
By making compression configurable the $nocomp flag in response got set to
the configured (or default) setting, irrespective of the explicitly passed
value to response.

This broke (e.g.) noVNC connections

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-02-21 10:40:16 +01:00
Stoiko Ivanov
23dfd1b7c9 Add configurable 'compression'
Rationale for disabling compression is the potential for being affected by
the BREACH (CVE-2013-3587) attack and it's considered good practice for https
configuration (see e.g. [0]).

The default remains: to have compression enabled for compressible file-types.

[0] https://cipherli.st/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-02-19 17:14:14 +01:00
Stoiko Ivanov
54c0ead916 Add configurable 'honor_cipher_order'
Needed to fix #2069.

Prefering the ciphers set in the server, instead of relying on the offer of the
client is considered good practice in TLS1.[012] (see e.g. [0]).

[0] https://cipherli.st/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-02-19 17:14:14 +01:00
Thomas Lamprecht
55af714ea8 bump version to 2.0-11
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-28 10:42:07 +02:00
Dominik Csapak
6c31d13ebc fix #1935: read empty line after 200 OK
commit a4d8bbafbe400be78bebeab169963025dc46e29b
introduced an additional empty line after '200 OK'
for remote-viewer 7 to work, but we also have to read this line
in our own proxy reader else the connection to a remote node does
not work

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-28 09:40:15 +02:00
Rhonda D'Vine
131889e977 Use https for Homepage URL
Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2018-09-06 11:49:21 +02:00
Rhonda D'Vine
5e9788ddd7 Add unzip to Build-Depends
Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2018-09-06 11:49:21 +02:00
Dietmar Maurer
60f28d48c2 bump version to 2.0-10 2018-08-17 08:30:07 +02:00
Dominik Csapak
a4d8bbafbe fix #1869: send correct http response in spice proxy
the glib implementation of the http proxy correctly checks the
http response (response code, followed by an empty line)
so we need to answer with the correct status

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-17 08:28:36 +02:00
Dietmar Maurer
ed8d2557ae websocket: set $max_payload_size = 128*1024; (131072)
AnyEvent checks rbuf_max after calling the callback (too late), so
we can receive larger data, because AnyEvent uses MAX_READ_SIZE=131072
to fill the buffer.

So a more elegant solution is to set $max_payload_size=128*1024. At least
I am not able to receive rbuf larger than 128*1024 now. But I keep the
protection from the previous patch - just to be sure.
2018-06-07 10:08:59 +02:00
Dietmar Maurer
cdb6932787 limit websocket frame size
AnyEvent checks rbuf_max after calling the callback (too late), so
we can receive larger data.
2018-06-06 16:41:30 +02:00
Dietmar Maurer
25c6e03f71 bump version to 2.0-9 2018-05-28 10:36:26 +02:00
René Jochum
ed979f7a2c Fix #1684 WebSocket proxy behind a buffered proxy.
The given patch fixes incoming WebSocket traffic behind buffered Proxies
like NGINX.

NGINX buffers multiple requests from the Browser into one frame and sends that to pveproxy,
before this patch we then processed the first message of the frame and cleared the buffer which
may contained more messages.
With this patch we process each message and clear the buffer right.

This fixes the "NoVNC blank screen" problem users reported on the forums.
2018-05-28 10:27:08 +02:00
Thomas Lamprecht
0ef7efdb9d fixup no newline at end of .gitignore 2018-05-25 16:42:05 +02:00
René Jochum
bc2028c9be Add .gitignore
Signed-off-by: René Jochum <rene@jochums.at>
2018-05-25 16:41:23 +02:00
Fabian Grünbichler
8a424513a4 bump version to 2.0-8 2017-12-11 15:36:42 +01:00
Thomas Lamprecht
d8327719e3 auth_handler: respond with passed error if we get a PVE::Exception
Allows to fix a problem where a logged in connected client was logged
out because we could not verify him for this call as the cluster
filesystem was unavailable.

If we get such a exception then use it for responding.
THis is save as no logged out client can get ever do anything where
login privileges are required and a logged in client cannot to
anything during the problematic period, but does not gets logged out.
Partail fix for #1589

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-12-11 14:53:24 +01:00
Wolfgang Bumiller
b1e84aa34d whitespace fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-11-24 09:25:55 +01:00
Dominik Csapak
ae5e0a954b add 'map' filetype to http-server
those files are used for javascript source maps
(useful for debugging purposes)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-11-24 09:19:21 +01:00
Dominik Csapak
e3b29cc9da do not send websocket status code to port
this is not data, but the status code,
so print it in debug mode instead

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-11-24 09:19:21 +01:00
Dietmar Maurer
d80c5f14c1 bump version to 2.0-7 2017-11-14 08:05:38 +01:00
Dietmar Maurer
80d61dd6bb add content type application/x-compressed-tar 2017-11-09 07:17:49 +01:00
Dietmar Maurer
20a61215ce allow API calls to download file contents.
We use this to download backup files with pmg.
2017-11-08 09:23:30 +01:00
Fabian Grünbichler
c26f8b28fb build: reformat debian/control
using wrap-and-sort -abt
2017-10-04 11:05:33 +02:00
Dietmar Maurer
c5b723232e bump version to 2.0-6 2017-08-10 12:06:11 +02:00
Dietmar Maurer
66a7a3a38d pass $format to rest_handler()
Used by PMG::HTTPServer.
2017-08-10 08:47:32 +02:00
Wolfgang Bumiller
b06960b9e1 bump version to 2.0-5 2017-06-02 12:49:56 +02:00
Dominik Csapak
3d12de14cc add json/mp3/oga/svg filetypes
those are needed for the noVNC upgrade

svg: button images
mp3/oga: bell sound of terminal
json: language files

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-05-24 13:10:39 +02:00
Thomas Lamprecht
967dcb7682 increase max POST data limit to 64 KB
this matches also our wbuf_max settings of our AnyEvent handle

Tested with 1000 parallel started dummy POST request with 64KB
payload, wh

It should not be too problematic to increase the limit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-05-24 11:28:22 +02:00
Dietmar Maurer
e703c558be bump version to 2.0-4 2017-05-02 11:56:13 +02:00
Dietmar Maurer
256da58194 assume all parameters are utf8 encoded
Previously, we called decode_utf8_parameters(), which only encoded
some parameters. This was just an optimization, and it turend out to
be error prone (for example passwords also contain utf8 parameters).
2017-05-02 11:54:29 +02:00
Wolfgang Bumiller
e8ae1f090b buildsys: clean: remove *.buildinfo 2017-04-27 14:02:51 +02:00
Dietmar Maurer
c6cbc95f24 bump version to 2.0-3 2017-04-24 07:43:50 +02:00
Dietmar Maurer
2fd728c93b avoid locale specific time stamps 2017-04-24 07:39:27 +02:00