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
3de87cb7
Commit
3de87cb7
authored
5 years ago
by
Marco Malavolti
Browse files
Options
Downloads
Patches
Plain Diff
Refactorized and removed Logger for ECCS2 output
parent
5dacd1f9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+21
-0
21 additions, 0 deletions
README.md
cleanAndRunEccs2.sh
+3
-0
3 additions, 0 deletions
cleanAndRunEccs2.sh
eccs2.py
+36
-66
36 additions, 66 deletions
eccs2.py
eccs2properties.py
+2
-2
2 additions, 2 deletions
eccs2properties.py
runEccs2.py
+1
-1
1 addition, 1 deletion
runEccs2.py
with
63 additions
and
69 deletions
README.md
+
21
−
0
View file @
3de87cb7
...
@@ -46,4 +46,25 @@
...
@@ -46,4 +46,25 @@
*
'Excluded'
*
'Excluded'
*
/eccs/eccsresults (Return the results of the last check ready for ECCS Gui)
*
/eccs/eccsresults (Return the results of the last check ready for ECCS Gui)
# APACHE CONFIGURATION
*
`sudo vim /etc/apache2/sites-availabled/eccs2.conf
```apache
<IfModule mod_alias.c>
Alias /eccs2 /opt/eccs2/web
Alias /eccs2html /opt/eccs2/html
<Directory /opt/eccs2/web>
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /opt/eccs2/html>
Require all granted
</Directory>
</IfModule>
```
* `
sudo a2ensite eccs2.conf
`
* `
sudo systemctl reload apache2.service
`
This diff is collapsed.
Click to expand it.
cleanAndRunEccs2.sh
+
3
−
0
View file @
3de87cb7
...
@@ -5,3 +5,6 @@ rm -f /opt/eccs2/input/*.json
...
@@ -5,3 +5,6 @@ rm -f /opt/eccs2/input/*.json
# Run ECCS2
# Run ECCS2
/opt/eccs2/runEccs2.py
/opt/eccs2/runEccs2.py
# Run Failed Command again
bash /opt/eccs2/logs/failed-cmd.sh
This diff is collapsed.
Click to expand it.
eccs2.py
+
36
−
66
View file @
3de87cb7
...
@@ -7,7 +7,7 @@ import re
...
@@ -7,7 +7,7 @@ import re
import
requests
import
requests
import
time
import
time
from
eccs2properties
import
DAY
,
ECCS2HTMLDIR
,
ECCS2LOGSDIR
,
ECCS2OUTPUTDIR
,
ECCS2RESULTSLOG
,
ECCS2CHECKSLOG
,
FEDS_BLACKLIST
,
IDPS_BLACKLIST
,
ECCS2SPS
,
ECCS2SELENIUMDEBUG
from
eccs2properties
import
DAY
,
ECCS2HTMLDIR
,
ECCS2OUTPUTDIR
,
ECCS2RESULTSLOG
,
ECCS2CHECKSLOG
,
FEDS_BLACKLIST
,
IDPS_BLACKLIST
,
ECCS2SPS
,
ECCS2SELENIUMDEBUG
from
pathlib
import
Path
from
pathlib
import
Path
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.common.keys
import
Keys
...
@@ -45,12 +45,10 @@ def checkIdP(sp,idp):
...
@@ -45,12 +45,10 @@ def checkIdP(sp,idp):
if
(
idp
[
'
registrationAuthority
'
]
in
federation_blacklist
):
if
(
idp
[
'
registrationAuthority
'
]
in
federation_blacklist
):
check_time
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y-%m-%dT%H:%M:%S
'
)
+
'
Z
'
check_time
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y-%m-%dT%H:%M:%S
'
)
+
'
Z
'
#logger.info("%s;%s;%s;NULL;Federation excluded from checks" % (idp['entityID'],sp,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
NULL
"
,
"
DISABLED
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
NULL
"
,
"
DISABLED
"
)
if
(
idp
[
'
entityID
'
]
in
entities_blacklist
):
if
(
idp
[
'
entityID
'
]
in
entities_blacklist
):
check_time
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y-%m-%dT%H:%M:%S
'
)
+
'
Z
'
check_time
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y-%m-%dT%H:%M:%S
'
)
+
'
Z
'
#logger.info("%s;%s;%s;NULL;IdP excluded from checks" % (idp['entityID'],sp,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
NULL
"
,
"
DISABLED
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
NULL
"
,
"
DISABLED
"
)
# Open SP, select the IDP from the EDS and press 'Enter' to reach the IdP login page to check
# Open SP, select the IDP from the EDS and press 'Enter' to reach the IdP login page to check
...
@@ -70,7 +68,6 @@ def checkIdP(sp,idp):
...
@@ -70,7 +68,6 @@ def checkIdP(sp,idp):
html
.
write
(
page_source
)
html
.
write
(
page_source
)
except
TimeoutException
as
e
:
except
TimeoutException
as
e
:
#logger.info("%s;%s;999;%s;Timeout" % (idp['entityID'],sp,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
999
"
,
"
Timeout
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
999
"
,
"
Timeout
"
)
except
NoSuchElementException
as
e
:
except
NoSuchElementException
as
e
:
...
@@ -82,7 +79,6 @@ def checkIdP(sp,idp):
...
@@ -82,7 +79,6 @@ def checkIdP(sp,idp):
return
None
return
None
except
UnexpectedAlertPresentException
as
e
:
except
UnexpectedAlertPresentException
as
e
:
#logger.info("%s;%s;888;%s;UnexpectedAlertPresent" % (idp['entityID'],sp,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
888
"
,
"
ERROR
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
"
888
"
,
"
ERROR
"
)
except
WebDriverException
as
e
:
except
WebDriverException
as
e
:
...
@@ -100,7 +96,6 @@ def checkIdP(sp,idp):
...
@@ -100,7 +96,6 @@ def checkIdP(sp,idp):
finally
:
finally
:
driver
.
quit
()
driver
.
quit
()
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_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_username
=
'
<input[\s]+[^>]*((type=\s*[
\'
"
](text|email)[
\'
"
]|user)|(name=\s*[
\'
"
](name)[
\'
"
]))[^>]*>
'
;
...
@@ -144,19 +139,43 @@ def checkIdP(sp,idp):
...
@@ -144,19 +139,43 @@ def checkIdP(sp,idp):
print
(
"
IdP: %s
\n
SP: %s
"
%
(
idp
[
'
entityID
'
],
sp
))
print
(
"
IdP: %s
\n
SP: %s
"
%
(
idp
[
'
entityID
'
],
sp
))
status_code
=
"
555
"
status_code
=
"
555
"
if
(
metadata_not_found
):
if
(
metadata_not_found
):
#logger.info("%s;%s;%s;%s;No-eduGAIN-Metadata" % (idp['entityID'],sp,status_code,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
No-eduGAIN-Metadata
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
No-eduGAIN-Metadata
"
)
elif
not
username_found
or
not
password_found
:
elif
not
username_found
or
not
password_found
:
#logger.info("%s;%s;%s;%s;Invalid-Form" % (idp['entityID'],sp,status_code,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
Invalid-Form
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
Invalid-Form
"
)
else
:
else
:
#logger.info("%s;%s;%s;%s;OK" % (idp['entityID'],sp,status_code,check_time))
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
OK
"
)
return
(
idp
[
'
entityID
'
],
sp
,
check_time
,
status_code
,
"
OK
"
)
def
check
(
idp
,
sps
,
eccs2log
):
def
storeECCS2result
(
idp
,
results
,
idp_status
):
# Build the contacts lists: technical/support
listTechContacts
=
getIdPContacts
(
idp
,
'
technical
'
)
listSuppContacts
=
getIdPContacts
(
idp
,
'
support
'
)
strTechContacts
=
'
,
'
.
join
(
listTechContacts
)
strSuppContacts
=
'
,
'
.
join
(
listSuppContacts
)
# IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;Status;SP-entityID-1;SP-check-time-1;SP-status-code-1;SP-result-1;SP-entityID-2;SP-check-time-2;SP-status-code-2;SP-result-2
with
open
(
"
%s/%s
"
%
(
ECCS2OUTPUTDIR
,
ECCS2RESULTSLOG
),
'
a
'
)
as
f
:
f
.
write
(
"
%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s
\n
"
%
(
idp
[
'
displayname
'
].
replace
(
"
'
"
,
"'"
).
split
(
'
;
'
)[
1
].
split
(
'
==
'
)[
0
],
# IdP-DisplayName
idp
[
'
entityID
'
],
# IdP-entityID
idp
[
'
registrationAuthority
'
],
# IdP-RegAuth
strTechContacts
,
# IdP-TechCtcsList
strSuppContacts
,
# IdP-SuppCtcsList
idp_status
,
# IdP-ECCS-Status
results
[
0
][
1
],
# SP-entityID-1
results
[
0
][
2
],
# SP-check-time-1
results
[
0
][
3
],
# SP-status-code-1
results
[
0
][
4
],
# SP-result-1
results
[
1
][
1
],
# SP-entityID-2
results
[
1
][
2
],
# SP-check-time-2
results
[
1
][
3
],
# SP-status-code-2
results
[
1
][
4
]))
# SP-result-2
def
check
(
idp
,
sps
):
results
=
[]
results
=
[]
for
sp
in
sps
:
for
sp
in
sps
:
resultCheck
=
checkIdP
(
sp
,
idp
)
resultCheck
=
checkIdP
(
sp
,
idp
)
...
@@ -171,69 +190,20 @@ def check(idp,sps,eccs2log):
...
@@ -171,69 +190,20 @@ def check(idp,sps,eccs2log):
f
.
write
(
"
;
"
.
join
(
elem
))
f
.
write
(
"
;
"
.
join
(
elem
))
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
listTechContacts
=
getIdPContacts
(
idp
,
'
technical
'
)
listSuppContacts
=
getIdPContacts
(
idp
,
'
support
'
)
strTechContacts
=
'
,
'
.
join
(
listTechContacts
)
strSuppContacts
=
'
,
'
.
join
(
listSuppContacts
)
# If all checks are 'OK', than the IdP consuming correctly eduGAIN Metadata.
# If all checks are 'OK', than the IdP consuming correctly eduGAIN Metadata.
if
(
results
[
0
][
4
]
==
results
[
1
][
4
]
==
"
OK
"
):
if
(
results
[
0
][
4
]
==
results
[
1
][
4
]
==
"
OK
"
):
# IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;Status;SP-entityID-1;SP-check-time-1;SP-status-code-1;SP-result-1;SP-entityID-2;SP-check-time-2;SP-status-code-2;SP-result-2
storeECCS2result
(
idp
,
results
,
'
OK
'
)
eccs2log
.
info
(
"
%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s
"
%
(
idp
[
'
displayname
'
].
replace
(
"
'
"
,
"'"
).
split
(
'
;
'
)[
1
].
split
(
'
==
'
)[
0
],
idp
[
'
entityID
'
],
idp
[
'
registrationAuthority
'
],
strTechContacts
,
strSuppContacts
,
'
OK
'
,
results
[
0
][
1
],
# SP-entityID-1
results
[
0
][
2
],
# SP-check-time-1
results
[
0
][
3
],
# SP-status-code-1
results
[
0
][
4
],
# SP-result-1
results
[
1
][
1
],
# SP-entityID-2
results
[
1
][
2
],
# SP-check-time-2
results
[
1
][
3
],
# SP-status-code-2
results
[
1
][
4
]))
# SP-result-2
elif
(
results
[
0
][
4
]
==
results
[
1
][
4
]
==
"
DISABLED
"
):
elif
(
results
[
0
][
4
]
==
results
[
1
][
4
]
==
"
DISABLED
"
):
eccs2log
.
info
(
"
%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s
"
%
(
storeECCS2result
(
idp
,
results
,
'
DISABLED
'
)
idp
[
'
displayname
'
].
replace
(
"
'
"
,
"'"
).
split
(
'
;
'
)[
1
].
split
(
'
==
'
)[
0
],
idp
[
'
entityID
'
],
idp
[
'
registrationAuthority
'
],
strTechContacts
,
strSuppContacts
,
'
DISABLE
'
,
results
[
0
][
1
],
results
[
0
][
2
],
results
[
0
][
3
],
results
[
0
][
4
],
results
[
1
][
1
],
results
[
1
][
2
],
results
[
1
][
3
],
results
[
1
][
4
]))
else
:
else
:
eccs2log
.
info
(
"
%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s
"
%
(
storeECCS2result
(
idp
,
results
,
'
ERROR
'
)
idp
[
'
displayname
'
].
replace
(
"
'
"
,
"'"
).
split
(
'
;
'
)[
1
].
split
(
'
==
'
)[
0
],
idp
[
'
entityID
'
],
idp
[
'
registrationAuthority
'
],
strTechContacts
,
strSuppContacts
,
'
ERROR
'
,
results
[
0
][
1
],
results
[
0
][
2
],
results
[
0
][
3
],
results
[
0
][
4
],
results
[
1
][
1
],
results
[
1
][
2
],
results
[
1
][
3
],
results
[
1
][
4
]))
# MAIN
# MAIN
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
eccs2log
=
getLogger
(
ECCS2RESULTSLOG
,
ECCS2OUTPUTDIR
,
'
a
'
,
"
INFO
"
)
sps
=
ECCS2SPS
sps
=
ECCS2SPS
parser
=
argparse
.
ArgumentParser
(
description
=
'
Checks if the input IdP consumed correctly eduGAIN metadata by accessing two different SPs
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Checks if the input IdP consumed correctly eduGAIN metadata by accessing two different SPs
'
)
...
@@ -243,4 +213,4 @@ if __name__=="__main__":
...
@@ -243,4 +213,4 @@ if __name__=="__main__":
idp
=
json
.
loads
(
args
.
idpJson
[
0
])
idp
=
json
.
loads
(
args
.
idpJson
[
0
])
check
(
idp
,
sps
,
eccs2log
)
check
(
idp
,
sps
)
This diff is collapsed.
Click to expand it.
eccs2properties.py
+
2
−
2
View file @
3de87cb7
...
@@ -18,7 +18,6 @@ ECCS2OUTPUTDIR = "%s/output" % ECCS2DIR
...
@@ -18,7 +18,6 @@ ECCS2OUTPUTDIR = "%s/output" % ECCS2DIR
ECCS2RESULTSLOG
=
"
eccs2_%s.log
"
%
DAY
ECCS2RESULTSLOG
=
"
eccs2_%s.log
"
%
DAY
ECCS2CHECKSLOG
=
"
eccs2checks_%s.log
"
%
DAY
ECCS2CHECKSLOG
=
"
eccs2checks_%s.log
"
%
DAY
ECCS2HTMLDIR
=
"
%s/html
"
%
ECCS2DIR
ECCS2HTMLDIR
=
"
%s/html
"
%
ECCS2DIR
ECCS2FAILEDCMD
=
"
%s/failed-cmd.sh
"
%
ECCS2LOGSDIR
# Selenium
# Selenium
ECCS2SELENIUMDEBUG
=
False
ECCS2SELENIUMDEBUG
=
False
...
@@ -30,9 +29,10 @@ ECCS2SELENIUMSCRIPTTIMEOUT = 30 #seconds
...
@@ -30,9 +29,10 @@ ECCS2SELENIUMSCRIPTTIMEOUT = 30 #seconds
ECCS2LOGSDIR
=
"
%s/logs
"
%
ECCS2DIR
ECCS2LOGSDIR
=
"
%s/logs
"
%
ECCS2DIR
ECCS2STDOUT
=
"
%s/stdout_%s.log
"
%
(
ECCS2LOGSDIR
,
DAY
)
ECCS2STDOUT
=
"
%s/stdout_%s.log
"
%
(
ECCS2LOGSDIR
,
DAY
)
ECCS2STDERR
=
"
%s/stderr_%s.log
"
%
(
ECCS2LOGSDIR
,
DAY
)
ECCS2STDERR
=
"
%s/stderr_%s.log
"
%
(
ECCS2LOGSDIR
,
DAY
)
ECCS2FAILEDCMD
=
"
%s/failed-cmd.sh
"
%
ECCS2LOGSDIR
# Number of processes to run in parallel
# Number of processes to run in parallel
ECCS2NUMPROCESSES
=
3
0
ECCS2NUMPROCESSES
=
2
0
# The 2 SPs that will be used to test each IdP
# The 2 SPs that will be used to test each IdP
ECCS2SPS
=
[
"
https://sp24-test.garr.it/secure
"
,
"
https://attribute-viewer.aai.switch.ch/eds/
"
]
ECCS2SPS
=
[
"
https://sp24-test.garr.it/secure
"
,
"
https://attribute-viewer.aai.switch.ch/eds/
"
]
...
...
This diff is collapsed.
Click to expand it.
runEccs2.py
+
1
−
1
View file @
3de87cb7
...
@@ -30,7 +30,7 @@ async def run(name,queue,stdout_file,stderr_file,cmd_file):
...
@@ -30,7 +30,7 @@ async def run(name,queue,stdout_file,stderr_file,cmd_file):
stdout_file
.
write
(
'
-----
\n
[cmd-out]
\n
%s
\n\n
[stdout]
\n
%s
'
%
(
cmd
,
stdout
.
decode
()))
stdout_file
.
write
(
'
-----
\n
[cmd-out]
\n
%s
\n\n
[stdout]
\n
%s
'
%
(
cmd
,
stdout
.
decode
()))
if
stderr
:
if
stderr
:
stderr_file
.
write
(
'
-----
\n
[cmd-err]
\n
%s
\n\n
[stderr]
\n
%s
'
%
(
cmd
,
stderr
.
decode
()))
stderr_file
.
write
(
'
-----
\n
[cmd-err]
\n
%s
\n\n
[stderr]
\n
%s
'
%
(
cmd
,
stderr
.
decode
()))
cmd_file
.
write
(
cmd
)
cmd_file
.
write
(
cmd
+
'
\n
'
)
# Notify the queue that the "work cmd" has been processed.
# Notify the queue that the "work cmd" has been processed.
queue
.
task_done
()
queue
.
task_done
()
...
...
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