Commit Graph

3065 Commits

Author SHA1 Message Date
Dietmar Maurer
edc588857e add global var to indicate server shutdown requests 2019-04-01 12:05:11 +02:00
Dietmar Maurer
c76ceea941 src/server/rest.rs: use formatter to encode errors 2019-04-01 08:04:12 +02:00
Dietmar Maurer
24c023fe47 src/server/rest.rs: generate csrf token if we have a valid ticket
This is important if the user reloads the browser page.
2019-04-01 07:52:30 +02:00
Dietmar Maurer
022b626bc0 src/server/rest.rs: correctly extract content type 2019-03-19 12:50:15 +01:00
Wolfgang Bumiller
50e95f7c39 daemon: simplify daemon creation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-03-19 12:12:54 +01:00
Wolfgang Bumiller
3aa2dbc857 tools: daemon: rename some structs
Reloadable resources are now 'Reloadable' instead of
'ReexecContinue'.

The struct handling the reload is a 'Reloader', not a
'ReexecStore'.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-03-19 11:09:46 +01:00
Wolfgang Bumiller
14ed3eb57c tools: implement ReexecContinue for tokio's TcpListener
This is the only thing we currently need to keep alive for
reloads.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-03-18 12:29:18 +01:00
Wolfgang Bumiller
66c138a51a tools: daemon: add a default signalfd helper
Proxy and daemon for now just want to handle reload via
`SIGHUP`, so provide a helper creating the signalfd stream
doing that - this is simply a filtered stream which passes
the remaining signals through, so it can be used exactly
like the signalfd stream could before to add more signals.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-03-18 12:29:18 +01:00
Wolfgang Bumiller
946995d984 tools: add daemon helpers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-03-18 12:29:18 +01:00
Dietmar Maurer
6dd8bfb84b src/tools/ticket.rs: define const TICKET_LIFETIME 2019-03-05 12:56:21 +01:00
Dietmar Maurer
b9febc5f1c src/tools/file_logger.rs: class to log into files 2019-03-01 09:34:29 +01:00
Dietmar Maurer
9b4e1de1c0 rc/server/rest.rs: allow to pass parameters as application/json 2019-02-27 12:37:53 +01:00
Wolfgang Bumiller
3dc99a5049 cleanup
Error::from is already a function taking 1 parameter,
there's no need to wrap it with `|e| Error::from(e)`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-02-18 13:21:27 +01:00
Dietmar Maurer
435615a34a src/server/rest.rs: correctly insert NoLogExtension() 2019-02-18 06:54:12 +01:00
Dietmar Maurer
bc6fa1684e src/server/rest.rs: get_index() include username and CSRF token
When we have an valid ticket. Also delay get_index() if called with
an invalid ticket.
2019-02-17 19:28:32 +01:00
Dietmar Maurer
c4c7466024 src/server/rest.rs: factor our normalize_path() 2019-02-17 17:31:53 +01:00
Dietmar Maurer
fce8be6fe1 src/server/rest.rs: improve logs for unauthorized request 2019-02-17 17:18:44 +01:00
Dietmar Maurer
b1c1c468ee improve api_schema module structure 2019-02-17 10:16:33 +01:00
Dietmar Maurer
304bfa59a8 rename src/api to src/api_schema 2019-02-17 09:59:20 +01:00
Dietmar Maurer
124b26b892 cleanup auth code, verify CSRF prevention token 2019-02-16 15:52:55 +01:00
Dietmar Maurer
1aff635a23 server/rest.rs: add method to log message 2019-02-15 10:16:12 +01:00
Dietmar Maurer
1314000db7 server/rest.rs: log full error messages 2019-02-15 09:55:12 +01:00
Dietmar Maurer
8daf9fd839 server/rest.rs: use a protocol extension to avoid double log
Instead of modifying the response header itself.
2019-02-14 16:04:24 +01:00
Dietmar Maurer
9bbd574fba avoid double logging of proxied requests 2019-02-14 13:28:41 +01:00
Dietmar Maurer
e683d9ccb7 src/server/rest.rs: log failed requests 2019-02-14 13:07:34 +01:00
Dietmar Maurer
50ff21da59 src/client/http_client.rs: try to login
use an environment var to store passphrase (PBS_PASSWORD)
2019-02-13 14:31:43 +01:00
Wolfgang Bumiller
fe3b25029b remove some rather inconvenient debug output
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-02-04 15:34:38 +01:00
Dietmar Maurer
9707fdadd7 implement relead_timezone flag 2019-02-01 10:04:46 +01:00
Dietmar Maurer
5d63509787 delay unauthorized request (rate limit) 2019-01-31 14:34:21 +01:00
Dietmar Maurer
8f75d998be move http error class to router.rs 2019-01-31 13:22:30 +01:00
Dietmar Maurer
0ef7c190e1 server/rest.rs: verify auth cookie 2019-01-31 12:22:00 +01:00
Dietmar Maurer
200b5b87ea Utils.js: fix cookie handling
Use unsecure cookie foör testing.
2019-01-31 10:08:08 +01:00
Dietmar Maurer
1701fd9bd4 api2/access.rs: add ticket api 2019-01-30 15:16:10 +01:00
Dietmar Maurer
c4f2b212c5 server/rest.rs: simplify proxy code
Only pass neccessary parameters.
2019-01-28 18:22:16 +01:00
Dietmar Maurer
8ec1299ab3 server/rest.rs: implement proxy_sync_api_request 2019-01-28 18:06:42 +01:00
Dietmar Maurer
1aa3b197a6 server/rest.rs: add proxy_sync_api_request() dummy 2019-01-28 17:30:39 +01:00
Dietmar Maurer
4e5a5728cb server/formatter.rs: fix extjs error format 2019-01-28 13:44:48 +01:00
Dietmar Maurer
08e45e3573 src/bin/proxmox-backup-proxy.rs: implement unpriviledged server
We want to run the public server as user www-data. Requests needing
root priviledges needs to be proxied to the proxmox-backup.service, which
now listens to 127.0.0.1:82.
2019-01-28 13:29:58 +01:00
Dietmar Maurer
42e06fc5ca RpcEnvironment: implement set_user() and get_user() 2019-01-27 10:52:26 +01:00
Dietmar Maurer
23db39488f RpcEnvironment: add environment type enum RpcEnvironmentType 2019-01-27 10:33:42 +01:00
Dietmar Maurer
084ccdd590 also pass rpcenv to async handlers 2019-01-27 10:18:52 +01:00
Dietmar Maurer
a0a545c720 move rpc environment implementation to separate files 2019-01-26 15:08:02 +01:00
Dietmar Maurer
32f3db27bd api: pass RpcEnvirnment to api handlers 2019-01-26 14:50:37 +01:00
Dietmar Maurer
b1be01218a server/rest.rs: fake login cookie 2019-01-23 12:49:10 +01:00
Dietmar Maurer
c643065864 rename api3 back to api2
There is no real need to change the path, so using api2 we can reuse
all helpers (like tools from proxmox widget toolkit).
2019-01-22 12:10:38 +01:00
Dietmar Maurer
e35404deb7 remove crate tokio-codec (seems to be part of tokio now) 2019-01-20 14:28:06 +01:00
Dietmar Maurer
85722a8492 api/router.rs: rename ApiUploadMethod to ApiAsyncMethod
We can use this for uploads and downloads ...
2019-01-19 16:42:43 +01:00
Dietmar Maurer
6e219aefd3 api3/admin/datastore/upload_catar.rs: verify content type ("application/x-proxmox-backup-catar") 2019-01-17 12:43:29 +01:00
Dietmar Maurer
90e1d858e0 api/router.rs: return Result in upload handler 2019-01-17 12:03:38 +01:00
Dietmar Maurer
148b327e63 server/rest.rs: correctly pass query/url parameters 2019-01-16 13:58:36 +01:00