Commit Graph

5282 Commits

Author SHA1 Message Date
Willy Tarreau
7e0c9713b4 CLEANUP: tests: removed completely obsolete test files
A number of config files were present in the tests/ directory and which
would either test features that are easier to test using more recent files
or test obsolete features. All of them emit tons of useless warnings, and
instead of fixing them, better remove them since they have never been used
in the last 10 years or so.

The remaining files may still emit warnings and require some fixing but
they provide some value for some tests.
2015-10-13 17:07:34 +02:00
Willy Tarreau
29e7aca645 CLEANUP: examples: shut up warnings in transparent proxy example
Just add some missing timeouts.
2015-10-13 16:47:16 +02:00
Willy Tarreau
e2daab49ab CLEANUP: tests: move a test file from examples/ to tests/
examples are for users, tests are for developers.
2015-10-13 16:47:16 +02:00
Willy Tarreau
15255f7c12 CLEANUP: examples: update sample file ssl.cfg
This one emitted an error due to the lack of "verify none" on the server line.
2015-10-13 16:47:16 +02:00
Willy Tarreau
05d50d0910 CLEANUP: examples: update sample file option-http_proxy.cfg
This one was still valid but emitted lots of warnings.
2015-10-13 16:47:16 +02:00
Willy Tarreau
677457e882 CLEANUP: examples: fix the example file content-sw-sample.cfg
This one didn't load anymore, but it was worth updating it since it matches
most common needs.
2015-10-13 16:47:16 +02:00
Willy Tarreau
ae4865d802 CLEANUP: examples: remove obsolete configuration file samples
This removes the obsolete CTTPROXY configuration, the tarpit example,
and the pre-content switching example involving 3 layers and cookie
rewriting to emulate the use_backend feature... (9 years old).
2015-10-13 16:47:16 +02:00
Willy Tarreau
27232d6ff1 CLEANUP: examples: remove some obsolete and confusing files
Some files are totally obsolete. The Formilux init scripts and packaging
scripts for haproxy 1.1.21 should go. Linux 2.4 kernel patch to enable
epoll() on EOLed RHEL3 should go. The tuning script is incomplete and
only suited to older kernels, better stop shipping this one.
2015-10-13 16:47:16 +02:00
Willy Tarreau
86ac176e03 MINOR: init: report use of libslz instead of "no compression"
It's confusing to see "no zlib support" followed by supported
compression algorithms. Fix this.
2015-10-13 16:47:16 +02:00
Willy Tarreau
a5c51ac6a6 BUILD: properly report when USE_ZLIB and USE_SLZ are used together
Use #error here otherwise the errors are hard to spot for the casual
user.
2015-10-13 16:47:16 +02:00
Willy Tarreau
c0edfc281e DOC: remove haproxy-{en,fr}.txt
This long-awaited moment finally came!
2015-10-13 16:35:36 +02:00
Willy Tarreau
373933df1b DOC: mention management.txt in README
and in intro.txt as well. Remove references to haproxy-{en,fr}.txt.
2015-10-13 16:35:36 +02:00
Willy Tarreau
cf2316644d MINOR: examples: update haproxy.spec to mention new docs
intro.txt and management.txt were added. haproxy-{en,fr}.txt were removed.
2015-10-13 16:35:36 +02:00
Willy Tarreau
44aed90ce1 DOC: move the stats socket documentation from config to management
The documentation of the stats part is much more related to management
than to the configuration, move it there.
2015-10-13 16:18:28 +02:00
Willy Tarreau
2212e6a9e2 DOC: add the "management" documentation
This doc explains how to start/stop haproxy, what signals are used
and a few debugging tricks. It's far from being complete but should
already help a number of users.

