Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN contacts
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 contacts
Commits
8a46e209
Commit
8a46e209
authored
2 years ago
by
Davide Vaghetti
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
entity_details See merge request
!6
parents
4d9a3040
381ee456
No related branches found
Branches containing commit
Tags
v1.0.0
1 merge request
!6
entity_details
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+13
-0
13 additions, 0 deletions
README.md
entities_security_contacts.py
+3
-2
3 additions, 2 deletions
entities_security_contacts.py
entity_details.py
+113
-0
113 additions, 0 deletions
entity_details.py
with
129 additions
and
2 deletions
README.md
+
13
−
0
View file @
8a46e209
...
...
@@ -3,6 +3,19 @@
This repository contains tools to parse contacts from eduGAIN metadata and from
the eduGAIN APIs published on https://technical.edugain.org/api.php.
## Identity federations contacts
Script name :
`identity_federations_contacts.py`
This script consume the eduGAIN API to retrieve the details of all the eduGAIN identity
federations and parse it to create a list of contacts per each federation in CSV format. This list will be printed to stdout.
CSV Format:
```
FEDERATION,COUNTRIES,SECURITY CONTACT,FEDERATION CONTACT
```
## Identity federations security contacts
Script name :
`identity_federations_security_contacts.py`
...
...
This diff is collapsed.
Click to expand it.
entities_security_contacts.py
+
3
−
2
View file @
8a46e209
...
...
@@ -34,7 +34,7 @@ entities = root.findall('./md:EntityDescriptor', ns)
for
entity
in
entities
:
sec_mails
=
set
()
entity_id
=
entity
.
attrib
[
'
entityID
'
].
strip
()
registration_authority
=
''
registration_info
=
entity
.
find
(
'
./md:Extensions/mdrpi:RegistrationInfo
'
,
ns
)
if
registration_info
==
None
:
...
...
@@ -70,7 +70,8 @@ for entity in entities:
for
mail
in
sec_mails
:
if
(
domain
,
mail
)
not
in
seen_doms_mails
:
seen_doms_mails
.
add
((
domain
,
mail
))
contacts
.
add
(
'
{},{},{},{}
'
.
format
(
registration_authority
,
domain
,
mail
,
orgname
))
contacts
.
add
(
'
{},{},{},{}
,{}
'
.
format
(
registration_authority
,
entity_id
,
domain
,
mail
,
orgname
))
for
contact
in
sorted
(
contacts
):
print
(
'
RegistrationAuthority,entityID,scope,security-contact,OrganizationName
'
)
print
(
contact
)
This diff is collapsed.
Click to expand it.
entity_details.py
0 → 100755
+
113
−
0
View file @
8a46e209
#!/usr/bin/env python3
import
sys
import
argparse
import
requests
from
xml.etree
import
ElementTree
as
ET
# DEFINE SOME VARS
entity_id
=
None
metadata_file
=
None
root
=
None
tec_contact
=
''
sup_contact
=
''
adm_contact
=
''
# ARGPARSE
parser
=
argparse
.
ArgumentParser
(
description
=
'
Show detailed information about an eduGAIN entity.
'
,
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
,
epilog
=
'''
Examples
- Retrieve details about a single entity using eduGAIN metadata:
\n
./entity_details.py https://idp.dir.garr.it/idp/shibboleth
\n\n
- Retrieve details for a list of idps using a local metadata file:
\n
./entity_details.py -e idp_list -f edugain-v2.xml
'''
)
group
=
parser
.
add_mutually_exclusive_group
()
group
.
add_argument
(
'
ENTITYID
'
,
nargs
=
'
?
'
,
help
=
'
entityID of the entity to look up
'
)
group
.
add_argument
(
'
-e
'
,
type
=
str
,
help
=
'
load entityIDs from file E
'
)
parser
.
add_argument
(
'
-f
'
,
type
=
str
,
help
=
'
load metadata from file F
'
)
parser
.
add_argument
(
'
-u
'
,
type
=
str
,
default
=
'
https://mds.edugain.org/edugain-v2.xml
'
,
help
=
'
download metadata from url U (default to https://mds.edugain.org/edugain-v2.xml)
'
)
args
=
parser
.
parse_args
()
# METHDO TO RETRIVE FED NAME
feds_request
=
requests
.
get
(
"
https://technical.edugain.org/api.php?action=list_feds&format
"
)
feds
=
feds_request
.
json
()
def
get_fed_name
(
registration_authority
):
for
key
in
feds
:
if
feds
[
key
][
'
reg_auth
'
]
==
registration_authority
:
return
feds
[
key
][
'
name
'
]
return
None
# MAIN
entities
=
[]
if
args
.
ENTITYID
:
entities
.
append
(
args
.
ENTITYID
)
elif
args
.
e
:
with
open
(
args
.
e
,
'
r
'
)
as
entitiesfile
:
entities
=
entitiesfile
.
readlines
()
else
:
parser
.
parse_args
([
'
-h
'
])
exit
(
1
)
if
args
.
f
:
tree
=
ET
.
parse
(
args
.
f
)
root
=
tree
.
getroot
()
else
:
xml_req
=
requests
.
get
(
args
.
u
)
root
=
ET
.
fromstring
(
xml_req
.
content
)
orgs
=
set
()
ns
=
{
'
md
'
:
'
urn:oasis:names:tc:SAML:2.0:metadata
'
,
'
mdui
'
:
'
urn:oasis:names:tc:SAML:metadata:ui
'
,
'
shibmd
'
:
'
urn:mace:shibboleth:metadata:1.0
'
,
'
remd
'
:
'
http://refeds.org/metadata
'
,
'
icmd
'
:
'
http://id.incommon.org/metadata
'
,
'
mdrpi
'
:
'
urn:oasis:names:tc:SAML:metadata:rpi
'
,
}
print
(
'
entityID,FederationName,RegistrationAuthority,OrganizationName,TechnicalContact,SupportContact,AdministrativeContact
'
)
for
entity_id
in
entities
:
entity
=
root
.
find
(
f
'
./md:EntityDescriptor[@entityID=
"
{
entity_id
.
strip
()
}
"
]
'
,
ns
)
if
entity
:
registration_authority
=
None
registration_info
=
entity
.
find
(
'
./md:Extensions/mdrpi:RegistrationInfo
'
,
ns
)
if
registration_info
:
registration_authority
=
registration_info
.
attrib
[
'
registrationAuthority
'
].
strip
()
fed_name
=
get_fed_name
(
registration_authority
)
orgname
=
entity
.
find
(
'
./md:Organization/md:OrganizationDisplayName
'
,
ns
).
text
.
strip
()
tec_contact_el
=
entity
.
find
(
'
./md:ContactPerson[@contactType=
"
technical
"
]/md:EmailAddress
'
,
ns
)
if
tec_contact_el
is
not
None
:
tec_contact
=
tec_contact_el
.
text
.
replace
(
'
mailto:
'
,
''
)
sup_contact_el
=
entity
.
find
(
'
./md:ContactPerson[@contactType=
"
support
"
]/md:EmailAddress
'
,
ns
)
if
sup_contact_el
is
not
None
:
sup_contact
=
sup_contact_el
.
text
.
replace
(
'
mailto:
'
,
''
)
adm_contact_el
=
entity
.
find
(
'
./md:ContactPerson[@contactType=
"
administrative
"
]/md:EmailAddress
'
,
ns
)
if
adm_contact_el
is
not
None
:
adm_contact
=
adm_contact_el
.
text
.
replace
(
'
mailto:
'
,
''
)
print
(
'
{},{},{},{},{},{}
'
.
format
(
entity_id
,
fed_name
,
registration_authority
,
orgname
,
tec_contact
,
sup_contact
,
adm_contact
))
else
:
print
(
f
'
No such entityID:
{
entity_id
}
'
)
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