Commit Graph

35 Commits (c87c7387b302f4ab93bfce0aafcef2282ed1c9ab)

Author SHA1 Message Date
Selva Nair 0f21030774 Support sending commands to running instance
- New option --command <action> <params> to send commands to
  a running instance of openvpn-gui.exe
  Supported actions are
      connect, disconnect, reconnect
  each of which takes the name of the config (with or without the
  extension .ovpn) as a parameter;
      disconnect_all, exit
  which take no parameter and
      silent_connection
  which takes an optional parameter = 0 or 1 (1 is the default)

  Examples: with the gui running, start a new instance as

  openvpn-gui.exe --command disconnect myvpn : ask running instance
                        to disconnect myvpn if connected
  openvpn-gui.exe --command status myvpn     : ask running instance
                        to show the status window for myvpn if available
  openvpn-gui.exe --command disconnect_all   : ask running instance
                        to disconnect all active connections

- The second instance exits after issuing a SendMessage to the
  already running instance. If no action is specified, the running
  instance is notified to show a balloon to alert the user

- These messages may also be sent from scripts as COPYDATA messages
  with the wData element specifying the action to execute and lpData
  a pointer to the parameter. The dwData param must be one of
  WM_OVPN_xxx with xxx = START, STOP, RESTART, STOPALL, EXIT or
  SILENT. See main.h for their values.

v2: Bug fixes based on test reports from larson0815
here: https://github.com/selvanair/openvpn-gui/issues/5
and cron410 here: https://github.com/OpenVPN/openvpn-gui/issues/104

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-01-20 11:42:23 -05:00
Selva Nair 31896ce33b Add restart button to connection menus
- This works the same way as restart button in the status window
  but is more conveniently accessible from the tray menu.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-01-20 11:41:19 -05:00
Selva Nair 5fb23f6ad9 Auto submit saved auth-user-pass credentials after a brief delay
- Effective only when username and password are saved.
- The user may interrupt auto submission and edit the username/password.
- If silent_connection is on the dialog is bypassed without any delay.

v2 changes:
- Display message in normal text color and show remaining time

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2017-12-26 13:41:55 -05:00
Selva Nair 301a5e5644 Check for invalid characters in user inputs
- Flag password and username input if these contain an invalid character
  (currently only embedded '\n' is disallowed). Shows a popup when OK
  is pressed so that the user can correct the input and resubmit.

- Add an error message to the log when the management i/f returns
  ERROR for incorrectly parsed commands. Otherwise such errors go
  unnoticed.

Note: IDS_ERR_INVALID_USERNAME/PASSWORD need translations.

Reported and tested by: Florian Beier (H4ndl3 on github)
Fixes Trac: #958

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2017-11-20 09:53:31 -05:00
Selva Nair 1bd5a6faa9 Add a warning message when authentication is retried due to wrong credentials
- "Wrong username or password" message shown in the auth userpass dialog after
  an auth failure
- "Wrong password" message shown in the private key password dialog after a
  password failure.

These message texts are colored red by default (TODO: make the color customizable)

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2017-06-27 16:01:18 -04:00
Selva Nair be417bb38f Support pkcs11 token insertion request and pin input
Note: IDS_NFO_TOKEN_PASSWORD_CAPTION and IDS_NFO_TOKEN_PASSWORD_REQUEST
strings need translation.

TODO: support for selecting pkcs11-id from the GUI

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-11-15 19:29:23 -05:00
Selva Nair 1a5ce44a99 Handle dynamic challenge/response
- Add a base64 decode function using Windows CyptoAPI
- Move multibyte to widechar conversions to a function
- Add config name to caption of password dialogs to help user
  identify the request
- Add new dialog template for generic password/PIN requests
  and use it to handle dynamic challenge

Note 1: if dynamic challenge response verification fails, an auth-failed
message is returned by the server causing the GUI to clear any saved
password even if the user-auth dialog itself succeeeded.

Note 2: Dialog template ID_DLG_CHALLENGE_RESPONSE added to language
files may require translation.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-11-15 19:14:32 -05:00
Samuli Seppänen 135f177546 Merge pull request #86 from selvanair/get-pid-v2
Some bug fixes
2016-10-18 10:00:02 +03:00
Selva Nair fcd0efa479 Terminate any openvpn processes that fail to stop
Sometimes gracefully stopping openvpn fails leaving the
process running in background. This causes restarting of
connections to fail until those processes are manually killed.

- Read process ID from interactive service to get process
  handle when openvpn is started by the service.
- Add a last resort method to forcefully terminate openvpn
  process that fails to exit aftier sending stop signal. Terminate
  is triggered after a 3 second timeout following Stop.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-10-08 16:25:38 -04:00
Ilya Shipitsin 0f531dc3ee cleaned up unused resource 2016-09-24 17:17:23 +05:00
Selva Nair 5a47986ccb Make options saved in registry editable by user
Option ediitng dialogs are in two tabs: General and Advanced.
Proxy related options are left in the proxy tab. Options
config_dir, config_ext, log_dir, script timeouts and
service-only flag are in the Advanced tab. All other more commonly
used flags and options are in the General tab.

- As options are editable, save values in registry only when they differ
  from the default values. This leaves the registry clean and makes changing
  options and their defaults during updates easier.

- Entries for config_dir and log_dir must be absolute paths.
  Environemental variables such as %PROFILEDIR% may be used
  to construct these.

- Empty config_dir, config_ext and log_dir entries are silently
  ignored (i.e., the current values are left unchanged).

- Store all numeric and boolean parameters in registry as DWORD instead of
  strings.

- On startup, the default parameters are loaded, then the registry is read
  and finally command-line parameters parsedi.

