summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf_validation.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-11-05Router: matching query string support.Zhidao HONG1-0/+5
The "query" option matches decoded arguments, including plus ('+') to space (' '). Like "uri", it can be a string or an array of strings.
2021-11-05Configuration: improved matching pattern error messages.Zhidao HONG1-22/+51
2021-10-26Custom implementation of Base64 decoding function.Valentin Bartenev1-7/+3
Compared to the previous implementation based on OpenSSL, the new implementation has these advantages: 1. Strict and reliable detection of invalid strings, including strings with less than 4 bytes of garbage at the end; 2. Allows to use Base64 strings without '=' padding.
2021-10-09Configuration: automatic migration to the new "share" behavior.Zhidao HONG1-0/+21
2021-10-01Static: multiple paths in the "share" option.Zhidao HONG1-2/+49
2021-09-30Static: variables in the "share" option.Zhidao HONG1-0/+1
This commit supports variable in the "share" option, the finding path to file serve is the value from "share". An example: { "share": "/www/data/static$uri" }
2021-09-28Static: variables in the "chroot" option.Zhidao HONG1-13/+26
2021-09-14Fixing build with glibc 2.34.Max Romanov1-3/+4
Explicitly using the sysconf() call to obtain the minimum thread stack size instead of the PTHREAD_STACK_MIN macro. This closes #576 PR on GitHub.
2021-08-17Added TLS session tickets support.Andrey Suvorov1-0/+73
2021-08-12Router: client IP address replacement.Oisin Canty1-0/+25
This commit introduces the replacement of the client address based on the value of a specified HTTP header. This is intended for use when Unit is placed behind a reverse proxy like nginx or a CDN. You must specify the source addresses of the trusted proxies. This can be accomplished with any valid IP pattern supported by Unit's match block: ["10.0.0.1", "10.4.0.0/16", "!192.168.1.1"] The feature is configured per listener. The client address replacement functionality only operates when there is a source IP match and the specified header is present. Typically this would be an 'X-Forwarded-For' header. { "listeners": { "127.0.0.1:8080": { "client_ip": { "header": "X-Forwarded-For", "source": [ "10.0.0.0/8" ] }, "pass": "applications/my_app" }, } } If a request occurs and Unit receives a header like below: "X-Forwarded-For: 84.123.23.23" By default, Unit trusts the last rightmost IP in the header, so REMOTE_ADDR will be set to 84.123.23.23 if the connection originated from 10.0.0.0/8. If Unit runs behind consecutive reverse proxies and receives a header similar to the following: "X-Forwarded-For: 84.123.23.23, 10.0.0.254" You will need to enable "recursive" checking, which walks the header from last address to first and chooses the first non-trusted address it finds. { "listeners": { "127.0.0.1:8080": { "client_ip": { "header": "X-Forwarded-For", "source": [ "10.0.0.0/8" ] "recursive": true, }, "pass": "applications/my_app" }, } } If a connection from 10.0.0.0/8 occurs, the chain is walked. Here, 10.0.0.254 is also a trusted address so the client address will be replaced with 84.123.23.23. If all IP addresses in the header are trusted, the client address is set to the first address in the header: If 10.0.0.0/8 is trusted and "X-Forwarded-For: 10.0.0.3, 10.0.0.2, 10.0.0.1", the client address will be replaced with 10.0.0.3.
2021-07-23Router: split nxt_http_static_conf_t from nxt_http_action_t.Zhidao HONG1-7/+7
No functional changes.
2021-07-21Enabling configure TLS sessions.Andrey Suvorov1-0/+59
To support TLS sessions, Unit uses the OpenSSL built-in session cache; the cache_size option defines the number sessions to store. To disable the feather, the option must be zero.
2021-07-02Ruby: process and thread lifecycle hooks.Oisin Canty1-0/+3
This feature allows one to specify blocks of code that are called when certain lifecycle events occur. A user configures a "hooks" property on the app configuration that points to a script. This script will be evaluated on boot and should contain blocks of code that will be called on specific events. An example of configuration: { "type": "ruby", "processes": 2, "threads": 2, "user": "vagrant", "group": "vagrant", "script": "config.ru", "hooks": "hooks.rb", "working_directory": "/home/vagrant/unit/rbhooks", "environment": { "GEM_HOME": "/home/vagrant/.ruby" } } An example of a valid "hooks.rb" file follows: File.write("./hooks.#{Process.pid}", "hooks evaluated") on_worker_boot do File.write("./worker_boot.#{Process.pid}", "worker booted") end on_thread_boot do File.write("./thread_boot.#{Process.pid}.#{Thread.current.object_id}", "thread booted") end on_thread_shutdown do File.write("./thread_shutdown.#{Process.pid}.#{Thread.current.object_id}", "thread shutdown") end on_worker_shutdown do File.write("./worker_shutdown.#{Process.pid}", "worker shutdown") end This closes issue #535 on GitHub.
2021-05-26Enabling SSL_CTX configuration by using SSL_CONF_cmd().Andrey Suvorov1-0/+46
To perform various configuration operations on SSL_CTX, OpenSSL provides SSL_CONF_cmd(). Specifically, to configure ciphers for a listener, "CipherString" and "Ciphersuites" file commands are used: https://www.openssl.org/docs/man1.1.1/man3/SSL_CONF_cmd.html This feature can be configured in the "tls/conf_commands" section.
2021-05-26Static: handled unknown MIME types when MIME-filtering active.Oisin Canty1-1/+1
2021-05-25Configuration: generalized application "targets" validation.Oisin Canty1-110/+68
2021-05-20Python: support for multiple targets.Oisin Canty1-9/+123
2021-05-06Static: implemented MIME filteringOisin Canty1-0/+4
2021-04-29Static: support for openat2() features.Zhidao HONG1-0/+32
Support for chrooting, rejecting symlinks, and rejecting crossing mounting points on a per-request basis during static file serving.
2021-03-24Added ability to configure multiple certificates on a listener.Andrey Suvorov1-1/+28
The certificate is selected by matching the arriving SNI to the common name and the alternatives names. If no certificate matches the name, the first bundle in the array is chosen.
2021-03-02Fixing NetBSD compatibility.Max Romanov1-2/+2
Instead of PTHREAD_STACK_MIN define, NetBSD requires to get minimum stack size using sysctl(_SC_THREAD_STACK_MIN). This change originally proposed by Juraj Lutter <juraj@lutter.sk>.
2020-12-22Python: multiple values in the "path" option.Valentin Bartenev1-1/+34
2020-11-17Router: matching regular expressions support.Axel Duch1-2/+33
2020-11-17HTTP parser: allowed more characters in header field names.Valentin Bartenev1-0/+3
Previously, all requests that contained in header field names characters other than alphanumeric, or "-", or "_" were rejected with a 400 "Bad Request" error response. Now, the parser allows the same set of characters as specified in RFC 7230, including: "!", "#", "$", "%", "&", "'", "*", "+", ".", "^", "`", "|", and "~". Header field names that contain only these characters are considered valid. Also, there's a new option introduced: "discard_unsafe_fields". It accepts boolean value and it is set to "true" by default. When this option is "true", all header field names that contain characters in valid range, but other than alphanumeric or "-" are skipped during parsing. When the option is "false", these header fields aren't skipped. Requests with non-valid characters in header field names according to RFC 7230 are rejected regardless of "discard_unsafe_fields" setting. This closes #422 issue on GitHub.
2020-11-16Isolation: added option to disable "procfs" mount.Tiago Natel de Moura1-0/+3
Now users can disable the default procfs mount point in the rootfs. { "isolation": { "automount": { "procfs": false } } }
2020-11-13Isolation: added option to disable tmpfs mount.Tiago Natel de Moura1-0/+3
Now users can disable the default tmpfs mount point in the rootfs. { "isolation": { "automount": { "tmpfs": false } } }
2020-11-10Python: supporting ASGI legacy protocol.Max Romanov1-0/+26
Introducing manual protocol selection for 'universal' apps and frameworks.
2020-11-05Perl: request processing in multiple threads.Max Romanov1-0/+8
This closes #486 issue on GitHub.
2020-11-05Ruby: request processing in multiple threads.Max Romanov1-0/+4
This closes #482 issue on GitHub.
2020-11-05Java: request processing in multiple threads.Max Romanov1-0/+8
This closes #458 issue on GitHub.
2020-11-05Python: request processing in multiple threads.Max Romanov1-0/+58
This closes #459 issue on GitHub.
2020-10-13Using union instead of "void *".Igor Sysoev1-102/+110
2020-10-13Using C99 style declaration.Igor Sysoev1-563/+423
2020-10-13Reordering declarations.Igor Sysoev1-296/+317
2020-09-18Python: app module callable name configuration.Max Romanov1-0/+6
Now it is possible to specify the name of the application callable using optional parameter 'callable'. Default value is 'application'. This closes #290 issue on GitHub.
2020-08-25Isolation: added "automount" option.Tiago Natel de Moura1-0/+21
Now it's possible to disable default bind mounts of languages by setting: { "isolation": { "automount": { "language_deps": false } } } In this case, the user is responsible to provide a "rootfs" containing the language libraries and required files for the application.
2020-08-21Configuration: removed "reschedule_timeout" option.Valentin Bartenev1-6/+0
It's not used since cbcd76704c90. This option is a leftover from previous IPC between router and applications processes. It was never documented, though. Thanks to 洪志道 (Hong Zhi Dao).
2020-08-19Configuration: improved error message of invalid listener address.Valentin Bartenev1-2/+9
Thanks to 洪志道 (Hong Zhi Dao). This closes #466 issue on GitHub.
2020-08-13Basic variables support.Valentin Bartenev1-0/+21
2020-07-28Configuration: fixed buffer over-read in pattern validation.Axel Duch1-2/+3
There was an undefined behavior in the validation function, caused by testing one character after the string if a wildcard was at the end.
2020-07-24Configuration: added checking for presence of mandatory fields.Valentin Bartenev1-3/+131
2020-07-24Added missing ending indicator in object members validation lists.Valentin Bartenev1-1/+5
This fixes undefined behaviour due to array over-read if an unknown parameter is specified in an uidmap, a gidmap, or a php target object.
2020-07-24Configuration: removing redundant check.Axel Duch1-3/+3
Thanks to 洪志道 (Hong Zhi Dao).
2020-07-04Router: route patterns multi wildcards support.Axel Duch1-39/+5
2020-05-28Added "rootfs" feature.Tiago Natel de Moura1-0/+18
2020-05-14Router: decode uri and args.Axel Duch1-2/+115
2020-05-14PHP: implemented "targets" option.Valentin Bartenev1-23/+179
This allows to specify multiple subsequent targets inside PHP applications. For example: { "listeners": { "*:80": { "pass": "routes" } }, "routes": [ { "match": { "uri": "/info" }, "action": { "pass": "applications/my_app/phpinfo" } }, { "match": { "uri": "/hello" }, "action": { "pass": "applications/my_app/hello" } }, { "action": { "pass": "applications/my_app/rest" } } ], "applications": { "my_app": { "type": "php", "targets": { "phpinfo": { "script": "phpinfo.php", "root": "/www/data/admin", }, "hello": { "script": "hello.php", "root": "/www/data/test", }, "rest": { "root": "/www/data/example.com", "index": "index.php" }, } } } }
2020-05-14Configuration: URI encoding in the "pass" option.Valentin Bartenev1-33/+27
This is useful to escape "/" in path fragments. For example, in order to reference the application named "foo/bar": { "pass": "applications/foo%2Fbar" }
2020-03-30Rational number support in upstream server weight.Igor Sysoev1-7/+7
2020-03-30Configuration: support for rational numbers.Valentin Bartenev1-7/+7