Skip to contentSkip to conversation

revoke scripts were broken

PATCH In review Jan Kiszka 6 participants 42 messages Jun 30, 2004 – Jul 11, 2004

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 revoke scripts were broken

Hi all,

here is a tiny patch to make revoke-crt and make-crl work seamlessly within the easy-rsa environment. Seems that no one used it before ;)

Jan

PS: Has anyone ever thought about some small GUI (taskbar icon with some dialogs) for Windows, KDE, etc. to make the handling of multiple configurations and the status display easier in a roadwarrior scenario? Just a thought, I'm not saying I have the time for doing it - unfortunately.

[If you reply, please add a CC, I'm not on the list]

easy-rsa/make-crl renamed from tmp/openvpn-2.0_beta6/easy-rsa/make-crl +1 -1
diff -Nur /tmp/openvpn-2.0_beta6/easy-rsa/make-crl openvpn-2.0_beta6/easy-rsa/make-crl
@@ -12,7 +12,7 @@
 
 if test $KEY_DIR; then
        cd $KEY_DIR && \
-       openssl ca -gencrl -out $1
+       openssl ca -gencrl -out $1 -config $KEY_CONFIG
 else
        echo you must define KEY_DIR
 fi
easy-rsa/revoke-crt renamed from tmp/openvpn-2.0_beta6/easy-rsa/revoke-crt +1 -1
diff -Nur /tmp/openvpn-2.0_beta6/easy-rsa/revoke-crt openvpn-2.0_beta6/easy-rsa/revoke-crt
@@ -12,7 +12,7 @@
 
 if test $KEY_DIR; then
        cd $KEY_DIR && \
-       openssl ca -revoke $1
+       openssl ca -revoke $1 -config $KEY_CONFIG
 else
        echo you must define KEY_DIR
 fi
#1 lore raw
Quoted 3 lines · Jan Kiszka

PS: Has anyone ever thought about some small GUI (taskbar icon with some dialogs) for Windows, KDE, etc. to make the handling of multiple configurations and the status display easier in a roadwarrior scenario? Just a thought, I'm not saying I have the time for doing it - unfortunately.

[If you reply, please add a CC, I'm not on the list]

I just started working on such an application last night. I'm kinda new to C programming in Windows so I ran into a little annoying problem right away though!

I don't want to bother this list with basic C programming issues though, but if someone is used to classic C programming and message handeling in windows, please contact me offlist if you got a spare minute. A pointer to a good mailing-list for discussion about classic C programming in windows would be appreciated too.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#2 lore raw
Quoted 5 lines · Mathias Sundman
Quoted 3 lines · Jan Kiszka

PS: Has anyone ever thought about some small GUI (taskbar icon with some dialogs) for Windows, KDE, etc. to make the handling of multiple configurations and the status display easier in a roadwarrior scenario? Just a thought, I'm not saying I have the time for doing it
- unfortunately.

Quoted 7 lines
Quoted 1 line

[If you reply, please add a CC, I'm not on the list]

I just started working on such an application last night. I'm kinda new to C programming in Windows so I ran into a little annoying problem right away though!

I don't want to bother this list with basic C programming issues though, but if someone is used to classic C programming and message handeling in windows, please contact me offlist if you got a spare minute. A pointer to a good mailing-list for discussion about classic C programming in windows would be appreciated too.

While considering a similar interface for some other project, I once took a closer look at wxWindows (http://www.wxwindows.org). Before you start hacking your own message handling routines in C or switching over to the Windows-only MFC library, this project may be worth some thoughts because

A) it capsulates most of the annoying GUI work, and
B) it opens to possiblity to port your work later to Linux as well!

I think not only Windows users would appreciate a simple management interface for OpenVPN clients very much...

The only problem so far: You have to consider writing your program object-oriented, i.e. in C++. Did you ever worked with some OO languages (Java e.g.)?

I would furthermore suggest to discuss the required interface between the GUI and the OpenVPN daemon on this list. Starting and stopping would be possibly by just running the main binary, but I think a more sophisticated status and diagnosis interface requires some other mechanism (e.g. a local socket). Such an interface could furthermore prevent that the actual user who switches some configuration or just checks the status must own superuser privileges to start/stop a OpenVPN service and - even worse - read the secret key files.

Comments are welcome!

Jan

#3 lore raw

Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 8 lines

I would furthermore suggest to discuss the required interface between the GUI and the OpenVPN daemon on this list. Starting and stopping would be possibly by just running the main binary, but I think a more sophisticated status and diagnosis interface requires some other mechanism (e.g. a local socket). Such an interface could furthermore prevent that the actual user who switches some configuration or just checks the status must own superuser privileges to start/stop a OpenVPN service and - even worse - read the secret key files.

Yes, I would like to see some kind of interface for control of OpenVPN from external programs.

The mechanism of the interface would be a socket on *nix or a named pipe on Windows.

The interface would primarily be for interaction with a GUI agent and would allow for:

* Stop/Restart control
* Get status (like SIGUSR2)
* Provide authentication info

James

#41 lore raw
In reply to Jan Kiszka
Quoted 4 lines · Jan Kiszka

Hi all,

here is a tiny patch to make revoke-crt and make-crl work seamlessly within the easy-rsa environment. Seems that no one used it before ;)

Thanks, I've merged for inclusion in beta8.

James

#4 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to James Yonan
Quoted 6 lines · Jan Kiszka
Quoted 3 lines
Quoted 1 line

PS: Has anyone ever thought about some small GUI (taskbar icon with some dialogs) for Windows, KDE, etc. to make the handling of multiple configurations and the status display easier in a roadwarrior scenario?

I just started working on such an application last night. I'm kinda new to C programming in Windows so I ran into a little annoying problem right away though!

While considering a similar interface for some other project, I once took a closer look at wxWindows (http://www.wxwindows.org). Before you start hacking your own message handling routines in C or switching over to the Windows-only MFC library, this project may be worth some thoughts because

Quoted 8 lines

A) it capsulates most of the annoying GUI work, and
B) it opens to possiblity to port your work later to Linux as well!

I think not only Windows users would appreciate a simple management interface for OpenVPN clients very much...

The only problem so far: You have to consider writing your program object-oriented, i.e. in C++. Did you ever worked with some OO languages (Java e.g.)?

No, I'm not used to OO languages, unfortunally. The reasons why I started to write this in C was:

1) I only know how to code in C, VisualBasic and Assembler. Assembler is out of the question, and I'm tired of VBs dependency for a bunch of DLLs. I like beeing able to compile just one compact exe file and not need to create an installation package just to get the application working on another machine.

2) The egoistic one! I've though of learning to develop windows gui applications in C for a long time, but never really got to it. Now I saw an opportunity to write something useful and learn something I've wanted to learn at the same time.

3) OpenVPN is written in traditional C, so if I for any reason would like to integrate the gui into the openvpn binary, that would be very easy if the gui itself was written in C.

4) I like traditional C, and dislike object oriented languages! Don't ask me why, it's just my personal taste, and I can fully understand that other prefer OO languages...

I do agree with you though that makeing it portable would have been prefered, but just like you, I don't got that much spare time, so I'm not sure that I want to spend it learning yet another development environment.

James, do you put any preferance in what language/environment a gui for OpenVPN is developed in, if you would distribute it together with the main application in the future?

Quoted 15 lines · James Yonan
Quoted 8 lines

I would furthermore suggest to discuss the required interface between the GUI and the OpenVPN daemon on this list. Starting and stopping would be possibly by just running the main binary, but I think a more sophisticated status and diagnosis interface requires some other mechanism (e.g. a local socket). Such an interface could furthermore prevent that the actual user who switches some configuration or just checks the status must own superuser privileges to start/stop a OpenVPN service and - even worse - read the secret key files.

Yes, I would like to see some kind of interface for control of OpenVPN from external programs.

The mechanism of the interface would be a socket on *nix or a named pipe on Windows.

Quoted 6 lines

The interface would primarily be for interaction with a GUI agent and would allow for:

* Stop/Restart control
* Get status (like SIGUSR2)
* Provide authentication info

That's great news. That was one of my concerns the other night, how to communicate with OpenVPN to check the status.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#5 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 5 lines · Mathias Sundman

...
No, I'm not used to OO languages, unfortunally. The reasons why I started to write this in C was:

1) I only know how to code in C, VisualBasic and Assembler. Assembler is out of the question, and I'm tired of VBs dependency for a bunch of DLLs. I like beeing able to compile just one compact exe file and not need to create an installation package just to get the application working on another machine.

Ok, as far as I remember, you need one additional library for wxWindows. MFC, on the other hand, already comes with Windows. The binaries of both approaches will be very compact, while you may create larger programs when hacking all the standard work (messsage processing etc.) on your own.

Quoted 4 lines

2) The egoistic one! I've though of learning to develop windows gui applications in C for a long time, but never really got to it. Now I saw an opportunity to write something useful and learn something I've wanted to learn at the same time.

3) OpenVPN is written in traditional C, so if I for any reason would like to integrate the gui into the openvpn binary, that would be very easy if the gui itself was written in C.

I personally think that using different languages for different tasks in a project should be no problem, especially as C++ fits better to GUI modules. But I'm not the project manager :).

Quoted 2 lines

4) I like traditional C, and dislike object oriented languages! Don't ask me why, it's just my personal taste, and I can fully understand that other prefer OO languages...

I'm also hacking most of my software in C - because it's kernel code or command line tools. But for GUI stuff, OO is definitely better suited and more efficient (due to re-use of components).

Quoted 2 lines

I do agree with you though that makeing it portable would have been prefered, but just like you, I don't got that much spare time, so I'm not sure that I want to spend it learning yet another development environment.

Before discouraging you from doing anything at all, I would suggest that you start with a basic GUI tool (and feel a bit of the effort ;) ). If the interface to the OpenVPN core is specified and stable, extending the GUI capabilities can be done later as well - if required.

Jan

#6 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to Mathias Sundman
Quoted 3 lines

James, do you put any preferance in what language/environment a gui for OpenVPN is developed in, if you would distribute it together with the main application in the future?

These are my current thoughts on this:

* Preferably, the language development tools and environment are open source, so there's no impediment to anyone building from source.

* The total size of included libraries should be reasonable, so it doesn't excessively push up the size of the Windows self-installing exe.

Having said that, I'm certainly going to be pragmatic here -- if someone puts together a great GUI agent that requires Visual C++ to build, I'm not going to belabor the point.

On the other hand if it's written in Visual Basic and increases the Windows package size by 10 MB then I'm going to have to think twice about actually bundling it. But if it's up to standard, I'd still link to it from the website in a heartbeat.

James

#7 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Hey there. James and I had a prior discussion about the systray app offline, but I thought I'd just poke my head in here. I'm not a strong Windows application programmer, but I've been doing a lot of C# these days.

With that in mind, I was gonna whip together a quickie little systray app in C# which could control the openvpn server. I know that C# adds the rather large .NET framework runtime installation, so my app could be considered a prototype if you would like!

Where do I start? Are the namedpipe hooks into the OpenVPN service built? I'm not too familiar with named pipes on Windows (done a bit on *nix), but I'm sure it can't be too hard. I guess what I'd need to know are the command to send to the named pipe, and also what I can get from the named pipe in regards to status and such.

Any suggestions?

Signature · 4 lines
-bk


Quoting James Yonan <[email protected]...>:
Quoted 37 lines
Quoted 3 lines

James, do you put any preferance in what language/environment a gui for OpenVPN is developed in, if you would distribute it together with the main application in the future?

These are my current thoughts on this:

* Preferably, the language development tools and environment are open source,

so there's no impediment to anyone building from source.

* The total size of included libraries should be reasonable, so it doesn't excessively push up the size of the Windows self-installing exe.

Having said that, I'm certainly going to be pragmatic here -- if someone puts

together a great GUI agent that requires Visual C++ to build, I'm not going to belabor the point.

On the other hand if it's written in Visual Basic and increases the Windows package size by 10 MB then I'm going to have to think twice about actually bundling it. But if it's up to standard, I'd still link to it from the website in a heartbeat.

James

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#8 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 9 lines · Brandon Knitter

Hey there. James and I had a prior discussion about the systray app offline, but I thought I'd just poke my head in here. I'm not a strong Windows application programmer, but I've been doing a lot of C# these days.

With that in mind, I was gonna whip together a quickie little systray app in C# which could control the openvpn server. I know that C# adds the rather large .NET framework runtime installation, so my app could be considered a prototype if you would like!

Quoted 7 lines

Where do I start? Are the namedpipe hooks into the OpenVPN service built? I'm not too familiar with named pipes on Windows (done a bit on *nix), but I'm sure it can't be too hard. I guess what I'd need to know are the command to send to the named pipe, and also what I can get from the named pipe in regards to status and such.

Any suggestions?

Hi Brandon!

Have you looked at the systray application I wrote and released on the users-list last night?

If not, have a look at http://www.nilings.se/openvpn

I'm working hard on next version right now and will probably release it tomorrow. This version will support controlling multiple tunnels simultaneously from the the menu, and monitor if the process ends before it is manually disconnected.

My version is written in pure Win32 C code, but if you want to rewrite it using C# you are ofcource welcome...

Best Regards Mathias

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#9 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to Brandon Knitter
Quoted 9 lines · Brandon Knitter

Hey there. James and I had a prior discussion about the systray app offline, but I thought I'd just poke my head in here. I'm not a strong Windows application programmer, but I've been doing a lot of C# these days.

With that in mind, I was gonna whip together a quickie little systray app in C# which could control the openvpn server. I know that C# adds the rather large .NET framework runtime installation, so my app could be considered a prototype if you would like!

Quoted 5 lines

Where do I start? Are the namedpipe hooks into the OpenVPN service built? I'm not too familiar with named pipes on Windows (done a bit on *nix), but I'm sure it can't be too hard. I guess what I'd need to know are the command to send to the named pipe, and also what I can get from the named pipe in regards to status and such.

There are no hooks as of yet to control a running OpenVPN instance (other than sending signals).

While I initially thought that named pipes might be the appropriate channel for this, I'm wondering if if might make more sense (for portability) to use a local TCP/IP socket as the control channel, such as 127.0.0.0:[some port].

Then for testing purposes, you could just telnet to the socket.

I am thinking the interface should consist of a standard ascii command response loop, such as is used by SMTP.

Possible client -> server commands:

(1) send auth credentials
(2) get status (as in SIGUSR2)
(3) send signal (SIGHUP, SIGUSR1, or SIGUSR2, SIGTERM)

And server -> client commands:

(1) need auth credentials -- GUI should query the user then return them to the daemon via a "send auth credentials" command

The basic mechanism of operation to enable the management interface would be to pass an option like this in the config file:

management 127.0.0.1 20001

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

It's important, of course, that the management port always be local, since we are using it to potentially pass passwords and other sensitive data that should never actually touch a real network interface.

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

This is all just a proposal, no code has been written yet, comments are welcome.

James

#10 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 42 lines · James Yonan
Quoted 5 lines · Brandon Knitter

Where do I start? Are the namedpipe hooks into the OpenVPN service built? I'm not too familiar with named pipes on Windows (done a bit on *nix), but I'm sure it can't be too hard. I guess what I'd need to know are the command to send to the named pipe, and also what I can get from the named pipe in regards to status and such.

There are no hooks as of yet to control a running OpenVPN instance (other than sending signals).

While I initially thought that named pipes might be the appropriate channel for this, I'm wondering if if might make more sense (for portability) to use a local TCP/IP socket as the control channel, such as 127.0.0.0:[some port].

Then for testing purposes, you could just telnet to the socket.

I am thinking the interface should consist of a standard ascii command response loop, such as is used by SMTP.

Possible client -> server commands:

(1) send auth credentials
(2) get status (as in SIGUSR2)
(3) send signal (SIGHUP, SIGUSR1, or SIGUSR2, SIGTERM)

And server -> client commands:

(1) need auth credentials -- GUI should query the user then return them to the daemon via a "send auth credentials" command

The basic mechanism of operation to enable the management interface would be to pass an option like this in the config file:

management 127.0.0.1 20001

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

It's important, of course, that the management port always be local, since we are using it to potentially pass passwords and other sensitive data that should never actually touch a real network interface.

Quoted 6 lines

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

This is all just a proposal, no code has been written yet, comments are welcome.

This sounds good to me, and will allow us to start with a basic set of "commands", and add more as we find the need for a specific function.

One little wonder though, is it good to have a bi-directional protocol over a single socket. Ofcource replys to command can go over the same channel, but if both the server and the client is allowed to "start the conversation", how do we handle the case when both the server and client sends a command at the same time.

How will we know if what we recieve is an answer to our command, or a command from the server?

In addition to the information given by SIGUSR2 I'd would like to be able to get current state of the the link. We should be able to define several STATEs during the establishing of the connection. Like:

STATE_WAIT_FIRST_RESPONE - When we have tried to connect to the remote peer but still not recieved any answer.

STATE_WAIT_AUTH - We have recieved some answer from the remove peer, but not yet fully authenticated. (This state will never happend when using static keys.)

STATE_WAIT_PUSH - We wait for options to be pushed from the server.

STATE_WAIT_SETIP - We are waiting for the system to set the ip address.

STATE_WAIT_APPLY_SETTINGS - We are waiting for the system to set other pushed parameters like routes.

STATE_CONNECTED - We are fully connected!

I have not though through the absolute meaing of those states or if the names are any good, but it gives you an idea of what kind of information I'd like to get.

The reason for several states during the init is ofcource that it will allow me to set timeout values for every step and report to the user at what step the connection failed.

I suppose it will be best if the gui client query the server for the current state.

/Mathias

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#11 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 52 lines · Mathias Sundman
Quoted 43 lines · James Yonan
Quoted 5 lines · Brandon Knitter

Where do I start? Are the namedpipe hooks into the OpenVPN service built? I'm not too familiar with named pipes on Windows (done a bit on *nix), but I'm sure it can't be too hard. I guess what I'd need to know are the command to send to the named pipe, and also what I can get from the named pipe in regards to status and such.

There are no hooks as of yet to control a running OpenVPN instance (other than sending signals).

