🗃️ Committing everything that changed 🗃️

rootfs/tmp/etc/tor/torrc
rootfs/usr/local/bin/check-record
rootfs/usr/local/bin/get_dns_record
rootfs/usr/local/etc/docker/init.d/02-named.sh
This commit is contained in:
casjay 2025-05-20 10:23:40 -04:00
parent bae65e71fe
commit fa66d75cf9
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145
4 changed files with 134 additions and 22 deletions

View File

@ -12,28 +12,12 @@ CookieAuthFile REPLACE_RUN_DIR/control.authcookie
Log debug file REPLACE_LOG_DIR/debug.log
Log notice file REPLACE_LOG_DIR/notices.log
##### This section is just for location-hidden services
HiddenServiceDir REPLACE_DATA_DIR/hidden_service/default
HiddenServicePort 80 127.0.0.1:80
##### Server
ControlPort localhost:9051
SOCKSPort localhost:9050
HTTPTunnelPort localhost:9080
SOCKSPort 127.0.0.1:9050
ControlPort 127.0.0.1:9051
HTTPTunnelPort 127.0.0.1:9080
##### dns forwarder
DNSPort localhost:9053
DNSPort 127.0.0.1:9053
AutomapHostsOnResolve 1
AutomapHostsSuffixes .exit,.onion
##### This section is just for relays
#Nickname whateveryouwant
#ContactInfo tor-admin@example.com
#ORPort 443
#Exitpolicy reject *:*
#AccountingMax 100 GBytes
#AccountingStart month 1 00:00
#RelayBandwidthRate 5120 KBytes
#RelayBandwidthBurst 10240 KBytes
#DisableDebuggerAttachment 0
#HardwareAccel 1

View File

@ -0,0 +1,69 @@
#!/usr/bin/env sh
# shellcheck shell=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202505201013-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro
# @@License : LICENSE.md
# @@ReadME : check-record --help
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
# @@Created : Tuesday, May 20, 2025 10:13 EDT
# @@File : check-record
# @@Description :
# @@Changelog : New script
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename -- "$0" 2>/dev/null)"
VERSION="202505201013-git"
RUN_USER="$USER"
SET_UID="$(id -u)"
SCRIPT_SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
CHECK_RECORD_CWD="$(realpath "$PWD")"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# colorization
if [ "$SHOW_RAW" = "true" ]; then
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
else
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# check for command
__cmd_exists() { which $1 >/dev/null 2>&1 || return 1; }
__function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# custom functions
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define variables
DEFAULT_COLOR="254"
CHECK_RECORD_EXIT_STATUS=0
CHECK_RECORD_RECORD="${2:-A}"
CHECK_RECORD_DOMAIN="${1:-localhost}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
__cmd_exists dig || exit 10
if dig @1.1.1.1 "$CHECK_RECORD_DOMAIN" "$CHECK_RECORD_RECORD" | grep 'IN' | grep '[0-9][0-9]' | sed 's|.*A||g' | sed "s/^[ \t]*//"; then
CHECK_RECORD_EXIT_STATUS=0
__printf_color "The records for $CHECK_RECORD_DOMAIN have delegated" 2
elif dig @127.0.0.1 "$CHECK_RECORD_DOMAIN" "$CHECK_RECORD_RECORD" | grep 'IN' | grep '[0-9][0-9]' | sed 's|.*A||g' | sed "s/^[ \t]*//"; then
CHECK_RECORD_EXIT_STATUS=1
__printf_color "The records for $CHECK_RECORD_DOMAIN are working but have not delegated yet" 6
else
CHECK_RECORD_EXIT_STATUS=2
__printf_color "The record for $CHECK_RECORD_DOMAIN does not exist" 1
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# lets exit with code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exit $CHECK_RECORD_EXIT_STATUS
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh

View File

@ -0,0 +1,59 @@
#!/usr/bin/env sh
# shellcheck shell=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202505201007-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro
# @@License : LICENSE.md
# @@ReadME : get_dns_record --help
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
# @@Created : Tuesday, May 20, 2025 10:07 EDT
# @@File : get_dns_record
# @@Description :
# @@Changelog : New script
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename -- "$0" 2>/dev/null)"
VERSION="202505201007-git"
RUN_USER="$USER"
SET_UID="$(id -u)"
SCRIPT_SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
GET_DNS_RECORD_CWD="$(realpath "$PWD")"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# colorization
if [ "$SHOW_RAW" = "true" ]; then
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
else
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# check for command
__cmd_exists() { which $1 >/dev/null 2>&1 || return 1; }
__function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# custom functions
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define variables
DEFAULT_COLOR="254"
GET_DNS_RECORD_EXIT_STATUS=0
GET_DNS_RECORD_DOMAIN_NAME="$1"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
[ -n "$GET_DNS_RECORD_DOMAIN_NAME" ] || exit 2
grep '^@' "/data/bind/zones/$GET_DNS_RECORD_DOMAIN_NAME.zone" | grep 'IN' | grep ' A ' | sed 's|.*A||g;s|;.*||g;s/^[ \t]*//' || exit 2
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# lets exit with code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exit $GET_DNS_RECORD_EXIT_STATUS
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh

View File

@ -64,7 +64,7 @@ __certbot_key() { grep -s 'key "certbot" ' /etc/named.conf | grep -v 'KEY_CERTBO
__backup_key() { grep -s 'key "backup-key" ' /etc/named.conf | grep -v 'KEY_BACKUP' | sed 's|.*secret ||g;s|"||g;s|;.*||g' | grep '^' || return 1; }
__tsig_key() { tsig-keygen -a hmac-${1:-sha512} | grep 'secret' | sed 's|.*secret "||g;s|"||g;s|;||g' | grep '^' || echo 'I665bFnjoPMB9EmEUl5uZ+o7e4ryM02irerkCkLJiSPJJYJBvBHSXCauNn44zY2C318DSWRcCx+tf8WESYwgKQ=='; }
__check_dig() { dig "${1:-localhost}" "${2:-A}" | grep 'IN' | grep '[0-9][0-9]' | sed 's|.*A||g' | sed "s/^[ \t]*//" || return 2; }
__get_dns_record() { grep '^@' "/data/bind/zones/$1.org.zone" | grep 'IN' | grep ' A ' | sed 's|.*A||g;s|;.*||g;s/^[ \t]*//' || return 2; }
__get_dns_record() { grep '^@' "/data/bind/zones/$1.zone" | grep 'IN' | grep ' A ' | sed 's|.*A||g;s|;.*||g;s/^[ \t]*//' || return 2; }
#__records_match() {}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Script to execute
@ -161,11 +161,11 @@ user_pass="${NAMED_USER_PASS_WORD:-}" # normal user password
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional predefined variables
DNS_SERIAL="$(date +'%Y%m%d%S')"
DNS_ZONE_FILE="$ETC_DIR/zones.conf"
KEY_DHCP="${KEY_DHCP:-$(__dhcp_key || __tsig_key sha512)}"
KEY_RNDC="${KEY_RNDC:-$(__rndc_key || __tsig_key sha512)}"
KEY_BACKUP="${KEY_BACKUP:-$(__backup_key || __tsig_key sha512)}"
KEY_CERTBOT="${KEY_CERTBOT:-$(__certbot_key || __tsig_key sha512)}"
DNS_ZONE_FILE="$ETC_DIR/zones.conf"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional variables
DNS_TYPE="${DNS_TYPE:-primary}"