Commit graph

196 commits

Author SHA1 Message Date
Ashod Nakashian
a48917d052 killpoco: use http::Response in admin file serving
Change-Id: I9ad49002bc85071770aba08c23e0210bb10ff55b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
4dfb7ee312 killpoco: use http::Response for Admin metrics
Change-Id: I86eed98061bdb24d4bca8de452e4d4f925f27e93
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
882350ed70 wsd: remove sendWithDateAndAgent
The explicit header entries were needed
with Poco, but since we always set them
in our http::Response constructor, these
are redundant.

Change-Id: Ifde48fd3048018747dae3e84560b31960e511a25
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
00d483f67d wsd: minor cleanup of Admin::getLogLines
Change-Id: Ic238dcb7996c2967355366c062f0b94912d7adc7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
0a78d691ab wsd: parse config only once in Admin
Change-Id: I7b21f526145abd7f16eb4da8b2d4784798cf8b9b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
21b0394828 wsd: better empty string operations
Change-Id: Ic14efcaa8a1c345b875c27446b16f51740c55efa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Noel Grandin
8a8e55c16e replace Poco in StreamSocket::send
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Change-Id: I987cc515e27fbaf4e778a5ac6f005a43ff88be71
2024-02-27 13:17:12 +00:00
Aron Budea
81d743281a Capture this explicitely by name
To avoid the following warning in C++20:
error: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I8b195d675ddc87fa6b16f7240a046fac9a7769e1
2024-02-01 08:30:30 +01:00
Ashod Nakashian
84a0c1eec1 wsd: log cgroup memory and in GB
Change-Id: Ifda8891721228acf50e3348d43e902498e6d884d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Miklos Vajna
c97e4e2720 admin: handle errors while decoding URLs
#9 0x7f1fb8b06ee7 in __cxa_throw (/usr/lib64/libstdc++.so.6+0xb7ee7) (BuildId: c74eca671e2dd0f063706372d103f8acef88f1e3)
    #10 0x7f1fb808645b in Poco::URI::decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, bool) (/usr/lib64/libPocoFoundation.so.92+0x15145b) (BuildId: 32601204eb877c998d0122c4bef1c7c08c8d0285)
    #11 0x55a887e4bb8b in Util::decodeURIComponent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/common/Util.cpp:830:9
    #12 0x55a8874b7547 in AdminSocketHandler::handleMessage(std::vector<char, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/wsd/Admin.cpp:392:20

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I87f358d218e8774d5c82f1fb12e2f56898e7581e
2024-01-16 21:36:43 +01:00
Caolán McNamara
3b86ee3ba2 cid#340393 silence Division or modulo by float zero
and

cid#340397 Division or modulo by float zero

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0e2fae591f726eca0f3a605cd8c09d2de25d8db7
2024-01-15 08:38:31 +01:00
Ashod Nakashian
61cf7b9601 wsd: clean up unused header includes
Clang-tidy recommendation driven header
include clean-up.

Change-Id: I30c32866b7798e70df0463ee6bc7a0bcc3de5049
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-08 08:38:48 +01:00
Ashod Nakashian
373c04fe4e wsd: admin: use the cgroup limit as available memory
This applies the cgroup memory limit, if set,
such that if it is lower than the configured
memproportion percentage, we do not exceed it.
Otherwise, we risk running out of our cgroup
limit and by then it is too late to do anything
but die due to OOM.

This also moves the logging of the cgroup memory
stats from COOLWSD into Admin, to avoid duplicate
logging.

Also updated the description of memproportion
config entry to account for the cgroup logic.

Change-Id: I870ae61c1260eb2b3275bd2fa1a4c48ff30957a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-12-30 10:36:44 +00:00
Ashod Nakashian
a44e9411a8 wsd: admin: minor clean-up of memory-tracking members
Change-Id: If06545a097cd13318870f0e6f675367985035a12
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-12-30 10:36:44 +00:00
Jaume Pujantell
35d6e2925f use isKitInProcess() instead of KIT_IN_PROCESS
Removed all uses of KIT_IN_PROCESS, used Utils::isKitInProcess()
when necessary. Also removed the now unused parameter 'limit' from
forkLibreOfficeKit.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I068d3f55ab49076590f111847c87b3188f4d25d0
2023-12-18 10:34:10 +00:00
Rash419
f203a4d68f admin: indirection add new command for sanity check
- routetoken_sanity_check

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ieaabcd044b65ad0620089ae6413e3f626ff68c4c
2023-12-05 10:46:31 +05:30
Miklos Vajna
89f080ba45 wsd: check for nullptr channel in AdminSocketHandler
This can happen like this:

    #8 0x7f14fdf4ec86 in std::terminate() (/usr/lib64/libstdc++.so.6+0xb7c86) (BuildId: c74eca671e2dd0f063706372d103f8acef88f1e3)
    #9 0x7f14fdf4eee7 in __cxa_throw (/usr/lib64/libstdc++.so.6+0xb7ee7) (BuildId: c74eca671e2dd0f063706372d103f8acef88f1e3)
    #10 0x55ddc5b906d2 in Poco::AutoPtr<Poco::Channel>::operator->() /usr/include/Poco/AutoPtr.h:232:4
    #11 0x55ddc5b7eb07 in AdminSocketHandler::handleMessage(std::vector<char, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/wsd/Admin.cpp:236:13

