Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Connectivity Check
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 Connectivity Check
Commits
5e02eeca
Commit
5e02eeca
authored
5 years ago
by
Marco Malavolti
Browse files
Options
Downloads
Patches
Plain Diff
First commit
parent
9fdc3346
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+13
-1
13 additions, 1 deletion
README.md
eccs2.py
+115
-0
115 additions, 0 deletions
eccs2.py
with
128 additions
and
1 deletion
README.md
+
13
−
1
View file @
5e02eeca
# eccs2
# HOWTO Install and Configure ECCS-2
\ No newline at end of file
*
`sudo apt install mysql-server python3-pip`
*
`pip3 install mysql-connector certifi selenium urllib3`
# Create and configure the ECCS-2 database
*
`sudo mysql`
*
`CREATE DATABASE eccs2db;`
*
`CREATE USER 'eccs2user'@'localhost' IDENTIFIED BY '<password>';`
*
`GRANT ALL PRIVILEGES ON eccs2db.* TO 'eccs2user'@'localhost'`
*
`SHOW GRANTS FOR 'eccs2user'@'localhost';`
*
`FLUSH PRIVILEGES;`
This diff is collapsed.
Click to expand it.
eccs2.py
0 → 100755
+
115
−
0
View file @
5e02eeca
#!/usr/bin/env python3
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support.ui
import
Select
from
selenium.webdriver.common.keys
import
Keys
from
selenium.common.exceptions
import
NoSuchElementException
from
selenium.common.exceptions
import
TimeoutException
"""
Apre un SP con Discovery Service, seleziona l
'
IdP di cui fare il test e lo raggiunge iniziando una vera sessione via browser.
A noi serve fare un test di accesso e presentazione della pagina di Login su 2 SP dislocati geograficamente in punti diversi.
Per questo erano stati scelti SP24(IDEM) e l
'
Attribute Viewer (SWITCH). Se il test fallisce su entrambi, allora non va bene.
"""
def
logFile
(
idp
,
content
):
path
=
idp
+
"
.txt
"
f
=
open
(
path
,
'
w
'
)
f
.
write
(
content
)
f
.
close
()
def
getIdPs
():
import
certifi
import
urllib3
import
json
manager
=
urllib3
.
PoolManager
(
cert_reqs
=
'
CERT_REQUIRED
'
,
ca_certs
=
certifi
.
where
()
)
url
=
"
https://technical.edugain.org/api.php?action=list_eccs_idps
"
idp_json
=
manager
.
request
(
'
GET
'
,
url
)
idp_dict
=
json
.
loads
(
idp_json
.
data
.
decode
(
'
utf-8
'
))
idp_list
=
[]
for
idp
in
idp_dict
:
idp_list
.
append
(
idp
[
'
entityID
'
])
return
idp_list
def
checkIdP
(
driver
,
sp
,
idp
):
import
re
# Apro la URL contenente il Discovery Service, inserisco l'idp e vado alla pagina di login
try
:
driver
.
get
(
sp
)
driver
.
find_element_by_id
(
"
idpSelectInput
"
).
send_keys
(
idp
+
Keys
.
ENTER
)
driver
.
find_element_by_id
(
"
username
"
)
driver
.
find_element_by_id
(
"
password
"
)
except
NoSuchElementException
as
e
:
pass
except
TimeoutException
as
e
:
return
"
TIMEOUT
"
pattern_metadata
=
"
Unable.to.locate(\sissuer.in|).metadata(\sfor|)|no.metadata.found|profile.is.not.configured.for.relying.party|Cannot.locate.entity|fail.to.load.unknown.provider|does.not.recognise.the.service|unable.to.load.provider|Nous.n
'
avons.pas.pu.(charg|charger).le.fournisseur.de service|Metadata.not.found|application.you.have.accessed.is.not.registered.for.use.with.this.service|Message.did.not.meet.security.requirements
"
pattern_username
=
'
<input[\s]+[^>]*((type=\s*[
\'
"
](text|email)[
\'
"
]|user)|(name=\s*[
\'
"
](name)[
\'
"
]))[^>]*>
'
;
pattern_password
=
'
<input[\s]+[^>]*(type=\s*[
\'
"
]password[
\'
"
]|password)[^>]*>
'
;
metadata_not_found
=
re
.
search
(
pattern_metadata
,
driver
.
page_source
,
re
.
I
)
username_found
=
re
.
search
(
pattern_username
,
driver
.
page_source
,
re
.
I
)
password_found
=
re
.
search
(
pattern_password
,
driver
.
page_source
,
re
.
I
)
if
(
metadata_not_found
):
return
"
No-eduGAIN-Metadata
"
elif
not
username_found
and
not
password_found
:
return
"
Invalid Form
"
else
:
return
"
OK
"
def
setup
():
chrome_options
=
webdriver
.
ChromeOptions
()
chrome_options
.
add_argument
(
'
--headless
'
)
chrome_options
.
add_argument
(
'
--no-sandbox
'
)
driver
=
webdriver
.
Chrome
(
'
chromedriver
'
,
chrome_options
=
chrome_options
,
service_args
=
[
'
--verbose
'
,
'
--log-path=./selenium_chromedriver.log
'
])
# Configuro i timeout
driver
.
set_page_load_timeout
(
45
)
driver
.
set_script_timeout
(
45
)
return
driver
if
__name__
==
"
__main__
"
:
driver
=
setup
()
sps
=
[
"
https://sp24-test.garr.it/secure
"
,
"
https://attribute-viewer.aai.switch.ch/eds/
"
]
listIdPs
=
[
'
https://garr-idp-prod.irccs.garr.it
'
,
'
https://idp.hec.gov.pk/idp/shibboleth
'
,
'
https://login.itsak.gr/idp/shibboleth
'
,
'
https://idp.eastdurham.ac.uk/openathens
'
,
'
https://idp-lib.nwafu.edu.cn/idp/shibboleth
'
,
]
#listIdPs = getIdPs()
for
idp
in
listIdPs
:
for
sp
in
sps
:
print
(
"
IdP
'
%s
'
on SP
'
%s
'
results into: %s
"
%
(
idp
,
sp
,
checkIdP
(
driver
,
sp
,
idp
)))
driver
.
close
()
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