Skip to content

Instantly share code, notes, and snippets.

View AlainODea's full-sized avatar

Alain O'Dea AlainODea

View GitHub Profile
@AlainODea
AlainODea / README.md
Created December 18, 2020 05:29
Salesforce Flow InvocableMethod plugin for sending Lightning Email Templates

Salesforce Flow InvocableMethod plugin for sending Lightning Email Templates

This is an example implementation of supporting sending Lightning Email Templates from a Flow using @InvocableMethod.

Notes

Example__c won't necessarily exist or have matching fields. It is in here to inspire what you might do.

If you want to try this unmodified, you'll need to create a custom Object with an API name of Example. It will need to have fields with API names Email__c (Lookup(Contact)) and ExampleEmail__c (String or Email).

@AlainODea
AlainODea / alienvault.py
Created July 23, 2020 23:44
Example of connecting to AlienVault API using Python Requests 2 and Requests-OAuthlib
import json
from requests.auth import HTTPBasicAuth
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
from getpass import getpass
domain = "alienvault.cloud"
subdomain = "example" # use your actual subdomain
@AlainODea
AlainODea / README.md
Last active June 15, 2020 18:15
Allowing Microsoft Update through a transparent Squid TLS proxy

Allowing Microsoft Update through a transparent Squid TLS proxy

Using Squid and getting TAG_NONE on sls.update.microsoft.com and several other domains?

Root Cause

The problem is certificate related. These domains use Microsoft Root Certificate Authority 2011 which is not publicly trusted. It is trusted by Windows, but not in general.

Remedy

@AlainODea
AlainODea / README.md
Last active September 3, 2020 00:45
An Amazon Linux 2 Squid web proxy with a SASL-authenticated Postfix Implicit TLS for SMTP Submission relay to Amazon SES built with Packer and Terraform

Squid and Postfix SES Relay

A Squid transparent proxy server with Postfix configured as a SASL-authenticated SMTP relay to Amazon Simple Email Service (SES).

How do you use this module?

  • See the root README for instructions on using Terraform modules.
  • See variables.tf for all the variables you can set on this module.
  • See outputs.tf for all outputs you can get from this module in a terraform_remote_state data source.
@AlainODea
AlainODea / legal_fargate_configurations.md
Last active May 13, 2020 13:31
No Fargate configuration exists for given values
@AlainODea
AlainODea / Dockerfile
Created April 8, 2020 18:58
Circle CI multi-version Terraform Dockerfile with Gruntwork tools (you need a Gruntwork subscription to use them)
# The CircleCi builds will run in the Docker image built from this Dockerfile. To build a new image:
#
# 1. docker build -t <ACCOUNT_ID>.dkr.ecr.ca-central-1.amazonaws.com/circle-ci-build:<VERSION> --build-arg GITHUB_OAUTH_TOKEN=<YOUR_TOKEN> .
# 2. eval "$(aws ecr get-login --region ca-central-1 --no-include-email)"
# 3. docker push <ACCOUNT_ID>.dkr.ecr.ca-central-1.amazonaws.com/circle-ci-build:<VERSION>
# 4. Update the image setting in config.yml to your new VERSION.
#
# Note that we use a multi-stage build. This allows us to pass in the GITHUB_OAUTH_TOKEN secret (which we use to access
# the private gruntwork-io repos) as a build arg without it being stored in the build history. For more info, see:
#
@AlainODea
AlainODea / README.md
Last active June 6, 2024 02:17
Terragrunt config to auto-generate provider and backend config so you can apply library modules directly in infrastructure-live without an adapter module in infrastructure-modules

Using Terragrunt generate for extra DRY Terraform

Terragrunt config to auto-generate provider and backend config so you can apply library modules directly in infrastructure-live without an adapter module in infrastructure-modules.

@AlainODea
AlainODea / lambda_function.py
Created October 30, 2019 18:52
Providing encrypted environment variables to a Lambda decrypted on boot
from lib.secret_config import load_secret_config_from_env
def lambda_handler(event, context):
"""
The Handler function, which receives the lambda event and orchestrates the
response. It is called and passed args by Lambda.
Args:
event: The lambda event, which includes arguments from API Gateway.
context: Info about the execution context of the lambda.
"""
@AlainODea
AlainODea / DocumentBuilderFactory_XXE_mitigation.md
Last active May 17, 2021 02:45
DocumentBuilderFactory that mitigates XXE using OWASP guidance

Recommended mitigation:

Replace this dangerous code:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.isIgnoringElementContentWhitespace();
DocumentBuilder builder = factory.newDocumentBuilder();
@AlainODea
AlainODea / w.tf
Created December 18, 2018 18:24
A Terraform module that cannot be constructed (Error: module "WTF": missing required argument "version")
variable "version" {}