The Case for SQL Logins - Part 1

  • x

    Edited by - marten_brege on 06/24/2002 12:18:05 AM

  • You got it right, even Microsoft push for this approach on ASP.NET. One SQL account, hidden for the user, for doing the job, and a table of users maintained by your application. By preference use the same usernames as in the domain. In this way you can use role based security, maintained by the domain. This is the approach in the ASP.NET, but it could easily be extended for other client / server applications.

  • While I agree completely with your comments about Windows authentication, I don't believe they go far enough.

    Sql Server comes in many flavours, one of which is a Desktop version. I believe the very existence of this version of the product strongly implies that Microsoft expects, even encourages, us to develop bespoke databases for clients (and of course, the existence of the MSDE engine supports this inference).

    In such an environment, I can expect to provide a tailored solution to one or more clients. Such a solution may involve software (programming), hardware (machines) and data (stored in databases <g>). The client may elect to allow a number of users some type of access to all or some of the data - including a mobile access requirement (e.g. for a travelling salesman to work on his numbers at night in his hotel room). Now, in order to meet this type of requirement, the client can make available a copy of the database to run under the Desktop version of Sql Server.

    As the designer and implementor, I can impose whatever security my client desires. Perhaps his salesmen are to be denied access to one or more tables. But once the database has been copied to the salesman's machine, all existing Sql Server security has just gone out the window. Removing the BUILTIN/Administrators works only on the database machine on which you remove that login. By copying such a database to another machine, anyone who has administrative NT rights on that second machine instantly has unfettered access to the copied database (I've tested this by creating a test database and removing all access; as soon as I copied the database to another machine, all read/write access was restored).

    Even humble old Microsoft Access does better than this with its user security. The problem lies in where Sql Server chooses to store its security information - i.e. not in the target database.

    I have discussed this issue with various Microsoft technical people - once they understand the problem, they simply trot out the usual trite remarks about "there's no security without physical security". Even most of the Sql gurus don't seem to realize just how fatally flawed Sql Server is in this respect - I guess they're not really thinking of Sql Server being used in this way.

    Imagine the howls of protest (and even the derision and laughter) that would ensue if Microsoft were to announce that anyone with NT administrative rights on _any_ machine would _automatically_ have similar rights over _all_ other NT machines!

    --------

    Paul Thornett

  • Well it's good to keep this topic under discussion. I agree that WA dosnt do anything for internet sites where there is a problem that has to be addressed.

    However i use WA and application roles for all my intranet and internal apps because it allows me to switch people on and off easily, but dosnt give them any access to the database, apart from views & spocs that i explicitly give them. If an employee leaves he cannot even get onto the network and cannot connect to the database so knowledge of the app role password is not an issue after he has left.

    App Roles are essential to controlling access to rows and columns, which (unless i've missed something) cant be done in SQL Server 7.

    The problems with app roles are;

    1. you have to store the role name & password somewhere. This can be dealt with as suggested in the article.

    2. third party tools and components such as crystal reports dont support app roles - which is a serious drawback imo.

    One ommision that i would like to see a solution to is being able to see the sum total of access that a user has via the various roles etc. E.g. User W has read permission on table X through role Y and role Z

  • Excellent article. We use SQL to back end intranet and web applications and NT security is pretty much useless for what we need.

    Unless the operator somehow figures out how to set up an ODBC, work out the connection and the password, they can't access the data. If anyone needs data, it can always be extracted to a spreadsheet, or they can have a view designed for them


    ---------------------------------------
    It is by caffeine alone I set my mind in motion.
    It is by the Beans of Java that thoughts acquire speed,
    the hands acquire shaking, the shaking becomes a warning.
    It is by caffeine alone I set my mind in motion.

  • Thanks, very good article, makes me rethink about WA security (how safe is safe!!!!)

  • We tend to use WA because we also use groups to control software installation. The fact is, if you're using WA everywhere else, why change it. WA plus app roles provides enough control for us. Also, what about the transaction log? How do you know who's performing which transactions if you use a "service id"?

  • WA or mixed is as good as DBA is.

    The are lot of pro's and con's with each approach and no universal recommendation can be made. I assume that account lockout is excellent feature on sites which are often target to some attacks. In bookkeeping software is this feature unpleasant. You decide what is best in your deployment scenario and you have to try to guard the server whatever the security mode is.

    We use WA as much as possible, but my issue is that SAP R/3 package does not support WA, so we have non-WA island in sea of WA, which makes me much more nervous because different support procedures, hotline etc.

  • I do not agree with this article, The way you get access to a SERVER is completely different with permissions INSIDE a datbase.

    I did't hear the word Application role at all. And this is something microsoft recommends. Give a user access to a database ( Windows user or SQL USER ) is nonsense..... Should be done with an approle......

  • A thought provoking article. I think a mix of using windows authentication and SQL logins works best. Dependence on one or the other is limited to need. When windows authentication is needed we use it. When SQL logins is the only thing that works then we use it.

    Robert Marda

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

  • Please keep posting your comments. Especially the negatives! I'll try to address as many as I can in the follow up article.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Hi, what about wa in iis and have a sql user for connection from iis to the database. For vb or access applications we usualy make one sql login the different security per user is maintained in the application. We have also one bad example where every user has his own sql login this does not work because those sql logins are difficult to maintain.

    Klaas-Jan

  • Good points by many - I agree with well0539 that authentication (connecting) and authorization (using) are two different issues, and protecting access to resources (authorization) is a matter of assigning appropriate permissions to roles, app_roles, or users, and not a matter of how users connect at all.

    The point about desktop editions of SQL and local "sales-force" access to databases is also a good one. However, if you were that concerned about the data that the sales guys see, then use filter-replication to restrict what their local database actually gets.

    As far as ASP.NET development - by default web services use an account called ASP_NET for WA access to a SQL server. So using a SQL Login for ASP.NET development is not a requirement.

    I have not found an environment yet that would support a WA-only approach. Neither would I want a SQL Login-only approach either.

    Mike

Viewing 15 posts - 1 through 15 (of 75 total)

You must be logged in to reply to this topic. Login to reply