Sunday, March 11, 2012
Blocking sa user
I have a hypothetical scenario. I have few developers who all know the sa password. I want to block one developer from accessing the SQL server eventhough he knows the sa password.
Do we have any mechanism in SQL Server 2000 to block client based on the IP address of the client?
SQl Server is installed on Windows 2000 server. It uses SQL Server & Windows authentication.
Regards,
AnandChange the sa password|||Thanks for the reply.
I know that would be the best alternative :)
But currently I am not in a position to change it immediately.
Can you suggest something else
Regards,
Anand|||sa login is built-in login as well as assigned sysadmin fixed server role. You can change sa password, but if someone knows the password he/she can login the SQL Server.
Use mixed mode security or give separate SQL Login to the developers with the db_owner or db_ddladmin database role, according to your requirement.|||How about VPN, router settings, IP or MAC filtering?|||You can filter ports to keep an IP address from making any connection to a SQL Server database, but that's rather drastic for limiting a developer. There are solutions to this problem, but all of the ones that I can think of require intimate knowledge of the problem... I don't know of any generic answer to this kind of problem.
-PatP|||change the f'n sa password
sa shouldn't be used...some writers have even suggested creating a very strong password...write it down, put it in a safe and never use it..and create a new, "unknown" login that has sa rights|||change the f'n sa password
sa shouldn't be used...some writers have even suggested creating a very strong password...write it down, put it in a safe and never use it..and create a new, "unknown" login that has sa rights
Yep. First thing I do. Select newid() (on a different server). Copy and paste results into the install screen. Forget about it. Never use sa for anything.
Regards,
hmscott|||Yep. First thing I do. Select newid() (on a different server). Copy and paste results into the install screen. Forget about it. Never use sa for anything.
Regards,
hmscott
Humm... really unique password..! :rolleyes:
Sunday, February 19, 2012
Blank password works for user account - all other passwords don't!
Hi Group (and thanks for any help given):
I am new to SQL 2005 and have an issue with passwords. I set the password on a user account and tried to access my program (Time Matters.) I received an error message that the application was unable to connect to the system database. When I set the password to blank (no password), the application was able to connect to the SQL db and everything worked just fine.
I've tried several different passwords. Any password besides blank does not work. Blank always does. Obviously I don't want to use a blank password. But where in SQL Server is the setting or could a copy of the original password be "stuck"?
Thanks for your help.
Jeff
Hi,
if you are running on a WIndows 2003 Server you might have the password policy enabled. You can disabled that by navigating to the appropiate user in the Managment Studio and disable the Enforce password policy checkox. YOu can also disable that at server level (not if it is overwritten by a domain policy). Open the group policy snapin for this and navigate to the security option for the password policy.
Which error (number are you getting) ?
HTH, jens Suessmeyer.
http://www.sqlserver2005.de
|||what client application are you using to connect. is it the management studio|||Thanks for the reply.
It is a Windows 2003 Server and on one of my two users I can turn off the Enforce password policy checkbox (I still cannot connect with any password but a blank one, however.) On the other user, I get the error message 15128 (The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON.)
Due to security concerns on the server, I cannot turn off the Password Policy enabled setting on the Windows 2003 Server itself.
Any ideas?
Thanks,
Jeff
|||Yes, I am using the MS SQL Server Management Studio. The application I am trying to connect to its MS SQL Server databases is Time Matters. It creates two different database schemas in SQL Server (one for the "real" database, one for the "training" database.) For each of the databases, it creates a login that is used for workstations to exchange data with SQL Server.
Both logins will only work when the passwords are blank. Both worked earlier, before the server was physically moved (and, I think, some other, security-based changes were made.) It seems like a blank password is equivalent to not having the password checked, but any password entered is verified against some earlier password and deemed as out-of-date, and therefore access is denied.
(By the way, I have set the password(s) back to every password that has ever been used--the only one that works is a blank password.
Thanks for any advice.
Jeff
|||If "Must Change" is checked, the user has to change the password before they can log in successfully.
If you are enforcing the domain's password policy, any domain password complexity policy (repeated characters, presence of special characters, etc.) must be met as well. Make sure the passwords are sufficiently complex.
Have you tried creating a long, complex password for the login (e.g. "SqlS3rVr{pw") and unchecking the Must Change check box in the login dialog?
Thanks,
Steve
Hello...
I had similar problems. My solution: (i write this while i am actually doing it. the values do work on a standard windows 2003 server, fully updated)
Steps:
create an account: TestMe,
select SQL server authentication, (notice that "enforce", "expiration" and "must change" get enabled.)
Type the password: anypassword (euhm... yep do that twice :-) otherwise...)
deselect: [ ] User must change the password at next logon
close/save the user by clicking OK
open it again (notice that must change is greyed out)
deselect the remaining two options and your done. save and reopen: You can set the password to any you like.
I haven't had no time to test what exactly happens when you turn back on the "enforce password policy" but it would not surprise me if the domain policy is taking over. When using the SQL server authentication it is possible to "bypass" the domain security policy.
Blank password works for user account - all other passwords don't!
Hi Group (and thanks for any help given):
I am new to SQL 2005 and have an issue with passwords. I set the password on a user account and tried to access my program (Time Matters.) I received an error message that the application was unable to connect to the system database. When I set the password to blank (no password), the application was able to connect to the SQL db and everything worked just fine.
I've tried several different passwords. Any password besides blank does not work. Blank always does. Obviously I don't want to use a blank password. But where in SQL Server is the setting or could a copy of the original password be "stuck"?
Thanks for your help.
Jeff
Hi,
if you are running on a WIndows 2003 Server you might have the password policy enabled. You can disabled that by navigating to the appropiate user in the Managment Studio and disable the Enforce password policy checkox. YOu can also disable that at server level (not if it is overwritten by a domain policy). Open the group policy snapin for this and navigate to the security option for the password policy.
Which error (number are you getting) ?
HTH, jens Suessmeyer.
http://www.sqlserver2005.de
|||what client application are you using to connect. is it the management studio|||Thanks for the reply.
It is a Windows 2003 Server and on one of my two users I can turn off the Enforce password policy checkbox (I still cannot connect with any password but a blank one, however.) On the other user, I get the error message 15128 (The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON.)
Due to security concerns on the server, I cannot turn off the Password Policy enabled setting on the Windows 2003 Server itself.
Any ideas?
Thanks,
Jeff
|||Yes, I am using the MS SQL Server Management Studio. The application I am trying to connect to its MS SQL Server databases is Time Matters. It creates two different database schemas in SQL Server (one for the "real" database, one for the "training" database.) For each of the databases, it creates a login that is used for workstations to exchange data with SQL Server.
Both logins will only work when the passwords are blank. Both worked earlier, before the server was physically moved (and, I think, some other, security-based changes were made.) It seems like a blank password is equivalent to not having the password checked, but any password entered is verified against some earlier password and deemed as out-of-date, and therefore access is denied.
(By the way, I have set the password(s) back to every password that has ever been used--the only one that works is a blank password.
Thanks for any advice.
Jeff
|||If "Must Change" is checked, the user has to change the password before they can log in successfully.
If you are enforcing the domain's password policy, any domain password complexity policy (repeated characters, presence of special characters, etc.) must be met as well. Make sure the passwords are sufficiently complex.
Have you tried creating a long, complex password for the login (e.g. "SqlS3rVr{pw") and unchecking the Must Change check box in the login dialog?
Thanks,
Steve
Hello...
I had similar problems. My solution: (i write this while i am actually doing it. the values do work on a standard windows 2003 server, fully updated)
Steps:
create an account: TestMe,
select SQL server authentication, (notice that "enforce", "expiration" and "must change" get enabled.)
Type the password: anypassword (euhm... yep do that twice :-) otherwise...)
deselect: [ ] User must change the password at next logon
close/save the user by clicking OK
open it again (notice that must change is greyed out)
deselect the remaining two options and your done. save and reopen: You can set the password to any you like.
I haven't had no time to test what exactly happens when you turn back on the "enforce password policy" but it would not surprise me if the domain policy is taking over. When using the SQL server authentication it is possible to "bypass" the domain security policy.
Blank Password Policy problem
We recently started to receive complaints about our install project not
working and giving and shitload of error messages related to SQL. We
later found out that the problem was the users we were trying to bind
to we're not created because of the domain password policy feature
implemented into SQL Server 2005.
After much dabbling around the SQL scripts that created the database
structure, we came to the conclusion that only this piece of code could
correct our problem :
CREATE LOGIN mynewuser WITH PASSWORD = '', CHECK_POLICY = OFF,
CHECK_EXPIRATION = OFF
This runs perfectly fine on SQL2005, but not on SQL2000. We have been
searching for a way to have code in SQL files executed on install that
doesn't fail to compile when run against the server and that will
bypass the password policy in case it's a SQL Server 2005...
Right now we are testing a feature available in MSI that can filter
scripts not matching a database version, but the problem with this, is
that we are missing a lot of features that InstallShield has. In short,
we need Help to fix this issue and be able to continue with
development.
In hopes to receive a a prompt anwserOh and by the way, the SQL2000 code we use is the following:
exec sp_addlogin N'mynewuser', null, @.logindb, @.loginlang
PS : @.logindb and @.loginlang are valid variables that contain correct
info for this SP to work|||crazyone wrote:
Quote:
Originally Posted by
Oh and by the way, the SQL2000 code we use is the following:
>
exec sp_addlogin N'mynewuser', null, @.logindb, @.loginlang
>
PS : @.logindb and @.loginlang are valid variables that contain correct
info for this SP to work
Why not just set a sensible password to start with? The same password
for each login if you like (anything must be better than a blank
password). Have you ever had a security audit?
Otherwise I think having two versions of your code may be your only
option.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--|||My boss produced the code linking to the database with THAT user, it's
a read-only user but doesn't have password. I don't feel it's safe too,
but my boss doesn't want to recode the app to change the password, but
he does want me to spend (up to now) 20 hours to remake the install
software and the sql scripts... strange no?
Blank password from command line installation
If you install SQL Express to use Windows Authentication (the deafult) you don't need to supply an SAPWD. (In fact the SA account is disabled in this case for SQL Express.) If you are installing using SQL Authentication you need to supply a strong password, I don't know of a way around this.
I can't think of any reason that I would ever let the SA user have a blank password. You might as well just send hackers a key to you house, the dates of your next vacation and a note telling them to have a good time while you're away. Security is provided for very good reasons, you should not try to defeat it in this way.
Regards,
Mike Wachal
SQL Express team
Blank password check
Is there any way to check whether the password for existing sql authentication login is blank? (except trying to connect)
Where can I find information about how the passwords are stored internally in SQL Server?which version r u talking about. if its 2005 you can do that i believe.
credentials are stored in sysxlogins system table
Madhu
|||Only hashes are stored, you won′t find them in clear text. For SQL Server 2005 use password policies to ensure a certain password complexity.Jens K. Suessmeyer:
http://www.sqlserver2005.de
Oh, actually it seems to be fairly simple,
I just call ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N'' and if it succeed -- login myLogin has a blank password. Or am I missing something?
|||sir..... you are resetting the password to null. it will change the password, it will not tell u whether its blank or not. But it will make the password blank evenif its not blank. Not atall the correct method
Madhu
|||No, trying to change the password seems to be a bit offensive :-)I wrote this short code snippet for you, tell me if it works for you, it scans all reachable /discoverable servers and test all SQL Server logins:
Code Snippet
foreach (DataRow dr in SmoApplication.EnumAvailableSqlServers().Rows)
{
Server srv = new Server(dr["Name"].ToString());
foreach (Login l in srv.Logins)
{
if (l.LoginType == LoginType.SqlLogin)
{
SqlConnection conn = new SqlConnection(string.Format("Data Source={0};Initial Catalog=master;User Id={1},Password={2}",
srv.InstanceName,
l.Name,
string.Empty));
try
{
conn.Open();
Console.WriteLine(string.Format("The userid {0} has an empty password.", l.Name));
}
catch (SqlException ex)
{ }
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
}
}
Jens K. Suessmeyer
http://www.sqlserver2005.de
|||Thanks Jens,
the way you suggest works fine I think.
|||Madhu,
I cannot agree with you.
See the following script:
Code Snippet
CREATE LOGIN myLogin WITH PASSWORD = N'IT IS NOT A BLANK PASSWORD!', CHECK_POLICY = OFF
BEGIN TRY
-- this statement will FAIL because we specified invalid old (current) password
ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N''
END TRY
BEGIN CATCH
PRINT 'Password is NOT blank!'
END CATCH
-- this statement will actually change the password
ALTER LOGIN myLogin WITH PASSWORD = N''
PRINT '//Password was changed to blank//'
-- so now password is blank
BEGIN TRY
-- this statement will SUCCEED because we specified right old (current) password
ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N''
-- but actually nothing will happen because new password is the same as old one.
PRINT 'Password is BLANK!'
END TRY
BEGIN CATCH
END CATCH
DROP LOGIN myLogin
The idea is that ALTER LOGIN fails when called with OLD_PASSWORD option and invalid old (current) password given.
I think that it is even more effective way to check than trying to logon on server with <loginName, blankPassword> credentials.Blank password check
Is there any way to check whether the password for existing sql authentication login is blank? (except trying to connect)
Where can I find information about how the passwords are stored internally in SQL Server?which version r u talking about. if its 2005 you can do that i believe.
credentials are stored in sysxlogins system table
Madhu
|||Only hashes are stored, you won′t find them in clear text. For SQL Server 2005 use password policies to ensure a certain password complexity.Jens K. Suessmeyer:
http://www.sqlserver2005.de
Oh, actually it seems to be fairly simple,
I just call ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N'' and if it succeed -- login myLogin has a blank password. Or am I missing something?
|||sir..... you are resetting the password to null. it will change the password, it will not tell u whether its blank or not. But it will make the password blank evenif its not blank. Not atall the correct method
Madhu
|||No, trying to change the password seems to be a bit offensive :-)I wrote this short code snippet for you, tell me if it works for you, it scans all reachable /discoverable servers and test all SQL Server logins:
Code Snippet
foreach (DataRow dr in SmoApplication.EnumAvailableSqlServers().Rows)
{
Server srv = new Server(dr["Name"].ToString());
foreach (Login l in srv.Logins)
{
if (l.LoginType == LoginType.SqlLogin)
{
SqlConnection conn = new SqlConnection(string.Format("Data Source={0};Initial Catalog=master;User Id={1},Password={2}",
srv.InstanceName,
l.Name,
string.Empty));
try
{
conn.Open();
Console.WriteLine(string.Format("The userid {0} has an empty password.", l.Name));
}
catch (SqlException ex)
{ }
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
}
}
Jens K. Suessmeyer
http://www.sqlserver2005.de
|||Thanks Jens,
the way you suggest works fine I think.
|||Madhu,
I cannot agree with you.
See the following script:
Code Snippet
CREATE LOGIN myLogin WITH PASSWORD = N'IT IS NOT A BLANK PASSWORD!', CHECK_POLICY = OFF
BEGIN TRY
-- this statement will FAIL because we specified invalid old (current) password
ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N''
END TRY
BEGIN CATCH
PRINT 'Password is NOT blank!'
END CATCH
-- this statement will actually change the password
ALTER LOGIN myLogin WITH PASSWORD = N''
PRINT '//Password was changed to blank//'
-- so now password is blank
BEGIN TRY
-- this statement will SUCCEED because we specified right old (current) password
ALTER LOGIN myLogin WITH PASSWORD = N'' OLD_PASSWORD = N''
-- but actually nothing will happen because new password is the same as old one.
PRINT 'Password is BLANK!'
END TRY
BEGIN CATCH
END CATCH
DROP LOGIN myLogin
The idea is that ALTER LOGIN fails when called with OLD_PASSWORD option and invalid old (current) password given.
I think that it is even more effective way to check than trying to logon on server with <loginName, blankPassword> credentials.Blank password
doing a simple SELECT on syslogins.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Chris" <anonymous@.discussions.microsoft.com> wrote in message
news:C96827A2-4545-4D53-9CF6-6BEAAC55319F@.microsoft.com...
> Is this possible to know if there some blank password in my users.|||Hi,
The query will be,
select name from syslogins where password is null
Thanks
Hari
MCDBA
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OwAdMhdDEHA.684@.tk2msftngp13.phx.gbl...
> By blank I assume you mean no password. Yes, you can actually check this
by
> doing a simple SELECT on syslogins.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Chris" <anonymous@.discussions.microsoft.com> wrote in message
> news:C96827A2-4545-4D53-9CF6-6BEAAC55319F@.microsoft.com...
>