Commit Graph

1288 Commits

Author SHA1 Message Date
Max Romanov
4024b18bcc Go: adding main configure CFLAGS and LDFLAGS to module build flags.
This makes ASAN buildbot workers to work out-of-the-box.
2020-01-28 19:20:46 +03:00
Axel Duch
4eb2d3086b Fixed missing IPv6 checking in route-addr and an unused variable.
This closes #363 issue on Github.
Thanks to to 洪志道 (Hong Zhi Dao).
2020-01-28 15:05:12 +00:00
Max Romanov
1451090d85 Node.js: suppress compilation warning. 2020-01-28 17:06:57 +03:00
Max Romanov
4e0a2002fe Java: fixing configure errors reporting. 2020-01-28 17:03:19 +03:00
Max Romanov
1949be644c Java: introducing SHA512 sum validation for external JARs. 2020-01-28 17:02:51 +03:00
Max Romanov
04bf6457c6 Java: fixing maven repository URL.
It is required to use https scheme and different host to download
packages from maven repository.
2020-01-28 17:01:21 +03:00
Max Romanov
a58ca623cd Packages: added curl dependency to fetch Java archives. 2020-01-28 17:00:28 +03:00
Max Romanov
2f8b243fa4 Ruby: changing callback functions prototype for v2.7.
This closes #371 issue on GitHub.
2020-01-28 16:59:12 +03:00
Valentin Bartenev
4bad2cf1e9 Version bump. 2020-01-27 16:52:53 +03:00
Valentin Bartenev
d2eac78c57 Updated copyright notice. 2020-01-27 16:52:45 +03:00
Valentin Bartenev
55f8e31ed7 Added tag 1.14.0 for changeset 6e28966ed1f2 2019-12-26 17:04:37 +03:00
Valentin Bartenev
be8589d925 Generated Dockerfiles for Unit 1.14.0. 2019-12-26 17:03:21 +03:00
Valentin Bartenev
9403233328 Added version 1.14.0 CHANGES. 2019-12-26 17:03:21 +03:00
Max Romanov
693a458b4e Go: changing import name for "unit.nginx.org/go".
This patch includes packaging changes - update unit-go installation
directory.
2019-12-25 20:00:32 +03:00
Tiago Natel de Moura
eced72ba25 Using the 64-bit Linux capability mode when available.
For backward compatibility, the Linux capabilities macros exposes v1 semantics
(32-bit) by default.  We probe the version at runtime (because of pre-compiled
binaries) but the kernel syscall API is conservative and it doesn't return a
64-bit capability version if the input version is v1.

This patch suppress the kernel > 5.0 dmesg log below:

  capability: warning: 'unitd' uses 32-bit capabilities (legacy support in use)
2019-12-16 17:12:09 +00:00
Axel Duch
96a9a790a0 Tests: routing by listener address. 2019-12-24 13:59:58 +00:00
Axel Duch
1a76371499 Router: introducing routing on listener address. 2019-12-24 13:59:58 +00:00
Axel Duch
ee8fa5d467 Tests: routing by client address configuration. 2019-12-24 13:58:22 +00:00
Axel Duch
8677bf8d41 Router: introducing routing on client address. 2019-12-24 13:58:10 +00:00
Max Romanov
26ee4cb6c8 Go: introducing SHM_ACK observer.
Each request processed in a separate goroutine.  In case of OOSM state,
during response write, request goroutine blocks on channel which waits
event from main thread about SHM_ACK message from router.
2019-12-24 18:04:21 +03:00
Max Romanov
763bdff401 Node.js: implementing output message drain using SHM_ACK feature.
ServerResponse.write() method tries to write data buffer using libunit
and stores buffers to write in a Server-wide output queue, which is
processed in response to SHM_ACK message from router.

As a side effect 'drain' event implemented and socket.writable flag
reflect current state.
2019-12-24 18:04:17 +03:00
Max Romanov
df7caf4650 Introducing port messages to notify about out of shared memory.
- OOSM (out of shared memory).  Sent by application process to router
  when application reaches the limit of allocated shared memory and
  needs more.
