Refusing incoming connection based on IP (ACL)

13 views
Skip to first unread message

Knodi

unread,
Feb 1, 2012, 2:15:44 PM2/1/12
to EventMachine
Is a way I can get EventMachine to refuse incoming connection? For ACL
use, ACL based on IP address.

Iñaki Baz Castillo

unread,
Feb 10, 2012, 4:07:06 AM2/10/12
to eventm...@googlegroups.com
2012/2/1 Knodi <dco...@gmail.com>:

> Is a way I can get EventMachine to refuse incoming connection? For ACL
> use, ACL based on IP address.

No, you must code such feature in the way you need.

--
Iñaki Baz Castillo
<i...@aliax.net>

Knodi

unread,
Feb 20, 2012, 4:43:57 PM2/20/12
to EventMachine
What method would I use to check incoming connection before its
accepted?

Iñaki Baz Castillo

unread,
Feb 20, 2012, 4:46:52 PM2/20/12
to eventm...@googlegroups.com
2012/2/20 Knodi <dco...@gmail.com>:

> What method would I use to check incoming connection before its
> accepted?

Within your custom EM::Connection class, get the remote IP and port of
the client that connected by using:

@remote_port, @remote_ip = ::Socket.unpack_sockaddr_in(get_peername)

(do that under the post_init callback).

Then check the got IP against your list of IP's in your ACL system.

Reply all
Reply to author
Forward
0 new messages