]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Make push-peer-info visible in "normal" per-instance environment.
authorGert Doering <gert@greenie.muc.de>
Sun, 5 May 2013 12:36:13 +0000 (14:36 +0200)
committerGert Doering <gert@greenie.muc.de>
Mon, 27 May 2013 11:46:59 +0000 (13:46 +0200)
commita8be73799be163909a3b212656dedf03494f0792
tree079046ca6c087e66a8286709f1bb7a27a9b5b625
parent598e03f0e7bce434e501a9895819f2af0714d5f6
Make push-peer-info visible in "normal" per-instance environment.

Without this patch, peer-info pushed by clients in the TLS handshake
is only visible on the management interface, and only if
--management-client-auth is enabled.

With this patch, received records are sanitized and put into the normal
"multi instance" environment, where it can be evaluated by --client-connect
or --auth-user-pass-verify scripts and plugins, etc.  Only records matching
a fairly strict "name=value" format are accepted, and only names starting
with IV_ or UV_ are exported, to avoid clients sending funny stuff and
playing havoc with script/plugin environments on the server.  In the
"value" part, spaces, non-printable characters and shell metacharacters
are replaced by '_'.

The change is somewhat invasive as reception of the peer_info string was
only done when username+password are expected from the client, but the
data is always there (if the client sends no username/password, it will
send 0-length strings, so always extracting 3 strings is safe).  Also,
the sanitation function validate_peer_info_line() and the opts->peer_info
field were only compiled in #ifdef MANGEMENT_DEF_AUTH...

Patch v3: do not call the old man_output_peer_info_env() anymore, unless
a management env-filter has been set (= ensure IV_ and UV_ stuff is sent
at most *once*, and exactly the way OpenVPN AS expects it).  Add
substituting of "bad" characters in the environment values.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1367757373-31637-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7582
src/openvpn/manage.c
src/openvpn/multi.c
src/openvpn/multi.h
src/openvpn/ssl.c
src/openvpn/ssl_common.h