lighttpd, mod_auth, subdomain

Discussion in 'Installation/Configuration' started by TheRudy, May 23, 2008.

  1. TheRudy

    TheRudy Member

    I have a little problem actually i'm stuck really :)

    I've set up a user1/password (digest) for main domain. It works just fine!
    Then i've set up another user2/password (same password, different user) and set it for subdomain. Result, login doesn't work. The realm is set correctly for user2 login window.

    If i change on subdomain user2 to user1, the login works.

    Both lines for user/realm/password are in each own lines (2 lines). It appears that only 1st one is read.

    I've read everything 10 times in lighttpd docs (not much to read to be honest), browsed their forums (not much help there either) and google doesn't produce anything useful.

    Code that creates user/realm/password hash
    Code:
    #!/bin/sh
    user=$1
    realm=$2
    pass=$3
    
    hash=`echo -n "$user:$realm:$pass" | md5sum | cut -b -32`
    
    echo "$user:$realm:$hash"
    htdigest file:
    Code:
    user1:test1111:MD5HASH
    user2:test2222:MD5HASH
    
    lighttpd auth conf:
    Code:
    $HTTP["host"] =~ "^subdomain.domain.com$" {
            server.document-root = "/home/phpma/public_html"
            server.errorlog = "/home/phpma/logs/error.log"
            accesslog.filename = "/home/phpma/logs/access.log"
    
            # THIS ONE DOESN'T WORK!!
            auth.require = ( "" => (
                       "method"  => "digest",
                       "realm"   => "test2222",
                       "require" => "user=user2"
                       )
            )
          
            # IF I USE THIS ONE, IT WORKS
            #auth.require = ( "" => (
            #          "method"  => "digest",
            #          "realm"   => "test1111",
            #         "require" => "user=user1"
            #          )
            #)
    }
    
    I've tried everything i managed to google but nothing works :mad:

    Anyone has any ideas?
     
    Last edited: May 23, 2008
  2. falko

    falko Super Moderator Howtoforge Staff

    If you change the order of the lines in htdigest (i.e., make the first line for user2), then user2 can log in, and user1 cannot?
     
  3. TheRudy

    TheRudy Member

    Don't know why as i haven't changed anything but when i tried what you suggested it started working..

    Now i changed the user order back to original and its still working.
    Oh well..
     

Share This Page