Tuesday, March 14, 2017

Restrict user by ip address in sybase

SQL
Maybe usefull to use to restrict users by ip address
create group restrictedusergroup
go
create proc restrictuser as
declare @ip char(15)
select @ip = ipaddr from master..sysprocesses where spid = @@spid
if @ip in ('10.160.43.46','10.160.43.45', and so on)
begin
select syb_quit()
end
go
sp_modifylogin dbo_db,'dbo_db',restrictuser
go
grant execute on restrictuser to restrictedusergroup
go
I guess this would have to be set for all the logins that we want to restrict the
ipaddress too.
Execute sp_modifylogin

No comments:

Post a Comment