1

I'm trying to write an upstart file for OpenConnect. The task is pretty simple, but I'm stuck because I don't want to provide the username and password in a config file, but prompt the user to provide them each time.

The upstart file, placed in /etc/init/openconnect.conf is

exec /usr/sbin/openconnect --script=/etc/vpnc/vpnc-script my-gw.example.com

However, when I execute

start openconnect

the process is backgrounded immediately and I get no chance to provide input.

How can I make this upstart job ask the user for input?

Robert Munteanu
  • 1,542
  • 5
  • 22
  • 38
  • IMHO you simply shouldn't. init and upstart scripts should be able to run and complete without operator input. – HBruijn Nov 01 '13 at 14:28
  • @HBruijn - that's a valid point. However, consider an Apache instance which has a password-protected SSL cerfificate. That should be started with an upstart script - it's a system service - and it should allow the user to input the password. I'm looking for the same thing. – Robert Munteanu Nov 01 '13 at 14:32
  • In that case maybe a more traditional SysV init style script might work? – HBruijn Nov 01 '13 at 15:15

1 Answers1

0

I can't speak to Upstart doing something requiring user input, but it sounds like that is a no go from the comments.

If you wanted to use openconnect with Upstart, no additional config file, AND not ask for user input then you can use -u is for the username and --passwd-on-stdin for the password. For example:

script
  echo 'pw_here' | openconnect --passwd-on-stdin vpn_domain_here -u username_here
end script
Calvin
  • 101
  • 1