Skip to content

Instantly share code, notes, and snippets.

View robbmanes's full-sized avatar
🎮
pew pew

Robb Manes robbmanes

🎮
pew pew
View GitHub Profile
@robbmanes
robbmanes / podman-api-host.yaml
Last active February 27, 2024 16:15
[WIP] Configuring a podman API socket on an OpenShift 4 cluster
---
apiVersion: v1
kind: Namespace
metadata:
name: podman-api-host
labels:
app: podman-api-host
---
apiVersion: v1
kind: ServiceAccount
@robbmanes
robbmanes / test_systemd_session.yaml
Last active February 18, 2024 19:10
systemd user test within Ansible playbook
- name: Verify if a user can run `systemctl` commands as a non-root user
hosts: localhost
vars:
rootless_user: "rmanes"
rootless_uid: "1000"
become_method: machinectl
tasks:
- name: Check if DBUS socket exists for session user
stat:
path: "/run/user/{{ rootless_uid }}/bus"
@robbmanes
robbmanes / watch-unix-socket.stp
Last active October 17, 2023 09:24
Systemtap script to watch UNIX socket input
/*
* watch_unix_socket.stp
*
* This is a simply more modern version of the script found here:
* https://sourceware.org/systemtap/wiki/WSunixSockets
*
* The first argument is the location of the file descriptor for a UNIX socket.
* To find this address, for example, for the Docker socket run:
*
* # lsof 2>&1 | awk '/docker.sock/ {print $7}' | grep -v '0t0' | sort -u
@robbmanes
robbmanes / hll_crcon_get_vip_ids_to_csv.py
Created May 10, 2023 19:13
Get HLL CRCON VIP ID's and export them to CSV
import csv
import requests
import sys
RCON_URL='http://mycoolrcon.example'
RCON_USERNAME='admin'
RCON_PASSWORD='password'
CSV_FILE='vips.csv'
def main():
@robbmanes
robbmanes / container_labeler.go
Last active February 20, 2023 18:10
Go program that tests the container labeling capabilites of `go-selinux/label`.
package main
import (
"fmt"
"github.com/opencontainers/selinux/go-selinux/label"
)
// Mirroring the behavior found here:
// https://github.com/containers/podman/blob/8432ed7488e9c62738f9308fcc03f2ae9c2cd615/libpod/util_linux.go#L110-L129
func main() {
@robbmanes
robbmanes / bashy-bois.sh
Last active February 8, 2023 01:05
bashy-bois
#!/bin/bash
# bashy-bois.sh
# Maintained by Robb Manes <robbmanes@protonmail.com>
#
# A collection of bash functions that I've used and written over time.
# You CAN use this as a single script, but you probably want to pick-and-choose what you're looking for.
# It's probably best to assume you need to be root to do anything below unless otherwise specified.
# find_all_ptraces
@robbmanes
robbmanes / build-support-tools-infiniband.sh
Last active January 18, 2023 16:39
Adds Infiniband support to Red Hat Support Tools container image
#!/bin/bash
# Builds infiniband support into the base RHEL support-tools image.
# Must be run from a subscribed RHEL host.
IMAGE_NAME="quay.io/robbmanes/support-tools-ib:latest"
function main() {
echo "Pulling latest support-tools container image..."
CONTAINER=$(buildah from registry.redhat.io/rhel8/support-tools)
@robbmanes
robbmanes / bad-exit-ptracer.c
Last active August 8, 2022 19:58
Bad Exit Ptracer
#include <stdio.h>
#include <stdlib.h>
#include <syscall.h>
#include <sys/user.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <errno.h>
#define SYSCALL_EXIT 60
#define SYSCALL_EXIT_GROUP 231
@robbmanes
robbmanes / Makefile
Created November 23, 2021 17:16
Example character device driver for generating large minor numbers
obj-m += bigdummy.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@robbmanes
robbmanes / rh-container-registry.sh
Last active January 24, 2022 17:43
Test functionality of Red Hat Container Registries manually
#!/bin/bash
# rh-container-registry.sh
# Test functionality of Red Hat Container Registries using pure HTTP/S.
# Useful for determining issues when/if behind proxies, load balancers,
# or other in-the-middle network devices.
# For more information on using Red Hat Container Registries, please see
# the following:
# https://access.redhat.com/RegistryAuthentication