Updated dwm window tags, dropbear connect script has optional jump host support now, gitremote fixed for supernets git pushing, vps script improved, tmux keys updated

This commit is contained in:
Dionysus 2024-02-22 01:14:37 -05:00
parent 853980b4bf
commit 1ab05175b3
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
6 changed files with 67 additions and 30 deletions

View File

@ -15,7 +15,7 @@ static const int resizehints = 0;
static const int lockfullscreen = 1;
static const Layout layouts[] = { { "", tile } };
static const Rule rules[] = { { NULL, NULL, NULL, 0, False, -1 } };
static const char *tags[] = { "dev", "chat", "media", "www", "other" };
static const char *tags[] = { "chat", "dev", "media", "work", "www", "other" };
static const char *fonts[] = { "Misc Ohsnap.Icons:style=Regular:size=11" };
static const char dmenufont[] = "Misc Ohsnap.Icons:style=Regular:size=11";
static const char *colors[][3] = {
@ -65,6 +65,10 @@ static Key keys[] = {
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
};
static Button buttons[] = {

View File

@ -1,9 +1,22 @@
#!/bin/sh
# Dropbear Connect Script (DBC) - Developed by acidvegas (https://git.acid.vegas/void)
# Git usage : git config core.sshCommand "dbclient -i ~/.ssh/key"
# Generate private key : dropbearkey -t ed25519 -f ~/.dropbear/key
# Get public key : dropbearkey -y -f ~/.dropbear/key | head -n 2 | tail -n 1
# Dropbear config must be stored in pass in the following format:
# NAME USER HOST PORT JUMP
#
# JUMP is optional and can be used to specify a host that should use your jump host.
# If JUMP is set to *, the script will use the jump host to connect to the end host.
# There should only be one jump host in the config file and it should be named 'jump'.
#
# Example:
# jump acidvegas 68.192.37.5 5902
# hatebox acidvegas 100.151.45.10 2023 *
# aws admin 45.16.150.203 22
#
# Useful commands:
# Git usage : git config core.sshCommand "dbclient -i ~/.ssh/key"
# Generate private key : dropbearkey -t ed25519 -f ~/.dropbear/key
# Get public key : dropbearkey -y -f ~/.dropbear/key | head -n 2 | tail -n 1
load_host() {
CONFIG_DATA="$1"
@ -13,7 +26,7 @@ load_host() {
MATCHING_LINES=$(printf "%s\n" "$CONFIG_DATA" | grep "^$NAME ")
# Check if exactly one matching line is found
LINE_COUNT=$(printf "%s\n" "$MATCHING_LINES" | grep -c .)
LINE_COUNT=$(printf "%s\n" "$MATCHING_LINES" | wc -l)
if [ "$LINE_COUNT" -ne 1 ]; then
echo "Error: The NAME '$NAME' matches multiple or no lines." && return 1
fi
@ -26,16 +39,24 @@ load_host() {
line_user=$(echo $MATCHING_LINES | cut -d ' ' -f 2)
line_host=$(echo $MATCHING_LINES | cut -d ' ' -f 3)
line_port=$(echo $MATCHING_LINES | cut -d ' ' -f 4)
line_jump=$(echo $MATCHING_LINES | cut -d ' ' -f 5)
# Output the result
printf "%s@%s^%s" "$line_user" "$line_host" "$line_port"
printf "%s@%s^%s%s" "$line_user" "$line_host" "$line_port" "$line_jump"
}
# Check if the name argument is provided
if [ $# -ne 1 ]; then
echo "usage: $0 [name]" && exit 1
fi
# Read the name argument
NAME=$1
# Read the config data
CONFIG_DATA=$($HOME/.scripts/pass dropbear)
# Check if the config data is read successfully
if [ $? -ne 0 ]; then
echo "error: can not read config data" && exit 1
fi
@ -43,6 +64,12 @@ fi
# Load the host data
JUMP_HOST=$(load_host "$CONFIG_DATA" "jump")
END_HOST=$(load_host "$CONFIG_DATA" "$NAME")
JUMP_CHECK=$(printf "$END_HOST" | rev | cut -c1)
# Connect to the host
dbclient -K 0 -i $HOME/.dropbear/key $JUMP_HOST,$END_HOST
if [ $JUMP_CHECK = "*" ]; then
END_HOST=$(printf $END_HOST | rev | cut -c1- | rev)
dbclient -K 60 -i $HOME/.dropbear/key $JUMP_HOST,$END_HOST
else
dbclient -K 60 -i $HOME/.dropbear/key $END_HOST
fi

View File

@ -19,7 +19,7 @@ update_repo() {
git -C $DIR remote add origin git@github.com:$USER/acidvegas.github.io.git
git -C $DIR remote set-url --add --push origin git@github.com:$USER/acidvegas.github.io.git
git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/acidvegas.gitlab.io.git
git -C $DIR remote set-url --add --push origin git@$ACIDGIT:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin supergit:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin acidgit:$REPO.git
elif [ $REPO = 'internetrelaychat.org' ]; then
git -C $DIR remote add origin git@github.com:internet-relay-chat/internet-relay-chat.github.io.git
@ -31,20 +31,20 @@ update_repo() {
git -C $DIR remote add origin git@github.com:internet-relay-chat/$REPO.git
git -C $DIR remote set-url --add --push origin git@github.com:internet-relay-chat/$REPO.git
git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/$REPO.git
git -C $DIR remote set-url --add --push git@$ACIDGIT:$USER/$REPO.git
git -C $DIR remote set-url --add --push supergit:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin acidgit:$REPO.git
elif [ $REPO = 'supernets.org' ]; then
git -C $DIR remote add origin git@github.com:$USER/supernets.github.io.git
git -C $DIR remote set-url --add --push origin git@github.com:$USER/supernets.github.io.git
git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/supernets.gitlab.io.git
git -C $DIR remote set-url --add --push origin git@$ACIDGIT:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin supergit:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin acidgit:$REPO.git
else
git -C $DIR remote add origin git@github.com:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin git@github.com:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin git@codeberg.org:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin git@$ACIDGIT:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin supergit:$USER/$REPO.git
git -C $DIR remote set-url --add --push origin acidgit:$REPO.git
fi
git -C $DIR config user.signingkey 441EB0F297E0DCF0AEF2F711EF4B922DB85DC9DE

View File

@ -2,17 +2,17 @@
# enter the void (vps) - developed by acidvegas (https://git.acid.vegas/void)
# Notes:
#
# MUSL builds for Void Linux are having an issue where `su` is segfaulting or returning "Bad address"
# MUSL builds for Void Linux are having an issue where `su` is segfaulting or returning "Bad address"
#
# Bootstrap:
# xbps-install -Su && xbps-install -u xbps && xbps-install wget nano && wget https://git.supernets.org/acidvegas/void/raw/branch/master/vps && chmod +x vps && ./vps root
# xbps-install -Su && xbps-install -u xbps && xbps-install wget nano && wget https://git.supernets.org/acidvegas/void/raw/branch/master/scripts/vps && chmod +x vps && ./vps root
set -xev
# Configuration
ARCH=x86_64 # x86_64 or x86_64-musl
DRIVE=/dev/vda
SSH_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBgw6zK6LghGq/6fdMGFKfH9fr+qCOASlD+Xi7Zoe7Ps acidvegas@paloalto"
SWAP_SIZE=$((1 * 1024)) # 1GB
TIMEZONE="America/New_York"
USERNAME=supernets
@ -46,18 +46,19 @@ setup_chroot() {
xbps-remove -y base-system openssh
xbps-install -Syu curl dropbear git htop lxd iptables nano net-tools runit-iptables tmux socklog-void wget
# Set up networking
IP_ADDR=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
GATEWAY=$(ip route show default | awk '/default/ {print $3}')
printf "ip link set eth0 up\nip addr add ${IP_ADDR}/24 dev eth0\nip route add default via $GATEWAY\n" > /etc/rc.local
printf "printf \"nameserver 208.67.222.222\\\nnameserver 208.67.220.220\\\nnameserver 2620:119:35::35\\\nnameserver 2620:119:53::53\" > /etc/resolv.conf" >> /etc/rc.local
echo "$HOSTNAME" > /etc/hostname
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -K 0 -p %s -R -w -t -T 1 -F 2>&1\n' "$(shuf -i 10000-65534 -n 1)" > /etc/sv/dropbear/run
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
printf "set boldtext\nset minibar\nset nohelp\nset nowrap\nset quickblank\nset tabsize 4\nunbind ^J main\nset selectedcolor black,red\ninclude \"/usr/share/nano/*.nanorc\"\n" > /etc/nanorc
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
printf "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%%wheel ALL=(ALL) ALL\n" > /etc/sudoers
printf "\n\033[1m \033[32m\"Bee\" careful \033[34m__\n \033[32mwith sudo! \033[34m// \ \n \\\\\\_/ \033[33m//\n \033[35m''-.._.-''-.._.. \033[33m-(||)(')\n '''\033[0m\n" > /etc/sudoers.d/sudoers.lecture
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -K 0 -p %s -R -w -t -T 1 -F 2>&1\n' "$(shuf -i 10000-65534 -n 1)" > /etc/sv/dropbear/run
echo "hsts=0" >> /etc/wgetrc
#printf "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%%wheel ALL=(ALL) ALL\n" > /etc/sudoers
#printf "\n\033[1m \033[32m\"Bee\" careful \033[34m__\n \033[32mwith sudo! \033[34m// \ \n \\\\\\_/ \033[33m//\n \033[35m''-.._.-''-.._.. \033[33m-(||)(')\n '''\033[0m\n" > /etc/sudoers.d/sudoers.lecture
>/var/log/lastlog && chattr +i /var/log/lastlog
# Enable services
@ -140,7 +141,7 @@ setup_chroot() {
# Set up user SSH keys
mkdir -p /home/$USERNAME/.ssh
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBgw6zK6LghGq/6fdMGFKfH9fr+qCOASlD+Xi7Zoe7Ps" > /home/$USERNAME/.ssh/authorized_keys
echo "$SSH_KEY" > /home/$USERNAME/.ssh/authorized_keys
chmod 700 $HOME/.ssh && chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
chmod 400 $HOME/.ssh/authorized_keys && chattr +i $HOME/.ssh/authorized_keys && chattr +i $HOME/.ssh

7
setup
View File

@ -32,22 +32,21 @@ setup_root() {
xbps-install -y ohsnap-font font-unifont-bdf freefont-ttf noto-fonts-ttf noto-fonts-ttf-extra noto-fonts-cjk noto-fonts-emoji
fi
xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 youtube-dl
xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 youtube-dl # Revamp audio setup at some point
xbps-install -y checkbashisms go make patch pkg-config python3 python3-pip shellcheck
if [ $ARCH = "x86_64" ]; then
xbps-install -y gcc vscode
fi
xbps-install -y bandwhich bat bind-utils btop curl earlyoom exa git glow gnupg2-scdaemon lazygit lxc lxd mlocate net-tools ncdu oath-toolkit progress ripgrep rsync socklog-void tmate tmux tor tree unzip weechat zip
xbps-install -y bandwhich bat bind-utils btop curl earlyoom exa git glow gnupg2-scdaemon lazygit lxc lxd net-tools ncdu oath-toolkit progress ripgrep rsync socklog-void tmate tmux tor tree unzip weechat zip
xbps-install -y asciiquarium cmatrix no-more-secrets tty-solitaire
xbps-install -y kismet masscan nmap termshark wireshark
updatedb
useradd -m -s /bin/bash acidvegas && gpasswd -a acidvegas wheel && passwd acidvegas
usermod -aG kismet acidvegas && usermod -aG wireshark acidvegas
ln -sfv /etc/sv/earlyoom /var/service/
ln -sfv /etc/sv/socklog-unix /var/service

View File

@ -1,32 +1,38 @@
bind -n C-k kill-window
bind -n C-n new-window
bind -n C-t command-prompt -p "New title:" "rename-window '%%'"
# Sessions
bind -n C-M-k kill-session
bind -n C-M-t command-prompt -p "New session name:" "rename-session '%%'"
bind -n C-M-s choose-tree -Z
bind -n C-M-Left switch-client -n
bind -n C-M-Right switch-client -p
# Tabs
bind -n C-k kill-window
bind -n C-n new-window
bind -n C-t command-prompt -p "New title:" "rename-window '%%'"
bind -n C-Left previous-window
bind -n C-Right next-window
bind -n C-S-Left swap-window -t -1 \; previous-window
bind -n C-S-Right swap-window -t +1 \; next-window
# Panes
bind -n C-Up split-window -h
bind -n C-Down split-window -v
bind -n C-S-Up select-pane -t :.+
bind -n C-S-Down select-pane -t :.-
# Options
set -g detach-on-destroy off
set -g mouse on
# Status bar
set -g status-interval 3
set -g status-style bg=black
set -g status-right-length 100
set -g status-right "#[fg=yellow]#H#[default] | #[fg=cyan]Disk:#[default] #(df -h | grep '/dev/sda2' | awk '{printf \"%3.0f%\", $5}') | #[fg=cyan]CPU: #[default]#(top -bn1 | grep 'Cpu(s)' | awk '{printf \"%3.0f%\", $2 + $4}') | #[fg=cyan]MEM: #[default]#(free | awk '/^Mem/ {printf \"%3.0f%\", $3/$2 * 100.0}') | %I:%M"
set -g status-style bg=black
setw -g window-status-current-style fg=cyan,bg=default
setw -g window-status-activity-style fg=yellow,bg=default
setw -g window-status-style fg=grey,bg=black
setw -g window-status-format "#I: #W"
setw -g window-status-current-format "#[bold]#I: #W"