The stats part will be taken from the config doc.
2015-10-13 16:18:28 +02:00
Willy Tarreau
d72f0f3cff DOC: mention the "namespace" options for bind and server lines
It was only in the network-namespaces doc, but it needs to be
present in the config doc as well.
2015-10-13 16:18:28 +02:00
Willy Tarreau
163d4620c6 MEDIUM: server: implement TCP_USER_TIMEOUT on the server
This is equivalent to commit 2af207a ("MEDIUM: tcp: implement tcp-ut
bind option to set TCP_USER_TIMEOUT") except that this time it works
on the server side. The purpose is to detect dead server connections
even when checks are rare, disabled, or after a soft reload (since
checks are disabled there as well), and to ensure client connections
will get killed faster.
2015-10-13 16:18:27 +02:00
Willy Tarreau
061b5ded28 BUG/MINOR: config: make the stats socket pass the correct proxy to the parsers
Baptiste reported a segfault when the "id" keyword was passed on the
"stats socket" line. The problem is related to the fact that the stats
parser stats_parse_global() passes curpx instead of global.stats_fe to
the keyword parser. Indeed, curpx being a pointer to the proxy in the
current section, it is not correct here since the global section does
not describe a proxy. It's just by pure luck that only bind_parse_id()
uses the proxy since any other keyword parser could use it as well.

The bug has no impact since the id specified here is not usable at all
and can be discarded from a faulty configuration.

This fix must be backported to 1.5.
2015-10-13 15:49:31 +02:00
Thierry FOURNIER
26a7aacaff BUG/MEDIUM: lua: direction test failed
Lua needs to known the direction of the http data processed (request or
response). It checks the flag SMP_OPT_DIR_REQ, buf this flag is 0. This patch
correctly checks the flags after applying the SMP_OPT_DIR mask.
2015-10-13 15:49:31 +02:00
Baptiste Assmann
5a54921902 DOC: stats paramaters available in frontend
All stats directive are now available in both frontend and backend
sections.
2015-10-12 21:06:21 +02:00
Baptiste Assmann
809e22aae0 DOC: backend section missing parameters
One parameter was missing in the proxy paramater list.
One parameter was not alphabeticaly sorted.
2015-10-12 21:06:11 +02:00
Baptiste Assmann
3493d0f091 DOC: global section missing parameters
Some parameters were missing in the global paramater list.
A few parameters were not alphabeticaly sorted.
2015-10-12 21:05:52 +02:00
Neale Ferguson
5e98e3e998 BUILD: enable build on Linux/s390x
I would like to contribute the following fix to enable the Linux s390x
platform. The fix was built against today's git master. I've attached the
patch for review. Depending on your buildbot/jenkins/? requirements I can
set up a virtual machine for automated building/testing of the package in
this environment.
2015-10-12 20:58:51 +02:00
Andrew Hayworth
e32d1867f6 BUG/MINOR: Handle interactive mode in cli handler
A previous commit broke the interactive stats cli prompt. Specifically,
it was not clear that we could be in STAT_CLI_PROMPT when we get to
the output functions for the cli handler, and the switch statement did
not handle this case. We would then fall through to the default
statement, which was recently changed to set error flags on the socket.
This in turn causes the socket to be closed, which is not what we wanted
in this specific case.

To fix, we add a case for STAT_CLI_PROMPT, and simply break out of the
switch statement.

Testing:
 - Connected to unix stats socket, issued 'prompt', observed that I
   could issue multiple consecutive commands.
 - Connected to unix stats socket, issued 'prompt', observed that socket
   timed out after inactivity expired.
 - Connected to unix stats socket, issued 'prompt' then 'set timeout cli
   5', observed that socket timed out after 5 seconds expired.
 - Connected to unix stats socket, issued invalid commands, received
   usage output.
 - Connected to unix stats socket, issued 'show info', received info
   output and socket disconnected.
 - Connected to unix stats socket, issued 'show stat', received stats
   output and socket disconnected.
 - Repeated above tests with TCP stats socket.

[wt: no backport needed, this was introduced during the applet rework in 1.6]
2015-10-12 20:54:50 +02:00
Vincent Bernat
a72db18243 MINOR: lua: fix a spelling error in some error messages
"unknown" was spelled "unkown".
2015-10-10 08:13:37 +02:00
Dragan Dosen
17def46e10 BUG/MEDIUM: logs: fix time zone offset format in RFC5424
The time zone offset format used in function update_log_hdr_rfc5424() was
missing ":" as a separator.
2015-10-10 00:07:03 +02:00
Christopher Faulet
85b5a1a781 MINOR: ssl: Add callbacks to set DH/ECDH params for generated certificates
Now, A callback is defined for generated certificates to set DH parameters for
ephemeral key exchange when required.
In same way, when possible, we also defined Elliptic Curve DH (ECDH) parameters.
2015-10-09 12:13:17 +02:00
Christopher Faulet
7969a33a01 MINOR: ssl: Add support for EC for the CA used to sign generated certificates
This is done by adding EVP_PKEY_EC type in supported types for the CA private
key when we get the message digest used to sign a generated X509 certificate.
So now, we support DSA, RSA and EC private keys.

And to be sure, when the type of the private key is not directly supported, we
get its default message digest using the function
'EVP_PKEY_get_default_digest_nid'.

We also use the key of the default certificate instead of generated it. So we
are sure to use the same key type instead of always using a RSA key.
2015-10-09 12:13:12 +02:00
Christopher Faulet
c6f02fb929 MINOR: ssl: Read the file used to generate certificates in any order
the file specified by the SSL option 'ca-sign-file' can now contain the CA
certificate used to dynamically generate certificates and its private key in any
order.
2015-10-09 12:13:08 +02:00
Willy Tarreau
a84c267522 BUILD: ssl: fix build error introduced by recent commit
Commit d2cab92 ("BUG/MINOR: ssl: fix management of the cache where forged
certificates are stored") removed some needed #ifdefs resulting in ssl not
building on older openssl versions where SSL_CTRL_SET_TLSEXT_HOSTNAME is
not defined :

src/ssl_sock.c: In function 'ssl_sock_load_ca':
src/ssl_sock.c:2504: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
src/ssl_sock.c:2504: error: (Each undeclared identifier is reported only once
src/ssl_sock.c:2504: error: for each function it appears in.)
src/ssl_sock.c:2505: error: 'ssl_ctx_lru_seed' undeclared (first use in this function)
src/ssl_sock.c: In function 'ssl_sock_close':
src/ssl_sock.c:3095: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
src/ssl_sock.c: In function '__ssl_sock_deinit':
src/ssl_sock.c:5367: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
make: *** [src/ssl_sock.o] Error 1

Reintroduce the ifdefs around the faulty areas.
2015-10-09 12:13:07 +02:00
Christopher Faulet
77fe80c0b4 MINOR: ssl: Release Servers SSL context when HAProxy is shut down
[wt: could be backported to 1.5 as well]
2015-10-09 10:33:00 +02:00
Christopher Faulet
d2cab92e75 BUG/MINOR: ssl: fix management of the cache where forged certificates are stored
First, the LRU cache must be initialized after the configuration parsing to
correctly set its size.
Next, the function 'ssl_sock_set_generated_cert' returns -1 when an error occurs
(0 if success). In that case, the caller is responsible to free the memory
allocated for the certificate.
Finally, when a SSL certificate is generated by HAProxy but cannot be inserted
in the cache, it must be freed when the SSL connection is closed. This happens
when 'tune.ssl.ssl-ctx-cache-size' is set to 0.
2015-10-09 10:20:53 +02:00
Christopher Faulet
d57ad64873 BUG/MINOR: http: Add OPTIONS in supported http methods (found by find_http_meth)
The 'OPTIONS' method was not in the list of supported HTTP methods and
find_http_meth return HTTP_METH_OTHER instead of HTTP_METH_OPTIONS.

[wt: this fix needs to be backported at least to 1.5, 1.4 and 1.3]
2015-10-09 10:18:09 +02:00
Christopher Faulet
3c3a035be0 MINOR: lru: do not allocate useless memory in lru64_lookup
lru64_lookup function was added in a previous patch of mine. This one
just remove a useless memory allocation.
2015-10-09 10:13:18 +02:00
Joseph Lynch
ffaf30b689 BUILD: Fix the build on OSX (htonll/ntohll)
htonll and ntohll were defined in 5b4dd683cb but on osx they are already
defined in sys/_endian.h. So, we check if they are defined before
declaring them.

[wt: no backport needed]
2015-10-09 10:11:59 +02:00
Willy Tarreau
067ac9f4b6 MINOR: debug: enable memory poisonning to use byte 0
When debugging an issue, sometimes it can be useful to be able to use
byte 0 to poison memory areas, resulting in the same effect as a calloc().
This patch changes the default mem_poison_byte to -1 to disable it so that
all positive values are usable.
2015-10-08 14:12:13 +02:00
Willy Tarreau
a088d316b7 MEDIUM: init: support a list of files on the command line
HAProxy could already support being passed a file list on the command
line, by passing multiple times "-f" followed by a file name. People
have been complaining that it made it hard to pass file lists from init
scripts.

This patch introduces an end of arguments using the common "--" tag,
after which only file names may appear. These files are then added to
the existing list of other files specified using -f and are loaded in
their declaration order. Thus it becomes possible to do something like
this :

    haproxy -sf $(pidof haproxy) -- /etc/haproxy/global.cfg /etc/haproxy/customers/*.cfg
2015-10-08 11:58:48 +02:00
Willy Tarreau
c6ca1aa34d MEDIUM: init: support more command line arguments after pid list
Given that all command line arguments start with a '-' and that
no pid number can start with this character, there's no constraint
to make the pid list the last argument. Let's relax this rule.
2015-10-08 11:32:32 +02:00
Willy Tarreau
0078bfcb43 BUG/MEDIUM: lua: force server-close mode on Lua services
Thierry reported that keep-alive still didn't cope well with Lua
services. The reason is that for now applets have to be closed at
the end of a transaction so we want to work in server-close mode,
which isn't noticeable by the client since it still sees keep-alive.
Additionally we want to enable the request body transfer analyser
which will be needed to synchronize with the response analyser to
indicate the end of the transfer.
2015-10-07 20:24:05 +02:00
Willy Tarreau
6457d0fac3 CLEANUP: cli: ensure we can never double-free error messages
The release handler used to be called twice for some time and just by
pure luck we never ended up double-freeing the data there. Add a NULL
to ensure this can never happen should a future change permit this
situation again.
2015-10-07 20:00:24 +02:00
Willy Tarreau
8c1ad716df [RELEASE] Released version 1.6-dev7
Released version 1.6-dev7 with the following main changes :
    - MINOR: cli: Dump all resolvers stats if no resolver section is given
    - BUG: config: external-check command validation is checking for incorrect arguments.
    - DOC: documentation format cleanups
    - DOC: lua: few typos.
    - BUG/MEDIUM: str2ip: make getaddrinfo() consider local address selection policy
    - BUG/MEDIUM: logs: segfault writing to log from Lua
    - DOC: fix lua use-service example
    - MINOR: payload: add support for tls session ticket ext
    - MINOR: lua: remove the run flag
    - MEDIUM: lua: change the timeout execution
    - MINOR: lua: rename the tune.lua.applet-timeout
    - DOC: lua: update Lua doc
    - DOC: lua: update doc according with the last Lua changes
    - MINOR: http/tcp: fill the avalaible actions
    - DOC: reorder misplaced res.ssl_hello_type in the doc
    - BUG/MINOR: tcp: make silent-drop always force a TCP reset
    - CLEANUP: tcp: silent-drop: only drain the connection when quick-ack is disabled
    - BUILD: tcp: use IPPROTO_IP when SOL_IP is not available
    - BUILD: server: fix build warnings introduced by load-server-state
    - BUG/MEDIUM: server: fix misuse of format string in load-server-state's warnings
2015-10-06 12:13:56 +02:00
Andrew Hayworth
68d0534885 MINOR: cli: Dump all resolvers stats if no resolver section is given
This commit adds support for dumping all resolver stats. Specifically
if a command 'show stats resolvers' is issued withOUT a resolver section
id, we dump all known resolver sections. If none are configured, a
message is displayed indicating that.
2015-10-06 07:08:09 +02:00
Ben Cabot
49795eb00c BUG: config: external-check command validation is checking for incorrect arguments.
When using the external-check command option HAProxy was failing to
start with a fatal error "'external-check' cannot handle unexpected
argument". When looking at the code it was looking for an incorrect
argument. Also correcting an Alert message text as spotted by by
PiBa-NL.
2015-10-02 23:11:49 +02:00
David Carlier
61fdf8baa4 DOC: lua: few typos. 2015-10-02 23:06:42 +02:00
Thierry FOURNIER
ab95e656ea MINOR: http/tcp: fill the avalaible actions
This patch adds a function that generates the list of avalaible actions
for the error message.
2015-10-02 22:56:11 +02:00
Thierry FOURNIER
a2d02253cf DOC: lua: update doc according with the last Lua changes
The impact of the register_action() was not repported.
2015-10-02 22:56:11 +02:00
Thierry FOURNIER
7dd784b525 DOC: lua: update Lua doc
- Removes the Lua action reference
 - Update the tune.lu.service-timeout
2015-10-02 22:56:10 +02:00
Thierry FOURNIER
56da1012d2 MINOR: lua: rename the tune.lua.applet-timeout
The name of applet is "service", so this patch renames the
tune.lua.applet-timeout to tune.lua.service-timeout
2015-10-02 22:56:10 +02:00
Dmitry Sivachenko
eab7f3996f BUG/MEDIUM: str2ip: make getaddrinfo() consider local address selection policy
When first parameter to getaddrinfo() is not NULL (it is always not NULL
in str2ip()), on Linux AI_PASSIVE value for ai_flags is ignored. On
FreeBSD, when AI_PASSIVE is specified and hostname parameter is not NULL,
getaddrinfo() ignores local address selection policy, always returning
AAAA record. Pass zero ai_flags to behave correctly on FreeBSD, this
change should be no-op for Linux.

This fix should be backported to 1.5 as well, after some observation
period.
2015-10-02 01:01:58 +02:00
Dragan Dosen
43885c728e BUG/MEDIUM: logs: segfault writing to log from Lua
Michael Ezzell reported a bug causing haproxy to segfault during startup
when trying to send syslog message from Lua. The function __send_log() can
be called with *p that is NULL and/or when the configuration is not fully
parsed, as is the case with Lua.

This patch fixes this problem by using individual vectors instead of the
pre-generated strings log_htp and log_htp_rfc5424.

Also, this patch fixes a problem causing haproxy to write the wrong pid in
the logs -- the log_htp(_rfc5424) strings were generated at the haproxy
start, but "pid" value would be changed after haproxy is started in
daemon/systemd mode.
2015-10-02 00:57:45 +02:00