Skip to content

Instantly share code, notes, and snippets.

View linuxpld's full-sized avatar

LinuxPld linuxpld

View GitHub Profile
@linuxpld
linuxpld / luks_crypt.md
Created October 10, 2020 14:48
create a simple LUKS partition on a single physical volume

LUKS crypt

In this guide, I'm going to setup a keyfile-encrypted LUKS partition. I will be using a single, max-size partition on a single physical device. My physical device is located at /dev/sde

partition the physical device

parted /dev/sde
@linuxpld
linuxpld / test-memcached.php
Created November 11, 2020 10:55 — forked from maartendekeizer/test-memcached.php
Memcached test script
<?php
/**
* @license MIT License
* @copyright maartendekeizer
*/
$memcached = new Memcached();
$memcached->addServer('127.0.0.1', 11211);
@linuxpld
linuxpld / ifcfg-vlan-bridge-example
Created November 11, 2020 11:12 — forked from dutchiechris/ifcfg-vlan-bridge-example
CentOS 7 ifcfg syntax for VLAN tagged interface + bridge for KVM (referenced from http://www.beginswithdata.com/2016/12/30/centos7-kvm-coreos/)
[root@server02 network-scripts]# cat ifcfg-enp14s0
DEVICE=enp14s0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
[root@server02 network-scripts]# cat ifcfg-enp14s0.35
DEVICE=enp14s0.35
TYPE=Ethernet
@linuxpld
linuxpld / php-memcached-test.php
Created November 11, 2020 13:38 — forked from ansulev/php-memcached-test.php
PHP Memcached Server Test
<?php
// Test default memcached server. Load, then refresh.
if (class_exists('Memcache')) {
$meminstance = new Memcache();
} else {
$meminstance = new Memcached();
}
$meminstance->addServer("127.0.0.1",11211);
@linuxpld
linuxpld / fail2ban-manually-create-jail.md
Created November 14, 2020 13:01 — forked from deatharse/fail2ban-manually-create-jail.md
Create Fail2ban jail Manually

Manually create a Fail2Ban jail using fail2ban-client (pre-0.10)

N.B. any syntax / function changes made within fail2ban-client will alter the commands used. The commands used here worked with versions 0.8.6-3wheezy3 and 0.8.13-1. 0.9 may or may not work exactly using the below.

For anyone visiting this and stuck on a version pre 0.10 where you want to add a jail but do not want run reload (which pre 0.10 stops and starts all enabled jails as well as reparsing the config

@linuxpld
linuxpld / mssqld-auth.conf
Created November 14, 2020 13:03 — forked from jkljajic/mssqld-auth.conf
fail2Ban filter for MSSQL LInux
# Fail2Ban filter for unsuccesfull MSSQL authentication attempts
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf
[Definition]
@linuxpld
linuxpld / Gentoo-NFTables-Readme.md
Created December 13, 2020 08:58 — forked from 4np/Gentoo-NFTables-Readme.md
Gentoo Linux NFTables

Basic firewall / network router using Gentoo Linux.

After compiling the 4.19.66-gentoo kernel, udev renamed the network interfaces of my home linux Router / Firewall and my iptables setup stopped working due ip-conntrack kernel deprecations. I decided to move over to nftables, the new packet classification framework that replaces the existing {ip,ip6,arp,eb} tables infrastructure.

Even though nftables has been in the Linux kernel since 2014, the documentation is extremely sparse. As such this gist :)

Subjectively, using nftables setting up connections to my machine seems to be more responsive compared to using iptables. Connections seem to be made more quickly and ssh-ing into my machine seems more responsive. There always used to be a bit of a lag when I was using iptables, not anymore.

Preperations

@linuxpld
linuxpld / README.md
Created February 12, 2021 08:15 — forked from yorickdowne/README.md
Ubuntu Desktop 20.04 with mirrored ZFS boot drive

Overview

Ubuntu Desktop 20.04 supports a single ZFS boot drive out of the box. I wanted a ZFS mirror, without going through an entirely manual setup of Ubuntu as described by OpenZFS

This adds a mirror to an existing Ubuntu ZFS boot drive after the fact.

ZFS requires native encryption to be added at pool / dataset creation. These instructions are not suitable for creating an encrypted ZFS boot disk, please use the full instructions linked above for that. You can, however, add an encrypted dataset after the fact: You could encrypt just the portion of your file system that holds secrets.

Note: If your use case is running docker instances, and not a full-fledged Ubuntu install, then take a look at TrueNAS SCALE, which will manage the ZFS parts for you.

@linuxpld
linuxpld / add_to_cobbler.py
Created March 11, 2021 18:56 — forked from handyman5/add_to_cobbler.py
Use of the Cobbler API
cobbler_api = ServerProxy("http://cobbler/cobbler_api")
token = cobbler_api.login("USERNAME", "PASSWORD")
asset_list = ["server01", "server02"]
for system in asset_list:
print "Managing system %s" % system
print "System name is %s" % a
try:
handle = cobbler_api.get_system_handle(a, token)
@linuxpld
linuxpld / wget.sh
Created April 11, 2021 07:53 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.