Only allow certain IPs to connect
Moderator: Moderators
Only allow certain IPs to connect
I'm new to DC++ and I'm trying to set up a hub for use at my university. However, I want to restrict connections to only people in a certain IP range (those being the ones at my university) and I can't figure out how to do this. Any help would be appreciated.
-
- Posts: 506
- Joined: 2003-01-03 07:33
it can be done in varius ways.
1) incomming connections in a firewall router etc.. where you only allow
certain ip-ranges to connect
2) Most hubs also allow you to put up ip-ranges with or without the help of script..
so to be able to help you more, which dchub-software do you use? do you have a firewall and or a router etc?
there-is-more-ways-than-this-but-this-might-help-you-some-ly'ers
1) incomming connections in a firewall router etc.. where you only allow
certain ip-ranges to connect
2) Most hubs also allow you to put up ip-ranges with or without the help of script..
so to be able to help you more, which dchub-software do you use? do you have a firewall and or a router etc?
there-is-more-ways-than-this-but-this-might-help-you-some-ly'ers
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.
I do not have a firewall or router installed, and I don't really like that option.
As for the software I currently use... I don't. If you know of one that allows this without scripting, I'm willing to try it. So far I'v downloaded the Direct Connect hub software and PtokaX .324 IceCube.
Thanks for the help.
As for the software I currently use... I don't. If you know of one that allows this without scripting, I'm willing to try it. So far I'v downloaded the Direct Connect hub software and PtokaX .324 IceCube.
Thanks for the help.
Snooze, thanks for the link, but I'm having trouble finding any scripts that would do what I need. I see a few scripts that BAN a range of IPs, but I want to only allow a range of IPs.. i.e. ban all ranges that AREN'T blah.blah.*.* Could you link me to a specific one that can do that? Thanks a bunch.
script needed.
Hi, I've got just the script you need. At the moment its written for New Zealand Ip's but give this a go. I hope we are allowed to post things like this, so here goes: (I removed some oAllow("202.1.*") = "NZ"'s but you get the picture)
'IP-AllowNZ.script
Dim sBotName
Dim oAllow
Dim sRejectMessage
Sub Main()
Set oAllow = CreateObject("Scripting.Dictionary")
'Set these basic parameters
sBotName = "IPBotNZ" ' <- name of the bot
'The message to send to denied clients
sRejectMessage = "Sorry, no connections are allowed to those outside of New Zealand. If this is in error please contact Phantom"
'Add new entries for each ip number or subnet you want to allow.
'Here are some examples of the syntax; the "descriptions" can be
'anything, except for an empty string. Remove the examples when
'you add your own.
oAllow("192.168.*") = "local"
oAllow("127.0.*") = "local"
oAllow("202.0.*") = "NZ"
oAllow("202.1.*") = "NZ"
oAllow("202.2.*") = "NZ"
oAllow("202.3.*") = "NZ"
oAllow("202.4.*") = "NZ"
End Sub
Sub NewUserConnected(curUser)
Dim sIPfull
Dim sIPc, sIPb, sIPa
sIPfull = curUser.IP()
sIPc = Left(sIPfull, InStrRev(sIPfull, ".") - 1)
sIPb = Left(sIPc, InStrRev(sIPc, ".") - 1)
sIPa = Left(sIPb, InStrRev(sIPb, ".") - 1)
sIPa = sIPa & ".*"
sIPb = sIPb & ".*"
sIPc = sIPc & ".*"
If Not (curUser.bOperator Or oAllow.Exists(sIPfull) Or _
oAllow.Exists(sIPc) Or oAllow.Exists(sIPb) Or _
oAllow.Exists(sIPa)) Then
curUser.PrivateMessage CStr(sBotName), CStr(sRejectMessage)
frmHub.DoEventsForMe
curUser.Disconnect
End If
End Sub
'IP-AllowNZ.script
Dim sBotName
Dim oAllow
Dim sRejectMessage
Sub Main()
Set oAllow = CreateObject("Scripting.Dictionary")
'Set these basic parameters
sBotName = "IPBotNZ" ' <- name of the bot
'The message to send to denied clients
sRejectMessage = "Sorry, no connections are allowed to those outside of New Zealand. If this is in error please contact Phantom"
'Add new entries for each ip number or subnet you want to allow.
'Here are some examples of the syntax; the "descriptions" can be
'anything, except for an empty string. Remove the examples when
'you add your own.
oAllow("192.168.*") = "local"
oAllow("127.0.*") = "local"
oAllow("202.0.*") = "NZ"
oAllow("202.1.*") = "NZ"
oAllow("202.2.*") = "NZ"
oAllow("202.3.*") = "NZ"
oAllow("202.4.*") = "NZ"
End Sub
Sub NewUserConnected(curUser)
Dim sIPfull
Dim sIPc, sIPb, sIPa
sIPfull = curUser.IP()
sIPc = Left(sIPfull, InStrRev(sIPfull, ".") - 1)
sIPb = Left(sIPc, InStrRev(sIPc, ".") - 1)
sIPa = Left(sIPb, InStrRev(sIPb, ".") - 1)
sIPa = sIPa & ".*"
sIPb = sIPb & ".*"
sIPc = sIPc & ".*"
If Not (curUser.bOperator Or oAllow.Exists(sIPfull) Or _
oAllow.Exists(sIPc) Or oAllow.Exists(sIPb) Or _
oAllow.Exists(sIPa)) Then
curUser.PrivateMessage CStr(sBotName), CStr(sRejectMessage)
frmHub.DoEventsForMe
curUser.Disconnect
End If
End Sub
-
- Posts: 5
- Joined: 2003-03-02 01:50
IP Screening
I have the exact same situation in running my hub. For the NMDC hub, a nice script I found is called "IPBot," which you can search for. The source is basically exactly the same as that of the "New Zealand" script mentioned above, but for _both_ of these scripts, please beware of one pitfall: the NMDC hub calls "NewUserConnected" only when an unregistered user connects, and otherwise calls "OpConnected", even if the connecting user is simply a non-op but registered user. This means that (a) registered users from outside of you school can connect, e.g. from home, possibly angering your network admins, and (b) people from off campus can guess or steal registered user passwords and attempt to get into your hub.
To avoid this, make sure that the screening code is called when either "NewUserConnected" or "OpConnected" is called. If you want your ops, but not your registered users to be abel to connect from off campus, you'll need to check that the user is an op manually, by calling curUser.bOperator within the OpConnected method. Good luck.
To avoid this, make sure that the screening code is called when either "NewUserConnected" or "OpConnected" is called. If you want your ops, but not your registered users to be abel to connect from off campus, you'll need to check that the user is an op manually, by calling curUser.bOperator within the OpConnected method. Good luck.