- SHM_ACK.  Sent by router to application when the application's shared
  memory is released and the OOSM flag is enabled for the segment.

This implements blocking mode (the library waits for SHM_ACK in case of
out of shared memory condition and retries allocating the required memory
amount) and non-blocking mode (the library notifies the application that
it's out of shared memory and returns control to the application module
that sets up the output queue and puts SHM_ACK in the main message loop).
2019-12-24 18:04:13 +03:00
Max Romanov
64f649f990 Adding "limits/shm" configuration validation and parsing. 2019-12-24 18:04:09 +03:00
Max Romanov
429c5a1c54 Renaming nxt_unit_mmap_buf_remove to nxt_unit_mmap_buf_unlink.
The function unchains the buffer from the buffer's linked list.
2019-12-24 18:04:05 +03:00
Max Romanov
806b3945fe Introducing write tail reference to avoid buffer chain iteration. 2019-12-24 18:04:00 +03:00
Max Romanov
faeb73a65e Using non-shared memory buffers for small messages.
Current shared memory buffer implementation uses fixed-size memory blocks,
allocating at least 16384 bytes.  When application sends data in a large
number of small chunks, it makes sense to buffer them or use plain
memory buffers to improve performance and reduce memory footprint.

This patch introduces minimum size limit (1024 bytes) for shared
memory buffers.
2019-12-24 18:03:56 +03:00
Max Romanov
f5a2984acf Go: moving source files to the root of the project.
This patch includes packaging changes related to files move.
2019-12-24 17:59:52 +03:00
Max Romanov
a427ecd4c5 Go: installing go module for tests into build directory. 2019-12-24 17:59:48 +03:00
Max Romanov
3d712a7078 Packages: making unit-go architecture independent.
To support Go modules, the unit-go module should be platform independent.
All platform-dependent logic is moved to libunit, so the unit-dev package
should be installed before building unit-go.
2019-12-24 17:59:44 +03:00
Max Romanov
823f658c77 Go: linking against libunit. 2019-12-24 17:59:37 +03:00
Valentin Bartenev
9224e94a8d Removed unused variables from "docs/Makefile".
They actually have been broken since 00d8049418cf,
where NXT_VERSION was removed from nxt_main.h.

Also, shebang is added.
2019-12-24 17:03:47 +03:00
Valentin Bartenev
51af6ac0a1 Python: pre-creation of objects for string constants.
This is an optimization to avoid creating them at runtime on each request.
2019-12-23 21:14:14 +03:00
Andrei Belov
68a2292372 Packages: added Python 3 support on Amazon Linux 2 (LTS). 2019-12-10 19:35:12 +03:00
Max Romanov
55a368e505 Java: fixing racing condition in external JAR download.
Temporary file name with configure process PID used to download
JAR from external repository.  Then file renamed using command 'mv'.

The issue reproduced in clean environment when 2 or more concurrent builds
started.
2019-12-09 18:17:16 +03:00
Andrei Zeliankou
c2a7e403ef Tests: routing tests refactored. 2019-12-09 15:34:35 +03:00
Tiago Natel
752ffd1950 Tests: added privileged credential tests. 2019-12-06 17:02:23 +00:00
Tiago Natel
411daeaa53 Isolation: allowed the use of credentials with unpriv userns.
The setuid/setgid syscalls requires root capabilities but if the kernel
supports unprivileged user namespace then the child process has the full
set of capabilities in the new namespace, then we can allow setting "user"
and "group" in such cases (this is a common security use case).

