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
#!/bin/bash
# rh-download-blob
# Downloads a blob path from a Red Hat Container Registry location, using a username/password combo
# Input your username or service account and password/token.
USERNAME="username"
PASSWORD="password"
# Change this to the required blob location (SHA256 path)
@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 / 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 / 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 / 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
@robbmanes
robbmanes / unmount-watcher-ppc64le-rhel7.stp
Created January 21, 2022 13:35
PPC64LE unmount watcher systemtap for RHEL7
# unmount-watcher.stp
# Watches for filesystem unmounts and prints additional information about them.
# Authored by Robb Manes <[email protected]>
# Execute by running:
# stap unmount-watcher.stp > unmount-watcher.out
# In containerized environments, the unmounting process may belong to a different process namespace, so it's useful to print the
# entire tree to determine where it came from.
# This is borrowed from https://sourceware.org/systemtap/examples/network/connect_stat.stp
@robbmanes
robbmanes / shmem_test_tool.py
Created January 6, 2022 19:33
python3.8+ multiprocessing shared memory test tool
import sys
import time
def usage():
msg = '''
shmem_test_tool.py
==================
Utility for testing Python multiprocessing shared memory segments.
Note this is NOT the same as IPCS SHMEM segments in Linux/Unix.