Commit graph

177 commits

Author SHA1 Message Date
Pranav Kant
af13e5927d Open the log channel explicitly to avoid file creation inside jail
Change-Id: Ida66861e0e1c5925dbbf53d564a829eaf0fd15c7
2017-07-12 15:14:58 +05:30
Pranav Kant
fde57adbbf Introduce hard mode when we are OOM
Start killing documents when memory usage goes above threshold.

Also make it possible to close documents from admin instance.
In DocumentBroker::closeDocument, just set the _stop flag and wake
up the polling thread which will terminate the children, instead of
manually terminating the children.

Change-Id: Ie70e05b3fb6ea816a87b6dcfaed92cdddb94aa90
2017-07-07 21:14:53 +05:30
Andras Timar
ad8bffa04a configure option to disable SECCOMP
Change-Id: I8120674b60d388a3f85190631469a112c4af9266
Reviewed-on: https://gerrit.libreoffice.org/39408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-03 11:43:01 +02:00
Michael Meeks
73a87493f0 Use WireIds instead of long hashes to identify tiles efficiently.
Changes protocol to use 'wid' instead of 'hash' everywhere. Wire-ids
are monotonically increasing integers that can be mapped to hash
values for all of the hash values and tiles we cache internally.

Change-Id: Ibcb25817bab0f453e93d52a6f99d3ff65059e47d
2017-06-20 21:49:44 +01:00
Michael Meeks
8fb48811ec Protocol - only match complete token names.
Change-Id: I027e29da8cc6c48a0d896fa41516934a3ff71b43
2017-06-20 21:49:44 +01:00
Michael Meeks
7ea5f71a7b Units: allow filtering of user alerts.
Catch things that kill tests like disk-full earlier.

Change-Id: Ib50b516063305f2fc93b662ec3ad9ab6c52c6c92
2017-06-16 20:25:23 +01:00
Pranav Kant
db13014e00 Update modifiedTime for local files unconditionally
Also teach logger to print timestamp object.

Change-Id: Ia13836814c195cef92f5dafd8245c9958600876d
2017-06-16 19:49:37 +05:30
Ashod Nakashian
44d8876f27 Remove data rlimit
Seems to have no effect, so gone in
favor of RLIMIT_AS (virtual memeory).

Change-Id: I210879ec9285f420c9f9839cdabf45c42d865fb3
Reviewed-on: https://gerrit.libreoffice.org/38720
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-13 06:27:12 +02:00
Ashod Nakashian
6de3adcf9c wsd: pass default rlimits to forkit from config
Change-Id: I84d271f460f0fb1d03a973107c32265d84bf2841
Reviewed-on: https://gerrit.libreoffice.org/38675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:18:31 +02:00
Ashod Nakashian
92d29b1ce7 wsd: support setting process rlimits
Change-Id: I7117e6843d2ebc919d7d2303cc593de888cc54b1
Reviewed-on: https://gerrit.libreoffice.org/38672
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:17:21 +02:00
Aditya Dewan
9502741590 tdf#107278 admin console: adding graph to track CPU load
Change-Id: Idb07fe4139dd639a49ce1545cc15895f74876b06
Reviewed-on: https://gerrit.libreoffice.org/38425
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-06-08 12:58:12 +02:00
Michael Meeks
3101fa510d Accumulate I/O stats per document.
Change-Id: Ie2f5647e65070ddd828f048820efd38b600f9133
2017-06-02 20:41:25 +01:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Pranav Kant
7a4bc5b95a admin-console: Check the password against hashed value in config
The new password hash property is called secure_password in the config
file. `loolconfig` tool should be used to set the password hash in
appropriate format with desired salt length, password length, number of
iterations in PBKDF2.

To be backward compatible, plain-text password for admin-console in
config file is still accepted in case secure_password property is
missing from the config file.

Change-Id: If229999dac62856e368555c0242c4aa6f8061fba
2017-05-25 01:18:31 +05:30
Ashod Nakashian
407c538f04 Correctly send termination reason to clients
Fixes the case when the client reconnects on idle
disconnection (because it never got the 'close: idle'
message).

Also, show informative message to users in this case
instead of grey screen.

Change-Id: Ia2e1f2ffefe6d35dd1552e7cc44e490aab86c600
Reviewed-on: https://gerrit.libreoffice.org/37891
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:05:28 +02:00
Pranav Kant
8a02e7a8fa wsd: Debugging environment vars to debug storages
Also, extend the LOOLProtocol::tokenize to accept a custom delimeter.

Change-Id: I7f789e703c5c8d2ad325b3dd149ba888c722f5f3
2017-05-17 16:30:33 +05:30
Ashod Nakashian
47c01440ba wsd: logs
Change-Id: I286c4c7415b114f51f3258bd6d50f8e103ea6c75
Reviewed-on: https://gerrit.libreoffice.org/37611
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:14:55 +02:00
Ashod Nakashian
484fcd63a5 wsd: corrections to replace and unittests
Change-Id: I0e03deaa710ba722a97c9f857b514f8ecb0e1682
Reviewed-on: https://gerrit.libreoffice.org/37609
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:13:21 +02:00
Ashod Nakashian
d267b86bbd wsd: include version in http agent strings
And move the WOPI agent string to Common.hpp.

Change-Id: Ife679705bcd6914ddd45ad50446e690fb22dd317
Reviewed-on: https://gerrit.libreoffice.org/37607
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:10:06 +02:00
Ashod Nakashian
9798eafb8c wsd: random jail paths instead of pid
Jail paths are now generate from a PRNG
instead of using the PID of the kit process.

The PRN is converted to base-64 and used
as the directory name where a given
kit is jailed.

Change-Id: I8e4bc35d9ccdfdae0e542ab707c417cd29ad52f3
Reviewed-on: https://gerrit.libreoffice.org/37372
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-08 04:59:12 +02:00
Michael Meeks
9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Jan Holesovsky
2a2d863321 Fix build with older kernel versions.
Change-Id: I28fc6687a42ac428413d644e9fd55870cd5936fa
2017-05-02 17:24:44 +02:00
Michael Meeks
31818b7dd6 Trap rather than kill from seccomp and log invalid syscalls.
Change-Id: I319c10776476fea865dd7a95921f1b08b689e09f
2017-04-28 19:06:20 +01:00
Michael Meeks
08c70f1315 Signal safe number logging (lame but useful).
Change-Id: I0b6095fc08dcc237a224b5942ab5a09e6820e43f
2017-04-28 19:05:45 +01:00
Michael Meeks
a7eeacf9e0 SigUtil: split out dumpBacktrace.
Change-Id: I33121de341051bf40ae0d42d1d6d44843d6d1e97
2017-04-28 18:08:57 +01:00
Michael Meeks
bc31103a5d Seccomp: filter more syscalls.
Change-Id: I2cc203d48e4592c5f182e675383e96a13b87bc36
2017-04-28 17:55:14 +01:00
Michael Meeks
7f4f752667 Initial seccomp work.
Add a list of unhelpful looking system calls to improve containment.

Change-Id: I2e4bf3e0a6a752d427299728663d17120586bb10
2017-04-28 14:26:21 +01:00
Michael Meeks
c8d1c18cb5 Revert "wsd: correctly remove request from socket buffer"
This reverts commit c851c3e93b.
2017-04-25 22:49:08 +01:00
Ashod Nakashian
c851c3e93b wsd: correctly remove request from socket buffer
POST requests require the full request to be
left in the socket buffer to be parsed in full.
But GET requests, especially WS upgrade, must
have the request cleared from the socket, as
there is more data expected to be read after
the upgrade, which happens by the DocBroker
thread, so clearing the buffer must be done
before the upgrade.

This patch accomodates these two conflicting
cases and refactors the code slightly to
make it more structured and readable.

Change-Id: Ia7357a745a3900f986099ba14af2a0946023018b
Reviewed-on: https://gerrit.libreoffice.org/36873
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:49:33 +02:00
Michael Meeks
f72b7d2ba1 Don't set the buffer size to zero.
This slows things down terribly, particularly the setting on the websocket
made tiles appearing one by one. Let's keep the possibility to zero the buffer
sizes for debugging, but hide that behind an env. variable (and in debug
builds only anyway).

Change-Id: Ie4d2cdb3c0ec3c50f1a2b4f9941a462ac4f2d196
2017-04-19 10:58:18 +02:00
Jan Holesovsky
1585cbdb6b Merge document size changes callbacks in the message queue.
Change-Id: I1a540b17f2a72c374568db834a30b814878e9032
2017-04-07 12:13:45 +02:00
Jan Holesovsky
67586d3fdb Don't bloat the message queue with unprocessed status indicator changes.
Change-Id: I87f254a94183b5a97cfb1e4eb49ddea7f88258bf
2017-04-07 11:30:12 +02:00
Michael Meeks
2d1764d30e Dump ClientSession and MessageQueue state too. 2017-04-05 17:59:29 +01:00
Jan Holesovsky
37387518f4 Suppress assert()'s in the production builds.
Change-Id: I2074ed335b7201337e6519440ff6bed1809be915
2017-04-05 12:03:33 +02:00
Ashod Nakashian
95d51493aa wsd: remove nextmessage
This was a workaround to Poco's limitation
of requiring socket receiveFrame be given
preallocated buffer, which couldn't be
exceeded by a larger payload. This meant
the receiver had to know the maximum
payload in advance.

Since only the Kit uses Poco sockets,
and the Kit never receives large payloads,
this preamble is now obsolete.

100% (94/94) of old-style tests PASS.

Change-Id: I76776f89497409e5755e335a3e25553e91cf0876
Reviewed-on: https://gerrit.libreoffice.org/36037
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:09 +00:00
Ashod Nakashian
e0822f8516 wsd: better thread affinity logging
Change-Id: I9e4bc3fe864aa409dc4874a9d6fc4ab22bfea592
Reviewed-on: https://gerrit.libreoffice.org/36029
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:11:57 +00:00
Michael Meeks
2bca560feb Add hook for disk space check. 2017-03-31 17:18:41 +01:00
Michael Meeks
e79c5f9083 Use process name for a thread if no name is set (yet). 2017-03-31 11:21:35 +01:00
Pranav Kant
ce1084b74f wsd: Send readonly info to clients
With this every other client would be able to know about other client's
permission i.e whether they have opened the document as readonly. This
could be important eg: to hide the cursor overlay of readonly users in
the UI or to mark these users as readonly in the userlist.

Change-Id: I5dcb1b4e5a22c9b546d16b69b9216cc7653cff04
2017-03-31 12:20:09 +05:30
Michael Meeks
ae0dba1088 Cleanup prctl / gettid system-call thrash on logging.
Makes the strace look much prettier.
2017-03-30 18:14:40 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Ashod Nakashian
30d58f96a4 wsd: avoid unnecessary temp string construction
...when sending text messages over socket and
make return value indicative of success/failure.

Change-Id: Ie4d99103b0d49d238152f7da3155ebcb6ccd4e22
2017-03-29 23:55:19 -04:00
Ashod Nakashian
f1c371555a wsd: kill unused headless stuff
Change-Id: Ic4ee7603ecd7acd10e4499457de181342f2d7483
Reviewed-on: https://gerrit.libreoffice.org/35735
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-27 03:19:11 +00:00
Ashod Nakashian
b69d5683c3 wsd: log messages upon construction
Change-Id: Id8f2eeaa1fabf538af0c327a971d35cc17cb3596
Reviewed-on: https://gerrit.libreoffice.org/35734
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-27 03:18:29 +00:00
Jan Holesovsky
9f17050a7d Pass the locale settings from loleaflet to wsd/kit.
Change-Id: Ie530db73cfbdb62787f16eae0f4b07fbf8b8acb4
2017-03-24 12:34:32 +01:00
Ashod Nakashian
7096133f07 wsd: log thread affinity violations
Change-Id: Ib1317bc71f9162f005e0ce9b8c715bbce656db73
2017-03-20 00:41:53 -04:00
Pranav Kant
5a12b68b01 Fix unit test timeout interfering with normal run
Otherwise, loolwsd exits immediately upon start

Change-Id: I3bdf438797be162b8a44bb47ee1ddde7626dcc64
2017-03-17 12:44:23 +05:30
Michael Meeks
bb3fa00631 UnitPrefork - restore most of the functionality.
No need for the memory reporting bits now that Admin gets this right.
2017-03-16 19:13:14 +00:00
Michael Meeks
ab67d605e6 Unit tests: use WSD's main socket-poll for test timeouts. 2017-03-16 18:52:49 +00:00
Michael Meeks
8749f4f2e3 Cleanup unit test hooks. 2017-03-16 18:32:12 +00:00