Sql-server – Deny a Sql Server user from a specific hostname

authenticationsql serversql server 2014sql-server-2016

Is it possible to block a sql server user not to execute DDL and DML operations from a specific hostname (client)?

I have a CRM web application. That app connects to my database with a sql server auth user. There are several different developers working on that CRM web app. They know the user name and password from the web config file they develop. Some of them can connect to my database with that user and execute some DDL and DML commands and I want to block them by their client hostname. If a developer connects to db from his/her machine with the app user credential, I want to block them.

Best Answer

And, there several different developers which developes that CRM web app. They know the user name and password from the web config file they develope. Some of them can connect to my database with that user and execute some DDL and DML commands. And i want to block them by their client hostname. If a developer connects to db from his/her machine with the user credential, i want to block them.

I don't think you should try to fix it that way.

Both pc names and IPs can be changed at will, even static IPs could be changed if wanted/needed. Which means you'd have to maintain an up-to-date list all the time.
As a dev, if you really wanted to do something, remote to another VM, execute there.
I mean, there's probably plenty of security loopholes they can find if they really wanted to do something.

Finding a solution to do what you want, would probably only make it a hassle for them, but not fool proof.

I think you'd be better off trying to find a security solution for this. If one of the devs should not be able to do DML statements, don't give them a login that has access to it. Does the user in the config really need all the permissions it has now? Perhaps you can give less permissions to that user, and give the people who need more permissions an extra role, on their own login.