From 4e065a1f3f4c475c7ac422210d3b33430681475a Mon Sep 17 00:00:00 2001 From: Yong Bin Date: Thu, 14 Dec 2023 21:08:19 +0000 Subject: [PATCH] message_decoder: handle empty server_name --- init_pi.sh | 3 +-- proxy/CMakeLists.txt | 4 ++-- proxy/hood_proxy.conf | 2 +- proxy/install_dependencies_debian.sh | 6 +++--- proxy/src/tls_message_decoder.cpp | 4 ++++ scripts/02-hood-dispatcher | 20 +------------------- scripts/rc.local | 17 +++++++++++++++++ 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/init_pi.sh b/init_pi.sh index 667a296..985d0c8 100644 --- a/init_pi.sh +++ b/init_pi.sh @@ -16,11 +16,10 @@ EOF fi cp -Rf $script_dir/../v/home/x/.mozilla ~/ +exit sudo sed -i "s/dtoverlay=vc4-kms-v3d/dtoverlay=vc4-fkms-v3d/g" /boot/firmware/config.txt sudo sed -i "s/.*udp dport {6.*//g" /etc/NetworkManager/dispatcher.d/02-hood-dispatcher -exit - sudo tee /etc/modprobe.d/bin-y-blacklist.conf <(); + return ResultType::good; + } if (end_of_extension < offset + sizeof(protocol::extension::ServerName)) { LOG_DEBUG(); return ResultType::bad; diff --git a/scripts/02-hood-dispatcher b/scripts/02-hood-dispatcher index d6b3e30..fbd0795 100644 --- a/scripts/02-hood-dispatcher +++ b/scripts/02-hood-dispatcher @@ -35,7 +35,7 @@ function proxy_access_on(){ nft insert rule ip filter input index 5 iif $1 ip daddr $interface_address udp dport {53} accept nft insert rule ip filter input index 5 iif $1 udp sport {68} udp dport {67} log prefix \"[HOOD A]\" flags all accept nft insert rule ip filter output index 5 oif $1 udp sport {67} udp dport {68} log prefix \"[HOOD A]\" flags all accept - nohup /usr/sbin/dnsmasq --pid-file=/tmp/hood/dnsmasq-$1.pid --conf-file=/dev/null --no-hosts --no-resolv --keep-in-foreground --interface=$1 --clear-on-reload --strict-order --listen-address=$interface_address --bind-dynamic --no-poll --address=/#/$interface_address --cache-size=0 --dhcp-range=$interface_address,10.0.${counter}.255,255.255.255.0,400w --dhcp-authoritative --dhcp-leasefile=/tmp/hood/dnsmasq-$1.lease --dhcp-option=option:dns-server,$interface_address > /tmp/hood/dnsmasq-$1.log &2>1 & + nohup /usr/sbin/dnsmasq --pid-file=/tmp/hood/dnsmasq-$1.pid --conf-file=/dev/null --no-hosts --no-resolv --keep-in-foreground --interface=$1 --except-interface=lo --clear-on-reload --strict-order --listen-address=$interface_address --bind-interfaces --no-poll --address=/#/$interface_address --cache-size=0 --dhcp-range=$interface_address,10.0.${counter}.255,255.255.255.0,400w --dhcp-authoritative --dhcp-leasefile=/tmp/hood/dnsmasq-$1.lease --dhcp-option=option:dns-server,$interface_address > /tmp/hood/dnsmasq-$1.log &2>1 & disown } @@ -131,24 +131,6 @@ function http_timesync(){ if [ "$2" = "before-network-service" ]; then initial_firewall_rules - - hostname_format=$(($RANDOM % 6)) - if [[ $hostname_format == 0 ]]; then - hostname="WIN-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 11` - elif [[ $hostname_format == 1 ]]; then - hostname="LAPTOP-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 8` - elif [[ $hostname_format == 2 ]]; then - hostname="DESKTOP-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 7` - elif [[ $hostname_format == 3 ]]; then - hostname="iPad" - elif [[ $hostname_format == 4 ]]; then - hostname="iPhone" - elif [[ $hostname_format == 5 ]]; then - hostname="Apple Watch" - fi - - hostnamectl set-hostname $hostname - elif [ "$2" = "pre-up" ]; then #ifconfig $1 link random wan_port=0 diff --git a/scripts/rc.local b/scripts/rc.local index ff494ce..7de4c15 100644 --- a/scripts/rc.local +++ b/scripts/rc.local @@ -3,6 +3,23 @@ #echo '1-1' > /sys/class/backlight/ #ls /sys/class/backlight/ > /var/tmp/test +hostname_format=$(($RANDOM % 6)) +if [[ $hostname_format == 0 ]]; then + hostname="WIN-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 11` +elif [[ $hostname_format == 1 ]]; then + hostname="LAPTOP-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 8` +elif [[ $hostname_format == 2 ]]; then + hostname="DESKTOP-"`cat /dev/random | tr -dc "A-Z0-9"|head -c 7` +elif [[ $hostname_format == 3 ]]; then + hostname="iPad" +elif [[ $hostname_format == 4 ]]; then + hostname="iPhone" +elif [[ $hostname_format == 5 ]]; then + hostname="Apple Watch" +fi + +hostnamectl set-hostname $hostname + if test -f /var/lib/hood/flags/harden_only; then exit 0 fi