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: ...@@ -23,7 +23,7 @@ It requires the following CPAN distributions:
* Locale-Maketext-Lexicon * Locale-Maketext-Lexicon
* Mojolicious * Mojolicious
* Mojolicious-Plugin-INIConfig * Mojolicious-Plugin-INIConfig
* Mojolicious-Plugin-ClientIP * Mojolicious-Plugin-ForwardedFor
* Mojolicious-Plugin-TemplateToolkit * Mojolicious-Plugin-TemplateToolkit
* Rose-DB-Object * Rose-DB-Object
* Syntax-Keyword-Try * Syntax-Keyword-Try
......
...@@ -3,7 +3,6 @@ support_email = support@my.fqdn ...@@ -3,7 +3,6 @@ support_email = support@my.fqdn
name = eduGAIN Access Check name = eduGAIN Access Check
url = https://access-check.my.fqdn url = https://access-check.my.fqdn
login_url = https://access-check.my.fqdn/Shibboleth.sso/Login login_url = https://access-check.my.fqdn/Shibboleth.sso/Login
proxies =
[setup] [setup]
# templates theme # templates theme
......
...@@ -42,11 +42,7 @@ sub startup { ...@@ -42,11 +42,7 @@ sub startup {
); );
$self->plugin( $self->plugin(
'ClientIP', 'ForwardedFor',
{
private => [ '127.0.0.0/8' ],
ignore => [ $self->string_to_list($config->{app}->{proxies}) ]
}
); );
$self->log( $self->log(
......
...@@ -41,7 +41,7 @@ sub run { ...@@ -41,7 +41,7 @@ sub run {
return; return;
} }
my $client_ip = $self->client_ip(); my $client_ip = $self->forwarded_for();
my @allowed_ips = $self->string_to_list($config->{status}->{allowed}); my @allowed_ips = $self->string_to_list($config->{status}->{allowed});
if (none { network_contains($_, $client_ip) } @allowed_ips) { if (none { network_contains($_, $client_ip) } @allowed_ips) {
......
...@@ -112,7 +112,7 @@ sub run { ...@@ -112,7 +112,7 @@ sub run {
name => $config->{app}->{name}, name => $config->{app}->{name},
}, },
user => $user->{name}, user => $user->{name},
source_ip => $self->client_ip(), source_ip => $self->forwarded_for(),
idp => { entityid => $user->{idp}, }, idp => { entityid => $user->{idp}, },
sp => { entityid => $entityid, }, sp => { entityid => $entityid, },
to => $email, to => $email,
......
...@@ -3,3 +3,4 @@ ACCESS_CHECK_SERVER=daemon ...@@ -3,3 +3,4 @@ ACCESS_CHECK_SERVER=daemon
ACCESS_CHECK_URL=http://127.0.0.1:3000 ACCESS_CHECK_URL=http://127.0.0.1:3000
ACCESS_CHECK_OPTIONS= ACCESS_CHECK_OPTIONS=
ACCESS_CHECK_CONFIG=@confdir@/manager.conf 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.
Please register or to comment