- Out of range script timeout values in registry truncated with a
  warning instead of fatal error. This allows the user to access the
  settings dialog and make corrections.

- Save proxy and language settings under the same
  HKCU\Software\OpenVPN-GUI key as other options instead of under Nilings.

- Save the current version of the GUI in regsitry so that updates
  can be detected and any needed registry cleanup done.

- If no version info is present in the registry any values in OpenVPN-GUI
  key in HKCU are deleted for a clean start as this is the first version
  to save registry values in HKCU. Language and proxy data if present
  under Nilings is migrated.

Note: new controls in the General tab and newly added Advanced tab dialog
are copied to all language files from the English version. These need to
be translated.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-08-06 11:46:15 -04:00
Selva Nair 5880fdcd02 Save username and optionally passwords
- Username and, optionally, password as well as the private
  key passphrase are saved in config-specific registry keys
- All saved data are kept encrypted using DPAPI
- The passphrase dialog is skipped if a valid saved private
  key password is available. However, the user-auth dialog
  is always presented, prefilled with the saved username
  and password.

Note: A text string "Save password" is added to three dialogs
in all language resource files. Additional text with ids
IDS_MENU_CLEARPASS and IDS_NFO_DELETE_PASS are added to the
STRINGTABLE only in the English language resource file.
All these need translations.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-05-29 19:35:30 -04:00
Leonardo Basilio ece6aef6a6 Launch on startup setting 2016-05-22 22:05:42 -03:00
Selva Nair 43d0ef3a5a Handle interactive service policy restrictions
When a connection is attempted using a config in a location
that would fail, offer an option to add the user to the "OpenVPN
Administrators" group. This is done using shell-execute which will
show a UAC prompt for elevation. If it fails (due to user chooses
NO or the UAC dialog fails) the connection is not started.

v2 Changes
 - Rebase to master
 - Automaticlaly add the admin group if it doesn't exist
 - Allow unicode strings in debug output
 - Use domain\username to identify user
 - Fix the PrintDebug macro

Minor changes based on user feedback
 - Bring the window back to foreground after UAC prompt completion
 - Show a message if another connection is tried during authorization
 - Do not add user to ovpn_admin_group if it is same as the built-in admin group

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-03-13 20:23:20 -04:00
Soar Qin fe5a1c9b71 Adding static-challenge support 2016-02-27 13:51:13 +08:00
Samuli Seppänen c3e2584674 Merge pull request #17 from leobasilio/master
Add "Import file" menu option
2016-02-22 10:13:29 +02:00
Leonardo Basilio b47d3545e4 Improving feedback messages when importing 2016-02-21 12:15:40 -03:00
Selva Nair 5ce1298452 Warn if interative service is not installed or not running
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-02-16 20:09:20 -05:00
Leonardo Basilio 46a1bc715c Adding "Import file" feature 2016-02-16 22:23:23 -02:00
Selva Nair 352e44f03d Better error reporting when connection fails to come up
- Handle early errors (openvpn exits before management connection is up)
    with a helpful error message that points the user to view log.
- Include only readable config files in the connection list
- Warn if no connection profiles found

TODO: handle startup errors from interactive service
2016-02-16 15:57:37 -05:00
Selva Nair 4437ce7a8c Change default log file location to a OpenVPN/log in user's profile directory
Change the default log file location to OpenVPN/log in user's profile directory
to support running without admin privileges using the interactive service.
The registry keys are moved to HKCU from HKLM to allow for user-specific
settings as well as to avoid the need for running the GUI as admin at the
first instance.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2016-02-15 11:09:45 -05:00
Heiko Hund 22ff456888 check if "log_dir" exists or create it 2012-07-26 10:54:14 +02:00
Heiko Hund 66b77868b4 move "About" dialog to settings tab 2011-11-30 17:20:23 +01:00
Heiko Hund 9d918954d5 ask for HTTP proxy credentials on demand
* use "auto" parameter for --http-proxy option
 * pass proxy credentialsls via management interface
 * also closes #3223163
2011-03-24 17:54:53 +01:00
Heiko Hund 4bcebba60f use managment interface 2010-09-10 11:39:39 +02:00
Heiko Hund 7c4bea3f7e remove support for openvpn version < 2.0 2010-06-29 16:12:17 +02:00
Heiko Hund b0c1bd562c reformat and fix config file code
* make sure strings are \0 terminated
 * remove obsolete string IDS_ERR_LOG_CONSTRUCT
2010-03-21 21:32:48 +01:00
Heiko Hund 5963a4a49d fixed error string for failed MSIE proxy retrieval 2009-02-09 17:22:44 +00:00
Heiko Hund b8f520be05 config number for status dialog is now stored as property 2009-02-05 14:22:57 +00:00
Heiko Hund 2ba8e6eee0 fill in about dialog version info at build time instead of runtime 2009-02-04 16:26:14 +00:00
Heiko Hund 5783d7da94 cleaned up resource IDs 2009-02-04 15:54:37 +00:00
Heiko Hund 6f37fd999f added support for GUI localization at runtime 2009-02-02 17:27:09 +00:00
Heiko Hund e8dcb2f3ab moved proxy settings into a general settings dialog tab 2009-01-26 21:07:04 +00:00
Heiko Hund 33b255ebab redesigned settings dialog 2009-01-21 12:44:08 +00:00
Heiko Hund fd9e4ae6db import of openvpn-gui-1.0.3.zip
git-svn-id: https://openvpn-gui.svn.sourceforge.net/svnroot/openvpn-gui/trunk@2 43a1345a-9c20-4331-951f-9845fc178312
2008-12-18 11:08:35 +00:00