Commit Graph

713 Commits (577d982b51670f7f68d6dad9d0bf08f8a01879ba)

Author SHA1 Message Date
Selva Nair 6b4e6d301a Delete old messages in the window when content grows beyond a limit 2021-06-25 20:48:02 -04:00
Selva Nair 8182a455bb Document new registry keys for echo-msg
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-06-25 20:48:02 -04:00
Samuli Seppänen e7dc61c7a1 Bump version to 11.25.0.0
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
2021-06-17 12:16:05 +03:00
Selva Nair 86b86e6f7e Handling of CR_TEXT when no response is required
As with CRV1, submit an empty string as the response.
Our base64-encode functiton can handle empty input to generate
an empty string as output.

Also make ensure the message box is shown in foreground,
and not dependent on the status window which may be hidden.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-06-04 12:42:05 -04:00
Lev Stipakov 5dcc584a7a Support for crtext
This adds support for crtext method of pending authentication,
used by Access Server 2.7 and newer.

When enabled on the server side and on the client side (IV_SSO=crtext),
server returns AUTH_PENDING with Info command like:

    CR_TEXT:R,E:Enter Authenticator Code

Client prompts user for the response and sends base64-encoded response
to the server via management interface command:

    cr-response SGFsbG8gV2VsdCE=

See https://github.com/OpenVPN/openvpn/blob/master/doc/management-notes.txt (crtext part)
for more information.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-06-02 00:49:08 -04:00
Lev Stipakov bb00d95f86 Web-based extra authentication
This adds support for web-based extra authentication, which may be
used by OpenVPN Cloud. When enabled and client sends IV_SSO=openurl,
server pushes Info command OPEN_URL:<url>. The client opens that URL and
user authenticates.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-06-02 00:49:08 -04:00
Selva Nair e14287e93e Apply transparency mask to the connecting-state checkmark image
Use the image in the connecting state icon with background
color replaced by that of the menu for use as the checkmark.

MSDN docs on SetMenuItemBitmaps is unclear about the use of
color bitmaps for checkmarks, but this appears to display well.
(Tested on Windows 10 only).

The bitmap is recreated everytime the popup menus are made
although its sufficient to recreate it when system colours
change.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-06-02 00:48:41 -04:00
Lev Stipakov 8d878e8f7b CMake: read version from configure.ac
Instead of using hardcoded major/minor version in config-msvc.h,
use the values from configure.ac.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-24 09:01:33 -04:00
Selva Nair 438ea865c8 Remove repeated phrase and fix text truncation
The About text is truncated in Spanish version when
compiled with MSVC as LTEXT can't exceed 256 characters.

Removing the repeated phrase fixes this for now. If future
translations increase the length, please consider breaking
the paragraph into two.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-24 08:11:26 -04:00
Selva Nair 1c0c159d21 Have unique and non-zero IDs for all controls
Should fix duplicate control id warnings from resource
compiler.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-24 07:52:29 -04:00
Selva Nair 01bbd57e48 Enable all language resource files in MSVC build
Also remove openvpn-gui-res-en-msvc.rc which is no
longer used.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-19 20:58:06 -04:00
Selva Nair 5d209f44cb Construct version string in About dialog at runtime
Required to match the previous commit that removed macro
substitution in resource text strings.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-19 20:58:06 -04:00
Selva Nair 56efcc6515 Make all resource files MSVC compliant
- Remove intermediate quotes in continued lines
- Remove macro substitutions in strings
- Split two long LTEXT (>256 characters) into two

All changes autogenerated using a sed script here
https://gist.github.com/selvanair/ae78c29869d7c1d15abcb909f04676c6

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-19 20:58:06 -04:00
Selva Nair c15fb27570 Allow clearing of key password in ChangePassphraseDialogFunc
Use an empty password to clear any existing password in the
private key file. If not empty, the requirement of minimum 8
characters is retained.

