Skip to content

Instantly share code, notes, and snippets.

@salmon5
salmon5 / add-dod-certs.sh
Created February 21, 2024 07:38 — forked from AfroThundr3007730/add-dod-certs.sh
Import DoD root certificates into linux CA store
#!/bin/bash
# Import DoD root certificates into linux CA store
main() {
# Location of bundle from DISA site
url='https://public.cyber.mil/pki-pke/pkipke-document-library/'
bundle=$(curl -s $url | awk -F '"' 'tolower($2) ~ /dod.zip/ {print $2}')
#bundle=https://dl.dod.cyber.mil/wp-content/uploads/pki-pke/zip/certificates_pkcs7_v5-6_dod.zip
# Set cert directory and update command based on OS
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name yourdomain
ssl_certificate /etc/ssl/localcerts/yourdomain.crt;
ssl_certificate_key /etc/ssl/localcerts/yourdomain.key;
ssl_ecdh_curve prime256v1;
ssl_session_cache builtin:1000 shared:SSL:10m;
@salmon5
salmon5 / RH342.md
Created June 11, 2021 13:49 — forked from luckylittle/RH342.md
Red Hat RH342 Notes

Red Hat Enterprise Linux Diagnostics & Troubleshooting (RH342)

Last update: Fri Jul 26 08:23:20 UTC 2019 by @luckylittle


1. Troubleshooting principles

2. Generic issues

@salmon5
salmon5 / unix-socket-checker.py
Created May 14, 2021 04:57 — forked from robbmanes/unix-socket-checker.py
A python script that attempts to connect to a UNIX socket. This is useful when verifying if a container can reach a host socket, or has permissions issues with your current settings.
#!/usr/bin/python
import os
import sys
import time
import logging
import socket
def check_unix_socket():
@salmon5
salmon5 / tcp_conn_blaster.py
Created May 14, 2021 04:56 — forked from robbmanes/tcp_conn_blaster.py
Script that sets up a server to accept connections and a client to flood the server with connections.
import logging
import socket
import sys
import threading
import time
CLIENT_CONN_ADDR="127.0.0.1"
CLIENT_NUM_CONNS=10
SERVER_PORT=8888
SERVER_SYN_BACKLOG=128
@salmon5
salmon5 / request.sh
Created May 7, 2021 07:47 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@salmon5
salmon5 / watch-unix-socket.stp
Created May 4, 2021 14:55 — forked from robbmanes/watch-unix-socket.stp
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
@salmon5
salmon5 / nchttpd
Created December 8, 2020 10:47 — forked from captainwasabi/nchttpd
Smallest webserver
#!/bin/bash
#usage: nchttpd port "cmd"
# port - port number to listen on for requests (if port < 1024 use sudo)
# cmd - command to execute when a request comes in, ex> "cat /var/www/index.html"
#
#example:
# $nchttpd 1500 "cat /var/www/index.html"
#
while true; do
echo "HTTP/1.1 200 OK\r\n $($2)" | nc -lp $1 -q 1 &
@salmon5
salmon5 / bgpd.conf
Created October 2, 2020 02:39 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@salmon5
salmon5 / Dockerfile
Created June 26, 2019 15:18 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -