Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / simple-pf-anchor
Created May 15, 2013 04:53
A very simple set of pf rules, in the right order, that might be used with pf on OS X Mountain Lion
# Options
set block-policy drop
set fingerprints "/etc/pf.os"
set ruleset-optimization basic
set skip on lo0
# Normalization
# Scrub incoming packets
scrub in all no-df
@scottslowe
scottslowe / custom-pf-conf
Created May 15, 2013 04:46
Very simple configuration file for pf on OS X Mountain Lion
anchor "org.scottlowe.pf"
load anchor "org.scottlowe.pf" from "/etc/pf.anchors/org.scottlowe.pf.rules"
@scottslowe
scottslowe / puppet-ifcfg-manifest
Last active December 14, 2015 04:08
This snippet of Puppet code could be used on RHEL/RHEL variants to help automate the configuration of OVS.
# This code declares a file resource to manage an interface
# configuration script on RHEL/RHEL variants for automated
# configuration of OVS.
#
file {'/etc/sysconfig/network-scripts/ifcfg-mgmt0':
ensure => 'present',
source => 'puppet:///modules/module-name/ovs-ifcfg-mgmt0',
}
@scottslowe
scottslowe / modify-virt-user-collection
Last active December 12, 2015 07:59
This snippet of Puppet code shows how to modify the group membership of a realized virtual user resource
User <| title == 'johndoe' |> {
groups => 'othergroup',
}
@scottslowe
scottslowe / rhel-integrated-ovs-config
Created February 7, 2013 20:25
This snippet of output from ovs-vsctl shows an OVS configuration after corresponding RHEL/RHEL variant network startup scripts have been evaluated.
542de17b-4eb5-4eff-f736-3c760e40dff3
Bridge "ovsbr0"
Port "mgmt0"
Interface "mgmt0"
type: internal
Port "ovsbr0"
Interface "ovsbr0"
type: internal
Port "bond0"
Interface "eth0"
@scottslowe
scottslowe / ifcfg-mgmt0-script
Created February 7, 2013 20:20
This RHEL/RHEL variant network startup script creates an OVS internal interface and assigns it an IP address.
DEVICE="mgmt0"
BOOTPROTO="static"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSIntPort"
IPADDR=10.11.12.13
NETMASK=255.255.255.0
OVS_BRIDGE="ovsbr0"
HOTPLUG="no"
@scottslowe
scottslowe / ifcfg-bond0-script
Created February 7, 2013 20:17
This RHEL/RHEL variant network startup script creates a LACP bond on an OVS bridge.
DEVICE="bond0"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSBond"
OVS_BRIDGE="ovsbr0"
BOOTPROTO="none"
BOND_IFACES="eth0 eth1"
OVS_OPTIONS="bond_mode=balance-tcp lacp=active"
HOTPLUG="no"
@scottslowe
scottslowe / ifcfg-ovsbr0-script
Created February 7, 2013 20:13
This is an example of a RHEL/RHEL-variant network startup script that will automatically create an OVS bridge.
DEVICE="ovsbr0"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSBridge"
BOOTPROTO="none"
HOTPLUG="no"
@scottslowe
scottslowe / virtual-user-dependency
Created January 29, 2013 14:51
This Puppet code defines a virtual user resource, but includes a subclass dependency to ensure certain files are present before the account is defined.
# Used to define virtual users on Puppet-managed systems
# Includes subclass dependency on accounts::config
#
class accounts {
@accounts::virtual { 'johndoe':
uid => 1001,
realname => 'John Doe',
pass => '<password hash goes here>',
require => Class['accounts::config'],
@scottslowe
scottslowe / fictional-puppet-class
Last active December 11, 2015 21:48
Entirely fictional Puppet code to show dependencies on single resources
class foo {
package { 'foo':
ensure => 'present',
}
file { '/etc/foo.conf':
ensure => 'present',
source => 'puppet:///modules/foo/foo_conf',
mode => '0600',
require => Package['foo'],