While I initially thought that named pipes might be the appropriate channel for this, I'm wondering if if might make more sense (for portability) to use a local TCP/IP socket as the control channel, such as 127.0.0.0:[some port].

Then for testing purposes, you could just telnet to the socket.

I am thinking the interface should consist of a standard ascii command response loop, such as is used by SMTP.

Possible client -> server commands:

(1) send auth credentials
(2) get status (as in SIGUSR2)
(3) send signal (SIGHUP, SIGUSR1, or SIGUSR2, SIGTERM)

And server -> client commands:

(1) need auth credentials -- GUI should query the user then return them to the daemon via a "send auth credentials" command

The basic mechanism of operation to enable the management interface would be to pass an option like this in the config file:

management 127.0.0.1 20001

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

It's important, of course, that the management port always be local, since we are using it to potentially pass passwords and other sensitive data that should never actually touch a real network interface.

Quoted 7 lines

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

This is all just a proposal, no code has been written yet, comments are welcome.

Quoted 8 lines

This sounds good to me, and will allow us to start with a basic set of "commands", and add more as we find the need for a specific function.

One little wonder though, is it good to have a bi-directional protocol over a single socket. Ofcource replys to command can go over the same channel, but if both the server and the client is allowed to "start the conversation", how do we handle the case when both the server and client sends a command at the same time.

TCP connections are always full duplex so both sides can send and receive at the same time without collision issues.

Having said that, the application needs to support bidirectionality, by always having a listen queued on the port for possible incoming data.

On Windows, the best way to do this is to use the WSAAsyncSelect or WSAEventSelect functions. WSAAsyncSelect is particularly useful for Windows GUI-based programs because it gives you notification of incoming data on a TCP socket through the standard Windows message notification mechanism.

Quoted 2 lines

How will we know if what we recieve is an answer to our command, or a command from the server?

The unsolicited notification from the server would have a specific prefix that indicates that it is an asynchronous notification from the server, as opposed to a response to a client->server command.

For example, the server would say something like this:

NOTIFY:NEED_AUTH,USER,PASS

The "ASYNC" indicates that the message is an asynchronous notification.

NEED_AUTH is the command, and USER/PASS indicates that the GUI should prompt the user for and return both username and password.

Then the GUI would reply back:

AUTH_USER [username]
AUTH_PASS [password]

Quoted 11 lines

In addition to the information given by SIGUSR2 I'd would like to be able to get current state of the the link. We should be able to define several STATEs during the establishing of the connection. Like:

STATE_WAIT_FIRST_RESPONE - When we have tried to connect to the remote peer but still not recieved any answer.

STATE_WAIT_AUTH - We have recieved some answer from the remove peer, but not yet fully authenticated. (This state will never happend when using static keys.)

Quoted 8 lines

STATE_WAIT_PUSH - We wait for options to be pushed from the server.

STATE_WAIT_SETIP - We are waiting for the system to set the ip address.

STATE_WAIT_APPLY_SETTINGS - We are waiting for the system to set other pushed parameters like routes.

STATE_CONNECTED - We are fully connected!

We already have something like this in ssl.h (see "key negotiation states"), but your idea expands beyond this.

Quoted 4 lines

I have not though through the absolute meaing of those states or if the names are any good, but it gives you an idea of what kind of information I'd like to get.

Quoted 8 lines

The reason for several states during the init is ofcource that it will allow me to set timeout values for every step and report to the user at what step the connection failed.

I suppose it will be best if the gui client query the server for the current state.

/Mathias

I think the states are a good idea. The state info, like the request for auth credentials, will be an asynchronous server -> client notification.

For example:

NOTIFY:STATE,STATE_CONNECTED

James

#12 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 62 lines · James Yonan
Quoted 29 lines
Quoted 29 lines

There are no hooks as of yet to control a running OpenVPN instance (other than sending signals).

While I initially thought that named pipes might be the appropriate channel for this, I'm wondering if if might make more sense (for portability) to use a local TCP/IP socket as the control channel, such as 127.0.0.0:[some port].

Then for testing purposes, you could just telnet to the socket.

I am thinking the interface should consist of a standard ascii command response loop, such as is used by SMTP.

Possible client -> server commands:

(1) send auth credentials
(2) get status (as in SIGUSR2)
(3) send signal (SIGHUP, SIGUSR1, or SIGUSR2, SIGTERM)

And server -> client commands:

(1) need auth credentials -- GUI should query the user then return them to the daemon via a "send auth credentials" command

The basic mechanism of operation to enable the management interface would be to pass an option like this in the config file:

management 127.0.0.1 20001

Quoted 8 lines
Quoted 3 lines

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

One little wonder though, is it good to have a bi-directional protocol over a single socket. Ofcource replys to command can go over the same channel, but if both the server and the client is allowed to "start the conversation", how do we handle the case when both the server and client sends a command at the same time.

TCP connections are always full duplex so both sides can send and receive at the same time without collision issues.

Having said that, the application needs to support bidirectionality, by always having a listen queued on the port for possible incoming data.

On Windows, the best way to do this is to use the WSAAsyncSelect or WSAEventSelect functions. WSAAsyncSelect is particularly useful for Windows GUI-based programs because it gives you notification of incoming data on a TCP socket through the standard Windows message notification mechanism.

Quoted 2 lines

How will we know if what we recieve is an answer to our command, or a command from the server?

The unsolicited notification from the server would have a specific prefix that indicates that it is an asynchronous notification from the server, as opposed to a response to a client->server command.

For example, the server would say something like this:

NOTIFY:NEED_AUTH,USER,PASS

The "ASYNC" indicates that the message is an asynchronous notification.

Quoted 7 lines

NEED_AUTH is the command, and USER/PASS indicates that the GUI should prompt the user for and return both username and password.

Then the GUI would reply back:

AUTH_USER [username]
AUTH_PASS [password]

Okay. The NOTIFY prefix solves my wonder. I was aware that TCP connections are fullduplex, it was just the overlying protocol I was worried about.

Quoted 23 lines
Quoted 11 lines

In addition to the information given by SIGUSR2 I'd would like to be able to get current state of the the link. We should be able to define several STATEs during the establishing of the connection. Like:

STATE_WAIT_FIRST_RESPONE - When we have tried to connect to the remote peer but still not recieved any answer.

STATE_WAIT_AUTH - We have recieved some answer from the remove peer, but not yet fully authenticated. (This state will never happend when using static keys.)

Quoted 8 lines

STATE_WAIT_PUSH - We wait for options to be pushed from the server.

STATE_WAIT_SETIP - We are waiting for the system to set the ip address.

STATE_WAIT_APPLY_SETTINGS - We are waiting for the system to set other pushed parameters like routes.

STATE_CONNECTED - We are fully connected!

We already have something like this in ssl.h (see "key negotiation states"), but your idea expands beyond this.

Quoted 6 lines

I think the states are a good idea. The state info, like the request for auth credentials, will be an asynchronous server -> client notification.

For example:

NOTIFY:STATE,STATE_CONNECTED

I think it would be good both if the server sent NOTIFY messages when the state is change, and if there was a query command the client can issue to receive the current state. One use of the latter is that it would allow the gui to hook into an already running process (started by the service wrapper perhaps), and check the current state.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#13 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to James Yonan
Quoted 5 lines · James Yonan

management 127.0.0.1 20001

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

Quoted 7 lines

It's important, of course, that the management port always be local, since we are using it to potentially pass passwords and other sensitive data that should never actually touch a real network interface.

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

Please don't do too much of that. I've seen this auth featuritis creeping in ntp and ups tools(!). Results ain't pretty...

Reconfiguration of openvpn can always be done by editing config file and restarting openvpn daemon. Simple. Elegant. No additional coding
- no risk of introducing bugs.

This can be done via systray app, too.
--
vda

#14 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

Quoted 16 lines · Denis Vlasenko
Quoted 5 lines · James Yonan

management 127.0.0.1 20001

This will cause OpenVPN to listen on 127.0.0.1:20001 as its management interface port.

Quoted 7 lines

It's important, of course, that the management port always be local, since we are using it to potentially pass passwords and other sensitive data that should never actually touch a real network interface.

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

Quoted 8 lines

Please don't do too much of that. I've seen this auth featuritis creeping in ntp and ups tools(!). Results ain't pretty...

Reconfiguration of openvpn can always be done by editing config file and restarting openvpn daemon. Simple. Elegant. No additional coding
- no risk of introducing bugs.

This can be done via systray app, too.

I can understand your concerns, and mostly you are right. However, there is one quite important scenario - at least as I see it - where you need the core daemon and the GUI running in different accounts: whenever the key or secret has to be looked away from the user while it shall still be possible for her/him to start/stop VPN connections. One reason for this may be that the key is bound to the device and not the user. The other one is security. Through this separation, malicious programs running in the context of the user can not so easily access the secret.

And for those who don't trust this new interface (which will surely need a careful implementation): what about adding a configure switch and putting the respective code in some #ifdefs?

Jan

#17 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to James Yonan
Quoted 7 lines · James Yonan

...
Possible client -> server commands:

