diff --git a/cyhy/mailer/CyhyMessage.py b/cyhy/mailer/CyhyMessage.py index b01d68c..643ef65 100644 --- a/cyhy/mailer/CyhyMessage.py +++ b/cyhy/mailer/CyhyMessage.py @@ -29,7 +29,7 @@ class CyhyMessage(ReportMessage): Subject = "{{acronym}} - Cyber Hygiene Report - {{report_date}} Results" - TextBody = """Greetings {{acronym}}, + TextBody = """Greetings {{name}} ({{acronym}}), The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.) @@ -57,7 +57,7 @@ class CyhyMessage(ReportMessage): HtmlBody = """
-Greetings {{acronym}},
+Greetings {{name}} ({{acronym}}),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
@@ -91,6 +91,7 @@ def __init__( to_addrs, pdf_filename, entity_acronym, + entity_name, report_date, tech_pocs, from_addr=Message.DefaultFrom, @@ -113,6 +114,10 @@ def __init__( The acronym used by the entity corresponding to the CYHY report attachment. + entity_name : str + The name of the entity corresponding to the CYHY report + attachment. + report_date : str The date corresponding to the CYHY report attachment. We have been using dates of the form December 12, 2017. @@ -140,8 +145,9 @@ def __init__( # This is the data mustache will use to render the templates mustache_data = { "acronym": entity_acronym, - "report_date": report_date, "has_tech_pocs": len(tech_pocs) != 0, + "name": entity_name, + "report_date": report_date, "tech_pocs": tech_pocs, } diff --git a/cyhy/mailer/CyhyNotificationMessage.py b/cyhy/mailer/CyhyNotificationMessage.py index 63d37d9..2323233 100644 --- a/cyhy/mailer/CyhyNotificationMessage.py +++ b/cyhy/mailer/CyhyNotificationMessage.py @@ -29,7 +29,7 @@ class CyhyNotificationMessage(ReportMessage): Subject = "{{acronym}} - Cyber Hygiene Alert - {{report_date}}" - TextBody = """Greetings {{acronym}}, + TextBody = """Greetings {{name}} ({{acronym}}), Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following: * New critical, high, and/or known exploited vulnerabilities @@ -58,7 +58,7 @@ class CyhyNotificationMessage(ReportMessage): HtmlBody = """ -Greetings {{acronym}},
+Greetings {{name}} ({{acronym}}),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings {{acronym}},
+Greetings {{name}} ({{acronym}}),
Attached is your latest HTTPS Report.
This report is intended to assist your agency in complying with OMB M-15-13 and CISA Binding Operational Directive 18-01.
This report includes all second-level .gov domains your agency owns and many known subdomains. Subdomains are gleaned from Cyber Hygiene scans, the General Services Administration's Digital Analytics Program, Censys.io, and data from the End of Term Web Archive. The data in this report comes from a scan that took place on {{report_date}}.
@@ -98,6 +98,7 @@ def __init__( to_addrs, pdf_filename, entity_acronym, + entity_name, report_date, from_addr=Message.DefaultFrom, cc_addrs=Message.DefaultCc, @@ -119,6 +120,10 @@ def __init__( The acronym used by the entity corresponding to the Trustworthy Email report attachment. + entity_name : str + The name of the entity corresponding to the Trustworthy Email + report attachment. + report_date : str The date corresponding to the Trustworthy Email report attachment. We have been using dates of the form December @@ -137,7 +142,11 @@ def __init__( """ # This is the data mustache will use to render the templates - mustache_data = {"acronym": entity_acronym, "report_date": report_date} + mustache_data = { + "acronym": entity_acronym, + "name": entity_name, + "report_date": report_date, + } # Render the templates subject = chevron.render(HttpsMessage.Subject, mustache_data) diff --git a/cyhy/mailer/TmailMessage.py b/cyhy/mailer/TmailMessage.py index 99b9564..a3b41f3 100644 --- a/cyhy/mailer/TmailMessage.py +++ b/cyhy/mailer/TmailMessage.py @@ -29,7 +29,7 @@ class TmailMessage(ReportMessage): Subject = "{{acronym}} - Trustworthy Email Report - {{report_date}} Results" - TextBody = """Greetings {{acronym}}, + TextBody = """Greetings {{name}} ({{acronym}}), Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on {{report_date}}. @@ -63,7 +63,7 @@ class TmailMessage(ReportMessage):Greetings {{acronym}},
+Greetings {{name}} ({{acronym}}),
Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on {{report_date}}.
CISA Binding Operational Directive 18-01 requires your agency to take certain actions relevant to the data in this report:
Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
@@ -79,13 +82,16 @@ def test_four_params_single_recipient_multiple_pocs(self): to = ["recipient@example.com"] pdf = "./tests/data/pdf-sample.pdf" entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" tech_pocs = [ {"name": "Cixin Liu", "email": "cixin@liu.com"}, {"name": "Alastair Reynolds", "email": "alastair@reynolds.com"}, ] - message = CyhyMessage(to, pdf, entity_acronym, report_date, tech_pocs) + message = CyhyMessage( + to, pdf, entity_acronym, entity_name, report_date, tech_pocs + ) self.assertEqual(message["From"], "reports@cyber.dhs.gov") self.assertEqual( @@ -106,7 +112,7 @@ def test_four_params_single_recipient_multiple_pocs(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - text_body = """Greetings CLARKE, + text_body = """Greetings Clarke of Kent (CLARKE), The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.) @@ -134,7 +140,7 @@ def test_four_params_single_recipient_multiple_pocs(self): html_body = """ -Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
@@ -169,10 +175,13 @@ def test_four_params_multiple_recipients_one_poc(self): to = ["recipient@example.com", "recipient2@example.com"] pdf = "./tests/data/pdf-sample.pdf" entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" tech_pocs = [{"name": "Cixin Liu", "email": "cixin@liu.com"}] - message = CyhyMessage(to, pdf, entity_acronym, report_date, tech_pocs) + message = CyhyMessage( + to, pdf, entity_acronym, entity_name, report_date, tech_pocs + ) self.assertEqual(message["From"], "reports@cyber.dhs.gov") self.assertEqual( @@ -193,7 +202,7 @@ def test_four_params_multiple_recipients_one_poc(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.) @@ -218,7 +227,7 @@ def test_four_params_multiple_recipients_one_poc(self): html_body = """ -Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
@@ -252,6 +261,7 @@ def test_six_params_single_cc_one_poc(self): cc = ["cc@example.com"] bcc = ["bcc@example.com"] entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" tech_pocs = [{"name": "Cixin Liu", "email": "cixin@liu.com"}] @@ -259,6 +269,7 @@ def test_six_params_single_cc_one_poc(self): to, pdf, entity_acronym, + entity_name, report_date, tech_pocs, from_addr=fm, @@ -285,7 +296,7 @@ def test_six_params_single_cc_one_poc(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.) @@ -310,7 +321,7 @@ def test_six_params_single_cc_one_poc(self): html_body = """ -Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
@@ -344,6 +355,7 @@ def test_six_params_multiple_cc_one_poc(self): cc = ["cc@example.com", "cc2@example.com"] bcc = ["bcc@example.com", "bcc2@example.com"] entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" tech_pocs = [{"name": "Cixin Liu", "email": "cixin@liu.com"}] @@ -351,6 +363,7 @@ def test_six_params_multiple_cc_one_poc(self): to, pdf, entity_acronym, + entity_name, report_date, tech_pocs, from_addr=fm, @@ -377,7 +390,7 @@ def test_six_params_multiple_cc_one_poc(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.) @@ -402,7 +415,7 @@ def test_six_params_multiple_cc_one_poc(self): html_body = """ -Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
The Cyber Hygiene scan results are attached for your review. Same password as before. (If this is your first report and you have yet to receive a password, please let us know.)
diff --git a/tests/test_cyhynotificationmessage.py b/tests/test_cyhynotificationmessage.py index 9564f34..20e95e7 100644 --- a/tests/test_cyhynotificationmessage.py +++ b/tests/test_cyhynotificationmessage.py @@ -15,11 +15,12 @@ def test_four_params_single_recipient_fed(self): to = ["recipient@example.com"] pdf = "./tests/data/pdf-sample.pdf" entity_acronym = "FEDTEST" + entity_name = "Federal Test" is_federal = True report_date = "December 15, 2001" message = CyhyNotificationMessage( - to, pdf, entity_acronym, is_federal, report_date + to, pdf, entity_acronym, entity_name, is_federal, report_date ) self.assertEqual(message["From"], "reports@cyber.dhs.gov") @@ -41,7 +42,7 @@ def test_four_params_single_recipient_fed(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - text_body = """Greetings FEDTEST, + text_body = """Greetings Federal Test (FEDTEST), Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following: * New critical, high, and/or known exploited vulnerabilities @@ -71,7 +72,7 @@ def test_four_params_single_recipient_fed(self): html_body = """ -Greetings FEDTEST,
+Greetings Federal Test (FEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings FEDTEST,
+Greetings Federal Test (FEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings FEDTEST,
+Greetings Federal Test (FEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings FEDTEST,
+Greetings Federal Test (FEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings NONFEDTEST,
+Greetings Non-Federal Test (NONFEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings NONFEDTEST,
+Greetings Non-Federal Test (NONFEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings NONFEDTEST,
+Greetings Non-Federal Test (NONFEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings NONFEDTEST,
+Greetings Non-Federal Test (NONFEDTEST),
Cyber Hygiene scans of your host(s) conducted in the past day have detected one or more of the following:
Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your latest HTTPS Report.
This report is intended to assist your agency in complying with OMB M-15-13 and CISA Binding Operational Directive 18-01.
This report includes all second-level .gov domains your agency owns and many known subdomains. Subdomains are gleaned from Cyber Hygiene scans, the General Services Administration's Digital Analytics Program, Censys.io, and data from the End of Term Web Archive. The data in this report comes from a scan that took place on December 15, 2001.
@@ -108,9 +109,10 @@ def test_four_params_multiple_recipients(self): to = ["recipient@example.com", "recipient2@example.com"] pdf = "./tests/data/pdf-sample.pdf" entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" - message = HttpsMessage(to, pdf, entity_acronym, report_date) + message = HttpsMessage(to, pdf, entity_acronym, entity_name, report_date) self.assertEqual(message["From"], "reports@cyber.dhs.gov") self.assertEqual( @@ -130,7 +132,7 @@ def test_four_params_multiple_recipients(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), Attached is your latest HTTPS Report. @@ -167,7 +169,7 @@ def test_four_params_multiple_recipients(self):Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your latest HTTPS Report.
This report is intended to assist your agency in complying with OMB M-15-13 and CISA Binding Operational Directive 18-01.
This report includes all second-level .gov domains your agency owns and many known subdomains. Subdomains are gleaned from Cyber Hygiene scans, the General Services Administration's Digital Analytics Program, Censys.io, and data from the End of Term Web Archive. The data in this report comes from a scan that took place on December 15, 2001.
@@ -204,12 +206,14 @@ def test_six_params_single_cc(self): cc = ["cc@example.com"] bcc = ["bcc@example.com"] entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" message = HttpsMessage( to, pdf, entity_acronym, + entity_name, report_date, from_addr=fm, cc_addrs=cc, @@ -234,7 +238,7 @@ def test_six_params_single_cc(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), Attached is your latest HTTPS Report. @@ -271,7 +275,7 @@ def test_six_params_single_cc(self):Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your latest HTTPS Report.
This report is intended to assist your agency in complying with OMB M-15-13 and CISA Binding Operational Directive 18-01.
This report includes all second-level .gov domains your agency owns and many known subdomains. Subdomains are gleaned from Cyber Hygiene scans, the General Services Administration's Digital Analytics Program, Censys.io, and data from the End of Term Web Archive. The data in this report comes from a scan that took place on December 15, 2001.
@@ -308,12 +312,14 @@ def test_six_params_multiple_cc(self): cc = ["cc@example.com", "cc2@example.com"] bcc = ["bcc@example.com", "bcc2@example.com"] entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" message = HttpsMessage( to, pdf, entity_acronym, + entity_name, report_date, from_addr=fm, cc_addrs=cc, @@ -338,7 +344,7 @@ def test_six_params_multiple_cc(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - body = """Greetings CLARKE, + body = """Greetings Clarke of Kent (CLARKE), Attached is your latest HTTPS Report. @@ -375,7 +381,7 @@ def test_six_params_multiple_cc(self):Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your latest HTTPS Report.
This report is intended to assist your agency in complying with OMB M-15-13 and CISA Binding Operational Directive 18-01.
This report includes all second-level .gov domains your agency owns and many known subdomains. Subdomains are gleaned from Cyber Hygiene scans, the General Services Administration's Digital Analytics Program, Censys.io, and data from the End of Term Web Archive. The data in this report comes from a scan that took place on December 15, 2001.
diff --git a/tests/test_tmailmessage.py b/tests/test_tmailmessage.py index 745531c..6c7a001 100644 --- a/tests/test_tmailmessage.py +++ b/tests/test_tmailmessage.py @@ -15,9 +15,10 @@ def test_four_params_single_recipient(self): to = ["recipient@example.com"] pdf = "./tests/data/pdf-sample.pdf" entity_acronym = "CLARKE" + entity_name = "Clarke of Kent" report_date = "December 15, 2001" - message = TmailMessage(to, pdf, entity_acronym, report_date) + message = TmailMessage(to, pdf, entity_acronym, entity_name, report_date) self.assertEqual(message["From"], "reports@cyber.dhs.gov") self.assertEqual( @@ -38,7 +39,7 @@ def test_four_params_single_recipient(self): self.assertEqual(part.get_payload(decode=True), bytes) self.assertEqual(part.get_filename(), "pdf-sample.pdf") elif part.get_content_type() == "text/plain": - text_body = """Greetings CLARKE, + text_body = """Greetings Clarke of Kent (CLARKE), Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on December 15, 2001. @@ -73,7 +74,7 @@ def test_four_params_single_recipient(self):Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on December 15, 2001.
CISA Binding Operational Directive 18-01 requires your agency to take certain actions relevant to the data in this report:
Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on December 15, 2001.
CISA Binding Operational Directive 18-01 requires your agency to take certain actions relevant to the data in this report:
Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on December 15, 2001.
CISA Binding Operational Directive 18-01 requires your agency to take certain actions relevant to the data in this report:
Greetings CLARKE,
+Greetings Clarke of Kent (CLARKE),
Attached is your Trustworthy Email Report. This report presents your organization's support of SPF and DMARC, two email authentication standards, as published at your .gov domains. The data in this report comes from a scan that took place on December 15, 2001.
CISA Binding Operational Directive 18-01 requires your agency to take certain actions relevant to the data in this report: