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
Last active March 25, 2024 23:39
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 / main.tf
Last active February 24, 2024 05:08
Terraform: Latest Amazon Linux 2 encrypted AMI (Terraform v0.11.3, aws provider v1.60.0)
resource "aws_ami_copy" "amazon-linux-2-encrypted" {
name = "${data.aws_ami.amazon-linux-2.name}-encrypted"
description = "${data.aws_ami.amazon-linux-2.description} (encrypted)"
source_ami_id = "${data.aws_ami.amazon-linux-2.id}"
source_ami_region = "${var.region}"
encrypted = true
tags {
ImageType = "encrypted-amzn2-linux"
}
@AlainODea
AlainODea / Okta_ACS_Issue.md
Last active June 10, 2023 21:39
Okta ACS RelayState issue exploration

An example with minimal dependencies is a loopback within an Okta Org.

Say you want to get to the admin interface of an Org. It's at:

/home/admin-entry

URL encoded (what you need for RelayState) that is:

@AlainODea
AlainODea / CertificateFingerprinter.java
Created October 28, 2017 23:49
Akamai-compatible certificate fingerprinting (for use with mutual TLS and Extract - Client Certificate - Hashed Fingerprint)
import javax.xml.bind.DatatypeConverter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
@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 / HelloCovariance.java
Last active November 16, 2022 12:31
Exception in thread "main" java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class HelloCovariance {
public static void main(String[] args) {
ConcurrentHashMap<String, String> properties = new ConcurrentHashMap<>();
Set<String> keySet = properties.keySet();
}
}
@AlainODea
AlainODea / main.tf
Last active August 22, 2022 14:17
Terraform: Latest Ubuntu 18.04 LTS encrypted AMI
resource "aws_ami_copy" "ubuntu-18_04-encrypted" {
name = "${data.aws_ami.ubuntu-18_04.name}-encrypted"
description = "${data.aws_ami.ubuntu-18_04.description} (encrypted)"
source_ami_id = "${data.aws_ami.ubuntu-18_04.id}"
source_ami_region = "${var.region}"
encrypted = true
tags {
ImageType = "encrypted-ubuntu-18_04"
}
@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 / Get-IdP-Settings-From-SP.ps1
Last active December 4, 2020 09:14
PowerShell scripts for pulling SAML IdP and SP settings from metadata, with AD FS and Okta examples. Get the last (or only) signing key from WS-Federation FederationMetadata.xml like AD FS publishes for signature certificate rollover (PowerShell)
# Get settings to enter on the Identity Provider (IdP) to allow authentication to Service Provider (SP)
function Get-IdP-Settings-From-SP($Metadata) {
[xml]$SPMetadata = $Metadata
$SPAssertionConsumerServiceURL = $SPMetadata.EntityDescriptor.SPSSODescriptor.AssertionConsumerService |
? {$_.Binding -eq "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"} |
% {$_.Location}
$SPIssuerURI = $SPMetadata.EntityDescriptor.entityID
$SPSignatureCertificate = $SPMetadata.EntityDescriptor.SPSSODescriptor.KeyDescriptor |
? {$_.use -eq "signing"} |
Select-Object -Last 1 |
@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.