(1) send auth credentials
(2) get status (as in SIGUSR2)
(3) send signal (SIGHUP, SIGUSR1, or SIGUSR2, SIGTERM)

Quoted 8 lines

And server -> client commands:

(1) need auth credentials -- GUI should query the user then return them to the daemon via a "send auth credentials" command

The basic mechanism of operation to enable the management interface would be to pass an option like this in the config file:

management 127.0.0.1 20001

I would like to have some mechanism to fork an openvpn instance and let the new process use a specific configuration file. This would allow to start only certain VPN tunnels depending on what the user selects in the GUI.

Jan

#15 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to Jan Kiszka
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

Please don't do too much of that. I've seen this auth featuritis creeping in ntp and ups tools(!). Results ain't pretty...

I don't think that supplying a generalized authentication mechanism (that's method agnostic) will add very much complexity.

The way I see this working is that the SSL/TLS authentication still provides the real security. But after SSL/TLS authentication has occurred, one still might want to submit some sort of credentials string to the server (obtained via GUI from the user) to determine the common name which will be assigned to the client. In any case, OpenVPN on the server is probably going to interface with an authentication library which will handle all the details.

Quoted 15 lines
Quoted 5 lines

Reconfiguration of openvpn can always be done by editing config file and restarting openvpn daemon. Simple. Elegant. No additional coding
- no risk of introducing bugs.

This can be done via systray app, too.

I can understand your concerns, and mostly you are right. However, there is one quite important scenario - at least as I see it - where you need the core daemon and the GUI running in different accounts: whenever the key or secret has to be looked away from the user while it shall still be possible for her/him to start/stop VPN connections. One reason for this may be that the key is bound to the device and not the user. The other one is security. Through this separation, malicious programs running in the context of the user can not so easily access the secret.

Quoted 3 lines

And for those who don't trust this new interface (which will surely need a careful implementation): what about adding a configure switch and putting the respective code in some #ifdefs?

I agree -- the management interface should not be implicitly enabled by default. You will need to specify the "management" config option to turn it on.

James

#16 lore raw

Re: Interface with GUI agent, was: Re: [Openvpn-devel] [Patch] revoke scripts were broken

In reply to Jan Kiszka
Quoted 12 lines · Jan Kiszka
Quoted 12 lines
Quoted 4 lines

Thinking ahead, the challenge/response sequence for passing authentication info should be open-ended to provide for future implementation of alternative authentication methods such as Radius, LDAP, NT Auth, etc.

Please don't do too much of that. I've seen this auth featuritis creeping in ntp and ups tools(!). Results ain't pretty...

Reconfiguration of openvpn can always be done by editing config file and restarting openvpn daemon. Simple. Elegant. No additional coding
- no risk of introducing bugs.

Quoted 7 lines
Quoted 1 line

This can be done via systray app, too.

I can understand your concerns, and mostly you are right. However, there is one quite important scenario - at least as I see it - where you need the core daemon and the GUI running in different accounts: whenever the key or secret has to be looked away from the user while it shall still be possible for her/him to start/stop VPN connections. One reason for

Easy. openvpn shall start in admin account, then read the key, and *then* change its uid to the uid killable by user. --
vda

#18 lore raw

[Openvpn-devel] Re: Interface with GUI agent

In reply to Jan Kiszka
Quoted 1 line · Jan Kiszka

I would like to have some mechanism to fork an openvpn instance and let the new process use a specific configuration file. This would allow to start only certain VPN tunnels depending on what the user selects in the GUI.

I've been giving this some more thought... and I agree we definitly need something like this.

Is it possible in windows to install a program as SUID in unix, so the application is ran as administrator even though it is started by an ordinary user? If yes, that would be eliminate the need to fork new processes (as I can think of right now atleast).

If no, Is it only on windows we can't do this, or do we have this problem on other platforms too?

If it's a windows specific problem, then maybe this functionally should be in the service wrapper. If we add a simple interface to the service wrapper our gui client could tell the service wrapper to start new openvpn processes when we want.

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#19 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 6 lines · Mathias Sundman
Quoted 4 lines · Jan Kiszka

I would like to have some mechanism to fork an openvpn instance and let the new process use a specific configuration file. This would allow to start only certain VPN tunnels depending on what the user selects in the GUI.

Quoted 7 lines

I've been giving this some more thought... and I agree we definitly need something like this.

Is it possible in windows to install a program as SUID in unix, so the application is ran as administrator even though it is started by an ordinary user? If yes, that would be eliminate the need to fork new processes (as I can think of right now atleast).

No, I don't think this is possible in Windows.

Quoted 2 lines

If no, Is it only on windows we can't do this, or do we have this problem on other platforms too?

Most other platforms support the SUID bit.

Quoted 4 lines

If it's a windows specific problem, then maybe this functionally should be in the service wrapper. If we add a simple interface to the service wrapper our gui client could tell the service wrapper to start new openvpn processes when we want.

Yes, this is probably a better idea.

Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

James

#20 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 17 lines · James Yonan
Quoted 6 lines · Mathias Sundman
Quoted 4 lines · Jan Kiszka

I would like to have some mechanism to fork an openvpn instance and let the new process use a specific configuration file. This would allow to start only certain VPN tunnels depending on what the user selects in the GUI.

Quoted 7 lines

I've been giving this some more thought... and I agree we definitly need something like this.

If it's a windows specific problem, then maybe this functionally should be in the service wrapper. If we add a simple interface to the service wrapper our gui client could tell the service wrapper to start new openvpn processes when we want.

Yes, this is probably a better idea.

Quoted 7 lines
Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Do you have time to do this in the near future? Otherwise, I think I could do it. I'm pretty familiar with the service wrapper code now that I've copied most of it to my gui :-) So now I just need to put it back in the service wrapper!

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#21 lore raw

[Openvpn-devel] Re: Interface with GUI agent

In reply to James Yonan
Quoted 7 lines · James Yonan

...

Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Then don't forget that we will need a similar wrapper for unix as well...

Jan

#22 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 11 lines · Jan Kiszka
Quoted 7 lines · James Yonan

...

Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Then don't forget that we will need a similar wrapper for unix as well...

Why do we need a wrapper in unix? Can't the openvpn binary be run as a normal user in unix?

If we need root-privs, what's wrong with installing openvpn as suid root and have it drop its privs after start-up?

We still need the management interface in openvpn though for all platforms so we can check the status of the connection from a gui, but that's another issue.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#23 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 14 lines · Mathias Sundman
Quoted 12 lines · Jan Kiszka
Quoted 9 lines · James Yonan

...

Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Quoted 7 lines
Quoted 1 line

Then don't forget that we will need a similar wrapper for unix as well...

Why do we need a wrapper in unix? Can't the openvpn binary be run as a normal user in unix?

If we need root-privs, what's wrong with installing openvpn as suid root and have it drop its privs after start-up?

Yes, this will work. But I'm afraid - maybe I'm wrong - that the GUI will then have to be implemented quite differently on Windows and Unix. On Windows, we would open a socket and both send the commands over it and receive the status. On Unix, we would first start the process and then connect to a socket for status information (BTW, which socket would then be used when multiple instances of openvpn are running?).

Quoted 2 lines

We still need the management interface in openvpn though for all platforms so we can check the status of the connection from a gui, but that's another issue.

Don't think so. We should first find a concept for both topics so that we can be sure that nothing interfers later.

Jan

#24 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Quoted 11 lines · Jan Kiszka
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Then don't forget that we will need a similar wrapper for unix as well...

Why do we need a wrapper in unix? Can't the openvpn binary be run as a normal user in unix?

If we need root-privs, what's wrong with installing openvpn as suid root and have it drop its privs after start-up?

Yes, this will work. But I'm afraid - maybe I'm wrong - that the GUI will then have to be implemented quite differently on Windows and Unix. On Windows, we would open a socket and both send the commands over it and receive the status. On Unix, we would first start the process and then connect to a socket for status information (BTW, which socket would then be used when multiple instances of openvpn are running?).

Yes and No. The way the GUI starts an openvpn process will have to implemented in diffrent ways for unix and windows. On Windows it will open a socket to the service wrapper and tell it to start an openvpn process with a specific config. On unix it will launch the openvpn process itself. This is not many lines of code so I think it can be handled with ifdefs quite cleanly.

Then when the openvpn process has been started the gui connects to a socket that openvpn is listening on to receive status or send other commands that we can think of.

The socket each openvpn process is listening on should be specified in the config-file with an option like "management 127.0.0.1 6001", where 6001 is the TCP port number. So each process should be listening on a unique port.

A perhaps cleaner way is that the gui adds the manangement option when it starts the openvpn process, so the user don't have to bother setting the correct management option in his config-files.

This interface to the openvpn deamon will be the same regardless of the platform.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#25 lore raw

[Openvpn-devel] Re: Interface with GUI agent

Some more things to consider...

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

1b. Scan a defined directory for config files, and require the config files to have a management option. Then we can try connecting to the specified tcp port to find if there is a running ovpn process.

1c. Query the system for processes with the name "openvpn", and which sockets this process has opened. Then we could try connecting to those ports to find the management socket.

I dislike 1b because it would complicate for the user, that he has to have the management option in his config-file. If using 1a that is handled automaticly by the gui or service wrapper.

The drawback with 1a is, how do we handle the same thing on unix? There could be situations where we would like start the vpn before a gui agent here to. Are we back to what Jan K said, we need a "service wrapper" for unix to, that can run at al ltime as a deamon and keep track of our openvpn processes? It would require some extra work writing this deamon to, but it would give us a consistent way of starting openvpn processes from a gui agent regardless of the platform.

2. How should the service wrapper know which configs to launch at start-up? To maintain backwords-compatibility it should launch all config files in the config folder. However the gui agent should be able to handle both processes started at boot-time and other that is started manually from the gui later.

I've thought of two ways of doing this.

2a. Use a config file which list which configs that should be launched at boot-time. If that config file does not exist, it will launch all it finds, as it is today. A gui agent can then create this file to specify which configs should be launched at boot-time.

2b. Use another folder for configs that should not be started at boot-time.

Please let me know how you think we should handle these issues before I put anymore work into the service wrapper in a wrong direction...

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#40 lore raw

[Openvpn-devel] Re: Interface with GUI agent

In reply to Mathias Sundman
Quoted 13 lines · Mathias Sundman
Quoted 12 lines · Jan Kiszka
Quoted 10 lines · James Yonan

...

Quoted 2 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Quoted 4 lines
Quoted 1 line

Then don't forget that we will need a similar wrapper for unix as well...

Why do we need a wrapper in unix? Can't the openvpn binary be run as a normal user in unix?

The sticking point for running in user mode is opening the tun/tap device node and adding routes.

James

#38 lore raw

[Openvpn-devel] Re: Interface with GUI agent

In reply to Mathias Sundman
Quoted 5 lines · Mathias Sundman
Quoted 4 lines · Jan Kiszka
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

If it's not a windows specific problem, then I suppost it's best to add the functionallity in the openvpn binary so we get the portability.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

I don't think the openvpn binary needs to know about this. But the service wrapper probably needs a second mode of operation, where instead of getting its config files by scanning a directory, it listens on a local socket for a command from the GUI to start an openvpn.exe instance.

Then don't forget that we will need a similar wrapper for unix as well...

I'm not sure that we really need a wrapper for unix, because most unix users will control OpenVPN by:

(1) editing config files and starting from /etc/init.d, or
(2) using some sort of GUI-based admin tool such as YaST

and both of these methods are traditionally done as root.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Why do we need a wrapper in unix? Can't the openvpn binary be run as a normal user in unix?

If we need root-privs, what's wrong with installing openvpn as suid root and have it drop its privs after start-up?

Not a big problem, though some might prejudice a package which requires SUID.

Quoted 6 lines
Quoted 6 lines

Yes, this will work. But I'm afraid - maybe I'm wrong - that the GUI will then have to be implemented quite differently on Windows and Unix. On Windows, we would open a socket and both send the commands over it and receive the status. On Unix, we would first start the process and then connect to a socket for status information (BTW, which socket would then be used when multiple instances of openvpn are running?).

Should the unix GUI be written for generic X, or should we develop admin modules for specific distros such as YaST?

I would go for the latter, because it will make the interface fit more seamlessly into a distribution's existing admin infrastructure.

Quoted 11 lines

Yes and No. The way the GUI starts an openvpn process will have to implemented in diffrent ways for unix and windows. On Windows it will open a socket to the service wrapper and tell it to start an openvpn process with a specific config. On unix it will launch the openvpn process itself. This is not many lines of code so I think it can be handled with ifdefs quite cleanly.

Then when the openvpn process has been started the gui connects to a socket that openvpn is listening on to receive status or send other commands that we can think of.

Quoted 7 lines

The socket each openvpn process is listening on should be specified in the config-file with an option like "management 127.0.0.1 6001", where 6001 is the TCP port number. So each process should be listening on a unique port.

A perhaps cleaner way is that the gui adds the manangement option when it starts the openvpn process, so the user don't have to bother setting the correct management option in his config-files.

I agree. This is sort of like the way the current service wrapper passes --service to each OpenVPN process.

So the system-tray GUI manages a pool of 127.0.0.1 ports and allocates them to OpenVPN processes.

James

#26 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

In reply to Mathias Sundman
Quoted 11 lines · Mathias Sundman

Some more things to consider...

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or (b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

(a) is probably simpler to develop, but (b) may be a better solution long-term because it handles the management interface in a portable way, and makes the GUI itself (which probably needs a separate admin module for Win32, YaST, X, http, etc.) as lightweight and stateless as possible.

Now the way I would implement (b) is to design as much of the "portable service wrapper" code as is possible without actually coding any function calls to create windows or dispatch window messages or do any GUI stuff directly. The service wrapper would take care of instantiating OpenVPN processes, managing the 127.0.0.1 port pool to communicate with the processes.

Now the GUI applet itself becomes very simple and stateless, it only needs to connect to the service wrapper, and any window message corresponding to a user mouse action gets encoded into a simple command that gets sent to the service wrapper.

I agree that this is a more complicated problem to solve because now we have the service wrapper which is talking to the individual OpenVPN processes, and we have the GUI applet talking to the service manager.

But long term (IMHO) this gives us great flexibility to easily port the GUI applet to other interfaces, such as even http. It would be very cool, for example, if with a little bit of php programming, you could control your OpenVPN instances via a web interface for example. You wouldn't need to rewrite a huge program which deals with all the details of starting/stopping/managing the pool of OpenVPN processes, because that program would already exist as the cross-platform service wrapper daemon.

Quoted 3 lines

1b. Scan a defined directory for config files, and require the config files to have a management option. Then we can try connecting to the specified tcp port to find if there is a running ovpn process.

No, I don't think people should explicitly put the management option in their config files.

Quoted 3 lines

1c. Query the system for processes with the name "openvpn", and which sockets this process has opened. Then we could try connecting to those ports to find the management socket.

I don't like the idea of querying the system for "openvpn" processes (for one there's no portable API for querying the system for processes). I would rather see the manager deal with managing a pool of local ports.

Quoted 3 lines

I dislike 1b because it would complicate for the user, that he has to have the management option in his config-file. If using 1a that is handled automaticly by the gui or service wrapper.

I agree, the management option is something that should be programmatically placed on the command line by the program which does the CreateProcess to start the OpenVPN instantiation on a given config file.

Quoted 7 lines

The drawback with 1a is, how do we handle the same thing on unix? There could be situations where we would like start the vpn before a gui agent here to. Are we back to what Jan K said, we need a "service wrapper" for unix to, that can run at al ltime as a deamon and keep track of our openvpn processes? It would require some extra work writing this deamon to, but it would give us a consistent way of starting openvpn processes from a gui agent regardless of the platform.

I'm not sure that we need to add the complexity of a service wrapper on unix, because most unix users take it as a matter of course that touching the network configuration requires root privileges.

I think it's fair to say that root is required, and if someone _really_ wants to control tunnels from non-root, then they must SUID the binary, or change the permissions on the tun/tap device node.

Quoted 11 lines

2. How should the service wrapper know which configs to launch at start-up? To maintain backwords-compatibility it should launch all config files in the config folder. However the gui agent should be able to handle both processes started at boot-time and other that is started manually from the gui later.

I've thought of two ways of doing this.

Quoted 7 lines

2a. Use a config file which list which configs that should be launched at boot-time. If that config file does not exist, it will launch all it finds, as it is today. A gui agent can then create this file to specify which configs should be launched at boot-time.

2b. Use another folder for configs that should not be started at boot-time.

I like 2a because it solves the problem while still being backward compatible, and only requires the GUI applet write a simple config file, and that the service wrapper test the existence of the file, and if it exists, use the file as an instantiation list rather than scanning the config file directory.

Quoted 2 lines

Please let me know how you think we should handle these issues before I put anymore work into the service wrapper in a wrong direction...

I think the larger architectural issue here is:

(a) GUI Applet (Statefull) <-> openvpn.exe[1], openvpn.exe[2], ...

OR

(b) GUI Applet (Stateless) <-> Portable Service Wrapper Daemon (Statefull) <-> openvpn[1], openvpn[2], openvpn[3], ...

James

#27 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 43 lines · James Yonan
Quoted 11 lines · Mathias Sundman

