Skip to content

Administration

SkyperTHC edited this page Dec 26, 2022 · 30 revisions

Misc information for SSC Administrators.

Load Admin Tools:

source "${SF_BASEDIR:-/sf}/sfbin/funcs_admin.sh"

Reset a messed up docker/overlay2:

systemctl stop docker
docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
docker volume prune -f
systemctl start docker

(to free enough space docker rmi -f sf-guest is normally sufficient)

Enlarge XFS (AWS):

xfs_growfs -d /sf

Quick Traffic Rate check:

iftop -BnN -f "not host ${SSH_CONNECTION%% *}" # then press 's' and 't'

Show largest consumer

# Memory:
docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | sort -k 4 -h
# BlockIO OUT:
docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.BlockIO}}" | sort -k 9 -h

Update & restart just 1 container

docker-compose build tor
docker-compose up -d --no-deps tor

Check CGROUP stats:

systemd-cgtop

List all guest processes:

systemctl status sf_guest.slice

List processes for $LID

systemctl status docker-"$(docker inspect --format='{{.Id}}' "$LID")".scope

Display cgroup for a pid

cat /proc/PID/cgroup

List all cgroups on the system

ps xawf -eo pid,user,cgroup,args

Firewall an IP

iptables -I FORWARD -p tcp --dport 22 -s 46.106.190.5 -j DROP
tcpdump -n -i ens5 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0' and port 22

Common startup problems:

Clone this wiki locally