mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 19:48:36 +02:00
merge main
This commit is contained in:
commit
89a65e597f
7 changed files with 111 additions and 6 deletions
|
@ -46,7 +46,7 @@ This is a standard Django secret key. See Django documentation for tips on gener
|
||||||
|
|
||||||
This is the base64 encoded private key used in the OpenID Connect authentication flow with Login.gov. It is used to sign a token during user login; the signature is examined by Login.gov before their API grants access to user data.
|
This is the base64 encoded private key used in the OpenID Connect authentication flow with Login.gov. It is used to sign a token during user login; the signature is examined by Login.gov before their API grants access to user data.
|
||||||
|
|
||||||
Generate a new key using this command (or whatever is most recently recommended by Login.gov):
|
Generate a new key using this command (or whatever is most recently [recommended by Login.gov](https://developers.login.gov/testing/#creating-a-public-certificate)):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private.pem -out public.crt
|
openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private.pem -out public.crt
|
||||||
|
|
|
@ -256,7 +256,6 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
hostList = []
|
hostList = []
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
hostList.append((host["name"], host["addrs"]))
|
hostList.append((host["name"], host["addrs"]))
|
||||||
|
|
||||||
return hostList
|
return hostList
|
||||||
|
|
||||||
def _create_host(self, host, addrs):
|
def _create_host(self, host, addrs):
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
{% url 'domain-dns-nameservers' pk=domain.id as url %}
|
{% url 'domain-dns-nameservers' pk=domain.id as url %}
|
||||||
{% if domain.nameservers|length > 0 %}
|
{% if domain.nameservers|length > 0 %}
|
||||||
{% include "includes/summary_item.html" with title='DNS name servers' value=domain.nameservers list='true' edit_link=url %}
|
{% include "includes/summary_item.html" with title='DNS name servers' domains='true' value=domain.nameservers list='true' edit_link=url %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2 class="margin-top-neg-1"> DNS name servers </h2>
|
<h2 class="margin-top-neg-1"> DNS name servers </h2>
|
||||||
<p> No DNS name servers have been added yet. Before your domain can be used we’ll need information about your domain name servers.</p>
|
<p> No DNS name servers have been added yet. Before your domain can be used we’ll need information about your domain name servers.</p>
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include "includes/contact.html" with contact=value %}
|
{% include "includes/contact.html" with contact=value %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- TODO #687 add here another elif for nameservers to show item Ips -->
|
|
||||||
{% elif list %}
|
{% elif list %}
|
||||||
{% if value|length == 1 %}
|
{% if value|length == 1 %}
|
||||||
{% if users %}
|
{% if users %}
|
||||||
|
@ -56,6 +55,17 @@
|
||||||
{% for item in value %}
|
{% for item in value %}
|
||||||
{% if users %}
|
{% if users %}
|
||||||
<li>{{ item.user.email }}</li>
|
<li>{{ item.user.email }}</li>
|
||||||
|
{% elif domains %}
|
||||||
|
<li>
|
||||||
|
{{ item.0 }}
|
||||||
|
{% if item.1 %}
|
||||||
|
({% spaceless %}
|
||||||
|
{% for addr in item.1 %}
|
||||||
|
{{addr}}{% if not forloop.last %}, {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endspaceless %})
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li>{{ item }}</li>
|
<li>{{ item }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -738,6 +738,7 @@ class MockEppLib(TestCase):
|
||||||
"ns1.cats-are-superior3.com",
|
"ns1.cats-are-superior3.com",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
infoDomainNoHost = fakedEppObject(
|
infoDomainNoHost = fakedEppObject(
|
||||||
"my-nameserver.gov",
|
"my-nameserver.gov",
|
||||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||||
|
@ -793,7 +794,20 @@ class MockEppLib(TestCase):
|
||||||
infoDomainHasIP = fakedEppObject(
|
infoDomainHasIP = fakedEppObject(
|
||||||
"nameserverwithip.gov",
|
"nameserverwithip.gov",
|
||||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||||
contacts=[],
|
contacts=[
|
||||||
|
common.DomainContact(
|
||||||
|
contact="securityContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.SECURITY,
|
||||||
|
),
|
||||||
|
common.DomainContact(
|
||||||
|
contact="technicalContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.TECHNICAL,
|
||||||
|
),
|
||||||
|
common.DomainContact(
|
||||||
|
contact="adminContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.ADMINISTRATIVE,
|
||||||
|
),
|
||||||
|
],
|
||||||
hosts=[
|
hosts=[
|
||||||
"ns1.nameserverwithip.gov",
|
"ns1.nameserverwithip.gov",
|
||||||
"ns2.nameserverwithip.gov",
|
"ns2.nameserverwithip.gov",
|
||||||
|
@ -802,6 +816,29 @@ class MockEppLib(TestCase):
|
||||||
addrs=[common.Ip(addr="1.2.3.4"), common.Ip(addr="2.3.4.5")],
|
addrs=[common.Ip(addr="1.2.3.4"), common.Ip(addr="2.3.4.5")],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
justNameserver = fakedEppObject(
|
||||||
|
"justnameserver.com",
|
||||||
|
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||||
|
contacts=[
|
||||||
|
common.DomainContact(
|
||||||
|
contact="securityContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.SECURITY,
|
||||||
|
),
|
||||||
|
common.DomainContact(
|
||||||
|
contact="technicalContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.TECHNICAL,
|
||||||
|
),
|
||||||
|
common.DomainContact(
|
||||||
|
contact="adminContact",
|
||||||
|
type=PublicContact.ContactTypeChoices.ADMINISTRATIVE,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
hosts=[
|
||||||
|
"ns1.justnameserver.com",
|
||||||
|
"ns2.justnameserver.com",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
infoDomainCheckHostIPCombo = fakedEppObject(
|
infoDomainCheckHostIPCombo = fakedEppObject(
|
||||||
"nameserversubdomain.gov",
|
"nameserversubdomain.gov",
|
||||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||||
|
@ -922,6 +959,7 @@ class MockEppLib(TestCase):
|
||||||
"threenameserversDomain.gov": (self.infoDomainThreeHosts, None),
|
"threenameserversDomain.gov": (self.infoDomainThreeHosts, None),
|
||||||
"defaultsecurity.gov": (self.InfoDomainWithDefaultSecurityContact, None),
|
"defaultsecurity.gov": (self.InfoDomainWithDefaultSecurityContact, None),
|
||||||
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None),
|
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None),
|
||||||
|
"justnameserver.com": (self.justNameserver, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Retrieve the corresponding values from the dictionary
|
# Retrieve the corresponding values from the dictionary
|
||||||
|
|
|
@ -1099,6 +1099,13 @@ class TestWithDomainPermissions(TestWithUser):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.domain, _ = Domain.objects.get_or_create(name="igorville.gov")
|
self.domain, _ = Domain.objects.get_or_create(name="igorville.gov")
|
||||||
|
self.domain_with_ip, _ = Domain.objects.get_or_create(
|
||||||
|
name="nameserverwithip.gov"
|
||||||
|
)
|
||||||
|
self.domain_just_nameserver, _ = Domain.objects.get_or_create(
|
||||||
|
name="justnameserver.com"
|
||||||
|
)
|
||||||
|
|
||||||
self.domain_dsdata, _ = Domain.objects.get_or_create(name="dnssec-dsdata.gov")
|
self.domain_dsdata, _ = Domain.objects.get_or_create(name="dnssec-dsdata.gov")
|
||||||
self.domain_multdsdata, _ = Domain.objects.get_or_create(
|
self.domain_multdsdata, _ = Domain.objects.get_or_create(
|
||||||
name="dnssec-multdsdata.gov"
|
name="dnssec-multdsdata.gov"
|
||||||
|
@ -1108,9 +1115,11 @@ class TestWithDomainPermissions(TestWithUser):
|
||||||
self.domain_dnssec_none, _ = Domain.objects.get_or_create(
|
self.domain_dnssec_none, _ = Domain.objects.get_or_create(
|
||||||
name="dnssec-none.gov"
|
name="dnssec-none.gov"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user, domain=self.domain
|
creator=self.user, domain=self.domain
|
||||||
)
|
)
|
||||||
|
|
||||||
DomainInformation.objects.get_or_create(
|
DomainInformation.objects.get_or_create(
|
||||||
creator=self.user, domain=self.domain_dsdata
|
creator=self.user, domain=self.domain_dsdata
|
||||||
)
|
)
|
||||||
|
@ -1120,9 +1129,17 @@ class TestWithDomainPermissions(TestWithUser):
|
||||||
DomainInformation.objects.get_or_create(
|
DomainInformation.objects.get_or_create(
|
||||||
creator=self.user, domain=self.domain_dnssec_none
|
creator=self.user, domain=self.domain_dnssec_none
|
||||||
)
|
)
|
||||||
|
DomainInformation.objects.get_or_create(
|
||||||
|
creator=self.user, domain=self.domain_with_ip
|
||||||
|
)
|
||||||
|
DomainInformation.objects.get_or_create(
|
||||||
|
creator=self.user, domain=self.domain_just_nameserver
|
||||||
|
)
|
||||||
|
|
||||||
self.role, _ = UserDomainRole.objects.get_or_create(
|
self.role, _ = UserDomainRole.objects.get_or_create(
|
||||||
user=self.user, domain=self.domain, role=UserDomainRole.Roles.MANAGER
|
user=self.user, domain=self.domain, role=UserDomainRole.Roles.MANAGER
|
||||||
)
|
)
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(
|
UserDomainRole.objects.get_or_create(
|
||||||
user=self.user, domain=self.domain_dsdata, role=UserDomainRole.Roles.MANAGER
|
user=self.user, domain=self.domain_dsdata, role=UserDomainRole.Roles.MANAGER
|
||||||
)
|
)
|
||||||
|
@ -1136,6 +1153,16 @@ class TestWithDomainPermissions(TestWithUser):
|
||||||
domain=self.domain_dnssec_none,
|
domain=self.domain_dnssec_none,
|
||||||
role=UserDomainRole.Roles.MANAGER,
|
role=UserDomainRole.Roles.MANAGER,
|
||||||
)
|
)
|
||||||
|
UserDomainRole.objects.get_or_create(
|
||||||
|
user=self.user,
|
||||||
|
domain=self.domain_with_ip,
|
||||||
|
role=UserDomainRole.Roles.MANAGER,
|
||||||
|
)
|
||||||
|
UserDomainRole.objects.get_or_create(
|
||||||
|
user=self.user,
|
||||||
|
domain=self.domain_just_nameserver,
|
||||||
|
role=UserDomainRole.Roles.MANAGER,
|
||||||
|
)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
|
@ -1219,6 +1246,37 @@ class TestDomainOverview(TestWithDomainPermissions, WebTest):
|
||||||
response = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
response = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
|
def test_domain_see_just_nameserver(self):
|
||||||
|
home_page = self.app.get("/")
|
||||||
|
self.assertContains(home_page, "justnameserver.com")
|
||||||
|
|
||||||
|
# View nameserver on Domain Overview page
|
||||||
|
detail_page = self.app.get(
|
||||||
|
reverse("domain", kwargs={"pk": self.domain_just_nameserver.id})
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertContains(detail_page, "justnameserver.com")
|
||||||
|
self.assertContains(detail_page, "ns1.justnameserver.com")
|
||||||
|
self.assertContains(detail_page, "ns2.justnameserver.com")
|
||||||
|
|
||||||
|
def test_domain_see_nameserver_and_ip(self):
|
||||||
|
home_page = self.app.get("/")
|
||||||
|
self.assertContains(home_page, "nameserverwithip.gov")
|
||||||
|
|
||||||
|
# View nameserver on Domain Overview page
|
||||||
|
detail_page = self.app.get(
|
||||||
|
reverse("domain", kwargs={"pk": self.domain_with_ip.id})
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertContains(detail_page, "nameserverwithip.gov")
|
||||||
|
|
||||||
|
self.assertContains(detail_page, "ns1.nameserverwithip.gov")
|
||||||
|
self.assertContains(detail_page, "ns2.nameserverwithip.gov")
|
||||||
|
self.assertContains(detail_page, "ns3.nameserverwithip.gov")
|
||||||
|
# Splitting IP addresses bc there is odd whitespace and can't strip text
|
||||||
|
self.assertContains(detail_page, "(1.2.3.4,")
|
||||||
|
self.assertContains(detail_page, "2.3.4.5)")
|
||||||
|
|
||||||
|
|
||||||
class TestDomainManagers(TestDomainOverview):
|
class TestDomainManagers(TestDomainOverview):
|
||||||
def test_domain_managers(self):
|
def test_domain_managers(self):
|
||||||
|
|
|
@ -298,7 +298,7 @@ class DomainNameserversView(DomainFormBaseView):
|
||||||
# Remove any leading or trailing whitespace from each IP in the list
|
# Remove any leading or trailing whitespace from each IP in the list
|
||||||
# this will return [] if no ips have been entered, which is taken
|
# this will return [] if no ips have been entered, which is taken
|
||||||
# into account in the model in checkHostIPCombo
|
# into account in the model in checkHostIPCombo
|
||||||
ip_list = [ip.replace(" ", "") for ip in ip_list]
|
ip_list = [ip.replace(" ", "").strip() for ip in ip_list]
|
||||||
|
|
||||||
as_tuple = (
|
as_tuple = (
|
||||||
form.cleaned_data["server"],
|
form.cleaned_data["server"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue