Mailing List Archive

[PATCH 1/5] support password helper
Allows to integrate UI, similar to ssh-askpass, program prompt user
for password and echo result to stdout.

Settings:
---
Password Helper /home/alonbl/vpnc/vpnc-getpass
Xauth interactive
---

vpn-getpass script for KDE:
---
prompt="$1"
exec kdialog --title "vpnc" --password "$prompt";
---

vpn-getpass script for KDE with SecurID:
---
prompt="$1"
pass="$(kdialog --title "vpnc" --password "$prompt")" || exit 1
otp="$(RSA_SecurID_getpasswd)" || exit 1
echo "${pass}${otp}"
exit 0
---

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
config.c | 17 +++++++-
config.h | 1 +
vpnc.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
vpnc.h | 2 +
4 files changed, 152 insertions(+), 3 deletions(-)

diff --git a/config.c b/config.c
index 0351e9b..90e8df5 100644
--- a/config.c
+++ b/config.c
@@ -469,6 +469,13 @@ static const struct config_names_s {
"Target network in dotted decimal or CIDR notation\n",
config_def_target_network
}, {
+ CONFIG_PASSWORD_HELPER, 1, 1,
+ "--password-helper",
+ "Password helper",
+ "<executable>",
+ "path to password program or helper name\n",
+ NULL
+ }, {
0, 0, 0, NULL, NULL, NULL, NULL, NULL
}
};
@@ -652,6 +659,7 @@ static void print_version(void)

