-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for RADIUS TLS-PSK #108
base: master
Are you sure you want to change the base?
Changes from all commits
6773b85
dad25fb
3c4445d
39af9b0
2f3f4dd
70b950c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,8 @@ NRO_PROV_SOCIAL_MEDIA_CONTACT = [ | |
|
||
# Helpdesk, used in base.html: | ||
NRO_DOMAIN_HELPDESK_DICT = {"name": _ld({'en': "Domain Helpdesk"}), 'email':'[email protected]', 'phone': '12324567890', 'uri': 'helpdesk.example.com'} | ||
# ream used to generate a TLS-PSK identity for service providers | ||
NRO_TLSPSK_REALM = "example.com" | ||
|
||
#Countries for Realm model: | ||
REALM_COUNTRIES = ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.29 on 2025-01-08 11:14 | ||
from __future__ import unicode_literals | ||
from django.db import migrations, models | ||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('edumanage', '0012_venue_info_select'), | ||
] | ||
operations = [ | ||
migrations.AddField( | ||
model_name='instserver', | ||
name='psk_identity', | ||
field=models.CharField(blank=True, help_text='Network Access Identifier (user@realm)', max_length=128, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='instserver', | ||
name='psk_key', | ||
field=models.CharField(blank=True, help_text='Randomly-generated string', max_length=80, null=True), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1458,6 +1458,7 @@ def base_response(request): | |
'institution_canhaveservicelocs': institution_canhaveservicelocs, | ||
'ERTYPES': ERTYPES, | ||
'ERTYPE_ROLES': ERTYPE_ROLES, | ||
'RADPROTOS': RADPROTOS, | ||
} | ||
|
||
|
||
|
@@ -2194,6 +2195,11 @@ def instxml(request, version): | |
server_type = EDB_SERVER_TYPES.TLS | ||
except: | ||
pass | ||
try: | ||
if server.proto == RADPROTOS.TLSPSK: | ||
server_type = EDB_SERVER_TYPES.TLS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the code here, what would happen if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My PR doesn't introduce a new problem. However, I also think it's safe because of the check at lines 2184-2187. It'll simply become |
||
except: | ||
pass | ||
instServer = ElementTree.SubElement(instElement, "server") | ||
instServerName = ElementTree.SubElement(instServer, "server_name") | ||
instServerName.text = "%s" % (server.host) | ||
|
@@ -2544,6 +2550,12 @@ def servdata(request): | |
if srv.name: | ||
srv_dict['label'] = srv.name | ||
srv_dict['secret'] = srv.secret | ||
srv_dict['addr_type'] = srv.addr_type | ||
srv_dict['proto'] = srv.proto | ||
if srv.proto == RADPROTOS.TLSPSK: | ||
# assuming the ManyToManyField is really many-to-one institution, which is true unless people play in the admin interface | ||
srv_dict['psk_identity'] = "%s@%s" % (srv.instid.first().instid, settings.NRO_TLSPSK_REALM) | ||
srv_dict['psk_key'] = srv.psk_key | ||
root['clients'].update({srv_id: srv_dict}) | ||
|
||
servers = hosts.filter(ertype__in=ERTYPE_ROLES.IDP) | ||
|
@@ -2562,6 +2574,11 @@ def servdata(request): | |
srv_dict['label'] = srv.name | ||
srv_dict['secret'] = srv.secret | ||
srv_dict['status_server'] = bool(srv.status_server) | ||
srv_dict['addr_type'] = srv.addr_type | ||
srv_dict['proto'] = srv.proto | ||
if srv.proto == RADPROTOS.TLSPSK: | ||
srv_dict['psk_identity'] = srv.psk_identity | ||
srv_dict['psk_key'] = srv.psk_key | ||
root['servers'].update({srv_id: srv_dict}) | ||
|
||
if insts: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come the default values for
NRO_TLSPSK_REALM
is different insettings.py
than it is here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Razorfang , this is a change @ghalse did on my suggestion.
The value in settings.py is an intentionally invalid value that is used only when local_settings.py does not provide a value for
NRO_TLSPSK_REALM
and is there to prevent the code from breaking.This is a value to be customised by local deployments. Existing deployments that do not update local_settings.py will get the clearly invalid value.
As the two values server different purposes, it makes sense to me to have them different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as @vladimir-mencl-eresearch suggests, they're intentionally different. The local_settings.py.dist file contains example values and uses the same example domain as the rest of the file (and fortunately that's already a documentation domain). The settings.py file uses an intentionally invalid value and uses a domain reserved for that purpose. Both are consistent with RFC2606.