Note how LOG_ANY() assumes that Log::logger().getChannel() is not
nullptr (so the caller has to check for it), while the more typical
variants with a log level like LOG_TRC() already do a similar check via
LOG_CONDITIONAL().

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I5e1379f33e6640fd07de673ef0d07b1d4d611c89
2023-12-01 15:35:39 +00:00
Miklos Vajna
07db53bb6e wsd: handle Poco::URISyntaxException in AdminSocketHandler::handleMessage()
terminate called after throwing an instance of 'Poco::URISyntaxException'
    #8 0x7f014e70dc86 in std::terminate() (/usr/lib64/libstdc++.so.6+0xb7c86) (BuildId: c74eca671e2dd0f063706372d103f8acef88f1e3)
    #9 0x7f014e70dee7 in __cxa_throw (/usr/lib64/libstdc++.so.6+0xb7ee7) (BuildId: c74eca671e2dd0f063706372d103f8acef88f1e3)
    #10 0x7f014dcea45b in Poco::URI::decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, bool) (/usr/lib64/libPocoFoundation.so.92+0x15145b) (BuildId: 32601204eb877c998d0122c4bef1c7c08c8d0285)
    #11 0x56496c48320b in Util::decodeURIComponent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/common/Util.cpp:800:9
    #12 0x56496bb21ec0 in AdminSocketHandler::handleMessage(std::vector<char, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/wsd/Admin.cpp:84:20

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I07551d92be5ae677d1cf63f0f0092fb838583337
2023-11-29 15:41:00 +00:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Michael Meeks
47b89b32ef spdx: improve machine and human readability of headers.
Change-Id: I1b6dcd2ec1fbef6556d70b8af3ccfd5d6a95c59a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-10-31 10:33:07 +00:00
Caolán McNamara
7c9c0f487e cid#321979 Big parameter passed by value
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id514b14c6bfda08cd561d5c75ab2430b933a8919
2023-10-20 17:01:47 +02:00
Rash419
11a0e78ed4 admin:log activities irrespective of logging.level
- It logs activities like when admin logged in, authenticated
  metrics endpoint accessed, external monitor getting connected
  and admin actions like kill the document etc

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I059f6b6ee0d8269aec7e3f521622773e348304a3
2023-10-17 14:57:10 +05:30
Rash419
3c20783ac6 admin: added id field in verifyauth msg
- this id will help to identify which adminClusterOverview socket
  has sent verifyauth message from controller

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ic09b33c9eb2c0072f84b7147acc673031dbac0d8
2023-10-10 13:10:44 +05:30
Rash419
855429dad5 admin: send serverId with migrate msg
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I484620df234a1dcbedeba5b5102dacee7451015a
2023-09-07 18:35:32 +05:30
Rash419
303001623f admin: use sendTextFrame for verifyauth msg
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib5c4144df168f5a649ce2a4a3a8690eb9de0f723
2023-08-28 10:29:29 +05:30
Rash419
319c6e4570 admin: add new command to verify auth token
- original auth command shutdowns the socket connection
  if the token is invalid
- in controller's case we just want to verify the token
  for adminClusterOverivew socket connection

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I2e640a746c839ea6f4494ddbdfcb8f924150906f
2023-08-28 10:29:29 +05:30
Ashod Nakashian
efe874f89c wsd: simplify shutdown and termination flagging
With the use of a single flag for both, the
logic is now less ambiguous, as we cannot have
termination flagged without also implying
shutting down.
The assertions are no longer needed.

Now that setting the termination flag
explicitly implies having the shut down flag
as well, the checks are simpler. We only
need to check that the shutdown is not set
to continue running as normal, since having
the termination flag must perfoce mean shut
down is also set, there is no need to check
both.

Change-Id: I99e22f5668385182b0594040a8e3354b55e74642
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-14 16:32:50 +02:00
Caolán McNamara
1cd88f217e cid#321976 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2207cc530e1773f29cf540ea2ff9c6f44c4c237b
2023-08-10 08:47:25 +02:00
Caolán McNamara
2119a19881 cid#321981 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6c2d30c8db254beb6b20aae7891b089a986a4df8
2023-08-09 13:39:23 +02:00
Caolán McNamara
1d179cdf76 cid#321981 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I92d66a3d497d574d819f18960bff5b60e180b715
2023-08-04 10:17:58 +02:00
Caolán McNamara
7cb1dfd4eb cid#321977 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I50f94b290e40b11d555c51448630835d71a62019
2023-08-04 10:17:58 +02:00
Henry Castro
47485adc3e admin: add access token
The access token will validate the session
when a websocket is connected to the server.

Change-Id: I008b04a499ab0d85fd6f95fc06a511f800c0bb2e
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-08-02 20:23:42 +01:00
Rash419
fcce324cbf admin: added retryInterval option in monitor config
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: If0b94bb043a6a4883affac6cf38adcffd3b72b9a
2023-06-29 18:21:33 +02:00
Rash419
9d1741232b admin: added wopiSrcMap command
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I95a7ccec6075848bd18b8899119c720aa303a106
2023-06-29 18:21:33 +02:00
Rash419
d63bca3f8e admin: migrate document after saving
- controller used to send two messages first to save then
  once saving is done migrate the document
- now controller only sends one message, COOL handles
  unsaved document

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Id4afe1f9a04ef99005d7f0dbd6246826ba82442b
2023-06-29 18:21:33 +02:00
Rash419
932f2ad67f admin: don't send the routing_rmdoc if doc is migrating
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ic1391dd509027e794ed005bcf78014afca31ede5
2023-06-29 18:21:33 +02:00
Rash419
164d1d2826 show message that document is migrating
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Id0908f31b578a6f0ff012c212f4ca4468a76038c
2023-06-29 18:21:33 +02:00
Rash419
b717be603e implement document migration
- updated protocol.txt

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I67a0515580979e15223ea084c835f5ed801ceb5e
2023-06-29 18:21:33 +02:00
Ashod Nakashian
155bc06e24 wsd: de-duplicate assertCorrectThread
This merges multiple implementations of
assertCorrectThread and simplifies its
usage.

Change-Id: I7be5dea62c6046fb0412d7f885fcbcc4b66e3fd9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Rash419
f7af990485 admin: added a seprate state for the uploaded document
- previously we set the Modified state in admin panel only when
  wsd successfully upload the document to storage
- modified state updation depends on core, it might happen that
  uploading is already done and successfull but we didnot get
  the modified state from the core which will show wrong modified
  status in admin panel

Change-Id: I014a8f92753fc6a93b37921d0f3cdce390bef35e
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
2023-05-04 11:35:07 +05:30
Ashod Nakashian
3dbfce54d3 wsd: helper to dump the state of an object as a string
Change-Id: Ib49a47be2dc37663ef06ac80be981c9f3c029814
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Ashod Nakashian
1dd2aba82d wsd: log the socket FD of ProtocolHandlerInterface
Change-Id: I362aca685f79868bdf685695d625a832eee02821
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00
Rash419
bd3dee9cbc admin: fix: monitor doesnot try connecting again after disconnecting
regression from 49bac0da174e31fcdbe5a4458f2f2100d606b6dc

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Id006db718d49da2b1f9142c4d6d5c6985b18ecc9
2023-02-14 14:55:48 +01:00
Rash419
c5fd805619 admin: added new admin->client command
routing_rmdoc command is added specifically to notify indirection url
server about document getting removed with its wopiSrc

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ic077f210d520394e3ef8ced778604b7343436328
2023-01-31 15:32:30 +01:00
Rash419
f63d07bdea wsd: store routeToken in server
- added routeToken in ClientSession::createPublicURI

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib4a211e69d96589dd735ba8e32ddbe5f98c96509
2023-01-31 15:32:30 +01:00
Rash419
c1dbe39a29 admin: monitors configurable with remote config
- make sure online connect to unique monitors
- able to disconnect monitor if uri doesnot exist in updated
  json

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ia6cfd6c8e56416c37d211aae55828c92a4ba27e5
2023-01-31 15:32:30 +01:00
Rash419
2529fa9ee2 notify client when route tokens get updated
- once client get notification it will update the routetoken
by refetching it from indirection url endpoint
- added support to configure indirectionurl enpoint using
remote config

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Iead22af56c655bdece6b70cc4e97a1fa401b1bae
2023-01-31 15:32:30 +01:00
Miklos Vajna
bbb8d98ae9 admin: drop conditional that is now redundant with clamping
Follow-up to
<https://github.com/CollaboraOnline/online/pull/5421#pullrequestreview-1179138409>.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie293218e504808d317436181639d9189eb6fb05c
2022-11-17 08:21:12 +01:00
Miklos Vajna
034b37a4a9 wsd: limit memToFreeKb in Admin::triggerMemoryCleanup()
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Idfe4ee00be9f805f5e12c7ece4f890aa2b9d08ed
2022-10-28 11:20:51 +01:00