Skip to content
Snippets Groups Projects
Commit a8b7809d authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

switch to Mojolicious::Plugin::ForwardedFor to get client IP

Other alternatives suffer from various defaults:
- Mojolicious::Plugin::ClientIP doesn't handle IPv6
- Mojolicious::Plugin::ClientIP::Pluggable exclude private addresses
parent d0ded3e5
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ It requires the following CPAN distributions:
* Locale-Maketext-Lexicon
* Mojolicious
* Mojolicious-Plugin-INIConfig
* Mojolicious-Plugin-ClientIP
* Mojolicious-Plugin-ForwardedFor
* Mojolicious-Plugin-TemplateToolkit
* Rose-DB-Object
* Syntax-Keyword-Try
......
......@@ -3,7 +3,6 @@ support_email = support@my.fqdn
name = eduGAIN Access Check
url = https://access-check.my.fqdn
login_url = https://access-check.my.fqdn/Shibboleth.sso/Login
proxies =
[setup]
# templates theme
......
......@@ -42,11 +42,7 @@ sub startup {
);
$self->plugin(
'ClientIP',
{
private => [ '127.0.0.0/8' ],
ignore => [ $self->string_to_list($config->{app}->{proxies}) ]
}
'ForwardedFor',
);
$self->log(
......
......@@ -41,7 +41,7 @@ sub run {
return;
}
my $client_ip = $self->client_ip();
my $client_ip = $self->forwarded_for();
my @allowed_ips = $self->string_to_list($config->{status}->{allowed});
if (none { network_contains($_, $client_ip) } @allowed_ips) {
......
......@@ -112,7 +112,7 @@ sub run {
name => $config->{app}->{name},
},
user => $user->{name},
source_ip => $self->client_ip(),
source_ip => $self->forwarded_for(),
idp => { entityid => $user->{idp}, },
sp => { entityid => $entityid, },
to => $email,
......
......@@ -3,3 +3,4 @@ ACCESS_CHECK_SERVER=daemon
ACCESS_CHECK_URL=http://127.0.0.1:3000
ACCESS_CHECK_OPTIONS=
ACCESS_CHECK_CONFIG=@confdir@/manager.conf
MOJO_REVERSE_PROXY=1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment