OpenConnect: Passing-over user password when executing authentication request?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Currently I am using the following command for executing authentication request to obtain the server certificate (FINGERPRINT) and OpenConnect
-Cookie:
openconnect --authenticate --user=<username> "VPN host"
Hereby I always have to enter my password in a later appearing user prompt.
Is there an option available to pass-over the password to OpenConnect
already in the upper command?
For example, by extending the command like...
openconnect --authenticate --user=<username> password=<password> "VPN host"
... ?
The challenge is:
The user RuiFRibeiro had the idea just to echo the password within the command. Unfortunately this does not work in our case, because the server provides one more user prompt before reaching the second prompt (= password prompt).
It will happen like that:
First user prompt: Server saying
- "Please choose if you want to tunnel all traffic or only specific one.
- "Type in
Tunnel all
orTunnel company
".
Second user prompt: Server is saying
- "Please enter your password."
As you can see, a simple echo
would give the wrong answer to the wrong question. :-)
For a possible expect
-script the real (exact) server request before inserting text is like followed:
First prompt:
GROUP: [tunnel MyCompany|tunnel all]:
, answer-insertion should betunnel MyCompany
Second prompt:
Password:
, answer-insertion should be123456789
networking configuration command vpn openconnect
add a comment |Â
up vote
2
down vote
favorite
Currently I am using the following command for executing authentication request to obtain the server certificate (FINGERPRINT) and OpenConnect
-Cookie:
openconnect --authenticate --user=<username> "VPN host"
Hereby I always have to enter my password in a later appearing user prompt.
Is there an option available to pass-over the password to OpenConnect
already in the upper command?
For example, by extending the command like...
openconnect --authenticate --user=<username> password=<password> "VPN host"
... ?
The challenge is:
The user RuiFRibeiro had the idea just to echo the password within the command. Unfortunately this does not work in our case, because the server provides one more user prompt before reaching the second prompt (= password prompt).
It will happen like that:
First user prompt: Server saying
- "Please choose if you want to tunnel all traffic or only specific one.
- "Type in
Tunnel all
orTunnel company
".
Second user prompt: Server is saying
- "Please enter your password."
As you can see, a simple echo
would give the wrong answer to the wrong question. :-)
For a possible expect
-script the real (exact) server request before inserting text is like followed:
First prompt:
GROUP: [tunnel MyCompany|tunnel all]:
, answer-insertion should betunnel MyCompany
Second prompt:
Password:
, answer-insertion should be123456789
networking configuration command vpn openconnect
@RuiFRibeiro: You mean executing the request with this command:echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?
â Dave
Aug 26 at 13:23
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Currently I am using the following command for executing authentication request to obtain the server certificate (FINGERPRINT) and OpenConnect
-Cookie:
openconnect --authenticate --user=<username> "VPN host"
Hereby I always have to enter my password in a later appearing user prompt.
Is there an option available to pass-over the password to OpenConnect
already in the upper command?
For example, by extending the command like...
openconnect --authenticate --user=<username> password=<password> "VPN host"
... ?
The challenge is:
The user RuiFRibeiro had the idea just to echo the password within the command. Unfortunately this does not work in our case, because the server provides one more user prompt before reaching the second prompt (= password prompt).
It will happen like that:
First user prompt: Server saying
- "Please choose if you want to tunnel all traffic or only specific one.
- "Type in
Tunnel all
orTunnel company
".
Second user prompt: Server is saying
- "Please enter your password."
As you can see, a simple echo
would give the wrong answer to the wrong question. :-)
For a possible expect
-script the real (exact) server request before inserting text is like followed:
First prompt:
GROUP: [tunnel MyCompany|tunnel all]:
, answer-insertion should betunnel MyCompany
Second prompt:
Password:
, answer-insertion should be123456789
networking configuration command vpn openconnect
Currently I am using the following command for executing authentication request to obtain the server certificate (FINGERPRINT) and OpenConnect
-Cookie:
openconnect --authenticate --user=<username> "VPN host"
Hereby I always have to enter my password in a later appearing user prompt.
Is there an option available to pass-over the password to OpenConnect
already in the upper command?
For example, by extending the command like...
openconnect --authenticate --user=<username> password=<password> "VPN host"
... ?
The challenge is:
The user RuiFRibeiro had the idea just to echo the password within the command. Unfortunately this does not work in our case, because the server provides one more user prompt before reaching the second prompt (= password prompt).
It will happen like that:
First user prompt: Server saying
- "Please choose if you want to tunnel all traffic or only specific one.
- "Type in
Tunnel all
orTunnel company
".
Second user prompt: Server is saying
- "Please enter your password."
As you can see, a simple echo
would give the wrong answer to the wrong question. :-)
For a possible expect
-script the real (exact) server request before inserting text is like followed:
First prompt:
GROUP: [tunnel MyCompany|tunnel all]:
, answer-insertion should betunnel MyCompany
Second prompt:
Password:
, answer-insertion should be123456789
networking configuration command vpn openconnect
networking configuration command vpn openconnect
edited Sep 3 at 16:28
Jeff Schaller
32.7k849110
32.7k849110
asked Aug 26 at 13:14
Dave
319213
319213
@RuiFRibeiro: You mean executing the request with this command:echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?
â Dave
Aug 26 at 13:23
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25
add a comment |Â
@RuiFRibeiro: You mean executing the request with this command:echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?
â Dave
Aug 26 at 13:23
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25
@RuiFRibeiro: You mean executing the request with this command:
echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?â Dave
Aug 26 at 13:23
@RuiFRibeiro: You mean executing the request with this command:
echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?â Dave
Aug 26 at 13:23
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Usually, VPN software does not allow as input the password for a user, because it is considered a security risk.
A possible solution is feeding the password via a pipe as in:
echo -e "Tunnel allnYourPassword" | openconnect --authenticate --user=<username> "VPN host"
If we are talking about you being interested in this method to write a script:
- be sure to understand the security implications of having your password in a file, and restrict the read rights of that file only to the user running the
openconnect
command.
PS Replace YourPassword with your real password
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
It is working now! I had to write the password with'password'
instead of"password"
...
â Dave
Aug 27 at 10:01
 |Â
