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


Using Logon Trigger to exclude SSMS connections


Using Logon Trigger to exclude SSMS connections

Author
Message
lbrady
lbrady
SSC Veteran
SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)

Group: General Forum Members
Points: 221 Visits: 184
Hi all,
Somehow, the application ID/PW became known to certain individuals within my organization. Someone ran a rogue query against the database via SSMS which brought down production! We cannot change the Application ID/PW because of the magnitude of such an effort.
I thought a logon trigger would take care of someone using the application ID to query the database.
I created the following
CREATE TRIGGER [Prevent_ApplicationID]
ON ALL SERVER
FOR LOGON
AS
BEGIN

IF ORIGINAL_LOGIN() = 'test' AND
(select count(*) FROM sys.sysprocesses
where spid = @@SPID
and (program_name like 'Microsoft SQL Server Management Studio%' or
program_name = 'SQL Query Analyzer'
or program_name = 'Toad for Data Analysts'
)) > 0
BEGIN
ROLLBACK;
END
END;

But it isn't working as expected. I can still access via SSMS and TOAD.
Any idea what is wrong with my trigger?

Thanks!
lbrady
lbrady
SSC Veteran
SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)SSC Veteran (221 reputation)

Group: General Forum Members
Points: 221 Visits: 184
Nevermind. I apologize for wasting people's time. If Mods see this, please delete.

I didn't search the forum thoroughly enough. Found my answer
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