in reply to Pointers required on understanding LDAP Authenticating script for openvpn

Howdy,

You don't show the code that you use to read these values in from the command line. It's possible you're just forgetting to chomp the result and newline is being included as part of the value

It's possible to use this script from the command line with no changes however. Either set those values in the environment before running it, or just:

username=WHATEVER password=SECRET ./ldap_authenticate.pl
  • Comment on Re: Pointers required on understanding LDAP Authenticating script for openvpn
  • Download Code

Replies are listed 'Best First'.
Re^2: Pointers required on understanding LDAP Authenticating script for openvpn
by shekarkcb (Beadle) on Apr 10, 2013 at 12:01 UTC
    Thanks for the reply.

    As i explained in first post, there is nothing code present passing username or password, this script is called from openvpn, the configuration file has this line

    auth-user-pass-verify /etc/openvpn/new_ldap_authenticate.pl via-env

    That's it, i am not sure how openvpn is passing username or password, that configuration file just says above line.
    I did tried manually passing username and password inside script, and from STDIN ( removed new line using chomp), and also tried your line, still getting <code> Invalid credentials<code>

    Just wanted to know how $ENV stuff is passed/called to/from Perl Script.
    And then add for new OU.

    Thanks

      The %ENV variable just holds your environment variables. So you should be able to change them values by updating the "username" and "password" environment variables before running your script. You can usually set them while running a script, like

      username="my_user" password="my_pass" perl script.pl