Windows authentication from SUSE 10.1? What module can do this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolsti
    Contributor
    • Mar 2008
    • 310

    Windows authentication from SUSE 10.1? What module can do this?

    I am not sure if this post belongs here in PHP or under Linux.

    I have an application at work running both on Centos 4.5 and on a Debian PC. For both of these, an authentication of a user is made using either smbauth_validat e and smbauth.so (Centos) or pam_auth (Debian), where the user's ID and password is sent to our Windows server and checked to see if they are valid.

    Now I need to migrate the application to a SUSE 10.1 x86_64 machine, and having difficulties in finding the right package that can do the same job.

    Can anyone help? Can anyone tell me for SUSE what module or RPM package can be used?

    Thanks for any help,

    Regards,
    Steve, Denmark
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    In my opinion this is a Linux problem, so I will move this thread to the Linux forum. Good luck.

    moderator

    Comment

    • coolsti
      Contributor
      • Mar 2008
      • 310

      #3
      Thank you to the moderator. I was, and still am, not really sure where this belongs, which is part of the problem behind the original post. I am working with PHP, and am not sure where to look for an appropriate authentificatio n module that will work on a 64bit SUSE 10.1 machine: a PHP module, or a more general Linux module (pam, squid, etc.).

      I do not require an entire authentificatio n system, just a function that will ask our Windows server if a user ID and password pair are currently valid, and return a true or false as answer to the PHP script.

      Hope someone out there can help!

      Steve, Denmark

      Comment

      • coolsti
        Contributor
        • Mar 2008
        • 310

        #4
        If it is any help to anyone, I will answer my own question. I could not find packages or modules for 64 bit SUSE 10.1 that gave me the equivalent functionality as I have for Centos and Debian, but it seems the php5-ldap module does what I want. I use the following function.
        [code=php]
        <?php
        function myCheckAuth($us er,$passwrd)
        {
        $user = trim($user);
        if ((strlen($user) ==0) or (strlen($passwr d)==0))
        {
        // Need to do this or it would be possible to log in anonymously
        return false;
        }
        // Convert the $user id to something that the Windows server will accept:
        $userid = trim($user) . '@companydomane .com';
        $host = 'ldap://companyserverUR L';

        $ldap = ldap_connect($h ost);
        ldap_set_option ($ldap,LDAP_OPT _PROTOCOL_VERSI ON, 3);

        // Attempt to bind this user.
        $ldapbind = ldap_bind($ldap ,$userid,$passw rd);
        if ($ldapbind)
        {
        ldap_close($lda p);
        return true;
        }
        else
        {
        ldap_close($lda p);
        return false;
        }
        }
        ?>
        [/code]

        This seems to do the job. The PHP script passes the user's Windows log on ID as $user and the user's password as $passwrd (obtained from the log on page using appropriate form input fields). If the user ID and password are currently valid, the bind is successful, and true is returned, otherwise the bind fails and false is returned.

        Steve, Denmark
        Last edited by numberwhun; Mar 11 '08, 11:33 PM. Reason: add code tags

        Comment

        • numberwhun
          Recognized Expert Moderator Specialist
          • May 2007
          • 3467

          #5
          Albeit the issue seems to be resolved, I believe that this should have been under the PHP forum as he was coding to do the authentication.

          Just my .02.

          Regards,

          Jeff

          Comment

          Working...