Tests were added to ensure user gets meaningful error messages for
uid/gid mapping misconfigurations.
2019-12-06 16:52:50 +00:00
Tiago Natel
ed2492a66a Moved credential-related code to nxt_credential.c.
This is required to avoid include cycles, as some nxt_clone_* functions
depend on the credential structures, but nxt_process depends on clone
structures.
2019-12-06 13:28:05 +00:00
Tiago Natel
c6a11260e8 Tests: added tests for setting user and group. 2019-11-11 14:36:22 +00:00
Tiago Natel
abbad122bb Tests: added support for testing "user" and "group". 2019-11-11 14:35:29 +00:00
Tiago Natel
417cc7be7c Refactor of process init.
Introduces the functions nxt_process_init_create() and
nxt_process_init_creds_set().
2019-11-26 16:26:24 +00:00
Andrei Belov
a3e5d09501 Packages: added Python 3 support on RHEL/CentOS 7. 2019-12-02 15:09:53 +03:00
Konstantin Pavlov
9a7881d131 Regenerated Dockerfiles. 2019-11-20 18:24:50 +03:00
Konstantin Pavlov
c87111cbb2 Moved docker images to Debian 10 "buster".
This changes the language versions we provide:
 - python 3.5 -> python 3.7
 - go 1.7/1.8 -> go 1.11
 - perl 5.24 -> perl 5.28
 - ruby 2.3 -> ruby 2.5
 - php 7.0 -> php 7.3
2019-11-20 18:24:46 +03:00
Tiago Natel
2f23923e44 Changed the group listing to run unprivileged when possible.
Now the nxt_user_groups_get() function uses getgrouplist(3) when available
(except MacOS, see below).  For some platforms, getgrouplist() supports
a method of probing how much groups the user has but the behavior is not
consistent.  The method used here consists of optimistically trying to get up
to min(256, NGROUPS_MAX) groups; only if ngroups returned exceeds the original
value, we do a second call.  This method can block main's process if LDAP/NDIS+
is in use.

MacOS has getgrouplist(3) but it's buggy.  It doesn't update ngroups if the
value passed is smaller than the number of groups the user has.  Some
projects (like Go stdlib) call getgrouplist() in a loop, increasing ngroups
until it exceeds the number of groups user belongs to or fail when a limit
is reached.  For performance reasons, this is to be avoided and MacOS is
handled in the fallback implementation.

The fallback implementation is the old Unit approach.  It saves main's
user groups (getgroups(2)) and then calls initgroups(3) to load application's
groups in main, then does a second getgroups(2) to store the gids and restore
main's groups in the end.  Because of initgroups(3)' call to setgroups(2),
this method requires root capabilities.  In the case of OSX, which has
small NGROUPS_MAX by default (16), it's not possible to restore main's groups
if it's large; if so, this method fallbacks again: user_cred gids aren't
stored, and the worker process calls initgroups() itself and may block for
some time if LDAP/NDIS+ is in use.
2019-11-26 16:15:23 +00:00
Tiago Natel
224787bbac Tests: added getjson() helper. 2019-11-26 16:00:11 +00:00
Tiago Natel
01103c5005 Tests: parsing of "Transfer-Encoding: chunked" responses. 2019-11-26 15:58:25 +00:00
Max Romanov
4eecf1cb6a Refactoring reference counting of req_app_link.
The reason for the change is that the req_app_link reference count
was incorrect if the application crashed at start; in this case,
the nxt_request_app_link_update_peer() function was never called.

This closes #332 issue on GitHub.
2019-11-26 17:14:53 +03:00
Tiago Natel
19b974674c Tests: fixed tests to run as root.
- The mode of testdir was changed to allow reading from other users/groups.
- The java multipart test now uploads the file into an app writable dir.
- The build directory was made readable for other users.
- The python environment test now uses the HOME env var instead of PWD
  because the latter is not set by the root shell (/bin/sh) by default.
- The node `node_modules` directory now is copied into the `testdir` instead
  of using symlinks.
2019-11-09 20:14:52 +00:00
Sergey Kandaurov
94a9162baa Configure: fixed posix_spawn() detection with glic 2.30.
In particular, it was previously broken on Ubuntu 19.10 and Fedora 31.
See for details: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2ab5741
2019-11-22 14:06:02 +03:00