Skip to content

Instantly share code, notes, and snippets.

View scarolan's full-sized avatar
🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar

Sean Carolan scarolan

🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar
View GitHub Profile
@scarolan
scarolan / setup.ps1
Created January 5, 2019 15:55
Does some setup and housekeeping on the workstation.
# Post-install steps for HashiCorp training workstation
git config --global core.autocrlf false
install-module posh-git -AllowClobber
resource "azurerm_network_security_group" "catapp-sg" {
name = "${var.prefix}-sg"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.myresourcegroup.name}"
security_rule {
name = "HTTP"
priority = 100
direction = "Inbound"
access = "Allow"
@scarolan
scarolan / network_troubleshooting.md
Last active August 9, 2019 17:42
Useful network troubleshooting commands

Handy Network Troubleshooting Commands

Nmap

Nmap is an all-purpose network and port scanner. It can scan hundreds of hosts and ports quickly, across a variety of protocols and situations. Here are a few basic commands that you can use:

Check that ports 8200 and 8201 are listening on a host. The Pn flag tells nmap to skip the preliminary ping to see if the host is up.

nmap -p 8200,8201 10.0.1.10 -Pn
#!/bin/sh
lolcat <<EOF
' ..
,xNX :WO:
.dXWWWX :WWWW.
.lKWWWWWWX :WWWW. :.
.lKWWWWWWWWk, :WWWW. OWKl.
0WWWWWWW0c :WWWW. OWWW0
0WWWWXo. ; :WWWW. OWWW0
0WWWW' ,kWX :WWWW. OWWW0
url - https://aws.amazon.com/blogs/security/a-safer-way-to-distribute-aws-credentials-to-ec2/
Finding hard-coded credentials in your code
Hopefully you’re excited about deploying credentials to EC2 that are automatically rotated. Now that you’re using Roles, a good security practice would be to go through your code and remove any references to AKID/Secret. We suggest running the following regular expressions against your code base:
Search for access key IDs: (?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9]). In English, this regular expression says: Find me 20-character, uppercase, alphanumeric strings that don’t have any uppercase, alphanumeric characters immediately before or after.
Search for secret access keys: (?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=]). In English, this regular expression says: Find me 40-character, base-64 strings that don’t have any base 64 characters immediately before or after.
If grep is your preferred tool, run a recursive, Perl-compatible search using the following commands
@scarolan
scarolan / zsh_stuff.sh
Created August 7, 2020 18:59
zsh_stuff
# Aliases
alias ls='lsd'
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
alias e='explorer.exe'
# Useful cd paths
setopt auto_cd
@scarolan
scarolan / main.tf
Created January 28, 2021 22:26
Terraform for Lacework AWS Cloudtrail and Config
terraform {
required_providers {
lacework = {
source = "lacework/lacework"
version = "~> 0.2.7"
}
}
}
provider "aws" {}
provider "lacework" {}
@scarolan
scarolan / azure_terraform_example.tf
Created August 27, 2021 22:17
An example snippet of Terraform code for Azure
resource "azurerm_resource_group" "example" {
name = "example"
location = "Central US"
}
@scarolan
scarolan / instruqt_style.css
Created December 3, 2021 14:23
Example CSS file
summary { color: cyan; }
hr.cyan { background-color: cyan; }
hr.thick { background-color: cyan; color: cyan; height: 2px; }
h2.cyan { color: cyan; }