ff651fa9483a59cccc59d78d1a78d2b946bb552f — Gregory Anders 2 years ago 2b8f0f7
Simplify CSP
2 files changed, 32 insertions(+), 8 deletions(-)

M content/blog/caching-ldap-queries-in-mutt.md
M netlify.toml
M content/blog/caching-ldap-queries-in-mutt.md => content/blog/caching-ldap-queries-in-mutt.md +30 -1
@@ 17,7 17,36 @@ future recipients can be found in the aliases file, which is significantly

The following script does exactly this:
{{< gist gpanders e700b59c49d26528a93246a4c3c8facf >}}

# Query lbdbq and save results to Mutt alias file

set -e

# Mutt aliases file to save results to

# Only save email addresses from $DOMAIN. Leave empty to save all email addresses

query_and_cache() {
    results=$(lbdbq "$@" 2>/dev/null)

    printf '%s\n' "$results"

    # Remove first line from results
    results=$(sed '1d' <<< "$results")

    # Format results like mutt aliases
    sed -E $'s/^([[:alnum:]_.]+)@([[:alnum:]_.]+)\t([[:alnum:] -]+)/alias \\1 \\1@\\2 (\\3)/' <<< "$results" | awk -v domain="$DOMAIN" '$3 ~ domain {$2=tolower($2);print}' >> "$ALIASES"

    # Sort and remove duplicates
    sort -u -o "$ALIASES" "$ALIASES"

query_and_cache "$@"

The script queries your LDAP server using `lbdbq` and returns those "raw"
results to Mutt so that you can make your selection. However, it also reformats

M netlify.toml => netlify.toml +2 -7
@@ 16,16 16,11 @@
  for = "/*"
    Content-Security-Policy = "default-src 'self'; script-src 'self' 'sha256-8S1XWfApyYBGTRzR9CQ2UBCcYX34oUCUVY/1zndCEd4='; img-src 'self' https://stats.gpanders.com/count"
    Content-Security-Policy = "default-src 'self'; script-src 'self' 'sha256-8S1XWfApyYBGTRzR9CQ2UBCcYX34oUCUVY/1zndCEd4='"
    X-Content-Type-Options = "nosniff"
    X-Frame-Options = "SAMEORIGIN"

  for = "/blog/caching-ldap-queries-in-mutt/"
    Content-Security-Policy = "default-src 'self'; script-src 'self' 'sha256-8S1XWfApyYBGTRzR9CQ2UBCcYX34oUCUVY/1zndCEd4='; img-src 'self' https://stats.gpanders.com/count; script-src 'self' https://gist.github.com; style-src 'self' 'unsafe-inline' https://github.githubassets.com"

  for = "/blog/introducing-ijq/"
    Content-Security-Policy = "default-src 'self'; script-src 'self' 'sha256-8S1XWfApyYBGTRzR9CQ2UBCcYX34oUCUVY/1zndCEd4='; img-src 'self' https://stats.gpanders.com/count https://asciinema.org"
    Content-Security-Policy = "default-src 'self'; script-src 'self' 'sha256-8S1XWfApyYBGTRzR9CQ2UBCcYX34oUCUVY/1zndCEd4='"