IP address/IP range auth module for Erlang

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

IP address/IP range auth module for Erlang

Frank Muller
Hi guys

I’m looking for an Erlang module which let me authorize connexions based on an IP address or IP address range.

Examples:

. Rule 1: "51.121.92.25"

Only one IP address is allowed: 51.121.92.25

.  Rule 2: "51.121.*.25"

These IPs are all allowed:
51.121.92.25
51.121.91.25
51.121.90.25

Would be great if the module can also validate the connection IP address. For now, I only deal with IP v4 addresses (but I’m open to support IP v6 in my code).

Thanks in advance
/Frank
Reply | Threaded
Open this post in threaded view
|

Re: IP address/IP range auth module for Erlang

Luke Bakken-2
Hi Frank,

You may be able to get some inspiration from this RabbitMQ plugin:

https://github.com/gotthardp/rabbitmq-auth-backend-ip-range/

Thanks,
Luke

On Fri, Oct 25, 2019 at 10:15 AM Frank Muller
<[hidden email]> wrote:

>
> Hi guys
>
> I’m looking for an Erlang module which let me authorize connexions based on an IP address or IP address range.
>
> Examples:
>
> . Rule 1: "51.121.92.25"
>
> Only one IP address is allowed: 51.121.92.25
>
> .  Rule 2: "51.121.*.25"
>
> These IPs are all allowed:
> 51.121.92.25
> 51.121.91.25
> 51.121.90.25
> …
>
> Would be great if the module can also validate the connection IP address. For now, I only deal with IP v4 addresses (but I’m open to support IP v6 in my code).
>
> Thanks in advance
> /Frank
Reply | Threaded
Open this post in threaded view
|

Re: IP address/IP range auth module for Erlang

Frank Muller
Hi Luke

I quickly reviewed the code, and found this section intriguing:
https://github.com/gotthardp/rabbitmq-auth-backend-ip-range/blob/master/src/rabbit_auth_backend_ip_range.erl#L57-L60

How about just this instead:
Addr == Mask,


Anyway, thank you. If no one else has another alternative, I’m gonna hack this module a little bit to fit my needs.

/Frank

Le ven. 25 oct. 2019 à 19:23, Luke Bakken <[hidden email]> a écrit :
Hi Frank,

You may be able to get some inspiration from this RabbitMQ plugin:

https://github.com/gotthardp/rabbitmq-auth-backend-ip-range/

Thanks,
Luke

On Fri, Oct 25, 2019 at 10:15 AM Frank Muller
<[hidden email]> wrote:
>
> Hi guys
>
> I’m looking for an Erlang module which let me authorize connexions based on an IP address or IP address range.
>
> Examples:
>
> . Rule 1: "51.121.92.25"
>
> Only one IP address is allowed: 51.121.92.25
>
> .  Rule 2: "51.121.*.25"
>
> These IPs are all allowed:
> 51.121.92.25
> 51.121.91.25
> 51.121.90.25
> …
>
> Would be great if the module can also validate the connection IP address. For now, I only deal with IP v4 addresses (but I’m open to support IP v6 in my code).
>
> Thanks in advance
> /Frank
Reply | Threaded
Open this post in threaded view
|

Re: IP address/IP range auth module for Erlang

Marc Worrell
In reply to this post by Frank Muller
[2nd try, now from correct email address]

Hi Frank,

You can check zotonic_stdlib, there we have routines to check an IP address against IP address ranges.


Cheers,

Marc Worrell


On 25 Oct 2019, at 19:15, Frank Muller <[hidden email]> wrote:

Hi guys

I’m looking for an Erlang module which let me authorize connexions based on an IP address or IP address range.

Examples:

. Rule 1: "51.121.92.25"

Only one IP address is allowed: 51.121.92.25

.  Rule 2: "51.121.*.25"

These IPs are all allowed:
51.121.92.25
51.121.91.25
51.121.90.25

Would be great if the module can also validate the connection IP address. For now, I only deal with IP v4 addresses (but I’m open to support IP v6 in my code).

Thanks in advance
/Frank

Reply | Threaded
Open this post in threaded view
|

Re: IP address/IP range auth module for Erlang

Frank Muller
Thanks Marc. Quickly checked the code and it looks clean and simple. Exactly what I was looking for. 

/Frank

Le ven. 25 oct. 2019 à 20:39, Marc Worrell <[hidden email]> a écrit :
[2nd try, now from correct email address]

Hi Frank,

You can check zotonic_stdlib, there we have routines to check an IP address against IP address ranges.


Cheers,

Marc Worrell


On 25 Oct 2019, at 19:15, Frank Muller <[hidden email]> wrote:

Hi guys

I’m looking for an Erlang module which let me authorize connexions based on an IP address or IP address range.

Examples:

. Rule 1: "51.121.92.25"

Only one IP address is allowed: 51.121.92.25

.  Rule 2: "51.121.*.25"

These IPs are all allowed:
51.121.92.25
51.121.91.25
51.121.90.25

Would be great if the module can also validate the connection IP address. For now, I only deal with IP v4 addresses (but I’m open to support IP v6 in my code).

Thanks in advance
/Frank