For PEM key file, an empty password will clear encryption on
the key. For pkcs12 files it will set an empty password.
As use of an empty password is the default first try in
OpenVPN.exe when reading pkcs12 file, this effectively leads
to the user not prompted for a private key password during
connection setup.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-18 22:54:38 -04:00
Lev Stipakov 96d443a9d0 appveyor: remove msvc target
It has been replaced by github actions.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Lev Stipakov f22db17272 add github actions
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Lev Stipakov 2d329a32d1 add vcpkg manifest
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Lev Stipakov 4a483b029b replace msvc project with cmake
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Lev Stipakov af72adf2ee fix log() confusion
By some reasons Release build ignores _INC_MATH and includes math.h,
which conflicts with our own log definition. Rename it to log_.

While on it, also rename other enum names for consistency.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Lev Stipakov a68341f021 main.c: trim whitespaces
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-05-14 17:20:00 -04:00
Selva Nair 69e772d681 Fix handling of dynamic challenge when response is not required
In this case, as per management-notes.txt, a CRV1 response with
an empty password should be submitted. Currently we ignore
such "challenges" causing the regular user-auth dialog to be shown
instead.

Fix by displaying the message received from the server. Depending
on user action (OK or CANCEL), a properly formatted reponse with an
empty password is returned or the connection is aborted.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-03 00:51:33 -04:00
Selva Nair 21e09d4603 In generic password dialogs require non-empty inputs
In private key passphrase and dynamic-challenge/pkcs11 PIN
dialogs:

- Disable the OK button by default
- Require non-empty user input before the OK button is enabled

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-03 00:51:33 -04:00
Selva Nair e4252076cf In User-Auth dialog require non-empty password or PIN
We had earlier supported blank passwords or OTPs to be submitted. Change
this by enabling the OK button only if some minimal inputs are present.

- In static challenge dialog require username and either password or
  challenge-reponse (OTP) fields to be non-empty
- In normal user-auth dialog require username and password to be non-empty

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-05-03 00:51:33 -04:00
Samuli Seppänen 0511236062 Bump version to 11.24.0.0
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
2021-04-21 07:03:24 +03:00
kauczu b978fb2fd3 Update Polish translation in openvpn-gui-res-pl.rc
the style of the translation has been improved,
untranslated fields has been translated
2021-04-04 18:11:27 -04:00
Selva Nair c47c3bf81a Remove MAX_CONFIGS limit using WM_MENUCOMMAND for menu messages
We currently use WM_COMMAND message which is delivered with the
ID of the menu item requiring a unique ID for every command
(connect, disconnect etc..) for each connection profile. Instead,
use WM_MENUCOMMAND so that the message delivers a handle to the
menu and the position index of the menu item.

Connection menu array is now dynamically allocated. Yet, there
is still a limitation on the number of configs as the config
index + mgmt_port_offset must be < 65536 to be usable as a port
number. The error message shown for "too many configs" is reworded.
(English language file only).

Note: The current way of selecting the management port based on the
index of the config file increases chances of port conflicts
when the number of configs is large. It could be useful to change
this logic but that is beyond the cope of this PR.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-03-05 22:16:08 -05:00
Selva Nair 6b1372d886 Update help message
Describe recently added command line options:
 - iservice_admin
 - disable_popup_messages
 - popup_mute_interval
 - management_port_offset
Added the default English text to all langauage files.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-03-05 09:48:10 -05:00
Selva Nair 4ef560c649 Add command line option for management_port_offset
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-03-05 09:45:32 -05:00
Selva Nair 941c33f149 Improve the check for whether global and local config_dir are the same
Extend the string comparison of the two paths to include comparing their
file information structure.  (See Remarks under the MSDN docs for
GetFileInformationByHandle)

If the strings are identical we treat them as identical without checking
further whether the paths are valid. This matches the current
behaviour. Otherwise, the two paths are treated as identical if both
exist, are accessible and point to the same object in the file system.

