Skip to content

Instantly share code, notes, and snippets.

View deanwilson's full-sized avatar

Dean Wilson deanwilson

View GitHub Profile
pdk build
pdk (INFO): This module is not compatible with PDK, so PDK can not validate or test this build. Unvalidated modules may have errors when uploading to the Forge. To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.
Continue build without converting? no
pdk (INFO): Build cancelled; exiting.
$ pdk convert
------------Files to be added-----------
git clone https://github.com/alphagov/govuk-puppet.git
cd govuk-puppet/
git log --format=format: --name-only --since=18.month | egrep -v '^$' | sort | uniq -c | sort -nr | head -15
198 hieradata/common.yaml
178 hieradata_aws/common.yaml
151 hieradata_aws/integration.yaml
143 Rakefile
123 hieradata_aws/staging.yaml
114 hieradata_aws/production.yaml
@deanwilson
deanwilson / gist:c2aa8268ed311aa75ad80c983b4ee840
Created November 24, 2020 16:41
IPSet to block todays SSH Bruteforce attempting IP addresses
cat ipset-fail2ban
ipset -N fail2ban-2020-11-24 iphash
ipset -A fail2ban-2020-11-24 1.0.212.34
ipset -A fail2ban-2020-11-24 1.186.57.150
ipset -A fail2ban-2020-11-24 1.202.76.226
ipset -A fail2ban-2020-11-24 1.214.220.227
ipset -A fail2ban-2020-11-24 1.245.61.144
ipset -A fail2ban-2020-11-24 2.184.52.194
ipset -A fail2ban-2020-11-24 2.228.87.194
@deanwilson
deanwilson / bad-ips
Last active December 20, 2020 23:33
SSH Bruteforces against a non-standard SSH port
1.0.212.34
1.179.185.50
1.186.57.150
1.194.238.187
1.202.76.226
1.202.77.210
1.209.229.179
1.214.156.164
1.214.220.227
1.214.245.27
extern crate rand;
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1, 101);
## cat main.tf
variable "vpc_id" {
type = string
description = "VPC ID to deploy to"
validation {
#condition = can(regex("^vpc-", var.vpc_id))
condition = length(var.vpc_id) > 4 && substr(var.vpc_id, 0, 4) == "vpc-"
error_message = "The vpc_id must be a valid VPC ID of the form 'vpc-'."
package main
deny[msg] {
input[i].Cmd == "from"
val := input[i].Value
image := val[0]
trace(image)
not re_match(".+@sha256:.{64}$", image)
## command
conftest test -i ini samples/multiple-repos-broken.repo
## Policy
cat policy/yum-repo-security-settings.rego
package main
deny[msg] {
reponame := input[_] # gets the contents of the structure, not the [foo] value.
not input[reponame].gpgcheck = 1
@deanwilson
deanwilson / .pre-commit-config.yaml
Last active June 27, 2024 20:52
File extension restrictions in pre-commit
repos:
- repo: local
hooks:
- id: restricted-filenames
name: Check commits for unexpected file extensions
entry: These file extensions are unusual and should be checked
language: fail
files: '.*\.(xlsx|doc)'
- id: restricted-file-types
name: Check commits for unexpected file types
@deanwilson
deanwilson / README.md
Created March 16, 2016 17:04 — forked from lusis/README.md
terraform template to generate serverspec properties

This uses terraform's template_file resource to generate a yaml properties file for serverspec to use.

  • create the Rakefile in your terraform project root
  • create a spec directory and put spec_helper.rb in it
  • create the templates/properties.tmpl.yml file
  • create the serverspec.tf
  • terraform apply

tests

Tests will be matched based on roles defined for a given node.