Some more things to consider...

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or (b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

(a) is probably simpler to develop, but (b) may be a better solution long-term because it handles the management interface in a portable way, and makes the GUI itself (which probably needs a separate admin module for Win32, YaST, X, http, etc.) as lightweight and stateless as possible.

Now the way I would implement (b) is to design as much of the "portable service wrapper" code as is possible without actually coding any function calls to create windows or dispatch window messages or do any GUI stuff directly. The service wrapper would take care of instantiating OpenVPN processes, managing the 127.0.0.1 port pool to communicate with the processes.

Now the GUI applet itself becomes very simple and stateless, it only needs to connect to the service wrapper, and any window message corresponding to a user mouse action gets encoded into a simple command that gets sent to the service wrapper.

I agree that this is a more complicated problem to solve because now we have the service wrapper which is talking to the individual OpenVPN processes, and we have the GUI applet talking to the service manager.

Quoted 7 lines

But long term (IMHO) this gives us great flexibility to easily port the GUI applet to other interfaces, such as even http. It would be very cool, for example, if with a little bit of php programming, you could control your OpenVPN instances via a web interface for example. You wouldn't need to rewrite a huge program which deals with all the details of starting/stopping/managing the pool of OpenVPN processes, because that program would already exist as the cross-platform service wrapper daemon.

I agree this seems to be the best way to proceed. On thing is unclear (for me atleast) though. The gui should talk with the service manager to do the follow things:

* Get a list of running processes.
* Start a new process.
* Stop a running process.

But, how should the "check tunnel status" part be implemented?

1. The gui applet gets information from the service manager about which port each ovpn process is listening on. The gui then connects directly to each process to monitor it's status.

2. The service manager connects to each process to monitor its "tunnel status" and then maintain this information in its table over running processes. The gui applet can then get this information from the service manager over the same socket as it starts/stops the ovpn processes.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#28 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 67 lines · Mathias Sundman
Quoted 43 lines · James Yonan
Quoted 11 lines · Mathias Sundman

Some more things to consider...

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or (b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

(a) is probably simpler to develop, but (b) may be a better solution long-term because it handles the management interface in a portable way, and makes the GUI itself (which probably needs a separate admin module for Win32, YaST, X, http, etc.) as lightweight and stateless as possible.

Now the way I would implement (b) is to design as much of the "portable service wrapper" code as is possible without actually coding any function calls to create windows or dispatch window messages or do any GUI stuff directly. The service wrapper would take care of instantiating OpenVPN processes, managing the 127.0.0.1 port pool to communicate with the processes.

Now the GUI applet itself becomes very simple and stateless, it only needs to connect to the service wrapper, and any window message corresponding to a user mouse action gets encoded into a simple command that gets sent to the service wrapper.

I agree that this is a more complicated problem to solve because now we have the service wrapper which is talking to the individual OpenVPN processes, and we have the GUI applet talking to the service manager.

Quoted 8 lines

But long term (IMHO) this gives us great flexibility to easily port the GUI applet to other interfaces, such as even http. It would be very cool, for example, if with a little bit of php programming, you could control your OpenVPN instances via a web interface for example. You wouldn't need to rewrite a huge program which deals with all the details of
starting/stopping/managing the pool of OpenVPN processes, because that program would already exist as the cross-platform service wrapper daemon.

I agree this seems to be the best way to proceed. On thing is unclear (for me atleast) though. The gui should talk with the service manager to do the follow things:

* Get a list of running processes.
* Start a new process.
* Stop a running process.

But, how should the "check tunnel status" part be implemented?

1. The gui applet gets information from the service manager about which port each ovpn process is listening on. The gui then connects directly to each process to monitor it's status.

Quoted 5 lines

2. The service manager connects to each process to monitor its "tunnel status" and then maintain this information in its table over running processes. The gui applet can then get this information from the service manager over the same socket as it starts/stops the ovpn processes.

I think that the goal here is to work towards putting all of the complexity into the portable service manager, so the GUI applet will only open a single local TCP connection to the service manager, and the service manager will deal with communicating with the individual OpenVPN processes.

So the GUI applet will send a command to the service manager to enumerate all configs. Each line of output from the service manager will list the name of the config file and a comma-separated list of status fields, including stuff like connection status, and traffic byte counts.

There will also be a mechanism for the GUI to turn on asynchronous notification of various events from all or specific OpenVPN processes. As discussed before, such notifications (when turned on) will cause unsolicited output to be sent to the GUI applet with some kind of prefix which identifies the source of the notification.

One thing that's nice about using 127.0.0.1 TCP ports for ascii-based communication is that you can telnet to the the service manager or the individual OpenVPN processes, on their TCP ports, and test various commands and responses.

All of this of course represents a lot of development effort, so I think it makes a lot of sense to "evolve" towards these goals in small incremental steps.

James

The GUI applet can that

#29 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 8 lines · James Yonan
Quoted 3 lines

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I think that the goal here is to work towards putting all of the complexity into the portable service manager, so the GUI applet will only open a single local TCP connection to the service manager, and the service manager will deal with communicating with the individual OpenVPN processes.

I agree.

Quoted 3 lines

All of this of course represents a lot of development effort, so I think it makes a lot of sense to "evolve" towards these goals in small incremental steps.

Agree here to.

One more thing to consider... Should we consider a system running this service manager an open system where all locally logged on users is allowed to fully manage openvpn connections, which includes:

* Start/Stop openvpn processes
* Create new openvpn configs
* delete openvpn configs

(Hereby not said that creating/deleting configs should be done via the service manager. I just want to discuss whether a normal user should be able to do this or not)

or, do we need to restrict this somehow. Two ways to restict this:

1. On filesystem level we could have the service manger only read config files from a prespecified directory, and can then disallow normal users access to that directory by normal FS restrictions. This would allow us to control which users is allowed to add/delete/modify config-files, but not stop them from starting/stopping preconfigured connections.

2. Use authentication on the socket to the service manager. This would allow us to fully control which user is allowed to do what, but it would add alot of complexity so I think it should be avoided, if really don't need this.

Comments?

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#32 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

In reply to James Yonan
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or
(b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

(b) already exists. It's daemontools. (Does not exist on NT, though). Daemontools' license is not open enough, but there is a opensource clone at http://smarden.org/runit/.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

(a) is probably simpler to develop, but (b) may be a better solution long-term because it handles the management interface in a portable way, and makes the GUI itself (which probably needs a separate admin module for Win32, YaST, X, http, etc.) as lightweight and stateless as possible.

Let me hijack your attention for a moment.

Once I bought an UPS. I googled for UNIX UPS tools and found package named NUT. I downloaded and installed it. It consists of low-level UPS drivers, UPS-monitoring daemons, servers listening on TCP and clients which can talk to these servers. And maybe something else, I forgot. A bunch of config files is used to configure things like how are UPSes connected, which users can do what to which UPS, etc, etc, etc.

After an hour spent figuring out how to organize it, I managed to start it. Or shall I say 'them', because I needed to run several processes. I ended up with 2 Mbites of RSS spent for UPS monitoring.

I didn't like it. I didn't like it at all. I didn't like multiple config files. I didn't like additional user auth and crypto (who can connect to my UPS daemon, passwords, encryption of TCP protocol used to talk with it....). Why do I need Yet Another TCP Server, Auth, Crypto, Logging, Etc when ssh/ssl and daemontools already exist and is well debugged?

I took NUT apart. I chainsawed away the cruft, all 99% of it, and made smallish daemon which connects to serial port and can (1) poll UPS about it's state and (2) can command UPS to e.g. test battery, shutdown, etc. I put it under daemontools. I don't need to control it over the net or from another user account, but if I'll need to, I will do it using existing tools like ssh.
For example, ability to stop/restart daemon by user is controlled via chmod/chown'ing daemontools' control file. Daemontools are very elegant. Instead of reinventing ACLs, they _use_ ACLs already designed for filesystem access control. Cool, isn't it?

When compiled against dietlibc, my ups daemon consumes 32 _kilobytes_ of RAM:

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
884 root 15 0 32 32 24 S 0.0 0.0 0:01 0 powermust

What I am trying to say? I am very happy that you guys are actively working on openvpn. Really.

Just please do not OVERdesign it.

Maybe it's better to try to port daemontools to Windows and run openvpn daemon(s) under it.

Quoted 3 lines

All of this of course represents a lot of development effort, so I think it makes a lot of sense to "evolve" towards these goals in small incremental steps.

Exactly what I meant. It's counterproductive to reinvent the wheel. NUT folks wrote a ton of code duplicated in ssh et al, and they need to debug it also. Nnd then it just sits there wasting RAM. Ugly.
--
vda

#33 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 20 lines · Denis Vlasenko
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or
(b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

(b) already exists. It's daemontools. (Does not exist on NT, though). Daemontools' license is not open enough, but there is a opensource clone at http://smarden.org/runit/.

...

Quoted 7 lines

What I am trying to say? I am very happy that you guys are actively working on openvpn. Really.

Just please do not OVERdesign it.

Maybe it's better to try to port daemontools to Windows and run openvpn daemon(s) under it.

I agree that we must watch out so we don't overdesign it. It's easily done. However, one thing to keep in mind is that we're not talking about adding complexity to the openvpn binary (except for an interface to get status information), and we're not talking about removing current functionallity.

Which means that it will still be perfectly possible to run openvpn just like we have always done from the cmd-line or from the init-scripts, and I think this will continue to be the most-used method on unix platforms.

Windows users on the other hand tends to want automatic graphical installation packages and a nice gui to click on, and get afraid if they need to edit a textfile! So we need to keep the whole chain from installation to operating really simple.

Do you think we can achive this using deamon tools?

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#34 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 18 lines · Mathias Sundman
Quoted 7 lines

What I am trying to say? I am very happy that you guys are actively working on openvpn. Really.

Just please do not OVERdesign it.

Maybe it's better to try to port daemontools to Windows and run openvpn daemon(s) under it.

I agree that we must watch out so we don't overdesign it. It's easily done. However, one thing to keep in mind is that we're not talking about adding complexity to the openvpn binary (except for an interface to get status information), and we're not talking about removing current functionallity.

Which means that it will still be perfectly possible to run openvpn just like we have always done from the cmd-line or from the init-scripts, and I think this will continue to be the most-used method on unix platforms.

Quoted 6 lines

Windows users on the other hand tends to want automatic graphical installation packages and a nice gui to click on, and get afraid if they need to edit a textfile! So we need to keep the whole chain from installation to operating really simple.

Do you think we can achive this using deamon tools?

IMHO daemontools for windows, if ported, can handle quite a variety of different setups, including one needed by openvpn. Then you can install it as part of openvpn install.
--
vda

#35 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 15 lines · Denis Vlasenko
Quoted 5 lines · Mathias Sundman
Quoted 5 lines

What I am trying to say? I am very happy that you guys are actively working on openvpn. Really.

Just please do not OVERdesign it.

Quoted 8 lines
Quoted 2 lines

Maybe it's better to try to port daemontools to Windows and run openvpn daemon(s) under it.

I agree that we must watch out so we don't overdesign it. It's easily done. However, one thing to keep in mind is that we're not talking about adding complexity to the openvpn binary (except for an interface to get status information), and we're not talking about removing current functionallity.

Quoted 3 lines

IMHO daemontools for windows, if ported, can handle quite a variety of different setups, including one needed by openvpn. Then you can install it as part of openvpn install.

If the only issue we had to solve here was how a normal user should be able to spawn openvpn processes, I agree we should use already existing software to solve this.

However, this issue has grown abit larger than that. Our gui client needs to:

* Scan a directory for configuration files.
* A way to spawn processes (preferable portable)
* Maintain a table over on which port it can reach the openvpn process management interface.
* Monitor that all openvpn processes are still alive
* Connect to all the openvpn processes and get status info

There is no fancy hardcoded things we are talking about, so it could all reside in the gui client, however I liked the idea of moving this functionallity into a portable service manager.

I need to code this regardless if we put it in the gui agent itself, or in this service manager, so I think it makes more sence to put the effort into a deamon from which other gui clients can benefit on all platforms, instead of into my not-so-portable gui.

Signature · 4 lines
_____________________________________________________________
Mathias Sundman                  (^)   ASCII Ribbon Campaign
NILINGS AB                        X    NO HTML/RTF in e-mail
Tel: +46-(0)8-666 32 28          / \   NO Word docs in e-mail
#36 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

Quoted 11 lines
Quoted 3 lines

IMHO daemontools for windows, if ported, can handle quite a variety of different setups, including one needed by openvpn. Then you can install it as part of openvpn install.

If the only issue we had to solve here was how a normal user should be able to spawn openvpn processes, I agree we should use already existing software to solve this.

However, this issue has grown abit larger than that. Our gui client needs to:

Quoted 6 lines

* Scan a directory for configuration files.
* A way to spawn processes (preferable portable)
* Maintain a table over on which port it can reach the openvpn process management interface.
* Monitor that all openvpn processes are still alive
* Connect to all the openvpn processes and get status info

:) I will append 'man svscan' and 'man supervise'. Judge for yourself how many of your points are covered by them.

Also I'll append my current 'ps -AH e' output. You can see there how completely different daemons are controlled by those tools.

Quoted 8 lines

There is no fancy hardcoded things we are talking about, so it could all reside in the gui client, however I liked the idea of moving this functionallity into a portable service manager.

I need to code this regardless if we put it in the gui agent itself, or in this service manager, so I think it makes more sence to put the effort into a deamon from which other gui clients can benefit on all platforms, instead of into my not-so-portable gui.

No need to code it. Port it to Windows. That's all. --
vda

svscan(8) svscan(8)

NAME
svscan - starts and monitors a collection of services

SYNOPSIS
svscan [ directory ]

DESCRIPTION
svscan starts one supervise(8) process for each subdirectory of the current directory, up to a limit of 1000 subdirectories. svscan skips subdirectory names starting with dots. supervise(8) must be in svs- can's path.

svscan optionally starts a pair of supervise(8) processes, one for a subdirectory s, one for s/log, with a pipe between them. It does this if the name s is at most 255 bytes long and s/log exists. (In versions 0.70 and below, it does this if s is sticky.) svscan needs two free descriptors for each pipe.

Every five seconds, svscan checks for subdirectories again. If it sees a new subdirectory, it starts a new supervise(8) process. If it sees an old subdirectory where a supervise(8) process has exited, it restarts the supervise(8) process. In the log case it reuses the same pipe so that no data is lost.

svscan is designed to run forever. If it has trouble creating a pipe or running supervise(8), it prints a message to stderr; it will try again five seconds later.

If svscan is given a command-line argument directory, it switches to that directory when it starts.

SEE ALSO

       supervise(8),  svc(8),  svok(8),  svstat(8), svscanboot(8), readprocti-
       tle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8),
       setuidgid(8), envuidgid(8), envdir(8), softlimit(8), setlock(8)

       http://cr.yp.to/daemontools.html



                                                                     svscan(8)

supervise(8) supervise(8)

NAME
supervise - starts and monitors a service.

SYNOPSIS
supervise s

DESCRIPTION
supervise switches to the directory named s and starts ./run. It restarts ./run if ./run exits. It pauses for a second after starting ./run, so that it does not loop too quickly if ./run exits immediately.

If the file s/down exists, supervise does not start ./run immediately. You can use svc(8) to start ./run and to give other commands to super- vise.

supervise maintains status information in a binary format inside the directory s/supervise, which must be writable to supervise. The status information can be read by svstat(8).

supervise may exit immediately after startup if it cannot find the files it needs in s or if another copy of supervise is already running in s. Once supervise is successfully running, it will not exit unless it is killed or specifically asked to exit. You can use svok(8) to check whether supervise is successfully running. You can use svscan(8) to reliably start a collection of supervise processes.

SEE ALSO

       svc(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8),
       fghack(8), pgrphack(8), multilog(8), tai64n(8),  tai64nlocal(8),  setu-
       idgid(8), envuidgid(8), envdir(8), softlimit(8), setlock(8)

       http://cr.yp.to/daemontools.html



                                                                  supervise(8)
# ps -AH e
  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:01 /bin/sh /init
    2 ?        SWN    0:00   [ksoftirqd/0]
    3 ?        SW<    0:00   [events/0]
    4 ?        SW<    0:00     [khelper]
   20 ?        SW<    0:00     [kblockd/0]
   46 ?        SW     0:00     [pdflush]
   47 ?        SW     0:00     [pdflush]
   49 ?        SW<    0:00     [aio/0]
  479 ?        SW<    0:00     [reiserfs/0]
   48 ?        SW     0:00   [kswapd0]
   50 ?        SW     0:00   [cifsoplockd]
  214 ?        SW     0:00   [kseriod]
  392 ?        S      0:00   devfsd /dev
  681 ?        S      0:00   rpc.portmap
  993 ?        S      0:00   svscan /var/service
  995 ?        S      0:00     supervise fw
  996 ?        S      0:00     supervise gpm
  997 ?        S      0:00       gpm -D -2 -m /dev/psaux -t ps2
 1007 ?        S      0:00     supervise ntp
 1011 ?        S      0:00       /bin/sh ./run
 2274 ?        S<     0:00         ntpdate -b -t 10 -p 4 -k /dev/null 1.1.1.1 PWD=/.local/var/service/ntp SHLVL=1 _=/usr/bin/ntpdate
 1008 ?        S      0:00     supervise log
 1012 ?        S      0:00       multilog t n5 /var/log/service/ntp
 1009 ?        S      0:00     supervise top
 1036 ?        S      0:19       top c s TERM=linux
 1020 ?        S      0:00     supervise ups
 1021 ?        S      0:00     supervise log
 1022 ?        S      0:00       multilog t =/var/log/service/ups/last.out /var/log/service/ups
 1027 ?        S      0:00     supervise klog
 1031 ?        S      0:00       klogd -n -c 3 -x
 1028 ?        S      0:00     supervise once
 1040 ?        S      0:00     supervise pptp
 1041 ?        S      0:00     supervise log
 1056 ?        S      0:00       multilog t /var/log/service/pptp
 1047 ?        S      0:00     supervise sshd
 1048 ?        S      0:00       tcpserver -v -R -H -l 0 -c 40 0.0.0.0 ssh setuidgid root sshd -i -e -u0
 1049 ?        S      0:00     supervise log
 1091 ?        S      0:00       multilog t /var/log/service/sshd
 1064 ?        S      0:00     supervise httpd
 1075 ?        S      0:00       tcpserver -v -R -H -l 0 -c 40 0.0.0.0 www setuidgid apache httpd -X -f /.local/var/service/httpd/httpd.conf
 1065 ?        S      0:00     supervise log
 1076 ?        S      0:00       multilog t /var/log/service/httpd
 1066 ?        S      0:00     supervise nmlog
 1071 ?        S      0:00       /bin/sh ./run
 1072 ?        S      0:00         /bin/sh ./run
 1073 ?        S      0:00           nmeter c l x lx  p lp m lm  nif nlo d120000
 1074 ?        S      0:00         logger -t
 1067 ?        S      0:00     supervise mysql
 1068 ?        S      0:00       /bin/sh ./run
 1128 ?        S      0:00         mysqld --user=mysql --datadir=/var/app/mysql-3.23.52/data --tmpdir=/var/app/mysql-3.23.52/tmp --socket=/.lo
 1069 ?        S      0:00     supervise log
 1070 ?        S      0:00       multilog t /var/log/service/mysql
 1087 ?        S      0:00     supervise pgsql
 1088 ?        S      0:00     supervise log
 1101 ?        S      0:00       multilog t /var/log/service/pgsql
 1113 ?        S      0:00     supervise serial0
 1115 ?        S      0:00     supervise dnscache_local
 1130 ?        S      0:00       ./dnscache ROOT=./root IP=0.0.0.0 IPSEND=0.0.0.0 FORWARDONLY=1 DATALIMIT=2000000 CACHESIZE=1000000 GID=50 UID
 1116 ?        S      0:00     supervise log
 1132 ?        S      0:00       multilog t /var/log/service/dnscache_local
 1117 ?        S      0:00     supervise nmeter
 1138 ?        S      0:00       nmeter t c l x lx  p lp f lf  b lb  m lm  nif nlo
 1118 ?        S      0:00     supervise ovpn-1
 1297 ?        S      0:00       openvpn --secret /.local/var/service/ovpn-1/key --dev tun --proto udp --port 8006 --remote 1.1.4.1 --ifconfig
 1119 ?        S      0:00     supervise log
 1152 ?        S      0:00       multilog /var/log/service/ovpn-1
 1163 ?        S      0:00     supervise getty_tty1
 1164 ?        S      0:00     supervise getty_tty2
 1870 vc/2     S      0:00       agetty 38400 /dev/tty2 linux TERM=linux
 1165 ?        S      0:00     supervise getty_tty3
 1218 vc/3     S      0:00       agetty 38400 /dev/tty3 linux TERM=linux
 1166 ?        S      0:00     supervise getty_tty4
 1227 vc/4     S      0:00       agetty 38400 /dev/tty4 linux TERM=linux
 1167 ?        S      0:00     supervise getty_tty5
 1231 vc/5     S      0:00       agetty 38400 /dev/tty5 linux TERM=linux
 1168 ?        S      0:00     supervise getty_tty6
 1232 vc/6     S      0:00       agetty 38400 /dev/tty6 linux TERM=linux
 1169 ?        S      0:00     supervise getty_tty7
 1233 vc/7     S      0:00       agetty 38400 /dev/tty7 linux TERM=linux
 1170 ?        S      0:00     supervise getty_tty8
 1222 vc/8     S      0:00       agetty 38400 /dev/tty8 linux TERM=linux
 1171 ?        S      0:00     supervise syslog
 1172 ?        S      0:00       syslogd -n -f /.local/var/service/syslog/syslogd.conf
 1247 ?        S      0:00         multilog /var/log/syslog/auth.all
 1252 ?        S      0:00         multilog /var/log/syslog/daemon.all
 1255 ?        S      0:00         multilog /var/log/syslog/kern.all
 1258 ?        S      0:00         multilog /var/log/syslog/mark.all
 1261 ?        S      0:00         multilog /var/log/syslog/syslog.all
 1264 ?        S      0:00         multilog /var/log/syslog/user.all
 1267 ?        S      0:00         multilog /var/log/syslog/7.debug
 1270 ?        S      0:00         multilog /var/log/syslog/6.info
 1273 ?        S      0:00         multilog /var/log/syslog/5.notice
 1276 ?        S      0:00         multilog /var/log/syslog/4.warning
 1279 ?        S      0:00         multilog /var/log/syslog/3.err
 1282 ?        S      0:00         multilog /var/log/syslog/2.crit
 1285 ?        S      0:00         multilog /var/log/syslog/1.alert
 1288 ?        S      0:00         multilog /var/log/syslog/0.emerg
 1176 ?        S      0:00     supervise watch_quasar
 1177 ?        S      0:00     supervise automount
 1179 ?        S      0:00       /bin/sh ./run
 1306 ?        S      0:00         sleep 32000
 1178 ?        S      0:00     supervise watcher
 1209 ?        S      0:00       /bin/sh ./run
 2278 ?        S      0:00         sleep 33
#30 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

In reply to Mathias Sundman
Quoted 4 lines · Mathias Sundman

...
One more thing to consider... Should we consider a system running this service manager an open system where all locally logged on users is allowed to fully manage openvpn connections, which includes:

* Start/Stop openvpn processes

As a first step, I think we should allow all users to access this service. Later on, one may consider some authorisation mechanism to access specific configurations. This could be some additional parameter in a config file or some meta config file for the wrapping service.

Quoted 5 lines

* Create new openvpn configs
* delete openvpn configs

(Hereby not said that creating/deleting configs should be done via the service manager. I just want to discuss whether a normal user should be able to do this or not)

As just said in my reply to an earlier mail, I don't think that modifying the configurations shall become part of the gui. This would be feature overloading, especially on a unix system where you typically configure using a text editor.

Jan

#39 lore raw

[Openvpn-devel] Re: Interface with GUI agent

In reply to James Yonan
Quoted 8 lines · James Yonan

I'm not sure that we really need a wrapper for unix, because most unix users will control OpenVPN by:

(1) editing config files and starting from /etc/init.d, or
(2) using some sort of GUI-based admin tool such as YaST

and both of these methods are traditionally done as root.

You consider the typical openvpn user in a client scenario under unix as a command line freak - might be still true for the moment, but certainly not in the future. An increasing number of gui-oriented users are switching over to unix, in particular linux. And what would be better for a smooth switch-over than finding a similar gui on both platforms? Command line freaks already have anything the need with what openvpn now provides, so this is not the audience we should target.

Quoted 9 lines

...

Quoted 6 lines
Quoted 6 lines

Yes, this will work. But I'm afraid - maybe I'm wrong - that the GUI will then have to be implemented quite differently on Windows and Unix. On Windows, we would open a socket and both send the commands over it and receive the status. On Unix, we would first start the process and then connect to a socket for status information (BTW, which socket would then be used when multiple instances of openvpn are running?).

Quoted 4 lines

Should the unix GUI be written for generic X, or should we develop admin modules for specific distros such as YaST?

I would go for the latter, because it will make the interface fit more seamlessly into a distribution's existing admin infrastructure.

I would not think about an admin gui at the moment. Maybe this will never be needed as configuration files are much easier to handle. I'm personally not looking for gui dialogs where I can select and combine graphically any option the openvpn service provides - in case this is the impression you got of my feature request. If SuSE, any other distributor, or projects like webmin are interested in providing some gui for creating the config file, let them do this. But we should first concentrate on an interface for *using* openvpn in daily work!

Jan

#37 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

In reply to Denis Vlasenko
Quoted 21 lines · Denis Vlasenko
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

1. On Windows, if the the service wrapper has started some openvpn processes before our gui agent is started, how should find out about those processes?

I can think of the following ways:

1a. Ask the service wrapper via the socket interface that I'm working on right now. This will require the service wrapper not only start the processes, but keep a table over running processes.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I think it's an important point worth some discussion on whether to (a) put all the "intelligence" in the GUI applet and have the service wrapper just be a basic proxy to an admin-privileged CreateProcess, or
(b) write a portable service wrapper that's designed to run on all the OSes which OpenVPN currently supports, and which would do all the "under-the-hood" work in starting/stopping/managing of different OpenVPN processes, and the GUI applet would do nothing more than export the control interface of the portable service wrapper to a platform-specific, lightweight GUI.

Quoted 5 lines

(b) already exists. It's daemontools. (Does not exist on NT, though). Daemontools' license is not open enough, but there is a opensource clone at http://smarden.org/runit/.

I actually don't see why we should add this external dependency to openvpn or its graphical frontend. The daemontools are just another layer which would just take us half the way to a gui, we would then still need to control the daemontools itself (starting/stopping openvpn via the respective command or grabbing the status from the tools).

Basically, the only feature we really need is to start or stop some privileged process, that's all. Coding this into a service wrapper for openvpn takes as much effort as handling something like daemontools itself - both with respect to development time (a few hours up to a day) and to code size. Handling the status information of openvpn is so specific in any way, that daemontools cannot help us here.

But hey, I guess you will never need that wrapper anyhow, because its only purpose will be to enable running the gui. There will be likely no impact on the openvpn core itself besides an extended status interface (probably via stdout only).

Jan

#31 lore raw

Re: [Openvpn-devel] Re: Interface with GUI agent

In reply to Jan Kiszka
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Mathias Sundman

...
One more thing to consider... Should we consider a system running this service manager an open system where all locally logged on users is allowed to fully manage openvpn connections, which includes:

Quoted 6 lines
Quoted 1 line

* Start/Stop openvpn processes

As a first step, I think we should allow all users to access this service. Later on, one may consider some authorisation mechanism to access specific configurations. This could be some additional parameter in a config file or some meta config file for the wrapping service.

Just use ssh. Those who know username/password of special user able to control openvpn could log in via ssh and do it. --
vda