Trac: #1359, #1376

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-02-27 10:37:08 +01:00
Igor Rückert 03189690b1 Update openvpn-gui-res-pt.rc
Translated untranslated strings e fixed typos.
2021-02-25 10:16:40 -05:00
Samuli Seppänen bbd329cd7f Bump version to 11.23.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2021-02-24 11:16:56 +02:00
Samuli Seppänen af8acf878d Add Farsi language package to tarballs
Lack of this caused official release builds to fail

Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2021-02-24 11:15:13 +02:00
Selva Nair 7c4494b005 Copy newly added resources to all language files
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-02-24 09:26:05 +02:00
Selva Nair f098f2fee4 Make 'management port offset' and 'menu view' user-configurable
- Add an option in the advanced settings menu for
the management port offset. Allows any value in the
range 1 to 61000 which with upto ~4000 added as connection
id keeps it in range.

Default is the currently hard coded value of 25340.

As Windows has no concept of privileged ports and the ephemeral
range used varies from version to version, no attempt is made to
avoid conflicts with ports in use.

- Add an option to choose the config menu view from the
advanced settings with three options:

Auto:   Automatically switch to the nested view when
        number of configs exceed a limit (currently 25)
Flat:   Force the flat view irrespective of the number of
        configs
Nested: Force the nested view irrespective of the number
        of configs

Issues: 370 and 387

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-02-24 09:26:05 +02:00
Mohammad Javidi 8e9c9392a7 Translate line : 288 and 291->332 and 334->344 to Persian
Signed-off-by: Mohammad Javidi <m.javidii@yahoo.com>
2021-02-12 11:39:01 -05:00
Selva Nair e4fba0c003 Update echo-msg window from the thread that owns the window
Change the way echo-msg window is update (thread safety).
When new echo-msg content is available for display, update the window
from the thread owning it by sending a message to it.
A blocking SendMessage (with a timeout) is used, as the window
needs access to the config's echo-msg buffer which is cleared
on return from this this call.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 273322efb0 Add a From line at the top of new echo messages
This adds context to the message in the form:
"From: config-name date/time text" displayed as right-aligned
and in italics.

Also remove the show argument to AddMessageBoxText() and move ShowWindow()
to the caller.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair ba05ea0de9 Detect urls in echo message make them clickable
- Left clickng on http or https url will open it on the default browser

Several other URL schemes are detected and formatted as clickable
links, but we only support opening of http/https links.

Note on spaces in URLs: We unescape all %xx occurrences in the echo
message text so that %20 will be converted to space in plain text.
This means embedded spaces in URLs will not work even if written
as %20. An option is to use %2520 which will get conveted to %20
after the unescaping.
A better option is to enclose the URL in <>. If the
text inside <> starts with a valid scheme (http, https etc.),
the entire text including spaces is parsed as the URL.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 482bf586df Persist echo msg history in registry
- Echo msg history saved to registry on disconnect and loaded on
  reconnect.
- Muting of repeated messages now work across GUI restarts.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 82e17b239e Mute echo message if repeated or disabled
- Suppress messages with exactly same content as previously
  displayed within popup_mute_interval (24h by default). This parameter
  may be set on command line as "--popup_mute_interval n" where n is
  in hours.

- Command line option '--disable_popup_messages' disables all echo
  message popups (window and notification).

This patch only handles suppression of repeated messages during
reconnections.
TODO: Persist message history in the registry and use it to mute
repeated messages after disconnects and across restarts of the GUI.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 9c914305d9 Implement SHA1 digest of echo message
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 3f896b002b Implement display of echo message window
- Add a message box that support appending messages with
  a title formatted at a larger font and a text
  displayed in the default font.
- A global instance of the message box is used to
  display messages from all profiles.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 00732e1d9e Parse and display messages received by echo msg commands
Process four new echo commands to construct messages to be
displayed to the user:

      echo msg message-text
      echo msg-n message-text
      echo msg-window message-title
      echo msg-notify message-title

Note: All rules of push and echo processing apply and determine
what is received as echo commands by the GUI. In addition,
'url-encoded' characters (% followed by two hex digits) are
decoded and displayed.

The message is constructed in the GUI by concatenating the text
specified in one or more "echo msg text" or "echo msg-n text"
commands. In case of "echo msg text" text is appended with a new
line. An empty text in this case will
just add a new line.

