Skip to content

Instantly share code, notes, and snippets.

View robertsinfosec's full-sized avatar

robertsinfosec robertsinfosec

View GitHub Profile
@robertsinfosec
robertsinfosec / sshp.sh
Created August 11, 2026 03:42
The `ssh` command where it turns off SSH keys so that you can log in with a password
# If you have several SSH keys in `~/.ssh/`, and when you try to SSH into a machine where you don't have a key, but need a password, you'll get a "Too many authentication failures" because SSH tried all of your keys, and the remote system kicked you off.
#
# So this augments `ssh` with `sshp` where it will turn off SSH key auth and instead prompt for a password.
#
# Add this line to your `~/.bash_aliases` then use it just like the `ssh` command, except `sshp`.
alias sshp='ssh -o PubkeyAuthentication=no -o PreferredAuthentications=password -o IdentitiesOnly=yes'
@robertsinfosec
robertsinfosec / get-system.sh
Created August 11, 2026 03:38
Get a quick look at manufacturer and model, and CPU string and RAM of the current machine
#!/bin/bash
# Get a quick look at manufacturer and model, and CPU string and RAM of the current machine
MANUFACTURER=`dmidecode -t system | grep Manufacturer | head -n1 | cut -d':' -f2 | xargs`
MODEL=`dmidecode -t system | grep Version | head -n1 | cut -d':' -f2 | xargs`
CPU=`dmidecode -t processor | grep Version | head -n1 | cut -d':' -f2 | xargs`
RAM=`free -h | awk '/Mem:/ {print $2}'`
echo "Manufacturer..: $MANUFACTURER"
@robertsinfosec
robertsinfosec / install-seafile-client.sh
Created July 21, 2026 20:26
The Seafile client is just an `.AppImage`, so there is quite a lot more you need to do to make it look and act like an actual, installed application. This script downloads, verifies, and properly installs the Seafile client on Ubuntu 24.04 Workstation and later.
#!/usr/bin/env bash
# Install or update the official Seafile desktop sync client AppImage for the
# current user on Ubuntu 24.04 x86_64.
#
# The AppImage is downloaded from the official haiwen/seafile-client GitHub
# release and verified against GitHub's SHA-256 release-asset digest.
set -Eeuo pipefail
umask 022
@robertsinfosec
robertsinfosec / create-scoped-keys.sh
Created May 22, 2026 01:19
Bash script to create `{service}:{purpose}:{principal}:{hostname}:{YYYY-MM-DD}` style `ed25519` SSH key.
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Usage:
create-scoped-key.sh PLATFORM PURPOSE PRINCIPAL HOST [OPTIONS]
Creates an Ed25519 SSH key using this naming convention:
@robertsinfosec
robertsinfosec / gitrunner-setup.sh
Last active August 23, 2026 03:52
gitrunner-setup.sh - a one-shot command that prompts for a few things, but otherwise completely sets up a GitHub On-Prem Runner from a barebones Ubuntu server.
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
###############################################################################
# gitrunner-setup.sh
#
# Build, inspect, and remove GitHub self-hosted runner instances on Ubuntu 24.04.
# Multiple GitHub organizations/repositories may share the same physical host.
#
@robertsinfosec
robertsinfosec / install-mc.sh
Created January 22, 2026 04:34
Simple script to install the MiniIO (S3-compatible storage) command-line tool `mc`.
#!/usr/bin/env bash
set -euo pipefail
# Colored, prefixed logging
COLOR_RESET="\033[0m"
COLOR_CYAN="\033[1;36m"
COLOR_RED="\033[1;31m"
COLOR_GREEN="\033[1;32m"
COLOR_AMBER="\033[0;33m"
@robertsinfosec
robertsinfosec / compose-upgrade.sh
Last active December 5, 2025 01:41
Simple script to upgrade any Docker Compose services that use the `:latest` tag to update that service to the latest version of that container image. This could be run weekly, monthly or ad-hoc to make sure you are on the latest container image build. Consider putting this in `/usr/local/bin/` and `chmod +x compose-upgrade.sh` to mark it as exec…
#!/usr/bin/env bash
set -euo pipefail
# compose-upgrade.sh
# Usage: compose-upgrade.sh [--help] [--service-name NAME] [--service-path PATH] [--log-dir PATH]
#
# Runs: docker compose pull && docker compose up -d --remove-orphans
# Prints progress with [+]/[-] markers, logs to file, and exits nonzero on failure.
show_help() {
@robertsinfosec
robertsinfosec / service-generator.sh
Created November 5, 2025 17:14
Bash script to create a consistent Docker Compose-based service in `/opt/${ServiceName}` and be controllable by a Systemd service, via a created `service-runner` account that has limited `sudo` privilege to control the service and reboot.
#!/usr/bin/env bash
set -euo pipefail
# =========================
# service-generator.sh
# -------------------------
# Create a systemd-managed docker-compose service skeleton:
# - Unprivileged user: service-runner (home: /opt/${ServiceName})
# - Adds service-runner to docker group
# - Systemd unit: /etc/systemd/system/${ServiceName}.service
@robertsinfosec
robertsinfosec / Install-LlmClis.ps1
Last active October 29, 2025 06:19
Add LLM CLI's via PowerShell. This first installs the Node Version Manager (NVM), then installs the latest NodeJS. Then, this installs: Google Gemini CLI, Anthropic Claude CLI, GitHub Copilot CLI, OpenCode (for running against Ollama), and OpenAI's Codex CLI.
# Install-LlmClis.ps1
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# --- 0) Require Administrator ---
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $IsAdmin) { throw "This script must be run from an Administrator PowerShell." }
# --- 1) Ensure winget ---
@robertsinfosec
robertsinfosec / install-llm-clis.sh
Last active October 29, 2025 06:07
Add LLM CLI's via bash. This first installs the Node Version Manager (NVM), then installs the latest NodeJS. Then, this installs: Google Gemini CLI, Anthropic Claude CLI, GitHub Copilot CLI, OpenCode (for running against Ollama), and OpenAI's Codex CLI.
#!/usr/bin/env bash
set -euo pipefail
# --- prereqs ---
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends ca-certificates curl git build-essential unzip
mkdir -p "$HOME/.local/bin"
grep -q 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" \
|| echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"