void do_config(int argc, char **argv)
{
+ char _pass[1024];
char *s;
int i, c, known;
int got_conffile = 0, print_config = 0;
@@ -819,7 +827,14 @@ void do_config(int argc, char **argv)
switch (i) {
case CONFIG_IPSEC_SECRET:
case CONFIG_XAUTH_PASSWORD:
- s = strdup(getpass(""));
+ if (!vpnc_getpass(
+ config[CONFIG_PASSWORD_HELPER],
+ "",
+ _pass,
+ sizeof(_pass))) {
+ error(2, 0, "authentication unsuccessful");
+ }
+ s = _pass;
break;
case CONFIG_IPSEC_GATEWAY:
case CONFIG_IPSEC_ID:
diff --git a/config.h b/config.h
index 6fbd231..6c97801 100644
--- a/config.h
+++ b/config.h
@@ -59,6 +59,7 @@ enum config_enum {
CONFIG_AUTH_MODE,
CONFIG_CA_FILE,
CONFIG_CA_DIR,
+ CONFIG_PASSWORD_HELPER,
LAST_CONFIG
};

diff --git a/vpnc.c b/vpnc.c
index b3518b6..cc5f14f 100644
--- a/vpnc.c
+++ b/vpnc.c
@@ -37,6 +37,7 @@
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
+#include <sys/wait.h>

#include <gcrypt.h>

@@ -165,6 +166,128 @@ static struct sa_block *s_atexit_sa;

static void close_tunnel(struct sa_block *s);

+static int vpnc_getpass_program(const char * const program,
+ const char *const prompt, char *const input, const size_t input_size)
+{
+ int status;
+ pid_t pid = -1;
+ int fds[2] = {-1, -1};
+ int r = 0;
+ int rc;
+
+ if (input == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ if (program == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ if (pipe(fds) == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ pid = fork();
+ if (pid == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ if (pid == 0) {
+ close(fds[0]);
+ fds[0] = -1;
+
+ if (dup2(fds[1], 1) == -1)
+ _exit(1);
+
+ close(fds[1]);
+ fds[1] = -1;
+
+ execl(program, program, prompt, NULL);
+
+ _exit(1);
+ }
+
+ close(fds[1]);
+ fds[1] = -1;
+
+ while ((r = waitpid(pid, &status, 0)) == 0 ||
+ (r == -1 && errno == EINTR))
+ ;
+
+ if (r == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ if (!WIFEXITED(status)) {
+ rc = -EFAULT;
+ goto out;
+ }
+
+ if (WEXITSTATUS(status) != 0) {
+ rc = -EIO;
+ goto out;
+ }
+
+ if (input != NULL) {
+ ssize_t bytes;
+
+ bytes = read(fds[0], input, input_size);
+ if (bytes == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ input[bytes] = '\0';
+
+ if (strlen(input) > 0 && input[(int)strlen(input)-1] == '\n')
+ input[(int)strlen(input)-1] = '\0';
+ /* DOS cygwin */
+ if (strlen(input) > 0 && input[(int)strlen(input)-1] == '\r')
+ input[(int)strlen(input)-1] = '\0';
+ }
+
+ rc = 0;
+
+out:
+ if (rc != 0) {
+ if (input)
+ memset(input, 0, input_size);
+ }
+
+ if (fds[0] != -1) {
+ close(fds[0]);
+ fds[0] = -1;
+ }
+
+ if (fds[1] != -1) {
+ close(fds[1]);
+ fds[1] = -1;
+ }
+
+ return rc;
+}
+
+int vpnc_getpass(const char * const helper, const char *const prompt,
+ char *const input, const size_t input_size)
+{
+ if (helper == NULL) {
+ char *pass = getpass(prompt);
+ if (pass == NULL)
+ return 0;
+ strncpy(input, pass, input_size);
+ memset(pass, 0, strlen(pass));
+ return 1;
+ } else {
+ return vpnc_getpass_program(helper, prompt, input,
+ input_size) == 0;
+ }
+}
+
void print_vid(const unsigned char *vid, uint16_t len) {

int vid_index = 0;
@@ -2327,7 +2450,8 @@ static int do_phase2_xauth(struct sa_block *s)
phase2_fatal(s, "noninteractive can't reuse password", reject);
error(2, 0, "authentication failed (requires interactive mode)");
} else if (seen_answer || passwd_used || config[CONFIG_XAUTH_INTERACTIVE]) {
- char *pass, *prompt = NULL;
+ char pass[1024];
+ char *prompt = NULL;

asprintf(&prompt, "%s for VPN %s@%s: ",
(ap->type == ISAKMP_XAUTH_06_ATTRIB_ANSWER) ?
@@ -2335,7 +2459,14 @@ static int do_phase2_xauth(struct sa_block *s)
(ap->type == ISAKMP_XAUTH_06_ATTRIB_USER_PASSWORD) ?
"Password" : "Passcode",
config[CONFIG_XAUTH_USERNAME], ntop_buf);
- pass = getpass(prompt);
+ if (!vpnc_getpass(
+ config[CONFIG_PASSWORD_HELPER],
+ prompt,
+ pass,
+ sizeof(pass))) {
+ free(prompt);
+ error(2, 0, "authentication unsuccessful");
+ }
free(prompt);

na = new_isakmp_attribute(ap->type, NULL);
diff --git a/vpnc.h b/vpnc.h
index 2bacc08..e9b54bc 100644
--- a/vpnc.h
+++ b/vpnc.h
@@ -27,5 +27,7 @@ void process_late_ike(struct sa_block *s, uint8_t *r_packet, ssize_t r_length);
void keepalive_ike(struct sa_block *s);
void dpd_ike(struct sa_block *s);
void print_vid(const unsigned char *vid, uint16_t len);
+int vpnc_getpass(const char * const helper, const char *const prompt,
+ char *const input, const size_t input_size);

#endif
--
1.8.3.2

_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
[PATCH 1/5] support password helper [ In reply to ]
Allows to integrate UI, similar to ssh-askpass, program prompt user
for password and echo result to stdout.

Settings:
---
Password Helper /home/alonbl/vpnc/vpnc-getpass
Xauth interactive
---

vpn-getpass script for KDE:
---
prompt="$1"
exec kdialog --title "vpnc" --password "$prompt";
---

vpn-getpass script for KDE with SecurID:
---
prompt="$1"
pass="$(kdialog --title "vpnc" --password "$prompt")" || exit 1
otp="$(RSA_SecurID_getpasswd)" || exit 1
echo "${pass}${otp}"
exit 0
---

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
config.c | 17 +++++++-
config.h | 1 +
vpnc.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
vpnc.h | 2 +
4 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/config.c b/config.c
index 0351e9b..90e8df5 100644
--- a/config.c
+++ b/config.c
@@ -469,6 +469,13 @@ static const struct config_names_s {
"Target network in dotted decimal or CIDR notation\n",
config_def_target_network
}, {
+ CONFIG_PASSWORD_HELPER, 1, 1,
+ "--password-helper",
+ "Password helper",
+ "<executable>",
+ "path to password program or helper name\n",
+ NULL
+ }, {
0, 0, 0, NULL, NULL, NULL, NULL, NULL
}
};
@@ -652,6 +659,7 @@ static void print_version(void)

void do_config(int argc, char **argv)
{
+ char _pass[1024];
char *s;
int i, c, known;
int got_conffile = 0, print_config = 0;
@@ -819,7 +827,14 @@ void do_config(int argc, char **argv)
switch (i) {
case CONFIG_IPSEC_SECRET:
case CONFIG_XAUTH_PASSWORD:
- s = strdup(getpass(""));
+ if (!vpnc_getpass(
+ config[CONFIG_PASSWORD_HELPER],
+ "",
+ _pass,
+ sizeof(_pass))) {
+ error(2, 0, "authentication unsuccessful");
+ }
+ s = _pass;
break;
case CONFIG_IPSEC_GATEWAY:
case CONFIG_IPSEC_ID:
diff --git a/config.h b/config.h
index 6fbd231..6c97801 100644
--- a/config.h
+++ b/config.h
@@ -59,6 +59,7 @@ enum config_enum {
CONFIG_AUTH_MODE,
CONFIG_CA_FILE,
CONFIG_CA_DIR,
+ CONFIG_PASSWORD_HELPER,
LAST_CONFIG
};

diff --git a/vpnc.c b/vpnc.c
index b3518b6..d458d06 100644
--- a/vpnc.c
+++ b/vpnc.c
@@ -37,6 +37,7 @@
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
+#include <sys/wait.h>

#include <gcrypt.h>

@@ -165,6 +166,125 @@ static struct sa_block *s_atexit_sa;

static void close_tunnel(struct sa_block *s);

+static int vpnc_getpass_program(const char * const program,
+ const char *const prompt, char *const input, const size_t input_size)
+{
+ int status;
+ pid_t pid = -1;
+ int fds[2] = {-1, -1};
+ int r = 0;
+ int rc;
+ ssize_t bytes;
+
+ if (input == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ if (program == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ if (pipe(fds) == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ pid = fork();
+ if (pid == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ if (pid == 0) {
+ close(fds[0]);
+ fds[0] = -1;
+
+ if (dup2(fds[1], 1) == -1)
+ _exit(1);
+
+ close(fds[1]);
+ fds[1] = -1;
+
+ execl(program, program, prompt, NULL);
+
+ _exit(1);
+ }
+
+ close(fds[1]);
+ fds[1] = -1;
+
+ while ((r = waitpid(pid, &status, 0)) == 0 ||
+ (r == -1 && errno == EINTR))
+ ;
+
+ if (r == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ if (!WIFEXITED(status)) {
+ rc = -EFAULT;
+ goto out;
+ }
+
+ if (WEXITSTATUS(status) != 0) {
+ rc = -EIO;
+ goto out;
+ }
+
+ bytes = read(fds[0], input, input_size);
+ if (bytes == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ input[bytes] = '\0';
+
+ if (strlen(input) > 0 && input[(int)strlen(input)-1] == '\n')
+ input[(int)strlen(input)-1] = '\0';
+ /* DOS cygwin */
+ if (strlen(input) > 0 && input[(int)strlen(input)-1] == '\r')
+ input[(int)strlen(input)-1] = '\0';
+
+ rc = 0;
+
+out:
+ if (rc != 0) {
+ if (input)
+ memset(input, 0, input_size);
+ }
+
+ if (fds[0] != -1) {
+ close(fds[0]);
+ fds[0] = -1;
+ }
+
+ if (fds[1] != -1) {
+ close(fds[1]);
+ fds[1] = -1;
+ }
+
+ return rc;
+}
+
+int vpnc_getpass(const char * const helper, const char *const prompt,
+ char *const input, const size_t input_size)
+{
+ if (helper == NULL) {
+ char *pass = getpass(prompt);
+ if (pass == NULL)
+ return 0;
+ strncpy(input, pass, input_size);
+ memset(pass, 0, strlen(pass));
+ return 1;
+ } else {
+ return vpnc_getpass_program(helper, prompt, input,
+ input_size) == 0;
+ }
+}
+
void print_vid(const unsigned char *vid, uint16_t len) {

int vid_index = 0;
@@ -2327,7 +2447,8 @@ static int do_phase2_xauth(struct sa_block *s)
phase2_fatal(s, "noninteractive can't reuse password", reject);
error(2, 0, "authentication failed (requires interactive mode)");
} else if (seen_answer || passwd_used || config[CONFIG_XAUTH_INTERACTIVE]) {
- char *pass, *prompt = NULL;
+ char pass[1024];
+ char *prompt = NULL;

asprintf(&prompt, "%s for VPN %s@%s: ",
(ap->type == ISAKMP_XAUTH_06_ATTRIB_ANSWER) ?
@@ -2335,7 +2456,14 @@ static int do_phase2_xauth(struct sa_block *s)
(ap->type == ISAKMP_XAUTH_06_ATTRIB_USER_PASSWORD) ?
"Password" : "Passcode",
config[CONFIG_XAUTH_USERNAME], ntop_buf);
- pass = getpass(prompt);
+ if (!vpnc_getpass(
+ config[CONFIG_PASSWORD_HELPER],
+ prompt,
+ pass,
+ sizeof(pass))) {
+ free(prompt);
+ error(2, 0, "authentication unsuccessful");
+ }
free(prompt);

na = new_isakmp_attribute(ap->type, NULL);
diff --git a/vpnc.h b/vpnc.h
index 2bacc08..e9b54bc 100644
--- a/vpnc.h
+++ b/vpnc.h
@@ -27,5 +27,7 @@ void process_late_ike(struct sa_block *s, uint8_t *r_packet, ssize_t r_length);
void keepalive_ike(struct sa_block *s);
void dpd_ike(struct sa_block *s);
void print_vid(const unsigned char *vid, uint16_t len);
+int vpnc_getpass(const char * const helper, const char *const prompt,
+ char *const input, const size_t input_size);

#endif
--
1.8.3.2

_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Mon, Dec 16, 2013 at 1:36 AM, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> Allows to integrate UI, similar to ssh-askpass, program prompt user
> for password and echo result to stdout.
>
> Settings:
> ---
> Password Helper /home/alonbl/vpnc/vpnc-getpass
> Xauth interactive
> ---
>
> vpn-getpass script for KDE:
> ---
> prompt="$1"
> exec kdialog --title "vpnc" --password "$prompt";
> ---
>
> vpn-getpass script for KDE with SecurID:
> ---
> prompt="$1"
> pass="$(kdialog --title "vpnc" --password "$prompt")" || exit 1
> otp="$(RSA_SecurID_getpasswd)" || exit 1
> echo "${pass}${otp}"
> exit 0
> ---
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
> ---

Hi Alon,

applyed with quite some modification.
Could you please test it?

Thanks
Antonio
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Tue, Feb 18, 2014 at 7:18 AM, Antonio Borneo
<borneo.antonio@gmail.com> wrote:
>
> On Mon, Dec 16, 2013 at 1:36 AM, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> > Allows to integrate UI, similar to ssh-askpass, program prompt user
> > for password and echo result to stdout.
> >
> > Settings:
> > ---
> > Password Helper /home/alonbl/vpnc/vpnc-getpass
> > Xauth interactive
> > ---
> >
> > vpn-getpass script for KDE:
> > ---
> > prompt="$1"
> > exec kdialog --title "vpnc" --password "$prompt";
> > ---
> >
> > vpn-getpass script for KDE with SecurID:
> > ---
> > prompt="$1"
> > pass="$(kdialog --title "vpnc" --password "$prompt")" || exit 1
> > otp="$(RSA_SecurID_getpasswd)" || exit 1
> > echo "${pass}${otp}"
> > exit 0
> > ---
> >
> > Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
> > ---
>
> Hi Alon,
>
> applyed with quite some modification.
> Could you please test it?

Thank you!
Works.

My remaining queue[1]

I see that you handle[2] "always run the vpnc-script at exit"

Should I resend the others?

[1] https://github.com/alonbl/vpnc/compare/master...alonbl
[2] https://github.com/alonbl/vpnc/commit/2788cedbe30071fe6b102d372ee227d4b4ce5ab8

>
> Thanks
> Antonio
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Tue, Feb 18, 2014 at 8:23 PM, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> On Tue, Feb 18, 2014 at 7:18 AM, Antonio Borneo
> <borneo.antonio@gmail.com> wrote:
>>
>> Hi Alon,
>>
>> applyed with quite some modification.
>> Could you please test it?
>
> Thank you!
> Works.

Good, thanks.

>
> My remaining queue[1]
>
> I see that you handle[2] "always run the vpnc-script at exit"
>
> Should I resend the others?
>
> [1] https://github.com/alonbl/vpnc/compare/master...alonbl
> [2] https://github.com/alonbl/vpnc/commit/2788cedbe30071fe6b102d372ee227d4b4ce5ab8
>

The script vpnc-script is shared with the project openconnect.
I'm keeping your patches on-hold while exchanging email with
openconnect maintainer.
No need to re-send, at least not for now.

Anyway I have a question.
With one of your patches you enable unpriviledged user to run vpnc.
But you have to add that user as sudoer at least for /sbin/ip and
/sbin/resolvconf
Why not running directly "sudo vpnc"? Am I missing something?

Antonio
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, Feb 20, 2014 at 5:49 PM, Antonio Borneo
<borneo.antonio@gmail.com> wrote:
>
> On Tue, Feb 18, 2014 at 8:23 PM, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> > On Tue, Feb 18, 2014 at 7:18 AM, Antonio Borneo
> > <borneo.antonio@gmail.com> wrote:
> >>
> >> Hi Alon,
> >>
> >> applyed with quite some modification.
> >> Could you please test it?
> >
> > Thank you!
> > Works.
>
> Good, thanks.
>
> >
> > My remaining queue[1]
> >
> > I see that you handle[2] "always run the vpnc-script at exit"
> >
> > Should I resend the others?
> >
> > [1] https://github.com/alonbl/vpnc/compare/master...alonbl
> > [2] https://github.com/alonbl/vpnc/commit/2788cedbe30071fe6b102d372ee227d4b4ce5ab8
> >
>
> The script vpnc-script is shared with the project openconnect.
> I'm keeping your patches on-hold while exchanging email with
> openconnect maintainer.
> No need to re-send, at least not for now.
>
> Anyway I have a question.
> With one of your patches you enable unpriviledged user to run vpnc.
> But you have to add that user as sudoer at least for /sbin/ip and
> /sbin/resolvconf
> Why not running directly "sudo vpnc"? Am I missing something?

It is a matter of policy and trust.

Using vpnc as sudo is far from being least privileged, right? and
there is no need for have a component that keeps running as root post
configuration be exposed to network?

Using "sudo /sbin/ip" was just an example, in reality there can be a
wrapper script that checks that the interface and configuration is
permitted.
Same for resolveconf.

So let's summarize... vpnc has no need to run as root, nor should it
be able to modify host configuration directly. Privilege escalation
should be done via wrappers with clear interface that can filter
requests based on approve policy. The interface of iproute2 and
openresolv are good enough to serve that purpose.

Did I answer your question?

Regards,
Alon Bar-Lev.
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, 2014-02-20 at 17:55 +0200, Alon Bar-Lev wrote:
> So let's summarize... vpnc has no need to run as root, nor should it
> be able to modify host configuration directly. Privilege escalation
> should be done via wrappers with clear interface that can filter
> requests based on approve policy. The interface of iproute2 and
> openresolv are good enough to serve that purpose.
>
> Did I answer your question?

Specifically, look at the way that openconnect is used when it's run
from NetworkManager.

First NM creates a persistent tun device and grants access to it to the
'nm-openconnect' user with the TUNSETOWNER ioctl.

Then NM invokes openconnect as the (otherwise) unprivileged
nm-openconnect user. It can do all the networking stuff, and it can open
the *specific* tun device it was granted access to. And it spawns its
"vpnc-script" which in this case just passes all the information back to
NetworkManager.

We don't need any extra privileges at all.

It'd be great to have vpnc working that way too.

--
dwmw2
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, Feb 20, 2014 at 6:10 PM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Thu, 2014-02-20 at 17:55 +0200, Alon Bar-Lev wrote:
>> So let's summarize... vpnc has no need to run as root, nor should it
>> be able to modify host configuration directly. Privilege escalation
>> should be done via wrappers with clear interface that can filter
>> requests based on approve policy. The interface of iproute2 and
>> openresolv are good enough to serve that purpose.
>>
>> Did I answer your question?
>
> Specifically, look at the way that openconnect is used when it's run
> from NetworkManager.
>
> First NM creates a persistent tun device and grants access to it to the
> 'nm-openconnect' user with the TUNSETOWNER ioctl.
>
> Then NM invokes openconnect as the (otherwise) unprivileged
> nm-openconnect user. It can do all the networking stuff, and it can open
> the *specific* tun device it was granted access to. And it spawns its
> "vpnc-script" which in this case just passes all the information back to
> NetworkManager.
>
> We don't need any extra privileges at all.
>
> It'd be great to have vpnc working that way too.

I don't use network manager, and I do not want to use network manager,
it is way too complex software for what I need, it is too risky to use
it as it requires root, and it does not work correctly for most of the
designed issues of networking, especially bridges and such.

A simple wrapper for iproute and resolvconf are sufficient, *NOTHING*
including ***manager should run as root.

The only missing bits in vpnc are[1], I have similar working
configuration for openvpn, in both cases the daemon is run directly by
user, no need for any windows like manager only filter of network
configuration when iproute2 or resolvconf are being used.

Regards,
Alon

[1] https://github.com/alonbl/vpnc/compare/alonbl
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Sun, 2013-12-15 at 19:36 +0200, Alon Bar-Lev wrote:
>
> vpn-getpass script for KDE with SecurID:

Digression: why not just merge proper support for SecurID with
libstoken?

--
dwmw2
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, Feb 20, 2014 at 6:18 PM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Sun, 2013-12-15 at 19:36 +0200, Alon Bar-Lev wrote:
>>
>> vpn-getpass script for KDE with SecurID:
>
> Digression: why not just merge proper support for SecurID with
> libstoken?

IMO there is no reason to couple vpnc with any otp solution once you
have this interface. You can easily integrate any solution, I use
SecurID and Yubikey.
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, 2014-02-20 at 18:15 +0200, Alon Bar-Lev wrote:
>
> I don't use network manager, and I do not want to use network manager,

That's fair enough. Nevertheless, if we're making sure that vpnc can
operate without root privs, the case of running unprivileged under
NetworkManager is definitely something that should be considered. And
tested.

--
dwmw2
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, Feb 20, 2014 at 6:22 PM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Thu, 2014-02-20 at 18:15 +0200, Alon Bar-Lev wrote:
>>
>> I don't use network manager, and I do not want to use network manager,
>
> That's fair enough. Nevertheless, if we're making sure that vpnc can
> operate without root privs, the case of running unprivileged under
> NetworkManager is definitely something that should be considered. And
> tested.

Two different issues IMO.

Having vpnc run as unprivileged under Linux operating system is one
thing, and I provided the solutions.

Having vpnc run as unprivileged under NetworkManager operating system
is another and may require more/less work.

Two separate issues, please do not tie them.

Regards,
Alon
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, 2014-02-20 at 18:15 +0200, Alon Bar-Lev wrote:
> On Thu, Feb 20, 2014 at 6:10 PM, David Woodhouse <dwmw2@infradead.org> wrote:
> > On Thu, 2014-02-20 at 17:55 +0200, Alon Bar-Lev wrote:
> >> So let's summarize... vpnc has no need to run as root, nor should it
> >> be able to modify host configuration directly. Privilege escalation
> >> should be done via wrappers with clear interface that can filter
> >> requests based on approve policy. The interface of iproute2 and
> >> openresolv are good enough to serve that purpose.
> >>
> >> Did I answer your question?
> >
> > Specifically, look at the way that openconnect is used when it's run
> > from NetworkManager.
> >
> > First NM creates a persistent tun device and grants access to it to the
> > 'nm-openconnect' user with the TUNSETOWNER ioctl.
> >
> > Then NM invokes openconnect as the (otherwise) unprivileged
> > nm-openconnect user. It can do all the networking stuff, and it can open
> > the *specific* tun device it was granted access to. And it spawns its
> > "vpnc-script" which in this case just passes all the information back to
> > NetworkManager.
> >
> > We don't need any extra privileges at all.
> >
> > It'd be great to have vpnc working that way too.
>
> I don't use network manager, and I do not want to use network manager,
> it is way too complex software for what I need, it is too risky to use
> it as it requires root, and it does not work correctly for most of the
> designed issues of networking, especially bridges and such.

As a digression, NetworkManager used to have issues with such things,
but we've spent the last year or two fixing those, and are committed to
ensuring that NM isn't surprising and is useful for many of these cases.

I'm not disagreeing with your comments below, I am simply saying that
NetworkManager has changed quite a bit from when many people last formed
an opinion of it.

Dan

> A simple wrapper for iproute and resolvconf are sufficient, *NOTHING*
> including ***manager should run as root.
>
> The only missing bits in vpnc are[1], I have similar working
> configuration for openvpn, in both cases the daemon is run directly by
> user, no need for any windows like manager only filter of network
> configuration when iproute2 or resolvconf are being used.
>
> Regards,
> Alon
>
> [1] https://github.com/alonbl/vpnc/compare/alonbl
> _______________________________________________
> vpnc-devel mailing list
> vpnc-devel@unix-ag.uni-kl.de
> https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
> http://www.unix-ag.uni-kl.de/~massar/vpnc/


_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: [PATCH 1/5] support password helper [ In reply to ]
On Thu, 2014-02-20 at 18:26 +0200, Alon Bar-Lev wrote:
> Two different issues IMO.
>
> Having vpnc run as unprivileged under Linux operating system is one
> thing, and I provided the solutions.
>
> Having vpnc run as unprivileged under NetworkManager operating system
> is another and may require more/less work.
>
> Two separate issues, please do not tie them.

I disagree entirely. They are almost *identical* issues, and I think it
would be insane to come up with a design for the first without even
*considering* whether it'll be appropriate for the second.

But this isn't my project; I'm just heckling. It's up to Antonio :)

--
dwmw2