Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding service installation/registration #4

Closed
mattock opened this issue Jun 7, 2016 · 14 comments
Closed

Adding service installation/registration #4

mattock opened this issue Jun 7, 2016 · 14 comments

Comments

@mattock
Copy link
Collaborator

mattock commented Jun 7, 2016

Hi,

I'm now looking into integrating openvpnserv2 into the official OpenVPN installers. Right now the problem is that openvpnserv2 essentially replaces the old openvpnserv.exe, which actually consists of two services:

  • Interactive
    • Service name: OpenVPNServiceInteractive
    • Purpose: Interacts with OpenVPN-GUI to allow non-admin users to launch OpenVPN connections
  • Automatic
    • Service name: OpenVPNService
    • Purpose: launch 1+ OpenVPN connections automatically in the background, typically on system startup

The automatic service is what openvpnserv2 will replace. The above two share the same binary, so openvpnserv2 can't be just dropped in.

I had a look at the openvpnserv code, and it seems to me that moving to openvpnserv2 for the automatic part could be done in two phases:

  1. Register openvpnserv2 as an additional service, for example with these values:
    • Service name: OpenVPNService2
    • Executable name: openvpnserv2.exe
  2. Remove the automatic service code from openvpnserv once openvpnserv2 has proven itself in the wild

Can you implement service registration in, say, main function of openvpnserv2? The approach used in old openvpnserv.exe seems reasonable:

.\openvpnserv2.exe -install (register the service)
.\openvpnserv2.exe -remove (deregister the service)

I think this approach is less prone to breakage than installing with, say, InstallUtil.exe (if that is still relevant today).

Thoughts?

@mattock
Copy link
Collaborator Author

mattock commented Jun 9, 2016

@xkjyeah : notifying you, just in case :).

@xkjyeah
Copy link
Owner

xkjyeah commented Jun 10, 2016

Hi,

I'll look into it.

Daniel
On 7 Jun 2016 22:00, "Samuli Seppänen" notifications@github.com wrote:

Hi,

I'm now looking into integrating openvpnserv2 into the official OpenVPN
installers. Right now the problem is that openvpnserv2 essentially replaces
the old openvpnserv.exe, which actually consists of two services:

The automatic service is what openvpnserv2 will replace. The above two
share the same binary, so openvpnserv2 can't be just dropped in.

I had a look at the openvpnserv code
https://github.com/OpenVPN/openvpn/tree/master/src/openvpnserv, and it
seems to me that moving to openvpnserv2 for the automatic part could be
done in two phases:

  1. Register openvpnserv2 as an additional service, e.g.
    • Service name: OpenVPNService2
    • Executable name: openvpnserv2.exe
  2. Remove the automatic service codefrom openvpnserv

Can you implement service registration in, say, main function of
openvpnserv2? The approach used in old openvpnserv.exe seems reasonable:

.\openvpnserv2.exe -install (register the service)
.\openvpnserv2.exe -remove (deregister the service)

I think this approach is less prone to breakage than installing with, say,
InstallUtil.exe (if that is still relevant today).

Thoughts?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4, or mute the thread
https://github.com/notifications/unsubscribe/ACiTRwiU71eT4LKf5LXYrHHTLTnVSso3ks5qJXlngaJpZM4Iv9Cb
.

@mattock
Copy link
Collaborator Author

mattock commented Jun 10, 2016

@xkjyeah : thanks a lot!

@selvanair
Copy link

Alternatively we could install this one as "OpenVPNService" and rename the current automatic service name to something like "OpenVPNServiceLegacy". I'm assuming this one is able to work as a drop-in replacement.

As the binary name openvpnserv is already taken, this one will have to named, say, openvpnserv2.exe But if the service name is also changed to "OpenVPNService2" it may find slow acceptance.

@mattock
Copy link
Collaborator Author

mattock commented Jun 14, 2016

Sounds good. So this what we'd end up with:

  • openvpnserv.exe
    • automatic: OpenVPNServiceLegacy
    • interactive: OpenVPNServiceInteractive
  • openvpnserv2.exe: OpenVPNService

EDIT: I can take care of renaming the old openvpnserv.exe's automatic service part.

@lkarlslund
Copy link

While I understand the idea of not requiring too many external tools, you might want to consider looking into SC.EXE which is bundled with (at least) everything Windows from Windows 7 to latest versions. It's the command line tool for maintaining services etc.

Earlier it was only included in the resource kit, but that was ages ago.

https://technet.microsoft.com/en-us/library/bb490995.aspx

@selvanair
Copy link

Sounds good. So this what we'd end up with:

openvpnserv.exe
automatic: OpenVPNServiceLegacy
interactive: OpenVPNServiceInteractive
openvpnserv2.exe: OpenVPNService

I'm assuming this service can work as a drop-in replacement. We have to test things like support for sub-directories in config. Also it would be nice if it cleanly closes openvpn on service exit -- using an exit event or send ctrl-C before resorting to force-kill. Some users may also expect it to support the same command line options as the original.

@mattock
Copy link
Collaborator Author

mattock commented Jun 15, 2016

@lkarlslund : sc.exe is a reasonable option if it is available on every Windows version we support (7 and later). Its location needs to be well-known/static or at least programmatically discoverable (e.g. based on a value of a known registry key).

@lkarlslund
Copy link

@mattock It's in C:\WINDOWS\SYSTEM32, that's pretty static ;) You should be covered from at least Windows 7 onwards, but I can't find any documentation on when it was included in Windows.

@xkjyeah
Copy link
Owner

xkjyeah commented Jun 21, 2016

I'm not familiar with sc.exe. Where does sc.exe fit into the build/install process?

@xkjyeah
Copy link
Owner

xkjyeah commented Jun 21, 2016

8852738

@xkjyeah xkjyeah closed this as completed Jun 21, 2016
@mattock
Copy link
Collaborator Author

mattock commented Jun 22, 2016

@xkjyeah : thanks a lot: openvpnserv2 gets installed in openvpn.nsi already, but the service registration part is missing. I'll tackle that next week.

@abirnbaum
Copy link

Just curious why openvpnserv.exe Process has a signature, but openvpnserv2.exe does not?

@selvanair
Copy link

It shows up as unsigned for me too, but this is unexpected. AFAIK, all exe's included in the installer are signed. Strangely, the file version of openvpnserv2.exe shows as 0.0.0.0 as well (should be 1.3.0.0).

The copy at http://build.openvpn.net/downloads/releases/openvpnserv2-1.3.0.0 is signed though even that one also does not show the version and size is much larger. On rebuilding from sources the exe displays the version correctly. I recall the version issue was fixed about a year ago, so is an older unsigned exe getting included somehow?

@mattock any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants