Last active
August 18, 2024 01:29
-
-
Save Lemon2ee/f51acc99e48052e735cb3abead305f05 to your computer and use it in GitHub Desktop.
Revisions
-
Lemon2ee revised this gist
Aug 18, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,7 @@ log apt install curl wget iperf3 neofetch htop iptables -y # Step 3: Install Hysteria echo "Step 3: Installing Hysteria" log bash <(curl -fsSL https://get.hy2.sh/) --version v2.5.0 # Step 4: Enable Hysteria service echo "Step 4: Enabling Hysteria service" -
Lemon2ee revised this gist
Aug 17, 2024 . 1 changed file with 15 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,27 @@ generate_password() { < /dev/urandom tr -dc 'A-Za-z0-9-_!@#%&*+=?' | head -c 32 } # Check for -v flag and capture email and domain VERBOSE=false while getopts "v" flag; do case "${flag}" in v) VERBOSE=true ;; esac done shift $((OPTIND - 1)) # Check for domain and email in arguments domain="$1" email="$2" # If domain or email not provided, prompt the user if [ -z "$domain" ]; then read -p "Enter your domain: " domain fi if [ -z "$email" ]; then read -p "Enter your email: " email fi # Step 1: Update package list echo "Step 1: Running apt update" @@ -56,10 +70,6 @@ echo "Step 7: Applying sysctl settings" log sysctl -w net.core.rmem_max=16777216 log sysctl -w net.core.wmem_max=16777216 # Generate a random password password=$(generate_password) -
Lemon2ee revised this gist
Jul 18, 2024 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,11 @@ log() { fi } # Function to generate a random password generate_password() { < /dev/urandom tr -dc 'A-Za-z0-9-_!@#%&*+=?' | head -c 32 } # Check for -v flag VERBOSE=false while getopts "v" flag; do @@ -55,6 +60,9 @@ log sysctl -w net.core.wmem_max=16777216 read -p "Enter your domain: " domain read -p "Enter your email: " email # Generate a random password password=$(generate_password) # Step 8: Write Hysteria configuration echo "Step 8: Writing Hysteria configuration" cat <<EOT | log tee /etc/hysteria/config.yaml @@ -65,7 +73,7 @@ acme: auth: type: password password: $password masquerade: type: proxy @@ -87,3 +95,4 @@ echo "Step 11: Starting Hysteria service" log systemctl start hysteria-server.service echo "Setup complete!" echo "Generated password: $password" -
Lemon2ee created this gist
Jul 18, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,89 @@ #!/bin/bash # Function to hide or show output based on -v flag log() { if [ "$VERBOSE" = true ]; then "$@" else "$@" > /dev/null 2>&1 fi } # Check for -v flag VERBOSE=false while getopts "v" flag; do case "${flag}" in v) VERBOSE=true ;; esac done # Step 1: Update package list echo "Step 1: Running apt update" log apt update -y # Step 2: Upgrade packages and install necessary tools echo "Step 2: Running apt upgrade and installing necessary tools" log apt upgrade -y log apt install curl wget iperf3 neofetch htop iptables -y # Step 3: Install Hysteria echo "Step 3: Installing Hysteria" log bash <(curl -fsSL https://get.hy2.sh/) # Step 4: Enable Hysteria service echo "Step 4: Enabling Hysteria service" log systemctl enable hysteria-server.service # Step 5: Create directory for custom systemd configuration echo "Step 5: Creating directory for custom systemd configuration" log mkdir /etc/systemd/system/hysteria-server.service.d # Step 6: Write custom CPU scheduling configuration echo "Step 6: Writing custom CPU scheduling configuration" cat <<EOT | log tee /etc/systemd/system/hysteria-server.service.d/priority.conf [Service] CPUSchedulingPolicy=rr CPUSchedulingPriority=99 EOT # Step 7: Apply sysctl settings echo "Step 7: Applying sysctl settings" log sysctl -w net.core.rmem_max=16777216 log sysctl -w net.core.wmem_max=16777216 # Get user input for domain and email read -p "Enter your domain: " domain read -p "Enter your email: " email # Step 8: Write Hysteria configuration echo "Step 8: Writing Hysteria configuration" cat <<EOT | log tee /etc/hysteria/config.yaml acme: domains: - $domain email: $email auth: type: password password: j4Gv/wtubT1FAW33IwyQQCZF masquerade: type: proxy proxy: url: https://news.ycombinator.com/ rewriteHost: true EOT # Step 9: Set up iptables rule echo "Step 9: Setting up iptables rule" log iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443 # Step 10: Reload systemd daemon echo "Step 10: Reloading systemd daemon" log systemctl daemon-reload # Step 11: Start Hysteria service echo "Step 11: Starting Hysteria service" log systemctl start hysteria-server.service echo "Setup complete!"