Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
937d5d91
Commit
937d5d91
authored
5 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
add monitoring-dedicated status page
parent
6a0ef149
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conf/manager.conf.in
+4
-0
4 additions, 0 deletions
conf/manager.conf.in
lib/AccountManager/App.pm
+38
-0
38 additions, 0 deletions
lib/AccountManager/App.pm
with
42 additions
and
0 deletions
conf/manager.conf.in
+
4
−
0
View file @
937d5d91
...
...
@@ -11,6 +11,10 @@ templates_dir = @templatesdir@
templates_theme = edugain
accounts_file = /var/lib/access-check/accounts.php
[status]
allow = 127.0.0.1, ::1, 10.45.0.0/16
disabled = 0
[federations]
# list of all federations from which to fetch metadata
edugain = https://mds.edugain.org/
...
...
This diff is collapsed.
Click to expand it.
lib/AccountManager/App.pm
+
38
−
0
View file @
937d5d91
...
...
@@ -8,6 +8,7 @@ use CGI::Simple::Cookie;
use
DateTime
;
use
English
qw(-no_match_vars)
;
use
Log::Any::
Adapter
;
use
List::
Util
qw(any)
;
use
List::
MoreUtils
qw(uniq)
;
use
Template
;
use
Template::
Constants
qw(:chomp)
;
...
...
@@ -35,6 +36,7 @@ my %patterns = (
my
%actions
=
(
home
=>
'
req_home
',
status
=>
'
req_status
',
select_sp
=>
'
req_select_sp
',
select_email
=>
'
req_select_email
',
complete_challenge
=>
'
req_complete_challenge
',
...
...
@@ -703,6 +705,42 @@ sub req_home {
);
}
sub
req_status
{
my
(
$self
)
=
@_
;
Net::
IP
->
require
();
my
$source_ip_string
=
$ENV
{
HTTP_X_FORWARDED_FOR
}
?
(
split
(
/, /
,
$ENV
{
HTTP_X_FORWARDED_FOR
}))[
0
]
:
$ENV
{
REMOTE_ADDR
};
my
$source_ip
=
Net::
IP
->
new
(
$source_ip_string
);
my
@allowed_ips_strings
=
$self
->
{
configuration
}
->
{
status
}
->
{
allow
}
?
split
(
/, */
,
$self
->
{
configuration
}
->
{
status
}
->
{
allow
})
:
();
my
@allowed_ips
=
map
{
Net::
IP
->
new
(
$_
)
}
@allowed_ips_strings
;
if
(
any
{
$_
->
overlaps
(
$source_ip
)
}
@allowed_ips
)
{
Sys::
Hostname
->
require
();
JSON
->
require
();
print
$self
->
{
cgi
}
->
header
(
-
type
=>
'
application/json
',
-
charset
=>
'
utf8
',
);
my
$status
=
$self
->
{
configuration
}
->
{
status
}
->
{
disabled
}
?
'
disabled
'
:
'
available
';
print
JSON
->
new
()
->
encode
({
status
=>
$status
,
host
=>
Sys::Hostname::
hostname
()
});
}
else
{
$self
->
{
logger
}
->
errorf
("
Unauthorized access from %s
",
$source_ip_string
);
print
$self
->
{
cgi
}
->
header
(
-
status
=>
'
403 unauthorized
',
-
type
=>
'
text/plain
',
);
print
"
Unauthorized access
";
}
exit
0
;
}
sub
get_parameter
{
my
(
$self
,
%args
)
=
@_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment