aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Revert "curl: allow forcing HTTPS with a build-time option"HEADdevArttu Tarkiainen2 days3-24/+0
| | | | | | | | | | | | | | | This reverts commit a2a319ee4243d3fbbc4e0c4c2d1ac1fcbae2812c. Reason for revert: We wanted to make the protocol decision dynamic after all, based on the configured server URL. With the previous behavior the users are required to build a separate set of binaries, even if they want to just quickly evaluate or test the license server using plain HTTP. Pick-to: 3.1 Task-number: QLS-957 Change-Id: I7a726c1b32afd6aa1a8f130392ba0a0f1d4416c5 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* CIP: increase timeout for on-demand service startArttu Tarkiainen7 days1-1/+1
| | | | | | | | | | | Increase the time to give up from 10s to 30s, in case the service port information is not available after starting the service process in on-demand mode. Task-number: QLS-944 Pick-to: 3.1 Change-Id: I0ccdbd258ac32edcb5869639dac3c16853bb98eb Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Update changelogArttu Tarkiainen9 days1-0/+3
| | | | | | | | Pick-to: 3.1 Change-Id: Ic29f817400b3a7bee4563bb0b05c9f80610be8cd Reviewed-by: Heikki Halmet <heikki.halmet@qt.io> (cherry picked from commit d57cfe3041dca73ac3a9ed7af4a4164fd3b152ba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 3rdparty: update curl to version 8.7.1Arttu Tarkiainen13 days1162-26501/+36717
| | | | | | | | Release changelog https://curl.se/changes.html#8_7_1 Pick-to: 3.1 Change-Id: Ife32cac89887c3f82ebfa77f7153638dfc0372fd Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
* installations.ini: differentiate preview releasesArttu Tarkiainen2024-05-074-11/+81
| | | | | | | | | | | | | | | | | Add contextual --add-key-value option used in pair with --register, which can be used for inserting additional key-value pairs to the installations.ini section written when registering the installation. The supported key-value pair at the moment is "preview=true", which indicates a pre-release of the license service. In the CIP side, when looking for matching service installation to kick start, preview sections are preferred only if no same version exists in a non-preview section. Pick-to: 3.1 3.0 Change-Id: I0dbc7c05dfeff81162e36cb5a13cf6f2682157c6 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Hide JWT in the logsArttu Tarkiainen2024-05-061-1/+25
| | | | | | | | | | | In case of 'debug' logging level, the raw requests from clients were printed to stdout and file. Hide sensitive information in the logging print. Task-number: QLS-934 Pick-to: 3.1 Change-Id: Ibda32f718b27f84ad12304c52ff712bb5845660e Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Rename orig_moc(.exe) as qtmoc(.exe)Iikka Eklund2024-05-034-5/+6
| | | | | | | | | | | Use better naming for the referenced original moc executable in the mocwrapper. Pick-to: 3.1 Task-number: QLS-935 Change-Id: I63e02671bfdc655f29d60c646a49019f81d8f8f3 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io> Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* Update changelogArttu Tarkiainen2024-05-031-0/+4
| | | | | | Pick-to: 3.1 Change-Id: I15a52f708c1e2d302fa3ae6f2cc8dc6338f43372 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* CMake: allow skip of stripping binariesArttu Tarkiainen2024-05-022-0/+9
| | | | | | | | | | | | | The strip command fails on Windows 7, msvc 2015. As we only test the build on the target platform (artifacts are not included in release packages), the stripping of binaries can be disabled for now. The STRIP_BINARIES option can be set from an environment variable, defaults to ON. Pick-to: 3.1 Change-Id: I6418a019bce6f66aa9d6f7da4c97c39d6c0d7fd0 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Add "silly" log level for curl debug informationArttu Tarkiainen2024-05-025-4/+89
| | | | | | | | | | | Add debug callback function for curl, which will print additional messages to the log file / stdout, and enable it in case the user set log level is "silly". This can help providing information for debugging network related issues Pick-to: 3.1 Change-Id: I0776929399a1ae6e8f2f2dfbccd928da91837641 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Fix on-demand process shutting down after resuming from sleepArttu Tarkiainen2024-05-021-2/+9
| | | | | | | | | | | | | | | | | | | | | | In case the host machine was in sleep, the timeout value in the watchdog used for determining if an idle instance should be shut down could be reached on resume. The timeout is periodically reset before processing the message queue on Licenser::listen(), if there are connected clients. If on resume the watchdog's timer thread would read the reset flag (with a value of false) before the licenser would set it to true, and the timeout was reached, a timeout event message would be sent to the application message pipe and the process would shut down. Fix by adding additional check of connected clients to Licenser::onTimeoutEvent(). In case there are still connected clients, ignore the timeout event and start the watchdog again. Task-number: QLS-924 Pick-to: 3.1 3.0 Change-Id: I10fcfece2fd843e1f88972214b7f2bfed8709fdb Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Fix UnknownError status codes for LicenseClientPrivate::request()Arttu Tarkiainen2024-05-027-10/+18
| | | | | | | | | | | | | | | | | | In case the function returned early due to invalid request parameters or TCP errors, the status code in the LicenseReservationInfo object returned to client callbacks was not set, containing the default value due to being cleared before invoking LicenseClientPrivate::request(). Add new status code TcpSocketError for client socket related errors. Also fix TcpClient returning e_tcp_success incorrectly in case the received message was empty, as this indicates the service side socket was closed. Task-number: QLS-924 Pick-to: 3.1 3.0 Change-Id: I31420117b751cfd4464fae73fe01e03f06788bdc Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Update changelogArttu Tarkiainen2024-04-261-1/+0
| | | | | Change-Id: I5b70c0aab1cf4aa42b44453a2523e5d9b0cda363 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Licenser: disable time delta checks temporarilyArttu Tarkiainen2024-04-261-7/+0
| | | | | | | | | | | | | The string to time_t conversion breaks on platforms other than Linux in case std::get_time has a format string parameter which contains "%Z" conversion specifier. This part has value "GMT" in the server response. Disable the time checks for now to not reject license requests due to faulty time delta comparison. Task-number: QLS-921 Change-Id: I0bb64eddec2928a2210eaabb1ccf4d96cbe84259 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Hash hw_id setting using sha265 for network requestsArttu Tarkiainen2024-04-269-32/+69
| | | | | | | | | | | | | | | | Use a 64 byte hex representation of the hashed hw_id value in all request payloads, instead of the 32 byte uuid value stored to file. Make sha265() a generic method under QLicenseService::Crypto namespace. Make LicdSetup::setHwId() a public method, which should be invoked by consumers of the service configuration file, in case there is no existing hw_id value. This is to avoid having to link the core library against libcrypto, only the service library needs it. Task-number: QLS-922 Change-Id: Ia1d80fda80cec8981d54f516ef86532133fc344b Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* curl: drop TLS version requirement to v1.2 or laterArttu Tarkiainen2024-04-262-2/+2
| | | | | | | | | TLS v1.3 proved to be problematic on Windows 10 using the Schannel SSL backend, drop the requirement to v1.2. This should be supported from Windows 7 forwards. Change-Id: I10b5e14b0277ad954d97e69d4aae64e06566ea17 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* TcpServer: code style fixesArttu Tarkiainen2024-04-252-55/+57
| | | | | Change-Id: If6eeefbc3d7c77fc5e43489f9af48073b68c9d88 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Update changelogArttu Tarkiainen2024-04-251-0/+4
| | | | | Change-Id: I1bbdaf745d794f26dcf85e93bb25650e1cf75804 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* CIP: serialize access for installations.ini when purging the fileArttu Tarkiainen2024-04-2511-15/+163
| | | | | | | | | | | | | | | | | | There may be several processes using the CIP API simultaenously, each attempting to open the installations.ini for writing when purging obsolete sections from the file. Add RAII class for LockFile, and use it for access serialization for the file. Change the order of checks in LicenseClient::serviceAvailable() to follow the same sequence as in LicenseClient::init(), this saves us from redundant file read and write operations in case the service is already running. Pick-to: 3.0 Change-Id: I662a2920bf2f423374f8e1f5f3bcda0e37b1bc0a Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Ini file parser should check if the file can be openedIikka Eklund2024-04-255-75/+143
| | | | | | | | | | Check if the file can be accessed for reading or writing. Change the function signatures accordingly, so that the caller can act accordingly to the success of failure. Pick-to: 3.0 Change-Id: I734499aa5858631076bd9a64735f0c6b74a0d61c Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* HttpClient: increase maximum time the transfer is allowed to completeArttu Tarkiainen2024-04-251-1/+1
| | | | | | | | Increase CURLOPT_TIMEOUT from 10s to 30s, as the old value might not be enough in all cases. Change-Id: Id26fb7063abcb3f271384b0014a78d6982ee0d2d Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* qtlicensetool: disable log prints to fileArttu Tarkiainen2024-04-241-0/+1
| | | | | | | | | There's no log file set for the qtlicensetool, so log messages will cause dubious warnings about failing to open the log file. Pick-to: 3.0 Change-Id: Ie80a6be8a1c753d23790d29ed3b6c3e8bf80d00d Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Windows: add reference for controlling the system service from CMDArttu Tarkiainen2024-04-241-6/+17
| | | | | | | Task-number: QLS-902 Pick-to: 3.0 Change-Id: I2e7f0beb53a3c08682df1444b3e8d2b5879194a1 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Disable build curl if BUILD_SERVICE_LIB=OFFTim Jenssen2024-04-241-7/+9
| | | | | | | Change-Id: I0f9d517cb38e398cfcebd1aab43a3918ac7ad8b2 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io> (cherry picked from commit fbc62ce73e6b256c2f314f75d5e7e3816d01b8a3) Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* 3rdparty: remove license file for previously used hmac_sha256 libraryArttu Tarkiainen2024-04-241-24/+0
| | | | | Change-Id: I7b0389a47b2dcc65f844071ff5e56cb635640a95 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Print error in case CipCommandParser could not parse inputArttu Tarkiainen2024-04-241-0/+1
| | | | | | | | This could have been missed from the daemon side logs previously, as only a BAD_REQUEST response was replied to client. Change-Id: Id62960ee2fbfc1a4274f4467f0830c58a5fedeed Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Update changelogArttu Tarkiainen2024-04-241-1/+30
| | | | | Change-Id: I8123f2637a5fe636c5e73262338a42765ed12547 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Update allowed status codesArttu Tarkiainen2024-04-241-0/+1
| | | | | | | | | Add 4105002 server status code, indicating server busy when making new reservation. Pick-to: 3.0 Change-Id: Ib21933a8cbdb297209000c1342b8249b3524ecce Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* CIP: clean up installations.ini on LicenseClient::serviceAvailable()Arttu Tarkiainen2024-04-222-0/+8
| | | | | | | | | | | | | | | | | | | | The CIP API has a function to deduce the precense of the service installation. For this it checks the presence of the installations.ini file, if present then it implies that the Service exists on the system. But the installations.ini may be left in inconsistent state. The Service itself already cleans up this file upon start, but this is too late for the CIP API. The file is also cleaned up by the Qt Online Installer when uninstalling the license-service component. Make the CIP API to purge the installations.ini as well, before trying to deduce the Service installation on the system. Task-number: QLS-908 Pick-to: 3.0 Change-Id: I05d76e543310eb773c6eb140351299efbe745f39 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Remove unused defines and environment variablesArttu Tarkiainen2024-04-183-18/+0
| | | | | | Pick-to: 3.0 Change-Id: Ia6037b0d736cb1e001a8fa322540388fc95d7a5a Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Retry request after a delay when server returns 503 HTTP status codeArttu Tarkiainen2024-04-186-21/+19
| | | | | | | | | | | | | | | | | | Retry reservation, renewal, and release request after an increasing delay in case the server responds with a 503 HTTP status code. This is in addition to the previously checked status code in response body indicating a busy server. Also adjust the default retry delay times for requests to a more sensible values, starting from minimum 1s, with 1s increments, to a maximum delay of 10s. Remove unused "queue_max_waiting_time" from the configuration file, this has been obsolete also in previous 3.x versions. Task-number: QLS-900 Change-Id: I96264d41fef740d39c3c037a63571b0e7eff6c40 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Compare local time to server timeArttu Tarkiainen2024-04-1818-34/+345
| | | | | | | | | | | | | | | | | | - HttpClient: add support for getting the response headers from curl - Parse and create a string map of the response headers string - Add new HttpResponse type that wraps the reponse body and header map - Licenser: fetch server time from "Date" header on the "ping" request - Compare this time to local UTC time, if the difference is more than one hour, send TIME_MISMATCH error code to clients when requesting license. This helps avoiding misconfiguration of local time, which can have an effect on the reservation release time. Task-number: QLS-765 Change-Id: Ia7645565126964c708468c94c552eef630965703 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Fix attempt of new reservation in case license was revoked by serverArttu Tarkiainen2024-04-172-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the daemon attempted to perform a new license request for each client that consumed a reservation, in case the reservation renewal would fail. This had two problems: - The client API periodically asked for current license status, there would be no quarantee that the new license request would be finished - The license request handler will always reply to the client TCP socket, this would not work correctly for existing clients that did not yet send the status request Instead change the "heartbeat" client API *status* command to a *license* request. The service will return a response immediately for the client in case there is an existing valid reservation, or attempt a new reservation otherwise and return its result. This will also affect the business logic - the clients will retry a license request (once per heartbeat) if the existing reservation becomes invalid for any reason, for example if expired due to no network connection. Task-number: QLS-897 Change-Id: I7bf667f238cf51964cd78bcff3dfc02726004e74 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Rename daemonCanBeStarted() to better match current domain languageArttu Tarkiainen2024-04-174-5/+13
| | | | | | Pick-to: 3.0 Change-Id: I911334b7652d738519fc1b23dae671edb2b3abdd Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* add daemonCanBeStarted() to make fallbacks possibleTim Jenssen2024-04-164-1/+22
| | | | | | | | | | For a transition time it could be that the daemon is not available - this is used to enable the old license check way in Qt Desgin Studio. Pick-to: 3.0 Change-Id: I1dfbb04fa2292ce37c4805f532b155f920f39167 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Don't run service autotests if target is only for Integration testsHeikki Halmet2024-04-161-3/+8
| | | | | | | | | | | This is needed e.g. when running integration tests for macOS 11 target and the build binaries are done by the latest macOS version. Currently macOS 11 autotests can't be run if build artifacts are done with macOS 14 Pick-to: 3.0 Change-Id: I630c78e68ebe1aed614e26ac9d6e1117df7805a8 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* License: remove duplicate warning on license checksum mismatchArttu Tarkiainen2024-04-161-3/+1
| | | | | | | | | | | License::verifySignature() printed an additional warning, in case the verification could be done successfully, but result indicated a signature mismatch. This is a normal return, so no need to print a warning, the caller should decide if they want to print one. Pick-to: 3.0 Change-Id: I8aa6d33a641df169794f46ffc1cdaf25c12e2a24 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Disconnect clients immediately on reservation expirationArttu Tarkiainen2024-04-161-4/+12
| | | | | | | | | | | | | | | | | | | | After a reservation expiry event was sent, the associated client application were disconnected only after the release request was made and the server returned a response indicating success. This missed cases where the network connectivity was temprorarily down or request failed for some other reason. There could be also some delay between performing the request, and receiving the response, so clients could be using the reservation longer than the lease time would allow. Fix by disconnecting clients consuming a reservation to be released as a first action when handling a reservation expiry. Task-number: QLS-898 Pick-to: 3.0 Change-Id: Ie4f913024c1b163ee08d22b69d1acf2a32114a6e Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Move BUILD_SHARED_LIBS from build scripts to top level CMake fileIikka Eklund2024-04-123-4/+5
| | | | | | | | | | | In practice it makes no sense to build the License Service or the CIP API library as shared. Move the BUILD_SHARED_LIBS option from the build scripts to the top level CMakeLists.txt so when building without the provided build scripts this option is not forgotten. Pick-to: 3.0 Change-Id: I268748c149489109d26bcb412c69d5b41fd0d137 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Purge installations.ini fileIikka Eklund2024-04-128-6/+85
| | | | | | | | | | | | | | | | | | The user may manually delete License Service installations for on-demand launch. Also the user may manually edit (should not) the installations file and leave it in inconsistent state. Delete orphan/invalid registrations from the installations.ini file. Check the presence of each License Service installation in the config file and remove those sections which contained invalid entries. Perform the clean-up during the License Service shut down. Pick-to: 3.0 Task-number: QLS-850 Change-Id: I1f65f72c2a745215cfa33098bc8476842675785a Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Calculate checksum for cached reservation filesArttu Tarkiainen2024-04-113-1/+91
| | | | | | | | | | Create a sha256 checksum of the reservation object and store it to disk, which is checked again on cache initialization to avoid accidental modification of the reservation. Task-number: QLS-713 Change-Id: Ib435744df4a570110abffdff7729e2d6d0981e0d Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Read commit sha from .tag file as a fallbackArttu Tarkiainen2024-04-113-0/+12
| | | | | | | | | | | | | The source artifacts in coin are not in a git repository, so the revision information was missing from the official binaries. Add .gitattributes with export-subst attribute for the .tag file to expand the placeholder when adding the file to archive. Task-number: QLS-856 Pick-to: 3.0 Change-Id: I6f584961e548a4b44d5a5fb52f49e7ca67ce4e9f Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Doc: update build prerequisites for macOSArttu Tarkiainen2024-04-111-0/+9
| | | | | | Pick-to: 3.0 Change-Id: I1b0a1d91d2f873e7dfef6550aaf5b4d8e468af56 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Fix logic error on releasing a reservation which has connected clientsArttu Tarkiainen2024-04-112-9/+8
| | | | | | | | | | | | | | | | | | | Reservation information is reset from clients without disconnecting, when renewal fails but the daemon may attempt a new reservation. Clients are disconnected on reservation release. The reservation information was reset from clients before the lookup for clients that needed disconnecting, meaning none were found. Fix by resetting the clients only just before disconnecting. Also move the disconnect and reset methods out of Licenser::removeReservation() as the previously used boolean parameter was not very clear. Pick-to: 3.0 Task-number: QLS-896 Change-Id: I38d16575d7e5099850d6f72176f6d0b6c5a8a5fc Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* curl: allow forcing HTTPS with a build-time optionArttu Tarkiainen2024-04-104-0/+29
| | | | | | | | | Add CURL_FORCE_HTTPS CMake option (defaults to ON), which can be used to set HTTPS as the only only allowed protocol for all requests. Task-number: QLS-675 Change-Id: I7a5d802d6f3487aad75405efd0bfec5939ecff79 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* License: prevent secrets leaking through timing side channelArttu Tarkiainen2024-04-104-2/+30
| | | | | | | | | | | - Add function for constant time comparison of strings - Change "==" operator to use the new function for local user name and JWT members Task-number: QLS-681 Pick-to: 3.0 Change-Id: I9618f6ae60d65d005655736cf8c345d5694fd0a1 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* HttpRequest: replace deprecated CURLOPT_PROTOCOLS optionArttu Tarkiainen2024-04-101-1/+1
| | | | | | | | | | CURLOPT_PROTOCOLS is deprecated option since 7.85.0, use the replacement option CURLOPT_PROTOCOLS_STR instead. Task-number: QLS-686 Pick-to: 3.0 Change-Id: Ic4293b88a6e16405c5c4ad6fded4a95fbba7ecc8 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Require OPENSSL_ROOT_DIR only when building the service libraryIikka Eklund2024-04-101-4/+4
| | | | | | | | | | | | Only the service library depends on the OpenSSL thus it should be checked only when building the service library. That is, when building the CIP API library or running the tests, it should not be required to have the OPENSSL_ROOT_DIR set. Pick-to: 3.0 Change-Id: I4c7153968540813dfa7f6955080fdc019557261e Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Add .clang-format templateIikka Eklund2024-04-101-0/+103
| | | | | | | | | | | Adopted from Qt Creator project with minor modifications. Qt specific rules not needed. https://github.com/qt-creator/qt-creator/blob/master/.clang-format Pick-to: 3.0 Change-Id: Ia4433888f2dc4d52ff80c59629219779c90322b4 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Linux: fix incorrect CA certificate file path for qtlicensetool loginArttu Tarkiainen2024-04-091-0/+3
| | | | | | | | | | The settings value was not read and set for the HttpClient instance used for QtAccount login with qtlicensetool. Fix by parsing the setting similarly as done on daemon side. Pick-to: 3.0 Change-Id: I2dfd7ae34a352534b8b29de9142b7d928a4ea25c Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>