Wise monks,

I have a database application that has two levels of authentication: a standard Apache-based authentication to get into the site in the first place, based on IP addresses kept in httpd.conf and then on an htpasswd file if the IP doesn't work, and then an application-level login, based on checking against a database, saving user info (e.g. access levels) in a server-side session with one-hour expiration, and passing a random session ID in a cookie.

Most of my users do not have write/edit access to the database, just read access. They are also in specific corporate locations with fixed IP addresses. I have recently gotten complaints that it's a pain to have to log in all the time to use the database--this should, people think, be necessary only for people making changes.

What would be the best way to set up authentication on this basis? I'm imagining that anyone without a cookie then has their IP address via $ENV{REMOTE_ADDR} checked against a list, and setting a cookie with read-level permissions. Anyone needing a higher access level could go to a login page that will ignore the IP authentication when setting the cookie.

Is this sensible, and secure? Are there other modules or procedures that would be a better way of handling this? And is there any easy way to avoid duplicating the IP list between httpd.conf and the program? There are a number of different access levels stored in a database, it's not just a simple yes or no.

Thank you for any advice.


In reply to Mixing IP and password authentication by jest

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.