SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Server based Authentication MSSQL


Server based Authentication MSSQL

Author
Message
joythis
joythis
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 26
Hi,

Is there a way in MSSQL to authenticate a particular user and server to access a DB.

Like "ABC" user from "10.x.x.x" IP allowed to access "ABCDB"

Please guide me is there any other way to achieve this kind of restriction.

Thanks

Joythi S
ALZDBA
ALZDBA
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12061 Visits: 8923
If you want a user only to be used from a certain address, you should first create your UserId_to_IPAddress table and then use a logon trigger (you need at least SP2 !)

Be very careful with this kind of restrictions !

could be something like:

CREATE TRIGGER S_tr_DBA_ConnectionTracker
ON ALL SERVER
FOR LOGON
execute as owner -- check bol for these options !
AS
BEGIN
set nocount on
If NOT exists (
Select 1
from master.dbo.yourtable T
inner join sys.dm_exec_sessions ES
on ES.[session_id] = @@spid
-- and ES.[host_name] = T.[host_name]
-- and ES.[program_name] = T.[program_name]
-- and ES.[nt_domain] = T.[nt_domain]
-- and ES.[nt_user_name] = T.[nt_user_name]
and ES.[login_name] = T.[login_name]
-- and ES.[original_login_name] = T.[original_login_name]
inner join sys.dm_exec_connections EC
on EC.[session_id] = @@spid
and EC.[client_net_address] = T.[client_net_address] )

begin
Raiserror('SYSADMIN MESSAGE: Connection Not allowed (s) ',1,1,suser_sname()) with log;
rollback tran
end

END;



Johan


Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere w00t

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
joythis
joythis
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 26
Do we need to create the table for every DB. Please advise
K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (10K reputation)

Group: Moderators
Points: 10182 Visits: 1917
No. And keep in mind that this logon trigger is only going to fire when they first connect. Once they are in SQL Server, you can't prevent them from changing to a database they have access to.

K. Brian Kelley
@‌kbriankelley
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search