Skip to contentSkip to conversation

management-signal maps disconnect to SIGTERM if used with management-client

PATCH In review Arne Schwabe 3 participants 5 messages Aug 7, 2012 – Sep 2, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 management-signal maps disconnect to SIGTERM if used with management-client

---
 doc/openvpn.8 |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
doc/openvpn.8 +2 -1
index 56be29e..2b54d9b 100644
@@ -2478,7 +2478,8 @@ command.
 .B \-\-management-signal
 Send SIGUSR1 signal to OpenVPN if management session disconnects.
 This is useful when you wish to disconnect an OpenVPN session on
-user logoff.
+user logoff. When used in conjuction with --management-client SIGTERM
+will be sent.
 .\"*********************************************************
 .TP
 .B \-\-management-log-cache n
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
#1 lore raw

Hi,

doc/openvpn.8 command. · line 2483

Quoted 8 lines · Arne Schwabe
doc/openvpn.8 +2 -1
@@ -2478,7 +2478,8 @@ command.
 .B \-\-management-signal
 Send SIGUSR1 signal to OpenVPN if management session disconnects.
 This is useful when you wish to disconnect an OpenVPN session on
-user logoff.
+user logoff. When used in conjuction with --management-client SIGTERM
+will be sent.
 .\"*********************************************************

OK, for the record and the archive :-) - I've now tried to follow the twisted maze of manage.c to understand why one or the other signal is sent.

This is happening inside man_reset_client_socket(), in this bit of code:

if (!exiting)

    {
...
      if (man->settings.flags & MF_SIGNAL) {
          int mysig = man_mod_signal (man, SIGUSR1);
          if (mysig >= 0)
            {
              msg (D_MANAGEMENT, "MANAGEMENT: Triggering management signal");
              throw_signal_soft (mysig, "management-disconnect");
            }
      }

      if (man->settings.flags & MF_CONNECT_AS_CLIENT)
        {
          msg (D_MANAGEMENT, "MANAGEMENT: Triggering management exit");
          throw_signal_soft (SIGTERM, "management-exit");
        }
      else
        man_listen (man);
    }

MF_CONNECT_AS_CLIENT is set by options.c if --management-client is used, MF_SIGNAL is set by options.c if --management-signal is used - but note that the "if (... MF_SIGNAL)" clause doesn't apply to the SIGTERM signalling.

So, if I read this right

- SIGTERM will *always* be sent upon management-disconnect if --management-client has been used, even if --management-signal is not set

- SIGUSR1 will be sent upon disconnect *if* requested by --management-signal (subject to remapping, but not automatically remapped)

if that analysis is correct, I'd re-word the proposed new text in the manpage somewhat. Suggested wording:

.B \-\-management-signal
Send SIGUSR1 signal to OpenVPN if management session disconnects (subject to remapping by \-\-remap-usr1).
This is useful when you wish to disconnect an OpenVPN session on user logoff. If \-\-management-client is used, a SIGTERM signal will always be sent on disconnect, even if \-\-management-signal is not set. .\"*********************************************************

gert

Signature · 11 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw

PATCH 1/1 Document --management-client and --management-signal a bit better

---
 doc/openvpn.8 |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
doc/openvpn.8 +7 -3
index 56be29e..845fb9a 100644
@@ -2431,11 +2431,14 @@ be set to 127.0.0.1
 server to local clients. 
 .TP
 .B \-\-management-client
-Management interface will connect as a TCP client to
+Management interface will connect as a TCP/unix domain client to
 .B IP:port
 specified by
 .B \-\-management
-rather than listen as a TCP server.
+rather than listen as a TCP server or on a unix domain socket.
+
+If the client connection fails to connect or is disconnected, 
+a SIGTERM signal will be generated causing OpenVPN to quit.
 .\"*********************************************************
 .TP
 .B \-\-management-query-passwords
@@ -2478,7 +2481,8 @@ command.
 .B \-\-management-signal
 Send SIGUSR1 signal to OpenVPN if management session disconnects.
 This is useful when you wish to disconnect an OpenVPN session on
-user logoff.
+user logoff. For --management-client this option is not needed since
+a disconnect will always generate a SIGTERM.
 .\"*********************************************************
 .TP
 .B \-\-management-log-cache n
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
#3 lore raw

Re: [Openvpn-devel] [PATCH] Document --management-client and --management-signal a bit better

Hi,

Quoted 4 lines · Arne Schwabe
---
 doc/openvpn.8 |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

ACK, and thanks.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw

Re: [Openvpn-devel] [PATCH] Document --management-client and --management-signal a bit better

In reply to Arne Schwabe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · Arne Schwabe

10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)

Applied to master.

commit c447b4265cd3fae308dd5798081d42f87ae89d91

Author: Arne Schwabe <[email protected]...>
Date:   Wed Aug 8 19:31:42 2012 +0200
    Document --management-client and --management-signal a bit better

    Signed-off-by: Arne Schwabe <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/6962
    Signed-off-by: David Sommerseth <[email protected]...>

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlBDuJoACgkQDC186MBRfrpizgCePidywkD4F8nb1eNP5mEtzwI/ PcAAoKXwI3HVHhD3Lpgky4Jd79R19POn
=QHxn
-----END PGP SIGNATURE-----