Only allow certain IPs to connect

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Rangsk
Posts: 4
Joined: 2003-02-16 08:14
Contact:

Only allow certain IPs to connect

Post by Rangsk » 2003-02-16 08:18

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.

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2003-02-16 13:38

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
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Rangsk
Posts: 4
Joined: 2003-02-16 08:14
Contact:

Post by Rangsk » 2003-02-16 17:50

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.

Snooze
Posts: 119
Joined: 2003-01-26 13:42
Location: Denmark
Contact:

Post by Snooze » 2003-02-16 21:37

I have more than one script like that one my site ..;)

Rangsk
Posts: 4
Joined: 2003-02-16 08:14
Contact:

Post by Rangsk » 2003-02-16 22:24

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.

Phantom
Posts: 72
Joined: 2003-01-11 20:13
Location: New Zealand

script needed.

Post by Phantom » 2003-02-16 22:53

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

Rangsk
Posts: 4
Joined: 2003-02-16 08:14
Contact:

Post by Rangsk » 2003-02-16 22:58

Thanks so much, this was exactly what I was looking for.

Phantom
Posts: 72
Joined: 2003-01-11 20:13
Location: New Zealand

script

Post by Phantom » 2003-02-16 23:06

No problem, i've been using that for quite a while now :)

Xbiteâ„¢
Posts: 2
Joined: 2003-02-27 17:18
Location: Göteborg, Sweden
Contact:

Post by Xbiteâ„¢ » 2003-02-27 17:28

i can only see 1 prob with that, and that is that it disconnect people.

So i guess my script is better :wink:

well, depends :D :)
www.broadband.tk
[Broadbandâ„¢] Founder & Owner
[BBB] / [Sunet] ONLY Hub - xbite.no-ip.com

chrish4321
Posts: 5
Joined: 2003-03-02 01:50

IP Screening

Post by chrish4321 » 2003-03-02 02:17

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.

Locked