Skip to content

Instantly share code, notes, and snippets.

View mohclips's full-sized avatar

mohclips mohclips

View GitHub Profile
@t0xicCode
t0xicCode / install-node-exporter.sh
Last active March 30, 2022 20:26
Script to install, enable, and start node-exporter
#!/bin/sh
# Copyright (c) 2020 MagnaX Software
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@abhisek
abhisek / psp.yml
Created March 17, 2020 09:10
PodSecurityPolicy to Prevent hostPath Mount
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: developers-psp
spec:
privileged: false
allowPrivilegeEscalation: false
hostNetwork: false
hostPID: false
hostIPC: false
@JonTheNiceGuy
JonTheNiceGuy / create_cert.yml
Last active January 9, 2022 18:31
A simple ansible playbook to create a new self-signed certificate
---
- hosts: localhost
vars:
- dnsname: your.dns.name
- tmppath: "./tmp/"
- crtpath: "{{ tmppath }}{{ dnsname }}.crt"
- pempath: "{{ tmppath }}{{ dnsname }}.pem"
- csrpath: "{{ tmppath }}{{ dnsname }}.csr"
- pfxpath: "{{ tmppath }}{{ dnsname }}.pfx"
- private_key_password: "password"
@keckelt
keckelt / Backtick Behaviour.md
Last active July 13, 2024 12:25
Avoid typing backticks twice (on Linux and Windows)

Avoid typing backticks twice (on Linux and Windows) using the instructions below :)

@smithclay
smithclay / aws.tf
Created July 19, 2017 19:57
Multi-Cloud New Relic Blog Post: Terraform Configuration of AWS, Azure and GCP Load Balancers with Instance Groups (Autoscaling enabled)
variable "aws_region" {
description = "EC2 Region for the VPC"
default = "us-west-2"
}
variable "aws_availability_zones" {
default = "us-west-2a,us-west-2b,us-west-2c"
description = "List of availability zones, use AWS CLI to find your "
}
@ageis
ageis / systemd_service_hardening.md
Last active November 15, 2024 09:28
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@pburkholder
pburkholder / gist:a9cdde0b33be8d5e3c08
Created February 20, 2015 02:00 — forked from tyler-ball/gist:f7c16e814265f34260e9
Shared examples in rspec/serverspec.....

Create the following folder structure in your cookbook:

test
└── integrationq
    ├── helpers
    │   ├── serverspec
    │   │   ├── shared_serverspec_tests
    │   │   │   └── shared_tests2.rb
    │   │   └── spec_helper.rb
@mitchellrj
mitchellrj / README.md
Created May 30, 2014 15:54
Draytek Vigor SNMP monitoring with Cacti

This is based on the outdated, official Cacti configuration for ADSL Line and modified for Draytek Vigor support.

Changes from the original include:

  • Extra data sources
  • Removed unimplemented data sources
  • Updated for newer versions of Cacti

Installation & Usage

  1. Download this gist as a .zip file by clicking the button to the left labelled "Download Gist"
@mesimeris
mesimeris / grok-patterns
Last active April 16, 2021 22:10
LOGSTASH: syslog listener filtering with grok patterns and applying useful tags
# NOTE: These patterns take into account the additional log-line information passed to the logstash listener from rsyslog. YMMV.
DHCPD ((%{SYSLOGTIMESTAMP:timestamp})\s*(%{HOSTNAME:hostname})\s*dhcpd\S+\s*(%{WORD:dhcp_action})?.*[for|on] (%{IPV4:dhcp_client_ip})?.*[from|to] (%{COMMONMAC:dhcp_client_mac})?.*via (%{USERNAME:interface}))
IPTABLES ((%{SYSLOGTIMESTAMP:nf_timestamp})\s*(%{HOSTNAME:nf_host})\s*kernel\S+\s*(%{WORD:nf_action})?.*IN=(%{USERNAME:nf_in_interface})?.*OUT=(%{USERNAME:nf_out_interface})?.*MAC=(%{COMMONMAC:nf_dst_mac}):(%{COMMONMAC:nf_src_mac})?.*SRC=(%{IPV4:nf_src_ip}).*DST=(%{IPV4:nf_dst_ip}).*PROTO=(%{WORD:nf_protocol}).?*SPT=(%{INT:nf_src_port}?.*DPT=%{INT:nf_dst_port}?.*))
DNS ((%{MONTHDAY:day})-(%{MONTH:month})-(%{YEAR:year}) (%{TIME:timestamp}) client (%{IPV4:dns_client_ip})#(%{NONNEGINT:dns_uuid})?.*query: (%{HOSTNAME:dns_dest}) (%{WORD:dns_type}) (%{WORD:dns_record})?.*(%{IPV4:dns_server}))
PGSQL ((%{SYSLOGTIMESTAMP:pgsql_timestamp}) (%{HOSTNAME:pgsql_hostname})?.*SAST >(%{WORD:pgs
@nkwhr
nkwhr / partition.rb
Last active February 2, 2022 13:55
a serverspec resource type for checking partitions.
module Serverspec
module Type
class Partition < Base
def initialize(partition, type)
@name = partition
@partition_table = {}
case type
when 'cylinder'
options = "-l"