The message ends and gets displayed when one of the following
are receieved:

    echo msg-window title
    echo msg-notify title

where "title" becomes the title of the message window. In case of
msg-window, a modeless window shows the message, in the latter case
a notification balloon is shown.

Example: when pushed from the server:

    push "echo msg I say let the world go to hell%2C"
    push "echo msg I must have my cup of tea."
    push "echo msg-window Notes from the underground"

will display a modeless window with title
"Notes from the underground" and a two line body
    --
    I say let the world go to hell,
    I must have my cup of tea.
    --

Note that the message itself is not quoted in the above examples
and so it relies on the server's option-parser combining
individual words into a space separated string. Number of words
on a line is limited by the maximum number of parameters allowed
in openvpn commands (16). This limitation may be avoided by quoting
the text that follows so that the option parser sees it as one
parameter.

The comma character is not allowed in pushed strings, so
it has to be sent encoded as %2C as shown above.
Such encoding of arbitrary bytes is suppored. For example,
newlines may be embedded as %0A, though discouraged. Instead
use multiple "echo msg" commands to separate lines by new line.

An example with embedded spaces and multiple lines concatenated
without a new line in between (note use of single quotes):

    push "echo msg-n I swear to you gentlemen%2C that to be"
    push "echo msg-n ' overly conscious is a sickness%2C ' "
    push "echo msg-n a real%2C thorough sickness."
    push "echo msg-notify Quote of the Day"

    will show up as a notification that displays for an
    OS-dependent interval as:

    --
    Quote of the Day

    I swear to you gentlemen, that to be overly conscious
    is a sickness, a real, thorough sickness.
    --

where the location of the line break is automatically determined
by the notification API and is OS version-dependent.

Commands like "echo msg ..." in the config file are also
processed the same way. It gets displayed when the GUI connects
to the management interface and receives all pending echo.
Pushed message(s) get displayed when the client daemon
processes push-reply and passes on echo directives to the
GUI.

TODO: The actual window that displays the messages is
implemented in the next commit.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Mohammad Javidi 2aa61fee24
Add Persian language (#374)
* Copy *-en.rc file and rename to *-fa.rc for translate
* Translate line : 1->290 and 472->484 to Persian
* Add Persian(Farsi) language resources
2021-01-04 11:31:44 -05:00
Selva Nair 70b07c82d9 Show a mark against profiles that are in connecting state
Currently we show a check mark on connected profiles with no
indication on profiles that may be in the connecting state.

Change this by adding a mark against connecting/reconnecting
profiles. The yellow connecting state icon is used to generate
this mark although a custom designed check mark may look better.

In case of nested configs, the parent menus are marked with a tick
mark and only the profile is marked with the connecting icon.

No change in behaviour for profiles that are connected or
disconnected.

Trac #1241

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-02 12:35:48 -05:00
Selva Nair bcdda39660 Open all active status windows on left-double-click
Currently we pop up the status window on double click only
if one connection is active though there is no strong reason to
limit this behaviour. In fact, when multiple connections are
stuck in the connecting state, its very useful to have a quick
way to examine their progress instead of having to drill down
the menu. Especially so when nested menu is in use.

A random variation of up to 100 pixel is added to the initial
position of the status window to avoid all windows falling on
top of each other.

To prevent an explosion of new windows in the very unlikely event
of numerous active connections, restrict the maximum windows
shown to 10.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-12-30 13:07:34 -05:00
Samuli Seppänen 3820c1368d Bump version to 11.21.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2020-12-09 13:26:57 +02:00
Selva Nair 0232c6943e README updates
- Where output of scripts go
- Registry key for controlling config menu display

v2: formatting fix

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-12-04 18:29:37 -05:00
Frank Fesevur 5885c906db Only change to reconnecting when already connected 2020-12-04 11:24:31 -05:00
Frank Fesevur a9128787eb Add logging to RunDisconnectScript() 2020-11-08 07:53:26 -05:00