SnapOverflow

SnapOverflow Logo SnapOverflow Logo

SnapOverflow Navigation

  • Home
  • Server
  • Ubuntu

Mobile menu

Close
  • Home
  • System Administrators
    • Hot Questions
    • New Questions
    • Tags
  • Ubuntu
    • Hot Questions
    • New Questions
    • Tags
  • Help
Home / server / Questions / 404149
Accepted
petRUShka
petRUShka
Asked: 2012-07-03 10:03:48 +0800 CST2012-07-03 10:03:48 +0800 CST 2012-07-03 10:03:48 +0800 CST

How can I disable Kerberos authentication for only the root of my site?

  • 772

I have Kerberos-based authentication and I want to disable it on only root url: http://mysite.com/. And I want it to continue to work fine on any other page like http://mysite.com/page1.

I have such things in my .htaccess:

AuthType Kerberos
AuthName "Domain login"
KrbAuthRealms DOMAIN.COM
KrbMethodK5Passwd on
Krb5KeyTab /etc/httpd/httpd.keytab
require valid-user

I want to turn it off only for root URL. As workaround it is possible to turn off using .htaccess in virtual host config. Unfortunately I don't know how to do it.

Part of my vhost.conf:

    <Directory /home/user/www/current/public/>
            Options -MultiViews +FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

UPD. I'm using Apache/2.2.3 (Linux/SUSE)

I tried to use such version of .htaccess:

SetEnvIf Request_URI ^/$ rootdir=1
Allow from env=rootdir
Satisfy Any
AuthType Kerberos
AuthName "Domain login"
KrbAuthRealms DOMAIN.COM
KrbMethodK5Passwd on
Krb5KeyTab /etc/httpd/httpd.keytab
require valid-user

Unfortunately such config turn Kerberos AuthType for all URLs. I tried to place first 3 lines

SetEnvIf Request_URI ^/$ rootdir=1
Allow from env=rootdir
Satisfy Any

after main block, but it didn't help me.

apache-2.2 url authentication kerberos authorization
  • 3 3 Answers
  • 6820 Views

3 Answers

  • Voted
  1. Best Answer
    petRUShka
    2012-07-06T00:46:45+08:002012-07-06T00:46:45+08:00

    I moved mod_auth_kerb configuration to vhost.conf. And used Location directive to turn off authorisation on some URLs.

        # root_url
        <LocationMatch "(^\/$|^$)">
                Satisfy Any
        </LocationMatch>
        <Location /incidents/last>
                Satisfy Any
        </Location>
    
        <Directory /home/user/www/>
                Options -MultiViews +FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
                AuthType Kerberos
                AuthName "Domain login"
                KrbAuthRealms DOMAIN.COM
                KrbMethodK5Passwd On
                Krb5KeyTab /etc/httpd/httpd.keytab
                require valid-user
        </Directory>
    

    That solved my problem.

    • 2
  2. Ladadadada
    2012-07-04T01:32:26+08:002012-07-04T01:32:26+08:00

    How you do this will depend on whether you are using Apache 2.2 or Apache 2.4. I haven't actually tested these so it's entirely possible that it won't work at all or may need some tweaking.

    For 2.2 we can use SetEnvIf to set a variable if they are requesting / and use Allow from and Satisfy any to control access. All of your existing config should stay as it is:

    SetEnvIf Request_URI ^/$ rootdir=1
    Allow from env=rootdir
    Satisfy Any
    

    With 2.4 there are changes to authentication and authorisation. We now have a set of <Require> blocks which you can wrap around any access control to fine-tune authorisation:

    SetEnvIf Request_URI ^/$ rootdir=1
    
    <RequireAny>
      AuthType Kerberos
      AuthName "Domain login"
      KrbAuthRealms DOMAIN.COM
      KrbMethodK5Passwd on
      Krb5KeyTab /etc/httpd/httpd.keytab
      Require valid-user
      Require env rootdir=1
    </RequireAny>
    

    The <RequireAny> block means that any one of the Require directives must match for authorisation to succeed. There are also <RequireAll> and <RequireNone> blocks.

    • 0
  3. Amit Singh
    2012-07-03T12:08:33+08:002012-07-03T12:08:33+08:00

    Try AllowOverride None It will disable the .htacess

    • -1

Sidebar

Stats

  • Questions 681609
  • Answers 979841
  • Best Answers 279908
  • Users 287144
  • Popular
  • Answers
  • Marko Smith

    Can you pass user/pass for HTTP Basic Authentication in URL parameters?

    • 5 Answers
  • Marko Smith

    Ping a Specific Port

    • 18 Answers
  • Marko Smith

    Check if port is open or closed on a Linux server?

    • 7 Answers
  • Marko Smith

    How to automate SSH login with password?

    • 10 Answers
  • Marko Smith

    How do I tell Git for Windows where to find my private RSA key?

    • 30 Answers
  • Marko Smith

    What's the default superuser username/password for postgres after a new install?

    • 5 Answers
  • Marko Smith

    What port does SFTP use?

    • 6 Answers
  • Marko Smith

    Command line to list users in a Windows Active Directory group?

    • 9 Answers
  • Marko Smith

    What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?

    • 3 Answers
  • Marko Smith

    How to determine if a bash variable is empty?

    • 15 Answers
  • Martin Hope
    Davie Ping a Specific Port 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    Smudge Our security auditor is an idiot. How do I give him the information he wants? 2011-07-23 14:44:34 +0800 CST
  • Martin Hope
    kernel Can scp copy directories recursively? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh returns "Bad owner or permissions on ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil How to automate SSH login with password? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin How do I deal with a compromised server? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner How can I sort du -h output by size 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent How to determine if a bash variable is empty? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus How do you find what process is holding a file open in Windows? 2009-05-01 16:47:16 +0800 CST

Related Questions

Trending Tags

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Home
  • Questions
    • Hot Questions
    • New Questions
  • Tags
  • Help

Footer

SnapOverflow

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Help

© 2022 SOF-TR. All Rights Reserve