Skip to content

Instantly share code, notes, and snippets.

@mitcdh
Created August 31, 2018 01:23
Show Gist options
  • Save mitcdh/a7ec4a2ceaeeaf5509cb2f939ae6b308 to your computer and use it in GitHub Desktop.
Save mitcdh/a7ec4a2ceaeeaf5509cb2f939ae6b308 to your computer and use it in GitHub Desktop.
Exim Filter for Australian Government protective marking expansion
# Exim filter
# Only run this on the first pass through the filter
if not first_delivery then
finish
endif
# Trap any errors
if error_message then
finish
endif
# Expand Email Protective Marking shortcuts
if "$h_subject:" ends " mmuo"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmuo\\$}{ [SEC=UNOFFICIAL]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, SEC=UNOFFICIAL, ORIGIN=$sender_address"
elif "$h_subject:" ends " mmuc"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmuc\\$}{ [SEC=UNCLASSIFIED]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, SEC=UNCLASSIFIED, ORIGIN=$sender_address"
elif "$h_subject:" ends " mmfo"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmfo\\$}{ [DLM=For-Official-Use-Only]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, DLM=For-Official-Use-Only, ORIGIN=$sender_address"
elif "$h_subject:" ends " mmse"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmse\\$}{ [DLM=Sensitive]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, DLM=Sensitive, ORIGIN=$sender_address"
elif "$h_subject:" ends " mmsp"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmsp\\$}{ [DLM=Sensitive:Personal]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, DLM=Sensitive:Personal, ORIGIN=$sender_address"
elif "$h_subject:" ends " mmsl"
then
headers add "Expanded-Subject: ${sg{$h_subject:}{ mmsl\\$}{ [DLM=Sensitive:Legal]}}"
headers remove subject
headers add "Subject: $h_expanded-subject:"
headers remove expanded-subject
headers add "X-Protective-Marking: VER=2012.3, NS=gov.au, DLM=Sensitive:Legal, ORIGIN=$sender_address"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment