Merge pull request #29 from snowzach/lighttpd
-Simpleadmin on 80/443 https -ttyd now part of simpleadmin -simpleadmin now password protected -sshd installation option
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
# Define toolkit paths
|
||||
GITUSER="iamromulan"
|
||||
GITTREE="development"
|
||||
GITMAINTREE="main"
|
||||
GITDEVTREE="development"
|
||||
TMP_DIR="/tmp"
|
||||
USRDATA_DIR="/usrdata"
|
||||
SOCAT_AT_DIR="/usrdata/socat-at-bridge"
|
||||
SOCAT_AT_SYSD_DIR="/usrdata/socat-at-bridge/systemd_units"
|
||||
LIGHTTPD_DIR="/usrdata/lighttpd"
|
||||
SIMPLE_ADMIN_DIR="/usrdata/simpleadmin"
|
||||
SIMPLE_FIREWALL_DIR="/usrdata/simplefirewall"
|
||||
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
|
||||
@@ -97,6 +100,71 @@ send_at_commands() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for existing Entware/opkg installation, install if not installed
|
||||
ensure_entware_installed() {
|
||||
remount_rw
|
||||
if [ ! -f "/opt/bin/opkg" ]; then
|
||||
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
|
||||
cd /tmp && wget -O installentware.sh "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh" && chmod +x installentware.sh && ./installentware.sh
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mEntware/OPKG installation failed. Please check your internet connection or the repository URL.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
cd /
|
||||
else
|
||||
echo -e "\e[1;32mEntware/OPKG is already installed.\e[0m"
|
||||
if [ "$(readlink /bin/login)" != "/opt/bin/login" ]; then
|
||||
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Replace the login and passwd binaries and set home for root to a writable directory
|
||||
rm /opt/etc/shadow
|
||||
rm /opt/etc/passwd
|
||||
cp /etc/shadow /opt/etc/
|
||||
cp /etc/passwd /opt/etc
|
||||
mkdir -p /usrdata/root/bin
|
||||
touch /usrdata/root/.profile
|
||||
echo "# Set PATH for all shells" > /usrdata/root/.profile
|
||||
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
|
||||
chmod +x /usrdata/root/.profile
|
||||
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
|
||||
rm /bin/login /usr/bin/passwd
|
||||
ln -sf /opt/bin/login /bin
|
||||
ln -sf /opt/bin/passwd /usr/bin/
|
||||
ln -sf /opt/bin/useradd /usr/bin/
|
||||
echo -e "\e[1;31mPlease set the root password.\e[0m"
|
||||
/usr/bin/passwd
|
||||
|
||||
# Install basic and useful utilities
|
||||
opkg install mc htop dfc lsof
|
||||
ln -sf /opt/bin/mc /bin
|
||||
ln -sf /opt/bin/htop /bin
|
||||
ln -sf /opt/bin/dfc /bin
|
||||
ln -sf /opt/bin/lsof /bin
|
||||
fi
|
||||
|
||||
if [ ! -f "/usrdata/root/.profile" ]; then
|
||||
opkg update && opkg install shadow-useradd
|
||||
mkdir -p /usrdata/root/bin
|
||||
touch /usrdata/root/.profile
|
||||
echo "# Set PATH for all shells" > /usrdata/root/.profile
|
||||
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
|
||||
chmod +x /usrdata/root/.profile
|
||||
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "/opt/sbin/useradd" ]; then
|
||||
echo "useradd does not exist. Installing shadow-useradd..."
|
||||
opkg install shadow-useradd
|
||||
else
|
||||
echo "useradd already exists. Continuing..."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Check if Simple Admin is installed
|
||||
is_simple_admin_installed() {
|
||||
[ -d "$SIMPLE_ADMIN_DIR" ] && return 0 || return 1
|
||||
@@ -186,6 +254,7 @@ install_update_at_socat() {
|
||||
|
||||
# Function to install Simple Firewall
|
||||
install_simple_firewall() {
|
||||
remount_rw
|
||||
systemctl stop simplefirewall
|
||||
systemctl stop ttl-override
|
||||
echo -e "\033[0;32mInstalling/Updating Simple Firewall...\033[0m"
|
||||
@@ -300,10 +369,149 @@ configure_simple_firewall() {
|
||||
echo -e "\e[1;32mFirewall configuration updated.\e[0m"
|
||||
}
|
||||
|
||||
# Function to install Lighttpd
|
||||
install_lighttpd() {
|
||||
ensure_entware_installed
|
||||
remount_rw
|
||||
# Check for simpleadmin_httpd service and remove if exists
|
||||
if [ -f "/lib/systemd/system/simpleadmin_httpd.service" ]; then
|
||||
systemctl stop simpleadmin_httpd
|
||||
rm /lib/systemd/system/simpleadmin_httpd.service
|
||||
rm /lib/systemd/system/multi-user.target.wants/simpleadmin_httpd.service
|
||||
fi
|
||||
|
||||
/opt/bin/opkg install lighttpd lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy
|
||||
# Ensure rc.unslung doesn't try to start it
|
||||
# Dynamically find and remove any Lighttpd-related init script
|
||||
for script in /opt/etc/init.d/*lighttpd*; do
|
||||
if [ -f "$script" ]; then
|
||||
echo "Removing existing Lighttpd init script: $script"
|
||||
rm "$script" # Remove the script if it contains 'lighttpd' in its name
|
||||
fi
|
||||
done
|
||||
systemctl stop lighttpd
|
||||
echo -e "\033[0;32mInstalling/Updating Lighttpd...\033[0m"
|
||||
mkdir -p "$LIGHTTPD_DIR"
|
||||
wget -O "$LIGHTTPD_DIR/lighttpd.conf" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/lighttpd/lighttpd.conf
|
||||
wget -O "/lib/systemd/system/lighttpd.service" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/lighttpd/lighttpd.service
|
||||
ln -sf "/lib/systemd/system/lighttpd.service" "/lib/systemd/system/multi-user.target.wants/"
|
||||
|
||||
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
|
||||
-subj "/C=US/ST=MI/L=Romulus/O=RMIITools/CN=localhost" \
|
||||
-keyout $LIGHTTPD_DIR/server.key -out $LIGHTTPD_DIR/server.crt
|
||||
systemctl daemon-reload
|
||||
systemctl start lighttpd
|
||||
|
||||
echo -e "\033[0;32mLighttpd installation/update complete.\033[0m"
|
||||
|
||||
while true; do
|
||||
echo -e "\e[1;31mPlease set your root web login password.\e[0m"
|
||||
read -s password
|
||||
if [ -z "$password" ]; then
|
||||
echo -e "\e[1;32mNo password provided.\e[0m"
|
||||
else
|
||||
echo -n "root:" > $LIGHTTPD_DIR/.htpasswd
|
||||
openssl passwd -crypt "$password" >> $LIGHTTPD_DIR/.htpasswd
|
||||
echo -e "\e[1;32mPassword set.\e[0m"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Function to install or update ttyd
|
||||
install_ttyd() {
|
||||
echo -e "\e[1;34mStarting ttyd installation process...\e[0m"
|
||||
|
||||
ensure_entware_installed
|
||||
|
||||
mount -o remount,rw /
|
||||
|
||||
if [ ! -d "/usrdata/lighttpd" ]; then
|
||||
install_lighttpd
|
||||
fi
|
||||
|
||||
if [ -d "/usrdata/ttyd" ]; then
|
||||
echo -e "\e[1;34mttyd is already installed. Choose an option:\e[0m"
|
||||
echo -e "\e[1;34m1.) Update to ttyd 1.7.7 (If you are using ttyd you will temporarly loose connection ...)\e[0m"
|
||||
echo -e "\e[1;31m2.) Skip Update (Chose this if you already updated)\e[0m"
|
||||
read -p "Enter your choice (1/2): " choice
|
||||
case $choice in
|
||||
1)
|
||||
echo -e "\e[1;34mUpdating ttyd...\e[0m"
|
||||
echo -e "\e[1;34mIf you are using ttyd you will temporarly loose connection ...\e[0m"
|
||||
mkdir /usrdata/simpleupdates/scripts
|
||||
wget -O /usrdata/simpleupdates/scripts/update_ttyd.sh https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleupdates/scripts/update_ttyd.sh && chmod +x /usrdata/simpleupdates/scripts/update_ttyd.sh
|
||||
/usrdata/simpleupdates/scripts/update_ttyd.sh
|
||||
echo -e "\e[1;32mttyd has been updated.\e[0m"
|
||||
;;
|
||||
2)
|
||||
echo -e "\e[1;34mSkiping ttyd update...\e[0m"
|
||||
;;
|
||||
*)
|
||||
echo -e "\e[1;31mInvalid option. Exiting.\e[0m"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
|
||||
# Continue with installation if ttyd is not already installed.
|
||||
# Check for /usrdata/socat-at-bridge/atcmd, install if not installed
|
||||
if [ ! -f "/usrdata/socat-at-bridge/atcmd" ]; then
|
||||
echo -e "\e[1;34mDependency: atcmd command does not exist. Installing socat-at-bridge...\e[0m"
|
||||
install_update_at_socat
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mFailed to install/update atcmd. Please check the process.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
mkdir -p /usrdata/ttyd/scripts /usrdata/ttyd/systemd
|
||||
cd /usrdata/ttyd/
|
||||
wget -O ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.armhf && chmod +x ttyd
|
||||
wget -O scripts/ttyd.bash "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/scripts/ttyd.bash" && chmod +x scripts/ttyd.bash
|
||||
wget -O systemd/ttyd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/systemd/ttyd.service"
|
||||
cp systemd/ttyd.service /lib/systemd/system/
|
||||
ln -sf /usrdata/ttyd/ttyd /bin
|
||||
|
||||
# Enabling and starting ttyd service
|
||||
systemctl daemon-reload
|
||||
ln -sf /lib/systemd/system/ttyd.service /lib/systemd/system/multi-user.target.wants/
|
||||
systemctl start ttyd
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mFailed to start ttyd service. Please check the systemd service file and ttyd binary.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\e[1;32mInstallation Complete! ttyd server is up on port 443. Note: No TLS/SSL enabled yet.\e[0m"
|
||||
}
|
||||
|
||||
check_and_install_ttyd() {
|
||||
remount_rw
|
||||
local service_file="/lib/systemd/system/ttyd.service"
|
||||
local exec_start_expected1="/usrdata/ttyd/ttyd -p 443 -t 'theme={\"foreground\":\"white\",\"background\":\"black\"}' -t fontSize=25 --writable /usrdata/ttyd/scripts/ttyd.bash"
|
||||
local exec_start_expected2="/usrdata/ttyd/ttyd -i 127.0.0.1 -p 8088 -t 'theme={\"foreground\":\"white\",\"background\":\"black\"}' -t fontSize=25 --writable /usrdata/ttyd/scripts/ttyd.bash"
|
||||
|
||||
if [ -f "$service_file" ]; then
|
||||
# Extract ExecStart line from ttyd.service
|
||||
local exec_start=$(grep ExecStart $service_file)
|
||||
|
||||
if [ "$exec_start" == "ExecStart=$exec_start_expected1" ]; then
|
||||
install_ttyd
|
||||
elif [ "$exec_start" == "ExecStart=$exec_start_expected2" ]; then
|
||||
# Continue without action
|
||||
echo "No action required, ttyd service is configured as expected."
|
||||
else
|
||||
install_ttyd
|
||||
fi
|
||||
else
|
||||
install_ttyd
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install/update Simple Admin
|
||||
install_simple_admin() {
|
||||
while true; do
|
||||
echo -e "\e[1;32mWhat version of Simple Admin do you want to install? This will start a webserver on port 8080\e[0m"
|
||||
echo -e "\e[1;32mWhat version of Simple Admin do you want to install? This will start a webserver on port 8080 (80/443 on test build)\e[0m"
|
||||
echo -e "\e[1;32m1) Stable current version, (Main Branch)\e[0m"
|
||||
echo -e "\e[1;31m2) Install Test Build (Development Branch)\e[0m"
|
||||
echo -e "\e[0;33m3) Return to Main Menu\e[0m"
|
||||
@@ -327,33 +535,34 @@ install_simple_admin() {
|
||||
mkdir $SIMPLE_ADMIN_DIR/www/css
|
||||
mkdir $SIMPLE_ADMIN_DIR/www/js
|
||||
cd $SIMPLE_ADMIN_DIR/systemd
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/systemd/simpleadmin_generate_status.service
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/systemd/simpleadmin_generate_status.service
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/systemd/simpleadmin_httpd.service
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/scripts
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/build_modem_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/modemstatus_parse.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/tojson.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/scripts/build_modem_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/scripts/modemstatus_parse.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/scripts/tojson.sh
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/atcommander.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/index.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/speedtest.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/styles.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/ttl.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/atcommander.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/index.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/speedtest.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/styles.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/ttl.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/bandlock.html
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/js
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/js/alpinejs.min.js
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/js/alpinejs.min.js
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/css/admin.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/css/bulma.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/css/admin.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/css/bulma.css
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/cgi-bin
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_atcommand
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_csq
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_ttl_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/set_ttl
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/cgi-bin/get_atcommand
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/cgi-bin/get_csq
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/cgi-bin/get_ttl_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITMAINTREE/simpleadmin/www/cgi-bin/set_ttl
|
||||
sleep 1
|
||||
cd /
|
||||
chmod +x $SIMPLE_ADMIN_DIR/scripts/*
|
||||
@@ -365,7 +574,6 @@ install_simple_admin() {
|
||||
ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/
|
||||
systemctl start simpleadmin_generate_status
|
||||
sleep 1
|
||||
systemctl start simpleadmin_httpd
|
||||
remount_ro
|
||||
echo -e "\e[1;32msimpleadmin has been installed and is now ready for use!\e[0m"
|
||||
break
|
||||
@@ -376,6 +584,8 @@ install_simple_admin() {
|
||||
sleep 1
|
||||
install_simple_firewall
|
||||
sleep 1
|
||||
install_lighttpd
|
||||
sleep 1
|
||||
remount_rw
|
||||
sleep 1
|
||||
mkdir $SIMPLE_ADMIN_DIR
|
||||
@@ -386,47 +596,47 @@ install_simple_admin() {
|
||||
mkdir $SIMPLE_ADMIN_DIR/www/css
|
||||
mkdir $SIMPLE_ADMIN_DIR/www/js
|
||||
cd $SIMPLE_ADMIN_DIR/systemd
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/systemd/simpleadmin_generate_status.service
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/systemd/simpleadmin_httpd.service
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/systemd/simpleadmin_generate_status.service
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/scripts
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/build_modem_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/modemstatus_parse.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/tojson.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/scripts/build_modem_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/scripts/modemstatus_parse.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/scripts/tojson.sh
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/atcommander.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/index.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/speedtest.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/styles.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/ttl.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/sms.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/bandlock.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/atcommander.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/index.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/speedtest.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/styles.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/ttl.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/sms.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/bandlock.html
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/js
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/js/alpinejs.min.js
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/js/alpinejs.min.js
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/css/admin.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/css/bulma.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/css/admin.css
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/css/bulma.css
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/www/cgi-bin
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_atcommand
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_csq
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_ttl_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/set_ttl
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/cgi-bin/get_atcommand
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/cgi-bin/get_csq
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/cgi-bin/get_ttl_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITDEVTREE/simpleadmin/www/cgi-bin/set_ttl
|
||||
sleep 1
|
||||
cd /
|
||||
chmod +x $SIMPLE_ADMIN_DIR/scripts/*
|
||||
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
|
||||
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
|
||||
sleep 1
|
||||
systemctl daemon-reload
|
||||
sleep 1
|
||||
ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/
|
||||
ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/
|
||||
systemctl start simpleadmin_generate_status
|
||||
sleep 1
|
||||
systemctl start simpleadmin_httpd
|
||||
check_and_install_ttyd
|
||||
sleep 1
|
||||
remount_ro
|
||||
echo -e "\e[1;32msimpleadmin has been installed and is now ready for use!\e[0m"
|
||||
break
|
||||
@@ -446,7 +656,7 @@ install_simple_admin() {
|
||||
uninstall_simpleadmin_components() {
|
||||
echo -e "\e[1;32mStarting the uninstallation process for Simpleadmin components.\e[0m"
|
||||
echo -e "\e[1;32mNote: Uninstalling certain components may affect the functionality of others.\e[0m"
|
||||
echo -e "\e[1;36mIf you are upgrading from an older version of the toolkit uninstall/say yes to all everything.\e[0m"
|
||||
echo -e "\e[1;36mIf you are upgrading from an older version of the toolkit uninstall/say yes to all everything except ttyd.\e[0m"
|
||||
remount_rw
|
||||
|
||||
# Uninstall Simple Firewall
|
||||
@@ -501,22 +711,41 @@ uninstall_simpleadmin_components() {
|
||||
echo -e "\033[0;32mAT Socat Bridge services removed!...\033[0m"
|
||||
fi
|
||||
|
||||
# Uninstall the rest of Simpleadmin
|
||||
echo -e "\e[1;32mDo you want to uninstall the rest of Simpleadmin?\e[0m"
|
||||
# Uninstall ttyd
|
||||
echo -e "\e[1;32mDo you want to uninstall ttyd?\e[0m"
|
||||
echo -e "\e[1;31mWarning: Do not uninstall if you are currently using ttyd to do this!!!\e[0m"
|
||||
echo -e "\e[1;31mInstalling the test build will prompt ttyd to be updated if it needs it anyways\e[0m"
|
||||
echo -e "\e[1;32m1) Yes\e[0m"
|
||||
echo -e "\e[1;31m2) No\e[0m"
|
||||
read -p "Enter your choice (1 or 2): " choice_simpleadmin
|
||||
if [ "$choice_simpleadmin" -eq 1 ]; then
|
||||
echo -e "\e[1;34mUninstalling ttyd...\e[0m"
|
||||
systemctl stop ttyd
|
||||
rm -rf /usrdata/ttyd
|
||||
rm /lib/systemd/system/ttyd.service
|
||||
rm /lib/systemd/system/multi-user.target.wants/ttyd.service
|
||||
rm /bin/ttyd
|
||||
echo -e "\e[1;32mttyd has been uninstalled.\e[0m"
|
||||
fi
|
||||
|
||||
echo "Uninstalling the rest of Simpleadmin..."
|
||||
systemctl stop simpleadmin_httpd
|
||||
|
||||
# Check if Lighttpd service is installed and remove it if present
|
||||
if [ -f "/lib/systemd/system/lighttpd.service" ]; then
|
||||
echo "Lighttpd detected, uninstalling Lighttpd and its modules..."
|
||||
systemctl stop lighttpd
|
||||
opkg remove lighttpd lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy
|
||||
rm -rf $LIGHTTPD_DIR
|
||||
fi
|
||||
|
||||
systemctl stop simpleadmin_generate_status
|
||||
systemctl stop simpleadmin_httpd
|
||||
rm -f /lib/systemd/system/simpleadmin_httpd.service
|
||||
rm -f /lib/systemd/system/simpleadmin_generate_status.service
|
||||
systemctl daemon-reload
|
||||
rm -rf "$SIMPLE_ADMIN_DIR"
|
||||
echo "The rest of Simpleadmin uninstalled."
|
||||
echo "The rest of Simpleadmin and Lighttpd (if present) uninstalled."
|
||||
remount_ro
|
||||
fi
|
||||
|
||||
echo "Uninstallation process completed."
|
||||
}
|
||||
@@ -830,83 +1059,6 @@ WantedBy=multi-user.target" > "$cfun_service_path"
|
||||
fi
|
||||
}
|
||||
|
||||
install_ttyd() {
|
||||
echo -e "\e[1;34mStarting ttyd installation process...\e[0m"
|
||||
# Check for existing Entware/opkg installation, install if not installed
|
||||
if [ ! -f "/opt/bin/opkg" ]; then
|
||||
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
|
||||
cd /tmp && wget -O installentware.sh "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh" && chmod +x installentware.sh && ./installentware.sh
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mEntware/OPKG installation failed. Please check your internet connection or the repository URL.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
cd /
|
||||
else
|
||||
echo -e "\e[1;32mEntware/OPKG is already installed.\e[0m"
|
||||
fi
|
||||
|
||||
mount -o remount,rw /
|
||||
|
||||
if [ -d "/usrdata/ttyd" ]; then
|
||||
echo -e "\e[1;34mttyd is already installed. Choose an option:\e[0m"
|
||||
echo -e "\e[1;34m1.) Update to ttyd 1.7.5 (DO NOT UPDATE WHILE USING ttyd! Use ADB or SSH instead)\e[0m"
|
||||
echo -e "\e[1;31m2.) Uninstall ttyd\e[0m"
|
||||
read -p "Enter your choice (1/2): " choice
|
||||
case $choice in
|
||||
1)
|
||||
echo -e "\e[1;34mUpdating ttyd...\e[0m"
|
||||
systemctl stop ttyd
|
||||
wget -O /usrdata/ttyd/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.5/ttyd.armhf && chmod +x /usrdata/ttyd/ttyd
|
||||
systemctl start ttyd
|
||||
echo -e "\e[1;32mttyd has been updated.\e[0m"
|
||||
;;
|
||||
2)
|
||||
echo -e "\e[1;34mUninstalling ttyd...\e[0m"
|
||||
systemctl stop ttyd
|
||||
rm -rf /usrdata/ttyd
|
||||
rm /lib/systemd/system/ttyd.service
|
||||
rm /lib/systemd/system/multi-user.target.wants/ttyd.service
|
||||
rm /bin/ttyd
|
||||
echo -e "\e[1;32mttyd has been uninstalled.\e[0m"
|
||||
;;
|
||||
*)
|
||||
echo -e "\e[1;31mInvalid option. Exiting.\e[0m"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
|
||||
# Continue with installation if ttyd is not already installed.
|
||||
# Check for /usrdata/socat-at-bridge/atcmd, install if not installed
|
||||
if [ ! -f "/usrdata/socat-at-bridge/atcmd" ]; then
|
||||
echo -e "\e[1;34mDependency: atcmd command does not exist. Installing socat-at-bridge...\e[0m"
|
||||
install_update_at_socat
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mFailed to install/update atcmd. Please check the process.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
mkdir -p /usrdata/ttyd/scripts /usrdata/ttyd/systemd
|
||||
cd /usrdata/ttyd/
|
||||
wget -O ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.4/ttyd.armhf && chmod +x ttyd
|
||||
wget -O scripts/ttyd.bash "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/scripts/ttyd.bash" && chmod +x scripts/ttyd.bash
|
||||
wget -O systemd/ttyd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/systemd/ttyd.service"
|
||||
cp systemd/ttyd.service /lib/systemd/system/
|
||||
ln -sf /usrdata/ttyd/ttyd /bin
|
||||
|
||||
# Enabling and starting ttyd service
|
||||
systemctl daemon-reload
|
||||
ln -sf /lib/systemd/system/ttyd.service /lib/systemd/system/multi-user.target.wants/
|
||||
systemctl start ttyd
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mFailed to start ttyd service. Please check the systemd service file and ttyd binary.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\e[1;32mInstallation Complete! ttyd server is up on port 443. Note: No TLS/SSL enabled yet.\e[0m"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Main menu
|
||||
@@ -984,9 +1136,9 @@ echo " :+##+. "
|
||||
echo -e "\e[92m5) Install/Change or remove Daily Reboot Timer\e[0m" # Light Green
|
||||
echo -e "\e[91m6) Install/Uninstall CFUN 0 Fix\e[0m" # Light Red
|
||||
echo -e "\e[96m7) Install/Uninstall Entware/OPKG\e[0m" # Cyan (repeated color for additional options)
|
||||
echo -e "\e[96m8) Install/Update/Uninstall TTYd 1.7.4 (Uses port 443, No TLS/SSL)\e[0m" # Cyan
|
||||
echo -e "\e[92m9) Install Speedtest.net CLI app (speedtest command)\e[0m" # Light Green
|
||||
echo -e "\e[92m10) Install Fast.com CLI app (fast command)(tops out at 40Mbps)\e[0m" # Light Green
|
||||
echo -e "\e[92m8) Install Speedtest.net CLI app (speedtest command)\e[0m" # Light Green
|
||||
echo -e "\e[92m9) Install Fast.com CLI app (fast command)(tops out at 40Mbps)\e[0m" # Light Green
|
||||
echo -e "\e[92m10) Install OpenSSH Server\e[0m" # Light Green
|
||||
echo -e "\e[93m11) Exit\e[0m" # Yellow (repeated color for exit option)
|
||||
read -p "Enter your choice: " choice
|
||||
|
||||
@@ -1024,26 +1176,10 @@ echo " :+##+. "
|
||||
manage_cfun_fix
|
||||
;;
|
||||
7)
|
||||
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
|
||||
cd /tmp && wget -O installentware.sh https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh && chmod +x installentware.sh && ./installentware.sh && cd /
|
||||
ensure_entware_installed
|
||||
;;
|
||||
8)
|
||||
install_ttyd
|
||||
;;
|
||||
9)
|
||||
echo -e "\e[1;32mInstalling Speedtest.net CLI (speedtest command)\e[0m"
|
||||
# Check for existing Entware/opkg installation, install if not installed
|
||||
if [ ! -f "/opt/bin/opkg" ]; then
|
||||
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
|
||||
cd /tmp && wget -O installentware.sh "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh" && chmod +x installentware.sh && ./installentware.sh
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mEntware/OPKG installation failed. Please check your internet connection or the repository URL.\e[0m"
|
||||
exit 1
|
||||
fi
|
||||
cd /
|
||||
else
|
||||
echo -e "\e[1;32mEntware/OPKG is already installed.\e[0m"
|
||||
fi
|
||||
ensure_entware_installed
|
||||
echo -e "\e[1;32mInstalling Speedtest.net CLI (speedtest command)\e[0m"
|
||||
remount_rw
|
||||
mkdir /usrdata/root
|
||||
@@ -1062,7 +1198,7 @@ echo " :+##+. "
|
||||
echo -e "\e[1;32mNormaly only an issue in adb, ttyd and ssh you are forced to login\e[0m"
|
||||
echo -e "\e[1;32mIf in adb just type login and then try to run the speedtest command\e[0m"
|
||||
;;
|
||||
10)
|
||||
9)
|
||||
echo -e "\e[1;32mInstalling fast.com CLI (fast command)\e[0m"
|
||||
remount_rw
|
||||
mkdir /usrdata/root
|
||||
@@ -1076,6 +1212,36 @@ echo " :+##+. "
|
||||
echo -e "\e[1;32mTry running the command 'fast'\e[0m"
|
||||
echo -e "\e[1;32mThe fast.com test tops out at 40Mbps on the modem\e[0m"
|
||||
;;
|
||||
10)
|
||||
ensure_entware_installed
|
||||
echo -e "\e[1;32mOpenSSH Server\e[0m"
|
||||
remount_rw
|
||||
|
||||
mkdir /usrdata/sshd
|
||||
wget -O /lib/systemd/system/sshd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/sshd/sshd.service"
|
||||
ln -sf "/lib/systemd/system/sshd.service" "/lib/systemd/system/multi-user.target.wants/"
|
||||
|
||||
opkg install openssh-server-pam
|
||||
for script in /opt/etc/init.d/*sshd*; do
|
||||
if [ -f "$script" ]; then
|
||||
echo "Removing existing sshd init script: $script"
|
||||
rm "$script" # Remove the script if it contains 'sshd' in its name
|
||||
fi
|
||||
done
|
||||
/opt/bin/ssh-keygen -A
|
||||
systemctl daemon-reload
|
||||
systemctl enable sshd
|
||||
|
||||
# Enable PAM and PermitRootLogin
|
||||
sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config"
|
||||
sed -i "s/^.*PermitRootLogin .*/PermitRootLogin yes/" "/opt/etc/ssh/sshd_config"
|
||||
|
||||
# Ensure the sshd user exists in the /opt/etc/passwd file
|
||||
grep "sshd:x:106" /opt/etc/passwd || echo "sshd:x:106:65534:Linux User,,,:/opt/run/sshd:/bin/nologin" >> /opt/etc/passwd
|
||||
systemctl start sshd
|
||||
|
||||
echo -e "\e[1;32mOpenSSH installed!!\e[0m"
|
||||
;;
|
||||
11)
|
||||
echo -e "\e[1;32mGoodbye!\e[0m"
|
||||
break
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Modified by iamromlan to set up a proper entware environment for Quectel RM5xx series m.2 modems
|
||||
# Modified by iamromulan to set up a proper entware environment for Quectel RM5xx series m.2 modems
|
||||
TYPE='generic'
|
||||
#|---------|-----------------|
|
||||
#| TARGET | Quectel Modem |
|
||||
@@ -213,7 +213,7 @@ echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m'
|
||||
echo -e '\033[32mInfo: Run export PATH=/opt/bin:/opt/sbin:$PATH to do it for this session only\033[0m'
|
||||
echo -e '\033[32mInfo: opkg at /opt/bin will be linked to /bin but any package you install with opkg will not be automatically.\033[0m'
|
||||
ln -sf /opt/bin/opkg /bin
|
||||
opkg update && opkg install shadow-login shadow-passwd
|
||||
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
|
||||
exit 1
|
||||
@@ -234,17 +234,15 @@ opkg update && opkg install shadow-login shadow-passwd
|
||||
rm /bin/login /usr/bin/passwd
|
||||
ln -sf /opt/bin/login /bin
|
||||
ln -sf /opt/bin/passwd /usr/bin/
|
||||
echo -e "\e[1;31mPlease set your system login password.\e[0m"
|
||||
ln -sf /opt/bin/useradd /usr/bin/
|
||||
echo -e "\e[1;31mPlease set the root password.\e[0m"
|
||||
/usr/bin/passwd
|
||||
|
||||
# Install basic and useful utilites
|
||||
opkg install mc
|
||||
opkg install mc htop dfc lsof
|
||||
ln -sf /opt/bin/mc /bin
|
||||
opkg install htop
|
||||
ln -sf /opt/bin/htop /bin
|
||||
opkg install dfc
|
||||
ln -sf /opt/bin/dfc /bin
|
||||
opkg install lsof
|
||||
ln -sf /opt/bin/lsof /bin
|
||||
# Remount filesystem as read-only
|
||||
mount -o remount,ro /
|
||||
|
||||
47
lighttpd/lighttpd.conf
Normal file
47
lighttpd/lighttpd.conf
Normal file
@@ -0,0 +1,47 @@
|
||||
server.modules = (
|
||||
"mod_redirect",
|
||||
"mod_cgi",
|
||||
"mod_proxy",
|
||||
"mod_openssl",
|
||||
"mod_authn_file",
|
||||
)
|
||||
|
||||
server.username = "nobody"
|
||||
server.groupname = "dialout"
|
||||
|
||||
server.port = 80
|
||||
server.document-root = "/usrdata/simpleadmin/www"
|
||||
index-file.names = ( "index.html" )
|
||||
|
||||
auth.backend = "htpasswd"
|
||||
auth.backend.htpasswd.userfile = "/usrdata/lighttpd/.htpasswd"
|
||||
|
||||
$SERVER["socket"] == "0.0.0.0:443" {
|
||||
ssl.engine = "enable"
|
||||
ssl.privkey= "/usrdata/lighttpd/server.key"
|
||||
ssl.pemfile= "/usrdata/lighttpd/server.crt"
|
||||
ssl.acme-tls-1 = "/etc/lighttpd/dehydrated/tls-alpn-01"
|
||||
ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2") # (lighttpd 1.4.56 default; recommended to accept only TLSv1.2 and TLSv1.3)
|
||||
auth.require = ( "/" => (
|
||||
"method" => "basic",
|
||||
"realm" => "Authorized users only",
|
||||
"require" => "valid-user"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
# Redirect everything to https
|
||||
$HTTP["scheme"] == "http" {
|
||||
url.redirect = ("" => "https://${url.authority}${url.path}${qsa}")
|
||||
}
|
||||
|
||||
# Anything in /cgi-bin will be run as a script
|
||||
$HTTP["url"] =~ "/cgi-bin/" {
|
||||
cgi.assign = ( "" => "" )
|
||||
}
|
||||
|
||||
# Handle proxy to ttyd if it's running
|
||||
$HTTP["url"] =~ "(^/console)" {
|
||||
proxy.header = ("map-urlpath" => ( "/console" => "/" ), "upgrade" => "enable" )
|
||||
proxy.server = ( "" => ("" => ( "host" => "127.0.0.1", "port" => 8088 )))
|
||||
}
|
||||
14
lighttpd/lighttpd.service
Normal file
14
lighttpd/lighttpd.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Lighttpd Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
PIDFile=/opt/var/run/lighttpd.pid
|
||||
ExecStartPre=/opt/sbin/lighttpd -tt -f /usrdata/lighttpd/lighttpd.conf
|
||||
ExecStart=/opt/sbin/lighttpd -D -f /usrdata/lighttpd/lighttpd.conf
|
||||
ExecReload=/bin/kill -USR1 $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Simple Settings</title>
|
||||
<title>AT Commands</title>
|
||||
|
||||
<script src="/js/alpinejs.min.js" defer></script>
|
||||
<link rel="stylesheet" href="/css/bulma.css" />
|
||||
@@ -35,13 +35,12 @@
|
||||
>
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html">
|
||||
Simple Settings
|
||||
</a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,13 +44,12 @@
|
||||
>
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html">
|
||||
Simple Settings
|
||||
</a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
>
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> Simple Settings </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
>
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> Simple Settings </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
>
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> Simple Settings </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
<div id="navMenu" class="navbar-menu" :class="isOpen ? 'is-active' : ''">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="/"> Connection Info </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> Simple Settings </a>
|
||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||
<a class="navbar-item" href="/bandlock.html"> Simple Network </a>
|
||||
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> Speedtest </a>
|
||||
<a class="navbar-item" href="/speedtest.html"> OpenSpeedtest </a>
|
||||
<a class="navbar-item" href="/console"> Console </a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the ports you want to block
|
||||
PORTS=("80" "8080" "8088" "443") # Default ports, will be modified by the install script
|
||||
PORTS=("80" "443") # Default ports, will be modified by the install script
|
||||
|
||||
# First, allow specified ports on bridge0, eth0, and tailscale0
|
||||
for port in "${PORTS[@]}"; do
|
||||
|
||||
42
simpleupdates/scripts/update_ttyd.sh
Normal file
42
simpleupdates/scripts/update_ttyd.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define constants
|
||||
GITUSER="iamromulan"
|
||||
GITTREE="main"
|
||||
SERVICE_FILE="/lib/systemd/system/install_ttyd.service"
|
||||
TMP_SCRIPT="/tmp/install_ttyd.sh"
|
||||
|
||||
# Create the systemd service file
|
||||
cat <<EOF > "$SERVICE_FILE"
|
||||
[Unit]
|
||||
Description=Update ttyd service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash $TMP_SCRIPT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Create and populate the temporary shell script for installation
|
||||
cat <<EOF > "$TMP_SCRIPT"
|
||||
#!/bin/bash
|
||||
mount -o remount,rw /
|
||||
echo -e "\e[1;34mUpdating ttyd...\e[0m"
|
||||
systemctl stop ttyd
|
||||
wget -O /usrdata/ttyd/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.armhf && chmod +x /usrdata/ttyd/ttyd
|
||||
wget -O /usrdata/ttyd/scripts/ttyd.bash "https://raw.githubusercontent.com/$GITUSER/$GITTREE/ttyd/scripts/ttyd.bash" && chmod +x /usrdata/ttyd/scripts/ttyd.bash
|
||||
wget -O /usrdata/ttyd/systemd/ttyd.service "https://raw.githubusercontent.com/$GITUSER/$GITTREE/ttyd/systemd/ttyd.service"
|
||||
cp -f /usrdata/ttyd/systemd/ttyd.service /lib/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl start ttyd
|
||||
echo -e "\e[1;32mttyd has been updated.\e[0m"
|
||||
EOF
|
||||
|
||||
# Make the temporary script executable
|
||||
chmod +x "$TMP_SCRIPT"
|
||||
|
||||
# Reload systemd to recognize the new service and start the update
|
||||
systemctl daemon-reload
|
||||
systemctl start install_ttyd.service
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
@@ -3,7 +3,7 @@ Description=Socat Serial Emulation for smd11
|
||||
After=ql-netd.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN,raw,echo=0 pty,link=/dev/ttyOUT,raw,echo=1
|
||||
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN,raw,echo=0,group=20,perm=660 pty,link=/dev/ttyOUT,raw,echo=1,group=20,perm=660
|
||||
# Add a delay to prevent the clients from starting too early
|
||||
ExecStartPost=/bin/sleep 2s
|
||||
Restart=always
|
||||
|
||||
@@ -3,7 +3,7 @@ Description=Socat Serial Emulation for smd7
|
||||
After=ql-netd.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN2,raw,echo=0 pty,link=/dev/ttyOUT2,raw,echo=1
|
||||
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN2,raw,echo=0,group=20,perm=660 pty,link=/dev/ttyOUT2,raw,echo=1,group=20,perm=660
|
||||
# Add a delay to prevent the clients from starting too early
|
||||
ExecStartPost=/bin/sleep 2s
|
||||
Restart=always
|
||||
|
||||
17
sshd/sshd.service
Normal file
17
sshd/sshd.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=OpenBSD Secure Shell server
|
||||
Documentation=man:sshd(8) man:sshd_config(5)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
PIDFile=/opt/var/run/sshd.pid
|
||||
ExecStartPre=/opt/sbin/sshd -t
|
||||
ExecStart=/opt/sbin/sshd -D
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=sshd.service
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
@@ -1,9 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Read the serial number
|
||||
serial_number=$(/usrdata/socat-at-bridge/atcmd 'AT+EGMR=0,5' | grep '+EGMR:' | cut -d '"' -f2)
|
||||
# Read the firmware revision
|
||||
firmware_revision=$(/usrdata/socat-at-bridge/atcmd 'AT+CGMR' | grep -o 'RM[0-9A-Z]*' | head -1)
|
||||
# Check if /usrdata/socat-at-bridge/atcmd exists
|
||||
if [ -f "/usrdata/socat-at-bridge/atcmd" ]; then
|
||||
# Read the serial number
|
||||
serial_number=$(/usrdata/socat-at-bridge/atcmd 'AT+EGMR=0,5' | grep '+EGMR:' | cut -d '"' -f2)
|
||||
# Read the firmware revision
|
||||
firmware_revision=$(/usrdata/socat-at-bridge/atcmd 'AT+CGMR' | grep -o 'RM[0-9A-Z]*' | head -1)
|
||||
else
|
||||
serial_number="UNKNOWN"
|
||||
firmware_revision="UNKNOWN"
|
||||
fi
|
||||
|
||||
echo "=============================================================="
|
||||
echo "=============================================================="
|
||||
@@ -84,7 +90,7 @@ echo " :@@@@@*. "
|
||||
echo " .=@@@@@- "
|
||||
echo " :+##+. "
|
||||
echo "=============================================================="
|
||||
echo "TTYd session file by iamromulan v1.0"
|
||||
echo "TTYd session file by iamromulan v1.1"
|
||||
echo "Firmware Revision: $firmware_revision"
|
||||
echo "Serial Number: $serial_number"
|
||||
echo "=============================================================="
|
||||
|
||||
@@ -5,7 +5,7 @@ After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/sleep 5
|
||||
ExecStart=/usrdata/ttyd/ttyd -p 443 -t 'theme={"foreground":"white","background":"black"}' -t fontSize=25 --writable /usrdata/ttyd/scripts/ttyd.bash
|
||||
ExecStart=/usrdata/ttyd/ttyd -i 127.0.0.1 -p 8088 -t 'theme={"foreground":"white","background":"black"}' -t fontSize=25 --writable /usrdata/ttyd/scripts/ttyd.bash
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user