show 6 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Usually, VPN software does not allow as input the password for a user, because it is considered a security risk.
A possible solution is feeding the password via a pipe as in:
echo -e "Tunnel allnYourPassword" | openconnect --authenticate --user=<username> "VPN host"
If we are talking about you being interested in this method to write a script:
- be sure to understand the security implications of having your password in a file, and restrict the read rights of that file only to the user running the
openconnect
command.
PS Replace YourPassword with your real password
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
It is working now! I had to write the password with'password'
instead of"password"
...
â Dave
Aug 27 at 10:01
 |Â
show 6 more comments
up vote
2
down vote
accepted
Usually, VPN software does not allow as input the password for a user, because it is considered a security risk.
A possible solution is feeding the password via a pipe as in:
echo -e "Tunnel allnYourPassword" | openconnect --authenticate --user=<username> "VPN host"
If we are talking about you being interested in this method to write a script:
- be sure to understand the security implications of having your password in a file, and restrict the read rights of that file only to the user running the
openconnect
command.
PS Replace YourPassword with your real password
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
It is working now! I had to write the password with'password'
instead of"password"
...
â Dave
Aug 27 at 10:01
 |Â
show 6 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Usually, VPN software does not allow as input the password for a user, because it is considered a security risk.
A possible solution is feeding the password via a pipe as in:
echo -e "Tunnel allnYourPassword" | openconnect --authenticate --user=<username> "VPN host"
If we are talking about you being interested in this method to write a script:
- be sure to understand the security implications of having your password in a file, and restrict the read rights of that file only to the user running the
openconnect
command.
PS Replace YourPassword with your real password
Usually, VPN software does not allow as input the password for a user, because it is considered a security risk.
A possible solution is feeding the password via a pipe as in:
echo -e "Tunnel allnYourPassword" | openconnect --authenticate --user=<username> "VPN host"
If we are talking about you being interested in this method to write a script:
- be sure to understand the security implications of having your password in a file, and restrict the read rights of that file only to the user running the
openconnect
command.
PS Replace YourPassword with your real password
edited Aug 26 at 13:46
answered Aug 26 at 13:23
Rui F Ribeiro
36.7k1271117
36.7k1271117
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
It is working now! I had to write the password with'password'
instead of"password"
...
â Dave
Aug 27 at 10:01
 |Â
show 6 more comments
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
It is working now! I had to write the password with'password'
instead of"password"
...
â Dave
Aug 27 at 10:01
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
Thanks for your idea! Unfortunately there is one more user prompt before the mentioned prompt (the one where I have to insert the password). Because of this your command does not fit into this first user prompt, because during the first one the server only wants to know if I want to tunnel everything or just specific traffic. Unfortunately only in the next (= second) prompt the server will ask for the password.
â Dave
Aug 26 at 13:28
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
If you are placing the user in the command line, what is the nature of the other prompt? double factor auth?
â Rui F Ribeiro
Aug 26 at 13:29
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
In the first prompt the server is asking if I want to tunnel all traffic over the VPN or just specific one. The user prompt where I have to insert my password is the second prompt...
â Dave
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
I would that output/text/interaction to the question in the first place.
â Rui F Ribeiro
Aug 26 at 13:32
1
1
It is working now! I had to write the password with
'password'
instead of "password"
...â Dave
Aug 27 at 10:01
It is working now! I had to write the password with
'password'
instead of "password"
...â Dave
Aug 27 at 10:01
 |Â
show 6 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464920%2fopenconnect-passing-over-user-password-when-executing-authentication-request%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
@RuiFRibeiro: You mean executing the request with this command:
echo password | openconnect --authenticate --user=<username> "VPN host"
? Should I type in my real password or leave it as "password"?â Dave
Aug 26 at 13:23
added to the answer.
â Rui F Ribeiro
Aug 26 at 13:25