perf: removal of firewall
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
################################################################################
|
||||
# @file_name: iris.conf
|
||||
# @version: 0.0.50
|
||||
# @project_name: iris
|
||||
# @brief: config file for iris
|
||||
#
|
||||
# @author: Jamie Dobbs (awildamnesiac)
|
||||
# @author_contact: awildamnesiac@protonmail.ch
|
||||
#
|
||||
# @license: BSD-3 Clause (Included in LICENSE)
|
||||
# Copyright (C) 2021-2024, Jamie Dobbs
|
||||
# All rights reserved.
|
||||
# shellcheck disable=2034
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# @IMPORTANT: DO NOT UPDATE THIS FILE
|
||||
# UPDATE COPIES LOCATED IN $HOME/.config/iris/iris.conf
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# @description: iris configuration
|
||||
################################################################################
|
||||
_iris_modules=( "shopt" "git" "pyenv" "ssh" "readonly" "screen" ); # enabled modules
|
||||
|
||||
################################################################################
|
||||
# @description: prompt configuration
|
||||
################################################################################
|
||||
_prompt_input_newline="true"; # console input on new line: true/false
|
||||
_prompt_nerd_font="true"; # change to true if nerd font is installed and enabled in your terminal (supplied in fonts): true/false
|
||||
_prompt_input_symbol="❯"; # console input symbol
|
||||
_prompt_nerd_symbol="";
|
||||
# _prompt_nerd_symbol="❯"; # console input symbol for nerd font
|
||||
_prompt_username="true"; # show current user on prompt: true/false
|
||||
_prompt_hostname="ssh"; # show hostname on prompt: ssh,all,none
|
||||
_prompt_dir="true"; # show dir on prompt: true/false
|
||||
_prompt_display_error="true"; # displays error codes on prompt
|
||||
_prompt_seperator=" "; # seperator between prompt informations
|
||||
_prompt_wrapper="[]"; # wrapper for prompt information: 2 chars max (LR)
|
||||
_prompt_success_color="106" # changes prompt input symbol to green if previous command is return 0
|
||||
_prompt_fail_color="203"; # changes prompt input symbol to red if previous command does not return 0
|
||||
_prompt_user_color="109" # sets the user color in prompt
|
||||
_prompt_sudo_color="72" # sets the sudo color in prompt
|
||||
_prompt_info_color="172"; # sets the info color in prompt
|
||||
_prompt_input_color="254"; # sets the input color in prompt
|
||||
|
||||
################################################################################
|
||||
# @description: aliases
|
||||
################################################################################
|
||||
alias mkdir='mkdir -p'; # adds -p flag to mkdir as standard
|
||||
alias ll="ls -laFh"; # ll as an easier alias for ls -laFh
|
||||
alias la='ls -A'; # la as an easier alias for ls -A
|
||||
alias hist='history|grep'; # search history with hist needle
|
||||
alias count='find . -type f | wc -l'; # counts file list
|
||||
alias nano='nano -W'; # adds -W flag to nano as standard
|
||||
|
||||
################################################################################
|
||||
# @description: misc
|
||||
################################################################################
|
||||
declare -g HISTTIMEFORMAT='%F %T '; # time format for history
|
||||
declare -g PROMPT_DIRTRIM="2"; # trims dir path after x dirs
|
||||
[[ -z "$LC_CTYPE" && -z "$LC_ALL" ]] && declare -g LC_CTYPE="${LANG%%:*}"; # passes lang to lc_ctype
|
||||
[[ -z "$HISTFILE" ]] && declare -g HISTFILE="$HOME/.bash_history"; # if no HISTFILE is set, sets it to $HOME/.bash_history
|
||||
@@ -36,9 +36,6 @@ main() {
|
||||
mount)
|
||||
"${DAO_SCRIPTS_DIR}/always/mount.sh" "$@"
|
||||
;;
|
||||
firewall)
|
||||
"${DAO_SCRIPTS_DIR}/reboot/firewall.sh" "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: dao {update|transfer|pwgen|mount|firewall} [args]"
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ---
|
||||
# @file_name: jade.sh
|
||||
# @version: 1.3.1
|
||||
# @description: Lazy script for modifying docker files
|
||||
# @author: Jamie Albert (empty_produce)
|
||||
# @author_contact: <mailto:empty.produce@flatmail.me>
|
||||
# @license: GNU Affero General Public License v3.0 (Included in LICENSE)
|
||||
# Copyright (C) 2025, Jamie Albert
|
||||
# ---
|
||||
set -euo pipefail
|
||||
|
||||
# ---
|
||||
# shellcheck disable=1091
|
||||
# ---
|
||||
setup() {
|
||||
. /usr/local/share/dao/libs/libs_dao.sh
|
||||
. /usr/local/share/dao/config/dao.conf
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [3] Download failed.
|
||||
# ---
|
||||
download_file() {
|
||||
scp -q "${JADE_REMOTE_HOST}:${JADE_REMOTE_PATH}" "$JADE_LOCAL_PATH" || dao::error 3 'Download failed'
|
||||
dao::info "Downloaded: $JADE_LOCAL_PATH"
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [4] Local file missing.
|
||||
# @return_code: [5] Failed to create remote backup.
|
||||
# @return_code: [6] Upload failed.
|
||||
# ---
|
||||
upload_file() {
|
||||
[[ -f "$JADE_LOCAL_PATH" ]] || dao::error 4 "Local file missing: $JADE_LOCAL_PATH"
|
||||
ssh -q "${JADE_REMOTE_HOST}" "[[ -f '${JADE_REMOTE_PATH}' ]] && cp -f '${JADE_REMOTE_PATH}' '${JADE_REMOTE_PATH}.bak'" || dao::error 5 'Failed to create remote backup'
|
||||
scp -q "$JADE_LOCAL_PATH" "${JADE_REMOTE_HOST}:${JADE_REMOTE_PATH}" || dao::error 6 'Upload failed'
|
||||
dao::info "Uploaded: $JADE_LOCAL_PATH"
|
||||
dao::info "Remote file backed up to: ${JADE_REMOTE_PATH}.bak"
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [7] JADE_EDITOR command not found.
|
||||
# @return_code: [3] Download failed (inherited from download_file).
|
||||
# ---
|
||||
edit_file() {
|
||||
download_file
|
||||
if ! command -v "$JADE_EDITOR" >/dev/null; then
|
||||
dao::error 7 "JADE_EDITOR not found: '$JADE_EDITOR'"
|
||||
fi
|
||||
"$JADE_EDITOR" "$JADE_LOCAL_PATH"
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [6] Upload failed (inherited from upload_file).
|
||||
# @return_code: [8] Remote docker compose up failed.
|
||||
# ---
|
||||
upload_compose() {
|
||||
upload_file
|
||||
ssh -q "${JADE_REMOTE_HOST}" \
|
||||
"cd '$(dirname "$JADE_REMOTE_PATH")' && exec docker compose up -d --remove-orphans" \
|
||||
|| dao::error 8 'Remote docker compose up failed'
|
||||
dao::info 'Remote docker compose up -d completed'
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [9] Remote docker compose down failed.
|
||||
# @return_code: [6] Upload failed (inherited from upload_file).
|
||||
# @return_code: [11] Remote docker compose up failed during restart.
|
||||
# ---
|
||||
upload_restart() {
|
||||
ssh -q "${JADE_REMOTE_HOST}" \
|
||||
"cd '$(dirname "$JADE_REMOTE_PATH")' && exec docker compose down" \
|
||||
|| dao::error 9 'Remote docker compose down failed'
|
||||
upload_file
|
||||
ssh -q "${JADE_REMOTE_HOST}" \
|
||||
"cd '$(dirname "$JADE_REMOTE_PATH")' && exec docker compose up -d --remove-orphans" \
|
||||
|| dao::error 11 'Remote docker compose up failed during restart'
|
||||
dao::info 'Remote docker compose restart completed'
|
||||
}
|
||||
|
||||
# ---
|
||||
# @return_code: [10] Unknown command-line option.
|
||||
# @return_code: [12] Required tool 'scp' not found.
|
||||
# @return_code: [13] Required tool 'ssh' not found.
|
||||
# @return_code: [14] Unexpected execution mode.
|
||||
# @return_code: [N] Errors from called functions (e.g., download_file, upload_file, etc.).
|
||||
# ---
|
||||
main() {
|
||||
setup
|
||||
declare mode=''
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-d) mode='download' ; shift ;;
|
||||
-u) mode='upload' ; shift ;;
|
||||
-uc) mode='up' ; shift ;;
|
||||
-ur) mode='restart' ; shift ;;
|
||||
*) dao::error 10 "Unknown option: $1 (use -d, -u, -uc, -ur)" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
command -v scp >/dev/null || dao::error 12 "'scp' not found"
|
||||
command -v ssh >/dev/null || dao::error 13 "'ssh' not found"
|
||||
|
||||
case "$mode" in
|
||||
download) download_file ;;
|
||||
upload) upload_file ;;
|
||||
up) upload_compose ;;
|
||||
restart) upload_restart ;;
|
||||
'') edit_file ;;
|
||||
*) dao::error 14 "Unexpected mode: $mode" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ---
|
||||
# @file_name: mullvad_tailscale.sh
|
||||
# @version: 1.0.0
|
||||
# @description: Installs mullvad nft rules
|
||||
# @author: Jamie Albert (empty_produce)
|
||||
# @author_contact: <mailto:empty.produce@flatmail.me>
|
||||
# @license: GNU Affero General Public License v3.0 (Included in LICENSE)
|
||||
# Copyright (C) 2025, Jamie Albert
|
||||
# ---
|
||||
|
||||
# ---
|
||||
# shellcheck disable=1091
|
||||
# --
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
setup() {
|
||||
. /usr/local/share/dao/config/dao.conf
|
||||
}
|
||||
|
||||
wait_for_network() {
|
||||
echo "[i] Waiting for network connectivity..."
|
||||
local max_attempts=30
|
||||
local attempt=1
|
||||
|
||||
while ! ping -c1 -W1 nasa.gov >/dev/null 2>&1; do
|
||||
if [ $attempt -ge $max_attempts ]; then
|
||||
echo "[e] Network not available after ${max_attempts} attempts"
|
||||
exit 1
|
||||
fi
|
||||
echo "[i] Attempt $attempt/${max_attempts}: Network not ready, waiting 2 seconds..."
|
||||
sleep 2
|
||||
((attempt++))
|
||||
done
|
||||
echo "[i] Network connectivity confirmed"
|
||||
}
|
||||
|
||||
nft_mullvad() {
|
||||
echo "[i] Applying firewall rules..."
|
||||
if sudo nft -f "$DAO_USER_HOME/.config/dao/firewall/mullvad_tailscale.conf"; then
|
||||
echo "[i] Firewall rules applied successfully"
|
||||
else
|
||||
echo "[e] Failed to apply firewall rules"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
setup
|
||||
case "${1:-}" in
|
||||
--enable)
|
||||
wait_for_network
|
||||
nft_mullvad
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 --enable"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user