forked from snxraven/autoinstallers
first commit
This commit is contained in:
commit
754955ce15
131
64/wp
Normal file
131
64/wp
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Wordpress Automated installer"
|
||||||
|
echo "This will install Apache, MySQL, PHP and Wordpress on your system"
|
||||||
|
echo "The install will be located at /var/www/html"
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Thank for for using Discord-Linux x64 Beta! We are preparing your Wordpress installation..."
|
||||||
|
|
||||||
|
echo "======System Info========"
|
||||||
|
uptime
|
||||||
|
hostname
|
||||||
|
ifconfig
|
||||||
|
free -h
|
||||||
|
df -h
|
||||||
|
echo "======Updating System======="
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -
|
||||||
|
|
||||||
|
echo "=====Allowing Overrides========"
|
||||||
|
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||||
|
echo "done."
|
||||||
|
echo "======Starting MariaDB======="
|
||||||
|
service mariadb start
|
||||||
|
echo "sleeping 3 seconds to allow mysql to start"
|
||||||
|
sleep 3
|
||||||
|
echo "======creating database with random strings for dbname, dbuser and dbpassword====="
|
||||||
|
|
||||||
|
DBNAME=$(openssl rand -hex 12)
|
||||||
|
USERNAME=$(openssl rand -hex 12)
|
||||||
|
PASSWORD=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
mysql -uroot -e "CREATE DATABASE $DBNAME CHARACTER SET utf8 COLLATE utf8_general_ci";
|
||||||
|
mysql -uroot -e "CREATE USER $USERNAME@'localhost' IDENTIFIED BY '$PASSWORD'";
|
||||||
|
mysql -uroot -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$USERNAME'@'localhost'";
|
||||||
|
|
||||||
|
echo "Database and user created."
|
||||||
|
notif "We have created the following Database information for this installaton: Database: $DBNAME, Username: $USERNAME, Password: $PASSWORD"
|
||||||
|
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
|
||||||
|
echo "=====Fixing SystemD======="
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
echo "=====Installing Wordpress base====="
|
||||||
|
|
||||||
|
wget -O /var/www/html/latest.tar.gz https://wordpress.org/latest.tar.gz
|
||||||
|
#unzip wordpress
|
||||||
|
cd /var/www/html && tar -zxvf latest.tar.gz
|
||||||
|
#change dir to wordpress
|
||||||
|
cd /var/www/html/wordpress
|
||||||
|
#copy file to parent dir
|
||||||
|
cp -rf . ..
|
||||||
|
#move back to parent dir
|
||||||
|
cd ..
|
||||||
|
#remove files from wordpress folder
|
||||||
|
rm -R wordpress
|
||||||
|
#create wp config
|
||||||
|
cp wp-config-sample.php wp-config.php
|
||||||
|
|
||||||
|
echo "=====Setting up WP DB Config====="
|
||||||
|
#set database details with perl find and replace
|
||||||
|
perl -pi -e "s/database_name_here/$DBNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/username_here/$USERNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/password_here/$PASSWORD/g" /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#set WP salts
|
||||||
|
perl -i -pe'
|
||||||
|
BEGIN {
|
||||||
|
@chars = ("a" .. "z", "A" .. "Z", 0 .. 9);
|
||||||
|
push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|";
|
||||||
|
sub salt { join "", map $chars[ rand @chars ], 1 .. 64 }
|
||||||
|
}
|
||||||
|
s/put your unique phrase here/salt()/ge
|
||||||
|
' /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
#create uploads folder and set permissions
|
||||||
|
mkdir /var/www/html/wp-content/uploads
|
||||||
|
chmod 775 /var/www/html/wp-content/uploads
|
||||||
|
mkdir -p /var/www/temp
|
||||||
|
chmod 755 /var/www/temp
|
||||||
|
|
||||||
|
echo "====Installing WP CLI====="
|
||||||
|
# installing wp cli
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
php wp-cli.phar --info
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
echo "====Setting Custom ENV===="
|
||||||
|
cd /var/www/html/ && wp config set FS_METHOD \'direct\' --raw --type=constant --allow-root
|
||||||
|
cd /var/www/html/ && wp config set 'WP_TEMP_DIR' \'/var/www/temp\' --raw --type=constant --allow-root
|
||||||
|
|
||||||
|
echo "====repairing ownership and permissions====="
|
||||||
|
chown -R www-data:www-data /var/www/html/
|
||||||
|
chown -R www-data:www-data /var/www/temp
|
||||||
|
|
||||||
|
|
||||||
|
find /var/www/html/ -type d -exec chmod 755 {} \;
|
||||||
|
find /var/www/html/ -type f -exec chmod 644 {} \;
|
||||||
|
|
||||||
|
rm -f /var/www/html/index.html
|
||||||
|
sed -i "3 iif ( (\!empty( \$_SERVER['HTTP_X_FORWARDED_HOST'])) || (\!empty( \$_SERVER['HTTP_X_FORWARDED_FOR'])) ) { \$_SERVER['HTTPS'] = 'on'; }" /var/www/html/wp-config.php
|
||||||
|
echo "Cleaning..."
|
||||||
|
#remove zip file
|
||||||
|
rm latest.tar.gz
|
||||||
|
|
||||||
|
echo "=====Setting serverName ENV====="
|
||||||
|
echo "serverName $(hostname)" >> /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
echo "====starting webserver====="
|
||||||
|
service apache2 start
|
||||||
|
echo "=====starting httpRelay===="
|
||||||
|
httpPort
|
||||||
|
sed -i "s/#wp/service mariadb start \&\& service apache2 start/g" /start.sh
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
sed -i 's/wpinstaller//g' /start.sh
|
||||||
|
mv /wpInstaller_log /var/log
|
||||||
|
sleep 3
|
||||||
|
echo "$(httpURL)"
|
||||||
|
echo "$(httpURL)" > /wpInstallComplete
|
||||||
|
|
||||||
|
notif "Installation is complete. You can access your site at $(httpURL)"
|
||||||
|
|
53
alma/code-server
Normal file
53
alma/code-server
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux CodeServer Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Code-Server Automated installer for Discord-Linux ARM, We are preparing your installation..."
|
||||||
|
|
||||||
|
notif "Installing Code-Server 3.12 using DPKG"
|
||||||
|
|
||||||
|
wget https://github.com/coder/code-server/releases/download/v3.12.0/code-server-3.12.0-arm64.rpm
|
||||||
|
rpm -U code-server-3.12.0-arm64.rpm
|
||||||
|
rm -f code-server-3.12.0-arm64.rpm
|
||||||
|
|
||||||
|
notif "Downloading our configurations"
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.json https://ssh.surf/install/code-server/startCodeServer.json
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.sh https://ssh.surf/install/code-server/startCodeServer.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
mkdir -vp /root/.config/code-server/
|
||||||
|
|
||||||
|
wget -q -O /root/.config/code-server/config.yaml https://ssh.surf/install/code-server/config.yaml
|
||||||
|
|
||||||
|
PASS=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/replaceme/${PASS}/g" ~/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
sed -i "s/#code-server/cd \/var\/tools \&\& pm2 start startCodeServer.json \&\& relayPort 8080/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/127.0.0.1:8080/0.0.0.0:${port}/g" /root/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
pm2 start /var/tools/startCodeServer.json
|
||||||
|
|
||||||
|
|
||||||
|
notif "The installation has completed. You may access your install at: http://ssh.surf:$port with the password $PASS"
|
55
alma/hastebin
Normal file
55
alma/hastebin
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux HasteBin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the HasteBin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
cd /home
|
||||||
|
|
||||||
|
notif "Cloning into /home/haste-server"
|
||||||
|
git clone https://github.com/seejohnrun/haste-server.git
|
||||||
|
|
||||||
|
cd haste-server
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/7777/${port}/g" config.js
|
||||||
|
|
||||||
|
|
||||||
|
notif "Configuring HasteBin and starting it's server"
|
||||||
|
wget -O hasteBinStart.json https://ssh.surf/install/hastebin
|
||||||
|
|
||||||
|
cd /home/haste-server && pm2 start hasteBinStart.json
|
||||||
|
|
||||||
|
sed -i "s/#hastebin/cd \/home\/haste-server \&\& pm2 start hasteBinStart.json/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "You may also create a subdomain for your installation by usoing the following commands in discord"
|
||||||
|
echo "+dns register yoursubdomainhere"
|
||||||
|
echo "+dns vhost $port"
|
||||||
|
echo "The installation will then be avalible over encrypted SSL at https://yoursubdomainhere.ssh.surf"
|
||||||
|
|
||||||
|
echo "Sending discord notification to your account:"
|
||||||
|
notif "Your hastebin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
11
alma/jdk
Normal file
11
alma/jdk
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cat <<EOF > /etc/yum.repos.d/adoptium.repo
|
||||||
|
[Adoptium]
|
||||||
|
name=Adoptium
|
||||||
|
baseurl=https://packages.adoptium.net/artifactory/rpm/centos/8/$(uname -m)
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
|
||||||
|
EOF
|
||||||
|
yum remove java-1.8.0-openjdk-headless -y
|
||||||
|
yum update -y # update if you haven't already -y
|
||||||
|
yum install temurin-17-jdk -y
|
12
alma/list
Normal file
12
alma/list
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Software Currently Avalible for AlmaLinux:
|
||||||
|
To install use: auto-install packageName
|
||||||
|
|
||||||
|
PackageName - Software URL
|
||||||
|
|
||||||
|
webmin - https://www.webmin.com/
|
||||||
|
osjs-webdesktop - https://www.os-js.org/
|
||||||
|
wp - https://wordpress.org/
|
||||||
|
hastebin - https://www.toptal.com/developers/hastebin/about.md
|
||||||
|
code-server - https://github.com/coder/code-server
|
||||||
|
jdk - https://adoptium.net/
|
||||||
|
mc - https://papermc.io/
|
63
alma/mc
Normal file
63
alma/mc
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux MineCraft Server Automated installer"
|
||||||
|
echo "This will install MineCraft Sever on your system"
|
||||||
|
echo "A random port on your container will be selected."
|
||||||
|
printf "\n"
|
||||||
|
echo "Running this sever does require the Discord-Linux Power Plan"
|
||||||
|
echo "You may purchase this plan here: https://store.discord-linux.com/product/discord-power-upgrade/"
|
||||||
|
printf "\n"
|
||||||
|
echo "Sleeping for 30 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
wget -q -O - https://ssh.surf/notify | bash
|
||||||
|
notif "Welcome to the MineCraft Server installer for Discord-Linux, the installation is starting and will complete in 45 seconds"
|
||||||
|
useradd mc
|
||||||
|
mkdir -vp /home/mc
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
wget -O /home/mc/server.jar https://api.papermc.io/v2/projects/paper/versions/1.18.2/builds/357/downloads/paper-1.18.2-357.jar
|
||||||
|
|
||||||
|
|
||||||
|
wget -O /home/mc/minecraft-server.json https://ssh.surf/install/mc/minecraft-server.json
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /home/mc/eula.txt https://ssh.surf/install/mc/eula
|
||||||
|
|
||||||
|
chown -R mc:mc
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
|
||||||
|
echo "sleeping 30 seconds to allow the server to generate"
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo "Shutting down the MC server for port configuration"
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 delete all"
|
||||||
|
|
||||||
|
echo "killing any possible running instances of java"
|
||||||
|
pkill java -9
|
||||||
|
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
sleep 10
|
||||||
|
echo "Setting port in our config"
|
||||||
|
sed -i "s/25565/${port}/g" /home/mc/server.properties
|
||||||
|
sed -i "s/max-players=20/max-players=4/g" /home/mc/server.properties
|
||||||
|
sed -i "s/A Minecraft Server/An MC Server running on Discord-Linux/g" /home/mc/server.properties
|
||||||
|
|
||||||
|
echo "Starting the server for final launch"
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
notif "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
echo "Please allow up to 5 minutes for the server to start up"
|
||||||
|
|
116
alma/osjs-webdesktop
Executable file
116
alma/osjs-webdesktop
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux OSjs Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when this process is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "Sleeping for 5 seconds, please close this process if you do not wish to continue"
|
||||||
|
yum groupinstall 'Development Tools' -y
|
||||||
|
yum install pam-devel -y
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the OSjs Automated installer for Discord-Linux, we will begin by updating your system. Please wait..."
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
notif "The system has been updated and systemD has been patched, we are now starting to install the required NPM's for OSjs"
|
||||||
|
|
||||||
|
mkdir -vp /webos
|
||||||
|
|
||||||
|
cd /webos && git clone https://github.com/os-js/OS.js.git
|
||||||
|
|
||||||
|
mv /webos/OS.js /webos/OSjs
|
||||||
|
|
||||||
|
cd /webos/OSjs && rm -f package-lock.json
|
||||||
|
|
||||||
|
echo "Installing main packages..."
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "The Core OSjs Packages have been installed, we are now starting to install the Applications for OSJS Via NPM"
|
||||||
|
|
||||||
|
npm install @osjs/textpad-application
|
||||||
|
npm install --save --production @osjs/draw-application
|
||||||
|
npm install --save --production @osjs/filemanager-application
|
||||||
|
npm install @osjs/settings-application
|
||||||
|
npm install @osjs/writer-application
|
||||||
|
npm install --save --production @osjs/xterm-application
|
||||||
|
npm install --save --production @osjs/ace-application
|
||||||
|
npm install @osjs/xpra-application
|
||||||
|
npm install @osjs/vnc-application
|
||||||
|
npm install @osjs/epub-application
|
||||||
|
npm install @osjs/webodf-application
|
||||||
|
npm install @osjs/wolfenstein3d-application
|
||||||
|
npm install @osjs/tetris-application
|
||||||
|
npm install @osjs/standard-theme
|
||||||
|
npm install @osjs/standard-dark-theme
|
||||||
|
npm install @osjs/gnome-icons
|
||||||
|
npm install @osjs/freedesktop-sounds
|
||||||
|
npm install --save --production @osjs/pam-auth
|
||||||
|
|
||||||
|
echo "Fixing detected vulns"
|
||||||
|
|
||||||
|
npm audit fix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "We are almost finished, we are now configuring OSjs and starting the server"
|
||||||
|
|
||||||
|
echo "removing config files..."
|
||||||
|
rm -f src/server/index.js
|
||||||
|
|
||||||
|
rm -f src/server/config.js
|
||||||
|
|
||||||
|
rm -f src/client/config.js
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing our own customized config files"
|
||||||
|
|
||||||
|
wget -O src/server/index.js https://ssh.surf/install/osjs/osjs_server_index.js
|
||||||
|
|
||||||
|
wget -O src/server/config.js https://ssh.surf/install/osjs/osjs_server_config.js
|
||||||
|
|
||||||
|
wget -O src/client/config.js https://ssh.surf/install/osjs/osjs_client_config.js
|
||||||
|
|
||||||
|
wget -O src/client/wallpaper.jpg https://ssh.surf/wallpaper.jpg
|
||||||
|
|
||||||
|
wget -O osjsStart.json https://ssh.surf/install/osjs/osjsStart.json
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
echo "Setting port in our config"
|
||||||
|
sed -i "s/CUSTOM/${port}/g" src/server/config.js
|
||||||
|
|
||||||
|
echo "Discovering all installed packages..."
|
||||||
|
npm run package:discover
|
||||||
|
|
||||||
|
echo "Building the client..."
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
rm -f /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png
|
||||||
|
|
||||||
|
wget -O /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png https://ssh.surf/wallpaper.png
|
||||||
|
|
||||||
|
cd /webos/OSjs && pm2 start osjsStart.json
|
||||||
|
|
||||||
|
echo "cd /webos/OSjs && pm2 start osjsStart.json" > /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
sed -i "s/#osjs/cd \/webos\/OSjs \&\& pm2 start osjsStart.json /g" /start.sh
|
||||||
|
|
||||||
|
echo "Sending discord notification to your account:"
|
||||||
|
notif "Your OSJS installation has completed and should be running at this time, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
echo "Your OSJs installation has completed and should be running at this time, you may access your installation at: http://ssh.surf:$port"
|
46
alma/send-to-log
Normal file
46
alma/send-to-log
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Welcome to the Send-To-Log system installer"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
sleep 2
|
||||||
|
yum groupinstall 'Development Tools' -y
|
||||||
|
yum install cmake -y
|
||||||
|
|
||||||
|
notif Welcome to the Send-To-Log installer, we will pick a port and provide you a URL when complete.
|
||||||
|
|
||||||
|
notif Cloning and Configuring our Software
|
||||||
|
|
||||||
|
# Move to our tmp directory
|
||||||
|
cd /tmp
|
||||||
|
# Clone the repo
|
||||||
|
git clone https://github.com/tsl0922/ttyd.git
|
||||||
|
# Move and build!
|
||||||
|
cd ttyd && mkdir build && cd build
|
||||||
|
# Install
|
||||||
|
cd /tmp/ttyd/build && cmake ..
|
||||||
|
cd /tmp/ttyd/build && make && sudo make install
|
||||||
|
|
||||||
|
# lets download our start up files backend and frontend.
|
||||||
|
wget -q -O /etc/systemd/system/s2l.service https://ssh.surf/install/s2l/s2l-service.service
|
||||||
|
|
||||||
|
wget -q -O /etc/s2l.json https://ssh.surf/install/s2l/s2l-pm2.json
|
||||||
|
|
||||||
|
wget -q -O /usr/bin/s2l https://ssh.surf/install/s2l/input.sh
|
||||||
|
|
||||||
|
chmod +x /usr/bin/s2l
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/changeme/${port}/g" /etc/s2l.json
|
||||||
|
sed -i "s/#s2lmain/systemctl start s2l \&\& sleep 5/g" /start.sh
|
||||||
|
sed -i "s/#s2lsecond/pm2 start \/etc\/s2l.json/g" /start.sh
|
||||||
|
cd /
|
||||||
|
systemctl start s2l
|
||||||
|
sleep 5
|
||||||
|
pm2 start /etc/s2l.json
|
||||||
|
|
||||||
|
echo "Done, you may access s2l at http://ssh.surf:$port"
|
||||||
|
notif Done, you may access s2l at http://ssh.surf:$port
|
||||||
|
notif Send commands using s2l commandhere or on the bot ^s commandhere
|
53
alma/webmin
Executable file
53
alma/webmin
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Webmin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Webmin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
yum install dnf-plugins-core -y
|
||||||
|
|
||||||
|
yum config-manager --set-enabled powertools
|
||||||
|
|
||||||
|
|
||||||
|
yum -y install perl perl-Net-SSLeay openssl perl-IO-Tty perl-Encode-Detect
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.994-1.noarch.rpm
|
||||||
|
rpm -U webmin-1.994-1.noarch.rpm
|
||||||
|
rm -f webmin-1.994-1.noarch.rpm
|
||||||
|
|
||||||
|
|
||||||
|
#notif "Finding a port and configuring webmin"
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
echo "Disabling SSL in webmin for proxy support"
|
||||||
|
sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
|
||||||
|
echo "disabling refer checks to allow for vhost usage"
|
||||||
|
sed -i 's/referers_none=1/referers_none=0/g' /etc/webmin/config
|
||||||
|
sed -i 's/referer=1/referer=0/g' /etc/webmin/config
|
||||||
|
echo "Setting Webmin Port"
|
||||||
|
sed -i "s/10000/${port}/g" /etc/webmin/miniserv.conf
|
||||||
|
|
||||||
|
|
||||||
|
service webmin start
|
||||||
|
|
||||||
|
sed -i "s/#webmin/service webmin start/g" /start.sh
|
||||||
|
|
||||||
|
#notif "Your webmin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
155
alma/wp
Normal file
155
alma/wp
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Wordpress Automated installer"
|
||||||
|
echo "This will install Apache, MySQL, PHP and Wordpress on your system"
|
||||||
|
echo "The install will be located at /var/www/html"
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Welcome to the Wordpress Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
yum install dnf-plugins-core sudo -y
|
||||||
|
|
||||||
|
yum config-manager --set-enabled powertools
|
||||||
|
|
||||||
|
yum groupinstall 'Development Tools' -y
|
||||||
|
|
||||||
|
echo "Installing dependencies for Apache and PHP"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Installing dependencies for Apache and PHP"
|
||||||
|
#sudo add-apt-repository ppa:ondrej/php
|
||||||
|
#sudo apt update
|
||||||
|
sudo dnf install httpd httpd-tools -y
|
||||||
|
sudo dnf module reset php -y
|
||||||
|
|
||||||
|
sudo dnf module enable php:7.4 -y
|
||||||
|
|
||||||
|
sudo dnf install php php-common php-opcache php-cli php-gd php-curl php-mysqlnd -y
|
||||||
|
|
||||||
|
sudo dnf install mariadb-server -y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Installing MySQL 8"
|
||||||
|
echo "Installing MySQL 8"
|
||||||
|
|
||||||
|
|
||||||
|
echo "Starting MySQL 8"
|
||||||
|
service mysql start
|
||||||
|
notif "Sleeping for 5 seconds to allow MySQL to start."
|
||||||
|
echo "Sleeping 5 seconds to allow MySQL to start"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "creating database with random strings for dbname, dbuser and dbpassword"
|
||||||
|
DBNAME=$(openssl rand -hex 12)
|
||||||
|
USERNAME=$(openssl rand -hex 12)
|
||||||
|
PASSWORD=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
mysql -uroot -e "CREATE DATABASE $DBNAME CHARACTER SET utf8 COLLATE utf8_general_ci";
|
||||||
|
mysql -uroot -e "CREATE USER $USERNAME@'127.0.0.1' IDENTIFIED BY '$PASSWORD'";
|
||||||
|
mysql -uroot -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$USERNAME'@'127.0.0.1'";
|
||||||
|
|
||||||
|
notif "We have created the following Database information for this installaton: Database:$DBNAME|Username:$USERNAME|Password:$PASSWORD"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "Database and user created."
|
||||||
|
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
|
||||||
|
echo "Fixing SystemD"
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
echo "Installing Wordpress base"
|
||||||
|
|
||||||
|
wget -O /var/www/html/latest.tar.gz https://wordpress.org/latest.tar.gz
|
||||||
|
#unzip wordpress
|
||||||
|
cd /var/www/html && tar -zxvf latest.tar.gz
|
||||||
|
#change dir to wordpress
|
||||||
|
cd /var/www/html/wordpress
|
||||||
|
#copy file to parent dir
|
||||||
|
cp -rf . ..
|
||||||
|
#move back to parent dir
|
||||||
|
cd ..
|
||||||
|
#remove files from wordpress folder
|
||||||
|
rm -R wordpress
|
||||||
|
#create wp config
|
||||||
|
cp wp-config-sample.php wp-config.php
|
||||||
|
|
||||||
|
echo "Setting up WP DB Config"
|
||||||
|
#set database details with perl find and replace
|
||||||
|
perl -pi -e "s/database_name_here/$DBNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/username_here/$USERNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/password_here/$PASSWORD/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/localhost/127.0.0.1/g" /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
|
||||||
|
#set WP salts
|
||||||
|
perl -i -pe'
|
||||||
|
BEGIN {
|
||||||
|
@chars = ("a" .. "z", "A" .. "Z", 0 .. 9);
|
||||||
|
push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|";
|
||||||
|
sub salt { join "", map $chars[ rand @chars ], 1 .. 64 }
|
||||||
|
}
|
||||||
|
s/put your unique phrase here/salt()/ge
|
||||||
|
' /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
#create uploads folder and set permissions
|
||||||
|
mkdir /var/www/html/wp-content/uploads
|
||||||
|
chmod 775 /var/www/html/wp-content/uploads
|
||||||
|
mkdir -p /var/www/temp
|
||||||
|
chmod 755 /var/www/temp
|
||||||
|
|
||||||
|
echo "Installing WP CLI"
|
||||||
|
# installing wp cli
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
php wp-cli.phar --info
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
echo "Setting Custom ENV"
|
||||||
|
cd /var/www/html/ && wp config set FS_METHOD \'direct\' --raw --type=constant --allow-root
|
||||||
|
cd /var/www/html/ && wp config set 'WP_TEMP_DIR' \'/var/www/temp\' --raw --type=constant --allow-root
|
||||||
|
|
||||||
|
echo "repairing ownership and permissions"
|
||||||
|
chown -R www-data:www-data /var/www/html/
|
||||||
|
chown -R www-data:www-data /var/www/temp
|
||||||
|
|
||||||
|
|
||||||
|
find /var/www/html/ -type d -exec chmod 755 {} \;
|
||||||
|
find /var/www/html/ -type f -exec chmod 644 {} \;
|
||||||
|
|
||||||
|
rm -f /var/www/html/index.html
|
||||||
|
sed -i "3 iif ( (\!empty( \$_SERVER['HTTP_X_FORWARDED_HOST'])) || (\!empty( \$_SERVER['HTTP_X_FORWARDED_FOR'])) ) { \$_SERVER['HTTPS'] = 'on'; }" /var/www/html/wp-config.php
|
||||||
|
echo "Cleaning..."
|
||||||
|
#remove zip file
|
||||||
|
rm latest.tar.gz
|
||||||
|
|
||||||
|
echo "Setting serverName ENV"
|
||||||
|
echo "serverName $(hostname)" >> /etc/httpd/conf/httpd.conf
|
||||||
|
|
||||||
|
echo "starting webserver"
|
||||||
|
sudo systemctl start php-fpm
|
||||||
|
|
||||||
|
service httpd restart
|
||||||
|
sed -i "s/#wp/service mysql start \&\& service httpd start/g" /start.sh
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
notif "The Wordpress installation is complete, please complete your installation at your HTTP Port."
|
||||||
|
|
||||||
|
|
5
alpine/list
Normal file
5
alpine/list
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Software Currently Avalible for Alpine:
|
||||||
|
To install use: auto-install packageName
|
||||||
|
|
||||||
|
PackageName - Software URL
|
||||||
|
Sorry, No installers have been coded yet :(
|
58
alpine/webmin
Executable file
58
alpine/webmin
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Webmin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
apt update
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
#notif "Welcome to the Webmin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
apk add perl perl-net-ssleay
|
||||||
|
|
||||||
|
|
||||||
|
cd /opt
|
||||||
|
wget -O - https://github.com/webmin/webmin/archive/refs/tags/1.991.tar.gz | tar -xzf -
|
||||||
|
|
||||||
|
mv webmin-1.991 webmin
|
||||||
|
|
||||||
|
cd webmin
|
||||||
|
./setup.sh /usr/local/webmin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#notif "Finding a port and configuring webmin"
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
echo "Disabling SSL in webmin for proxy support"
|
||||||
|
sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
|
||||||
|
echo "disabling refer checks to allow for vhost usage"
|
||||||
|
sed -i 's/referers_none=1/referers_none=0/g' /etc/webmin/config
|
||||||
|
sed -i 's/referer=1/referer=0/g' /etc/webmin/config
|
||||||
|
echo "Setting Webmin Port"
|
||||||
|
sed -i "s/10000/${port}/g" /etc/webmin/miniserv.conf
|
||||||
|
|
||||||
|
rm -f /tmp/webmin_1.984_all.deb
|
||||||
|
|
||||||
|
service webmin start
|
||||||
|
|
||||||
|
sed -i "s/#webmin/service webmin start/g" /start.sh
|
||||||
|
|
||||||
|
#notif "Your webmin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
58
code-server-64
Normal file
58
code-server-64
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux CodeServer Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notify-x64 && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Code-Server Automated installer for Discord-Linux x64, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
wget -q https://github.com/coder/code-server/releases/download/v3.12.0/code-server_3.12.0_amd64.deb
|
||||||
|
|
||||||
|
notif "Installing Code-Server 3.12 using DPKG"
|
||||||
|
|
||||||
|
dpkg -i code-server_3.12.0_amd64.deb
|
||||||
|
|
||||||
|
rm -f code-server_3.12.0_amd64.deb
|
||||||
|
|
||||||
|
notif "Downloading our configurations"
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.json https://ssh.surf/install/code-server/startCodeServer.json
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.sh https://ssh.surf/install/code-server/startCodeServer.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
mkdir -vp /root/.config/code-server/
|
||||||
|
|
||||||
|
wget -q -O /root/.config/code-server/config.yaml https://ssh.surf/install/code-server/config.yaml
|
||||||
|
|
||||||
|
PASS=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/replaceme/${PASS}/g" ~/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
sed -i "s/#code-server/pm2 start \/var\/tools\/startCodeServer.json \&\& relayPort 8080/g" /start.sh
|
||||||
|
|
||||||
|
pm2 start /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
notif "Sleeping for 5 seconds to allow for code-server to start...."
|
||||||
|
|
||||||
|
relayPort 8080
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
notif "Sleeping to allow the relay to start..."
|
||||||
|
|
||||||
|
url=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-8080-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
|
||||||
|
notif "The installation has completed. You may access your install at: https://$url with the password $PASS"
|
58
debian/code-server
vendored
Normal file
58
debian/code-server
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux CodeServer Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Code-Server Automated installer for Discord-Linux ARM, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
wget -q https://github.com/coder/code-server/releases/download/v3.12.0/code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Installing Code-Server 3.12 using DPKG"
|
||||||
|
|
||||||
|
dpkg -i code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
rm -f code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Downloading our configurations"
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.json https://ssh.surf/install/code-server/startCodeServer.json
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.sh https://ssh.surf/install/code-server/startCodeServer.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
mkdir -vp /root/.config/code-server/
|
||||||
|
|
||||||
|
wget -q -O /root/.config/code-server/config.yaml https://ssh.surf/install/code-server/config.yaml
|
||||||
|
|
||||||
|
PASS=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/replaceme/${PASS}/g" ~/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
sed -i "s/#code-server/cd \/var\/tools \&\& pm2 start startCodeServer.json \&\& relayPort 8080/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/127.0.0.1:8080/0.0.0.0:${port}/g" /root/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
pm2 start /var/tools/startCodeServer.json
|
||||||
|
|
||||||
|
|
||||||
|
notif "The installation has completed. You may access your install at: http://ssh.surf:$port with the password $PASS"
|
57
debian/hastebin
vendored
Normal file
57
debian/hastebin
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux HasteBin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the HasteBin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
cd /home
|
||||||
|
|
||||||
|
notif "Cloning into /home/haste-server"
|
||||||
|
git clone https://github.com/seejohnrun/haste-server.git
|
||||||
|
|
||||||
|
cd haste-server
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/7777/${port}/g" config.js
|
||||||
|
|
||||||
|
|
||||||
|
notif "Configuring HasteBin and starting it's server"
|
||||||
|
wget -O hasteBinStart.json https://ssh.surf/install/hastebin
|
||||||
|
|
||||||
|
cd /home/haste-server && pm2 start hasteBinStart.json
|
||||||
|
|
||||||
|
sed -i "s/#hastebin/cd \/home\/haste-server \&\& pm2 start hasteBinStart.json/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "You may also create a subdomain for your installation by usoing the following commands in discord"
|
||||||
|
echo "+dns register yoursubdomainhere"
|
||||||
|
echo "+dns vhost $port"
|
||||||
|
echo "The installation will then be avalible over encrypted SSL at https://yoursubdomainhere.ssh.surf"
|
||||||
|
|
||||||
|
echo "Sending discord notification to your account:"
|
||||||
|
notif "Your hastebin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
12
debian/jdk
vendored
Normal file
12
debian/jdk
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
sudo apt-get install -y wget apt-transport-https
|
||||||
|
|
||||||
|
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /usr/share/keyrings/adoptium.asc
|
||||||
|
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
||||||
|
|
||||||
|
cat /etc/apt/sources.list.d/adoptium.list
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install temurin-17-jdk
|
||||||
|
|
14
debian/list
vendored
Normal file
14
debian/list
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Software Currently Avalible for Debian:
|
||||||
|
To install use: auto-install packageName
|
||||||
|
|
||||||
|
PackageName - Software URL
|
||||||
|
|
||||||
|
webmin - https://www.webmin.com/
|
||||||
|
osjs-webdesktop - https://www.os-js.org/
|
||||||
|
wp - https://wordpress.org/
|
||||||
|
hastebin - https://www.toptal.com/developers/hastebin/about.md
|
||||||
|
code-server - https://github.com/coder/code-server
|
||||||
|
jdk - https://adoptium.net/
|
||||||
|
mc - https://papermc.io/
|
||||||
|
secuNotify - https://docs.discord-linux.com/en/auto-installers#secunotify
|
||||||
|
send-to-log - https://docs.discord-linux.com/en/auto-installers#send-to-log-s2l
|
64
debian/mc
vendored
Normal file
64
debian/mc
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux MineCraft Server Automated installer"
|
||||||
|
echo "This will install MineCraft Sever on your system"
|
||||||
|
echo "A random port on your container will be selected."
|
||||||
|
printf "\n"
|
||||||
|
echo "Running this sever does require the Discord-Linux Power Plan"
|
||||||
|
echo "You may purchase this plan here: https://store.discord-linux.com/product/discord-power-upgrade/"
|
||||||
|
printf "\n"
|
||||||
|
echo "Sleeping for 30 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
wget -q -O - https://ssh.surf/notify | bash
|
||||||
|
notif "Welcome to the MineCraft Server installer for Discord-Linux, the installation is starting and will complete in 45 seconds"
|
||||||
|
apt update
|
||||||
|
useradd mc
|
||||||
|
mkdir -vp /home/mc
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
wget -O /home/mc/server.jar https://api.papermc.io/v2/projects/paper/versions/1.18.2/builds/357/downloads/paper-1.18.2-357.jar
|
||||||
|
|
||||||
|
|
||||||
|
wget -O /home/mc/minecraft-server.json https://ssh.surf/install/mc/minecraft-server.json
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /home/mc/eula.txt https://ssh.surf/install/mc/eula
|
||||||
|
|
||||||
|
chown -R mc:mc
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
|
||||||
|
echo "sleeping 30 seconds to allow the server to generate"
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo "Shutting down the MC server for port configuration"
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 delete all"
|
||||||
|
|
||||||
|
echo "killing any possible running instances of java"
|
||||||
|
pkill java -9
|
||||||
|
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
sleep 10
|
||||||
|
echo "Setting port in our config"
|
||||||
|
sed -i "s/25565/${port}/g" /home/mc/server.properties
|
||||||
|
sed -i "s/max-players=20/max-players=4/g" /home/mc/server.properties
|
||||||
|
sed -i "s/A Minecraft Server/An MC Server running on Discord-Linux/g" /home/mc/server.properties
|
||||||
|
|
||||||
|
echo "Starting the server for final launch"
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
notif "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
echo "Please allow up to 5 minutes for the server to start up"
|
||||||
|
|
BIN
debian/notif
vendored
Normal file
BIN
debian/notif
vendored
Normal file
Binary file not shown.
121
debian/osjs-webdesktop
vendored
Executable file
121
debian/osjs-webdesktop
vendored
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux OSjs Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when this process is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "Sleeping for 5 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the OSjs Automated installer for Discord-Linux, we will begin by updating your system. Please wait..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libpam-dev perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl python unzip zip
|
||||||
|
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
notif "The system has been updated and systemD has been patched, we are now starting to install the required NPM's for OSjs"
|
||||||
|
|
||||||
|
mkdir -vp /webos
|
||||||
|
|
||||||
|
cd /webos && git clone https://github.com/os-js/OS.js.git
|
||||||
|
|
||||||
|
mv /webos/OS.js /webos/OSjs
|
||||||
|
|
||||||
|
cd /webos/OSjs && rm -f package-lock.json
|
||||||
|
|
||||||
|
echo "Installing main packages..."
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "The Core OSjs Packages have been installed, we are now starting to install the Applications for OSJS Via NPM"
|
||||||
|
|
||||||
|
npm install @osjs/textpad-application
|
||||||
|
npm install --save --production @osjs/draw-application
|
||||||
|
npm install --save --production @osjs/filemanager-application
|
||||||
|
npm install @osjs/settings-application
|
||||||
|
npm install @osjs/writer-application
|
||||||
|
npm install --save --production @osjs/xterm-application
|
||||||
|
npm install --save --production @osjs/ace-application
|
||||||
|
npm install @osjs/xpra-application
|
||||||
|
npm install @osjs/vnc-application
|
||||||
|
npm install @osjs/epub-application
|
||||||
|
npm install @osjs/webodf-application
|
||||||
|
npm install @osjs/wolfenstein3d-application
|
||||||
|
npm install @osjs/tetris-application
|
||||||
|
npm install @osjs/standard-theme
|
||||||
|
npm install @osjs/standard-dark-theme
|
||||||
|
npm install @osjs/gnome-icons
|
||||||
|
npm install @osjs/freedesktop-sounds
|
||||||
|
npm install --save --production @osjs/pam-auth
|
||||||
|
|
||||||
|
echo "Fixing detected vulns"
|
||||||
|
|
||||||
|
npm audit fix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "We are almost finished, we are now configuring OSjs and starting the server"
|
||||||
|
|
||||||
|
echo "removing config files..."
|
||||||
|
rm -f src/server/index.js
|
||||||
|
|
||||||
|
rm -f src/server/config.js
|
||||||
|
|
||||||
|
rm -f src/client/config.js
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing our own customized config files"
|
||||||
|
|
||||||
|
wget -O src/server/index.js https://ssh.surf/install/osjs/osjs_server_index.js
|
||||||
|
|
||||||
|
wget -O src/server/config.js https://ssh.surf/install/osjs/osjs_server_config.js
|
||||||
|
|
||||||
|
wget -O src/client/config.js https://ssh.surf/install/osjs/osjs_client_config.js
|
||||||
|
|
||||||
|
wget -O src/client/wallpaper.jpg https://ssh.surf/wallpaper.jpg
|
||||||
|
|
||||||
|
wget -O osjsStart.json https://ssh.surf/install/osjs/osjsStart.json
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
echo "Setting port in our config"
|
||||||
|
sed -i "s/CUSTOM/${port}/g" src/server/config.js
|
||||||
|
|
||||||
|
echo "Discovering all installed packages..."
|
||||||
|
npm run package:discover
|
||||||
|
|
||||||
|
echo "Building the client..."
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
rm -f /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png
|
||||||
|
|
||||||
|
wget -O /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png https://ssh.surf/wallpaper.png
|
||||||
|
|
||||||
|
cd /webos/OSjs && pm2 start osjsStart.json
|
||||||
|
|
||||||
|
echo "cd /webos/OSjs && pm2 start osjsStart.json" > /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
sed -i "s/#osjs/cd \/webos\/OSjs \&\& pm2 start osjsStart.json /g" /start.sh
|
||||||
|
|
||||||
|
echo "Sending discord notification to your account:"
|
||||||
|
notif "Your OSJS installation has completed and should be running at this time, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
echo "Your OSJs installation has completed and should be running at this time, you may access your installation at: http://ssh.surf:$port"
|
44
debian/secuNotify
vendored
Normal file
44
debian/secuNotify
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Welcome to the secuNotify security system installer"
|
||||||
|
echo "This will install the secuNotify security system service for systemd"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
|
||||||
|
notif "Welcome to the secuNotify security system installer, We are preparing your installation..."
|
||||||
|
sleep 2
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install rsyslog
|
||||||
|
notif "We have installed rsyslog restarting requrired services"
|
||||||
|
sleep 2
|
||||||
|
service ssh stop
|
||||||
|
sleep 2
|
||||||
|
service rsyslog start
|
||||||
|
sleep 2
|
||||||
|
service ssh start
|
||||||
|
sleep 2
|
||||||
|
notif "Downloading the secuNotify and firewallctl bins and installing them into /var/tools/"
|
||||||
|
|
||||||
|
FILE=/etc/apache2/apache2.conf
|
||||||
|
if test -f "$FILE"; then
|
||||||
|
rm /etc/apache2/apache2.conf
|
||||||
|
wget -O /etc/apache2/apache2.conf https://ssh.surf/install/secu/apache2.conf
|
||||||
|
chmod 0644 /etc/apache2/apache2.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
wget -O /var/tools/secuNotify https://ssh.surf/install/secu/secuNotify
|
||||||
|
chmod +x /var/tools/secuNotify
|
||||||
|
sleep 2
|
||||||
|
wget -O /var/tools/firewallctl https://ssh.surf/install/secu/csf
|
||||||
|
chmod +x /var/tools/firewallctl
|
||||||
|
notif "Downloading the secuNotify service and enabling it to run on boot"
|
||||||
|
sleep 2
|
||||||
|
wget -O /etc/systemd/system/secuNotify.service https://ssh.surf/install/secu/secuNotify.service
|
||||||
|
sed -i 's/service ssh start/service rsyslog start \&\& service ssh start \&\& service secuNotify start/g' /start.sh
|
||||||
|
sleep 2
|
||||||
|
service apache2 restart
|
||||||
|
sleep 2
|
||||||
|
systemctl start secuNotify
|
||||||
|
sleep 2
|
||||||
|
notif "The system is installed and secuNotify is running"
|
||||||
|
systemctl status secuNotify
|
47
debian/send-to-log
vendored
Normal file
47
debian/send-to-log
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Welcome to the Send-To-Log system installer"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
sleep 2
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake git libjson-c-dev libwebsockets-dev screen
|
||||||
|
|
||||||
|
notif Welcome to the Send-To-Log installer, we will pick a port and provide you a URL when complete.
|
||||||
|
|
||||||
|
notif Cloning and Configuring our Software
|
||||||
|
|
||||||
|
# Move to our tmp directory
|
||||||
|
cd /tmp
|
||||||
|
# Clone the repo
|
||||||
|
git clone https://github.com/tsl0922/ttyd.git
|
||||||
|
# Move and build!
|
||||||
|
cd ttyd && mkdir build && cd build
|
||||||
|
# Install
|
||||||
|
cd /tmp/ttyd/build && cmake ..
|
||||||
|
cd /tmp/ttyd/build && make && sudo make install
|
||||||
|
|
||||||
|
# lets download our start up files backend and frontend.
|
||||||
|
wget -q -O /etc/systemd/system/s2l.service https://ssh.surf/install/s2l/s2l-service.service
|
||||||
|
|
||||||
|
wget -q -O /etc/s2l.json https://ssh.surf/install/s2l/s2l-pm2.json
|
||||||
|
|
||||||
|
wget -q -O /usr/bin/s2l https://ssh.surf/install/s2l/input.sh
|
||||||
|
|
||||||
|
chmod +x /usr/bin/s2l
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/changeme/${port}/g" /etc/s2l.json
|
||||||
|
sed -i "s/#s2lmain/systemctl start s2l \&\& sleep 5/g" /start.sh
|
||||||
|
sed -i "s/#s2lsecond/pm2 start \/etc\/s2l.json/g" /start.sh
|
||||||
|
cd /
|
||||||
|
systemctl start s2l
|
||||||
|
sleep 5
|
||||||
|
pm2 start /etc/s2l.json
|
||||||
|
|
||||||
|
echo "Done, you may access s2l at http://ssh.surf:$port"
|
||||||
|
notif Done, you may access s2l at http://ssh.surf:$port
|
||||||
|
notif Send commands using s2l commandhere or on the bot ^s commandhere
|
66
debian/webmin
vendored
Executable file
66
debian/webmin
vendored
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Webmin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
apt update
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Webmin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y shared-mime-info perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python unzip
|
||||||
|
|
||||||
|
#yes | DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --fix-broken install -f
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
rm /etc/apt/apt.conf.d/docker-gzip-indexes
|
||||||
|
apt-get -y purge apt-show-versions
|
||||||
|
rm /var/lib/apt/lists/*lz4
|
||||||
|
apt-get -o Acquire::GzipIndexes=false update
|
||||||
|
|
||||||
|
notif "We are building show versions, this may take a while..."
|
||||||
|
|
||||||
|
apt install -y apt-show-versions
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
wget -O /tmp/webmin-current.deb http://www.webmin.com/download/deb/webmin-current.deb
|
||||||
|
|
||||||
|
dpkg -i /tmp/webmin-current.deb
|
||||||
|
|
||||||
|
|
||||||
|
notif "Finding a port and configuring webmin"
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
echo "Disabling SSL in webmin for proxy support"
|
||||||
|
sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
|
||||||
|
echo "disabling refer checks to allow for vhost usage"
|
||||||
|
sed -i 's/referers_none=1/referers_none=0/g' /etc/webmin/config
|
||||||
|
sed -i 's/referer=1/referer=0/g' /etc/webmin/config
|
||||||
|
echo "Setting Webmin Port"
|
||||||
|
sed -i "s/10000/port=${port}/g" /etc/webmin/miniserv.conf
|
||||||
|
|
||||||
|
rm -f /tmp/webmin_1.984_all.deb
|
||||||
|
|
||||||
|
service webmin start
|
||||||
|
|
||||||
|
sed -i "s/#webmin/service webmin start/g" /start.sh
|
||||||
|
|
||||||
|
notif "Your webmin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
149
debian/wp
vendored
Normal file
149
debian/wp
vendored
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux Wordpress Automated installer"
|
||||||
|
echo "This will install Apache, MySQL, PHP and Wordpress on your system"
|
||||||
|
echo "The install will be located at /var/www/html"
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/debian/notif && chmod +x /usr/bin/notif
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
notif "Welcome to the Wordpress Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing dependencies for Apache and PHP"
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential unzip zip software-properties-common
|
||||||
|
|
||||||
|
|
||||||
|
notif "Installing dependencies for Apache and PHP"
|
||||||
|
#sudo add-apt-repository ppa:ondrej/php
|
||||||
|
#sudo apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive sudo apt install php -y
|
||||||
|
DEBIAN_FRONTEND=noninteractive sudo apt install php-gd php-curl php-xml php-soap php-mbstring php-mysql imagemagick zip unzip libapache2-mod-php php-zip php-intl php-imagick -y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install apache2
|
||||||
|
|
||||||
|
sudo a2enmod php8.0
|
||||||
|
sudo a2enmod rewrite
|
||||||
|
|
||||||
|
notif "Installing MySQL 8"
|
||||||
|
echo "Installing MySQL 8"
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install default-mysql-server
|
||||||
|
|
||||||
|
|
||||||
|
echo "Starting MySQL 8"
|
||||||
|
service mariadb start
|
||||||
|
notif "Sleeping for 5 seconds to allow MySQL to start."
|
||||||
|
echo "Sleeping 5 seconds to allow MySQL to start"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "creating database with random strings for dbname, dbuser and dbpassword"
|
||||||
|
DBNAME=$(openssl rand -hex 12)
|
||||||
|
USERNAME=$(openssl rand -hex 12)
|
||||||
|
PASSWORD=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
mysql -uroot -e "CREATE DATABASE $DBNAME CHARACTER SET utf8 COLLATE utf8_general_ci";
|
||||||
|
mysql -uroot -e "CREATE USER $USERNAME@'127.0.0.1' IDENTIFIED BY '$PASSWORD'";
|
||||||
|
mysql -uroot -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$USERNAME'@'127.0.0.1'";
|
||||||
|
|
||||||
|
notif "We have created the following Database information for this installaton: Database:$DBNAME|Username:$USERNAME|Password:$PASSWORD"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "Database and user created."
|
||||||
|
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
|
||||||
|
echo "Fixing SystemD"
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
echo "Installing Wordpress base"
|
||||||
|
|
||||||
|
wget -O /var/www/html/latest.tar.gz https://wordpress.org/latest.tar.gz
|
||||||
|
#unzip wordpress
|
||||||
|
cd /var/www/html && tar -zxvf latest.tar.gz
|
||||||
|
#change dir to wordpress
|
||||||
|
cd /var/www/html/wordpress
|
||||||
|
#copy file to parent dir
|
||||||
|
cp -rf . ..
|
||||||
|
#move back to parent dir
|
||||||
|
cd ..
|
||||||
|
#remove files from wordpress folder
|
||||||
|
rm -R wordpress
|
||||||
|
#create wp config
|
||||||
|
cp wp-config-sample.php wp-config.php
|
||||||
|
|
||||||
|
echo "Setting up WP DB Config"
|
||||||
|
#set database details with perl find and replace
|
||||||
|
perl -pi -e "s/database_name_here/$DBNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/username_here/$USERNAME/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/password_here/$PASSWORD/g" /var/www/html/wp-config.php
|
||||||
|
perl -pi -e "s/localhost/127.0.0.1/g" /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
|
||||||
|
#set WP salts
|
||||||
|
perl -i -pe'
|
||||||
|
BEGIN {
|
||||||
|
@chars = ("a" .. "z", "A" .. "Z", 0 .. 9);
|
||||||
|
push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|";
|
||||||
|
sub salt { join "", map $chars[ rand @chars ], 1 .. 64 }
|
||||||
|
}
|
||||||
|
s/put your unique phrase here/salt()/ge
|
||||||
|
' /var/www/html/wp-config.php
|
||||||
|
|
||||||
|
#create uploads folder and set permissions
|
||||||
|
mkdir /var/www/html/wp-content/uploads
|
||||||
|
chmod 775 /var/www/html/wp-content/uploads
|
||||||
|
mkdir -p /var/www/temp
|
||||||
|
chmod 755 /var/www/temp
|
||||||
|
|
||||||
|
echo "Installing WP CLI"
|
||||||
|
# installing wp cli
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
php wp-cli.phar --info
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
echo "Setting Custom ENV"
|
||||||
|
cd /var/www/html/ && wp config set FS_METHOD \'direct\' --raw --type=constant --allow-root
|
||||||
|
cd /var/www/html/ && wp config set 'WP_TEMP_DIR' \'/var/www/temp\' --raw --type=constant --allow-root
|
||||||
|
|
||||||
|
echo "repairing ownership and permissions"
|
||||||
|
chown -R www-data:www-data /var/www/html/
|
||||||
|
chown -R www-data:www-data /var/www/temp
|
||||||
|
|
||||||
|
|
||||||
|
find /var/www/html/ -type d -exec chmod 755 {} \;
|
||||||
|
find /var/www/html/ -type f -exec chmod 644 {} \;
|
||||||
|
|
||||||
|
rm -f /var/www/html/index.html
|
||||||
|
sed -i "3 iif ( (\!empty( \$_SERVER['HTTP_X_FORWARDED_HOST'])) || (\!empty( \$_SERVER['HTTP_X_FORWARDED_FOR'])) ) { \$_SERVER['HTTPS'] = 'on'; }" /var/www/html/wp-config.php
|
||||||
|
echo "Cleaning..."
|
||||||
|
#remove zip file
|
||||||
|
rm latest.tar.gz
|
||||||
|
|
||||||
|
echo "Setting serverName ENV"
|
||||||
|
echo "serverName $(hostname)" >> /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
echo "starting webserver"
|
||||||
|
|
||||||
|
service apache2 restart
|
||||||
|
sed -i "s/#wp/service mysql start \&\& service apache2 start/g" /start.sh
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
notif "The Wordpress installation is complete, please complete your installation at your HTTP Port."
|
||||||
|
|
||||||
|
|
BIN
docs/dlinux-docs.pdf
Normal file
BIN
docs/dlinux-docs.pdf
Normal file
Binary file not shown.
44
hastebin-64
Normal file
44
hastebin-64
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux HasteBin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notify-x64 && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the HasteBin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
cd /home
|
||||||
|
|
||||||
|
notif "Cloning into /home/haste-server"
|
||||||
|
git clone https://github.com/seejohnrun/haste-server.git
|
||||||
|
|
||||||
|
cd haste-server
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
sed -i "s/7777/10002/g" config.js
|
||||||
|
|
||||||
|
|
||||||
|
notif "Configuring HasteBin and starting it's server"
|
||||||
|
wget -O hasteBinStart.json https://ssh.surf/install/hastebin
|
||||||
|
|
||||||
|
cd /home/haste-server && pm2 start hasteBinStart.json
|
||||||
|
|
||||||
|
sed -i "s/#hastebin/cd \/home\/haste-server \&\& pm2 start hasteBinStart.json \&\& relayPort 10002/g" /start.sh
|
||||||
|
|
||||||
|
relayPort 10002
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
url=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-10002-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
|
||||||
|
notif "Your HasteBin is now running at https://$url"
|
6
index.php
Normal file
6
index.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
header("Location: https://discord-linux.com"); /* Redirect browser */
|
||||||
|
|
||||||
|
/* Make sure that code below does not get executed when we redirect. */
|
||||||
|
exit;
|
||||||
|
?>
|
BIN
install/XRDP/new.bmp
Normal file
BIN
install/XRDP/new.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
230
install/XRDP/xrdp.ini
Normal file
230
install/XRDP/xrdp.ini
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
[Globals]
|
||||||
|
; xrdp.ini file version number
|
||||||
|
ini_version=1
|
||||||
|
|
||||||
|
; fork a new process for each incoming connection
|
||||||
|
fork=true
|
||||||
|
|
||||||
|
; ports to listen on, number alone means listen on all interfaces
|
||||||
|
; 0.0.0.0 or :: if ipv6 is configured
|
||||||
|
; space between multiple occurrences
|
||||||
|
;
|
||||||
|
; Examples:
|
||||||
|
; port=3389
|
||||||
|
; port=unix://./tmp/xrdp.socket
|
||||||
|
; port=tcp://.:3389 127.0.0.1:3389
|
||||||
|
; port=tcp://:3389 *:3389
|
||||||
|
; port=tcp://<any ipv4 format addr>:3389 192.168.1.1:3389
|
||||||
|
; port=tcp6://.:3389 ::1:3389
|
||||||
|
; port=tcp6://:3389 *:3389
|
||||||
|
; port=tcp6://{<any ipv6 format addr>}:3389 {FC00:0:0:0:0:0:0:1}:3389
|
||||||
|
; port=vsock://<cid>:<port>
|
||||||
|
port=3389
|
||||||
|
|
||||||
|
; 'port' above should be connected to with vsock instead of tcp
|
||||||
|
; use this only with number alone in port above
|
||||||
|
; prefer use vsock://<cid>:<port> above
|
||||||
|
use_vsock=false
|
||||||
|
|
||||||
|
; regulate if the listening socket use socket option tcp_nodelay
|
||||||
|
; no buffering will be performed in the TCP stack
|
||||||
|
tcp_nodelay=true
|
||||||
|
|
||||||
|
; regulate if the listening socket use socket option keepalive
|
||||||
|
; if the network connection disappear without close messages the connection will be closed
|
||||||
|
tcp_keepalive=true
|
||||||
|
|
||||||
|
; set tcp send/recv buffer (for experts)
|
||||||
|
#tcp_send_buffer_bytes=32768
|
||||||
|
#tcp_recv_buffer_bytes=32768
|
||||||
|
|
||||||
|
; security layer can be 'tls', 'rdp' or 'negotiate'
|
||||||
|
; for client compatible layer
|
||||||
|
security_layer=negotiate
|
||||||
|
|
||||||
|
; minimum security level allowed for client for classic RDP encryption
|
||||||
|
; use tls_ciphers to configure TLS encryption
|
||||||
|
; can be 'none', 'low', 'medium', 'high', 'fips'
|
||||||
|
crypt_level=None
|
||||||
|
|
||||||
|
; X.509 certificate and private key
|
||||||
|
; openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365
|
||||||
|
; note this needs the user xrdp to be a member of the ssl-cert group, do with e.g.
|
||||||
|
;$ sudo adduser xrdp ssl-cert
|
||||||
|
certificate=
|
||||||
|
key_file=
|
||||||
|
|
||||||
|
; set SSL protocols
|
||||||
|
; can be comma separated list of 'SSLv3', 'TLSv1', 'TLSv1.1', 'TLSv1.2', 'TLSv1.3'
|
||||||
|
ssl_protocols=TLSv1.2, TLSv1.3
|
||||||
|
; set TLS cipher suites
|
||||||
|
#tls_ciphers=HIGH
|
||||||
|
|
||||||
|
; Section name to use for automatic login if the client sends username
|
||||||
|
; and password. If empty, the domain name sent by the client is used.
|
||||||
|
; If empty and no domain name is given, the first suitable section in
|
||||||
|
; this file will be used.
|
||||||
|
autorun=
|
||||||
|
|
||||||
|
allow_channels=true
|
||||||
|
allow_multimon=true
|
||||||
|
bitmap_cache=true
|
||||||
|
bitmap_compression=true
|
||||||
|
bulk_compression=true
|
||||||
|
#hidelogwindow=true
|
||||||
|
max_bpp=32
|
||||||
|
new_cursors=true
|
||||||
|
; fastpath - can be 'input', 'output', 'both', 'none'
|
||||||
|
use_fastpath=both
|
||||||
|
; when true, userid/password *must* be passed on cmd line
|
||||||
|
#require_credentials=true
|
||||||
|
; You can set the PAM error text in a gateway setup (MAX 256 chars)
|
||||||
|
#pamerrortxt=change your password according to policy at http://url
|
||||||
|
|
||||||
|
;
|
||||||
|
; colors used by windows in RGB format
|
||||||
|
;
|
||||||
|
blue=009cb5
|
||||||
|
grey=dedede
|
||||||
|
#black=000000
|
||||||
|
#dark_grey=808080
|
||||||
|
#blue=08246b
|
||||||
|
#dark_blue=08246b
|
||||||
|
#white=ffffff
|
||||||
|
#red=ff0000
|
||||||
|
#green=00ff00
|
||||||
|
#background=626c72
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; configure login screen
|
||||||
|
;
|
||||||
|
|
||||||
|
; Login Screen Window Title
|
||||||
|
ls_title=Discord-Linux RDP Login
|
||||||
|
|
||||||
|
; top level window background color in RGB format
|
||||||
|
ls_top_window_bg_color=000000
|
||||||
|
|
||||||
|
; width and height of login screen
|
||||||
|
ls_width=350
|
||||||
|
ls_height=430
|
||||||
|
|
||||||
|
; login screen background color in RGB format
|
||||||
|
ls_bg_color=dedede
|
||||||
|
|
||||||
|
; optional background image filename (bmp format).
|
||||||
|
#ls_background_image=
|
||||||
|
|
||||||
|
; logo
|
||||||
|
; full path to bmp-file or file in shared folder
|
||||||
|
#ls_logo_filename=/etc/xrdp/codingworldf.bmp
|
||||||
|
ls_logo_filename=/etc/xrdp/new.bmp
|
||||||
|
ls_logo_x_pos=55
|
||||||
|
ls_logo_y_pos=50
|
||||||
|
|
||||||
|
; for positioning labels such as username, password etc
|
||||||
|
ls_label_x_pos=30
|
||||||
|
ls_label_width=65
|
||||||
|
|
||||||
|
; for positioning text and combo boxes next to above labels
|
||||||
|
ls_input_x_pos=110
|
||||||
|
ls_input_width=210
|
||||||
|
|
||||||
|
; y pos for first label and combo box
|
||||||
|
ls_input_y_pos=220
|
||||||
|
|
||||||
|
; OK button
|
||||||
|
ls_btn_ok_x_pos=142
|
||||||
|
ls_btn_ok_y_pos=370
|
||||||
|
ls_btn_ok_width=85
|
||||||
|
ls_btn_ok_height=30
|
||||||
|
|
||||||
|
; Cancel button
|
||||||
|
ls_btn_cancel_x_pos=237
|
||||||
|
ls_btn_cancel_y_pos=370
|
||||||
|
ls_btn_cancel_width=85
|
||||||
|
ls_btn_cancel_height=30
|
||||||
|
|
||||||
|
[Logging]
|
||||||
|
LogFile=xrdp.log
|
||||||
|
LogLevel=DEBUG
|
||||||
|
EnableSyslog=true
|
||||||
|
SyslogLevel=DEBUG
|
||||||
|
; LogLevel and SysLogLevel could by any of: core, error, warning, info or debug
|
||||||
|
|
||||||
|
[Channels]
|
||||||
|
; Channel names not listed here will be blocked by XRDP.
|
||||||
|
; You can block any channel by setting its value to false.
|
||||||
|
; IMPORTANT! All channels are not supported in all use
|
||||||
|
; cases even if you set all values to true.
|
||||||
|
; You can override these settings on each session type
|
||||||
|
; These settings are only used if allow_channels=true
|
||||||
|
rdpdr=true
|
||||||
|
rdpsnd=true
|
||||||
|
drdynvc=true
|
||||||
|
cliprdr=true
|
||||||
|
rail=true
|
||||||
|
xrdpvr=true
|
||||||
|
tcutils=true
|
||||||
|
|
||||||
|
; for debugging xrdp, in section xrdp1, change port=-1 to this:
|
||||||
|
#port=/tmp/.xrdp/xrdp_display_10
|
||||||
|
|
||||||
|
; for debugging xrdp, add following line to section xrdp1
|
||||||
|
#chansrvport=/tmp/.xrdp/xrdp_chansrv_socket_7210
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; Session types
|
||||||
|
;
|
||||||
|
|
||||||
|
; Some session types such as Xorg, X11rdp and Xvnc start a display server.
|
||||||
|
; Startup command-line parameters for the display server are configured
|
||||||
|
; in sesman.ini. See and configure also sesman.ini.
|
||||||
|
[Xorg]
|
||||||
|
name=Discord-Linux Personal
|
||||||
|
lib=libxup.so
|
||||||
|
username=ask
|
||||||
|
password=ask
|
||||||
|
ip=127.0.0.1
|
||||||
|
port=-1
|
||||||
|
code=20
|
||||||
|
#[Xvnc]
|
||||||
|
#name=Xvnc
|
||||||
|
#lib=libvnc.so
|
||||||
|
#username=ask
|
||||||
|
#password=ask
|
||||||
|
#ip=127.0.0.1
|
||||||
|
#port=-1
|
||||||
|
##xserverbpp=24
|
||||||
|
#delay_ms=2000
|
||||||
|
|
||||||
|
#[vnc-any]
|
||||||
|
#name=vnc-any
|
||||||
|
#lib=libvnc.so
|
||||||
|
#ip=ask
|
||||||
|
#port=ask5900
|
||||||
|
#username=na
|
||||||
|
#password=ask
|
||||||
|
#pamusername=asksame
|
||||||
|
#pampassword=asksame
|
||||||
|
#pamsessionmng=127.0.0.1
|
||||||
|
#delay_ms=2000
|
||||||
|
|
||||||
|
#[neutrinordp-any]
|
||||||
|
#name=neutrinordp-any
|
||||||
|
#lib=libxrdpneutrinordp.so
|
||||||
|
#ip=ask
|
||||||
|
#port=ask3389
|
||||||
|
#username=ask
|
||||||
|
#password=ask
|
||||||
|
|
||||||
|
#; You can override the common channel settings for each session type
|
||||||
|
#channel.rdpdr=true
|
||||||
|
#channel.rdpsnd=true
|
||||||
|
#channel.drdynvc=true
|
||||||
|
#channel.cliprdr=true
|
||||||
|
#channel.rail=true
|
||||||
|
#channel.xrdpvr=true
|
4
install/code-server/config.yaml
Normal file
4
install/code-server/config.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bind-addr: 127.0.0.1:8080
|
||||||
|
auth: password
|
||||||
|
password: replaceme
|
||||||
|
cert: false
|
9
install/code-server/startCodeServer.json
Normal file
9
install/code-server/startCodeServer.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "Code-Server",
|
||||||
|
"script": "/var/tools/startCodeServer.sh",
|
||||||
|
"args" : ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
2
install/code-server/startCodeServer.sh
Normal file
2
install/code-server/startCodeServer.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
code-server
|
9
install/hastebin
Normal file
9
install/hastebin
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "HasteBin",
|
||||||
|
"script": "node server.js",
|
||||||
|
"args" : ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
3
install/mc/eula
Normal file
3
install/mc/eula
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
|
||||||
|
#Mon Mar 20 21:15:37 PDT 2017
|
||||||
|
eula=true
|
9
install/mc/minecraft-server.json
Normal file
9
install/mc/minecraft-server.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "MineCraft Server",
|
||||||
|
"script": "java -Xms960M -Xmx960M -jar server.jar --nogui",
|
||||||
|
"args" : ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
8
install/mysql/mysql.list
Normal file
8
install/mysql/mysql.list
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
|
||||||
|
# You may comment out entries below, but any other modifications may be lost.
|
||||||
|
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
|
||||||
|
deb http://repo.mysql.com/apt/debian/ bullseye mysql-apt-config
|
||||||
|
deb http://repo.mysql.com/apt/debian/ bullseye mysql-8.0
|
||||||
|
deb http://repo.mysql.com/apt/debian/ bullseye mysql-tools
|
||||||
|
#deb http://repo.mysql.com/apt/debian/ bullseye mysql-tools-preview
|
||||||
|
deb-src http://repo.mysql.com/apt/debian/ bullseye mysql-8.0
|
9
install/osjs/osjsStart.json
Normal file
9
install/osjs/osjsStart.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "OSjs",
|
||||||
|
"script": "npm run serve",
|
||||||
|
"args" : ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
65
install/osjs/osjs_client_config.js
Normal file
65
install/osjs/osjs_client_config.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* OS.js - JavaScript Cloud/Web Desktop Platform
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2020, Anders Evenrud <andersevenrud@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, t$
|
||||||
|
* list of conditions and the following disclaimer
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"$
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLI$
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE$
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMA$
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF TH$
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @author Anders Evenrud <andersevenrud@gmail.com>
|
||||||
|
* @licence Simplified BSD License
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// This is the client configuration tree.
|
||||||
|
// Guide: https://manual.os-js.org/v3/config/#client
|
||||||
|
// Complete config tree: https://github.com/os-js/osjs-client/blob/master/src/$
|
||||||
|
//
|
||||||
|
import wallpaper from './wallpaper.jpg';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
auth: {
|
||||||
|
ui: {
|
||||||
|
title: 'Discord-Linux Web OS',
|
||||||
|
stamp: 'Discord-Linux-OSJS v-2.4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
desktop: {
|
||||||
|
settings: {
|
||||||
|
background: {
|
||||||
|
src: wallpaper,
|
||||||
|
color: '#000',
|
||||||
|
style: 'cover'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// module.exports = {
|
||||||
|
// /// ws: {
|
||||||
|
// /// uri: '/ws'
|
||||||
|
// /// }
|
||||||
|
|
||||||
|
// };
|
28
install/osjs/osjs_server_config.js
Normal file
28
install/osjs/osjs_server_config.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// This is the server configuration tree.
|
||||||
|
// Guide: https://manual.os-js.org/v3/config/#server
|
||||||
|
// Complete config tree: https://github.com/os-js/osjs-server/blob/master/sr$
|
||||||
|
//
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const root = path.resolve(__dirname, '../../');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
root,
|
||||||
|
port: CUSTOM,
|
||||||
|
public: path.resolve(root, 'dist'),
|
||||||
|
vfs: { root: '/home' },
|
||||||
|
|
||||||
|
xterm: {
|
||||||
|
ssh: {
|
||||||
|
// Custom hostname
|
||||||
|
hostname: 'localhost',
|
||||||
|
|
||||||
|
// Custom port
|
||||||
|
args: '-p 22'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
79
install/osjs/osjs_server_index.js
Normal file
79
install/osjs/osjs_server_index.js
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* OS.js - JavaScript Cloud/Web Desktop Platform
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2020, Anders Evenrud <andersevenrud@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @author Anders Evenrud <andersevenrud@gmail.com>
|
||||||
|
* @licence Simplified BSD License
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// This is the server bootstrapping script.
|
||||||
|
// This is where you can register service providers or set up
|
||||||
|
// your libraries etc.
|
||||||
|
//
|
||||||
|
// https://manual.os-js.org/v3/guide/provider/
|
||||||
|
// https://manual.os-js.org/v3/install/
|
||||||
|
// https://manual.os-js.org/v3/resource/official/
|
||||||
|
//
|
||||||
|
|
||||||
|
// In the top of the file load the library
|
||||||
|
const pamAuth = require('@osjs/pam-auth');
|
||||||
|
|
||||||
|
const {
|
||||||
|
Core,
|
||||||
|
CoreServiceProvider,
|
||||||
|
PackageServiceProvider,
|
||||||
|
VFSServiceProvider,
|
||||||
|
AuthServiceProvider,
|
||||||
|
SettingsServiceProvider
|
||||||
|
} = require('@osjs/server');
|
||||||
|
|
||||||
|
const config = require('./config.js');
|
||||||
|
const osjs = new Core(config, {});
|
||||||
|
|
||||||
|
osjs.register(CoreServiceProvider, {before: true});
|
||||||
|
osjs.register(PackageServiceProvider);
|
||||||
|
osjs.register(VFSServiceProvider);
|
||||||
|
osjs.register(AuthServiceProvider, {
|
||||||
|
args: {
|
||||||
|
adapter: pamAuth
|
||||||
|
}
|
||||||
|
});
|
||||||
|
osjs.register(SettingsServiceProvider);
|
||||||
|
|
||||||
|
|
||||||
|
const shutdown = signal => (error) => {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
osjs.destroy(() => process.exit(signal));
|
||||||
|
};
|
||||||
|
|
||||||
|
process.on('SIGTERM', shutdown(0));
|
||||||
|
process.on('SIGINT', shutdown(0));
|
||||||
|
process.on('exit', shutdown(0));
|
||||||
|
|
||||||
|
osjs.boot().catch(shutdown(1));
|
2
install/s2l/input.sh
Normal file
2
install/s2l/input.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
screen -S s2l -X stuff "${*}^M"
|
12
install/s2l/s2l-pm2.json
Normal file
12
install/s2l/s2l-pm2.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "s2l",
|
||||||
|
"script": "ttyd -R -p changeme screen -x s2l",
|
||||||
|
"args" : "",
|
||||||
|
"error_file": "/dev/null",
|
||||||
|
"log_file": "/dev/null"
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
install/s2l/s2l-service.service
Normal file
13
install/s2l/s2l-service.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Screen2Log Backend for CMDBOT.Service
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
ExecStart=/bin/bash -c 'screen -mdS s2l -s bash'
|
||||||
|
RemainAfterExit=yes
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
229
install/secu/apache2.conf
Normal file
229
install/secu/apache2.conf
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
# This is the main Apache server configuration file. It contains the
|
||||||
|
# configuration directives that give the server its instructions.
|
||||||
|
# See http://httpd.apache.org/docs/2.4/ for detailed information about
|
||||||
|
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
|
||||||
|
# hints.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Summary of how the Apache 2 configuration works in Debian:
|
||||||
|
# The Apache 2 web server configuration in Debian is quite different to
|
||||||
|
# upstream's suggested way to configure the web server. This is because Debian's
|
||||||
|
# default Apache2 installation attempts to make adding and removing modules,
|
||||||
|
# virtual hosts, and extra configuration directives as flexible as possible, in
|
||||||
|
# order to make automating the changes and administering the server as easy as
|
||||||
|
# possible.
|
||||||
|
|
||||||
|
# It is split into several files forming the configuration hierarchy outlined
|
||||||
|
# below, all located in the /etc/apache2/ directory:
|
||||||
|
#
|
||||||
|
# /etc/apache2/
|
||||||
|
# |-- apache2.conf
|
||||||
|
# | `-- ports.conf
|
||||||
|
# |-- mods-enabled
|
||||||
|
# | |-- *.load
|
||||||
|
# | `-- *.conf
|
||||||
|
# |-- conf-enabled
|
||||||
|
# | `-- *.conf
|
||||||
|
# `-- sites-enabled
|
||||||
|
# `-- *.conf
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# * apache2.conf is the main configuration file (this file). It puts the pieces
|
||||||
|
# together by including all remaining configuration files when starting up the
|
||||||
|
# web server.
|
||||||
|
#
|
||||||
|
# * ports.conf is always included from the main configuration file. It is
|
||||||
|
# supposed to determine listening ports for incoming connections which can be
|
||||||
|
# customized anytime.
|
||||||
|
#
|
||||||
|
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
|
||||||
|
# directories contain particular configuration snippets which manage modules,
|
||||||
|
# global configuration fragments, or virtual host configurations,
|
||||||
|
# respectively.
|
||||||
|
#
|
||||||
|
# They are activated by symlinking available configuration files from their
|
||||||
|
# respective *-available/ counterparts. These should be managed by using our
|
||||||
|
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
|
||||||
|
# their respective man pages for detailed information.
|
||||||
|
#
|
||||||
|
# * The binary is called apache2. Due to the use of environment variables, in
|
||||||
|
# the default configuration, apache2 needs to be started/stopped with
|
||||||
|
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
|
||||||
|
# work with the default configuration.
|
||||||
|
|
||||||
|
|
||||||
|
# Global configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# ServerRoot: The top of the directory tree under which the server's
|
||||||
|
# configuration, error, and log files are kept.
|
||||||
|
#
|
||||||
|
# NOTE! If you intend to place this on an NFS (or otherwise network)
|
||||||
|
# mounted filesystem then please read the Mutex documentation (available
|
||||||
|
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
|
||||||
|
# you will save yourself a lot of trouble.
|
||||||
|
#
|
||||||
|
# Do NOT add a slash at the end of the directory path.
|
||||||
|
#
|
||||||
|
#ServerRoot "/etc/apache2"
|
||||||
|
|
||||||
|
#
|
||||||
|
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
|
||||||
|
#
|
||||||
|
#Mutex file:${APACHE_LOCK_DIR} default
|
||||||
|
|
||||||
|
#
|
||||||
|
# The directory where shm and other runtime files will be stored.
|
||||||
|
#
|
||||||
|
|
||||||
|
DefaultRuntimeDir ${APACHE_RUN_DIR}
|
||||||
|
|
||||||
|
#
|
||||||
|
# PidFile: The file in which the server should record its process
|
||||||
|
# identification number when it starts.
|
||||||
|
# This needs to be set in /etc/apache2/envvars
|
||||||
|
#
|
||||||
|
PidFile ${APACHE_PID_FILE}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Timeout: The number of seconds before receives and sends time out.
|
||||||
|
#
|
||||||
|
Timeout 300
|
||||||
|
|
||||||
|
#
|
||||||
|
# KeepAlive: Whether or not to allow persistent connections (more than
|
||||||
|
# one request per connection). Set to "Off" to deactivate.
|
||||||
|
#
|
||||||
|
KeepAlive On
|
||||||
|
|
||||||
|
#
|
||||||
|
# MaxKeepAliveRequests: The maximum number of requests to allow
|
||||||
|
# during a persistent connection. Set to 0 to allow an unlimited amount.
|
||||||
|
# We recommend you leave this number high, for maximum performance.
|
||||||
|
#
|
||||||
|
MaxKeepAliveRequests 100
|
||||||
|
|
||||||
|
#
|
||||||
|
# KeepAliveTimeout: Number of seconds to wait for the next request from the
|
||||||
|
# same client on the same connection.
|
||||||
|
#
|
||||||
|
KeepAliveTimeout 5
|
||||||
|
|
||||||
|
|
||||||
|
# These need to be set in /etc/apache2/envvars
|
||||||
|
User ${APACHE_RUN_USER}
|
||||||
|
Group ${APACHE_RUN_GROUP}
|
||||||
|
|
||||||
|
#
|
||||||
|
# HostnameLookups: Log the names of clients or just their IP addresses
|
||||||
|
# e.g., www.apache.org (on) or 204.62.129.132 (off).
|
||||||
|
# The default is off because it'd be overall better for the net if people
|
||||||
|
# had to knowingly turn this feature on, since enabling it means that
|
||||||
|
# each client request will result in AT LEAST one lookup request to the
|
||||||
|
# nameserver.
|
||||||
|
#
|
||||||
|
HostnameLookups Off
|
||||||
|
|
||||||
|
# ErrorLog: The location of the error log file.
|
||||||
|
# If you do not specify an ErrorLog directive within a <VirtualHost>
|
||||||
|
# container, error messages relating to that virtual host will be
|
||||||
|
# logged here. If you *do* define an error logfile for a <VirtualHost>
|
||||||
|
# container, that host's errors will be logged there and not here.
|
||||||
|
#
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
#
|
||||||
|
# LogLevel: Control the severity of messages logged to the error_log.
|
||||||
|
# Available values: trace8, ..., trace1, debug, info, notice, warn,
|
||||||
|
# error, crit, alert, emerg.
|
||||||
|
# It is also possible to configure the log level for particular modules, e.g.
|
||||||
|
# "LogLevel info ssl:warn"
|
||||||
|
#
|
||||||
|
LogLevel warn
|
||||||
|
|
||||||
|
# Include module configuration:
|
||||||
|
IncludeOptional mods-enabled/*.load
|
||||||
|
IncludeOptional mods-enabled/*.conf
|
||||||
|
|
||||||
|
# Include list of ports to listen on
|
||||||
|
Include ports.conf
|
||||||
|
|
||||||
|
|
||||||
|
# Sets the default security model of the Apache2 HTTPD server. It does
|
||||||
|
# not allow access to the root filesystem outside of /usr/share and /var/www.
|
||||||
|
# The former is used by web applications packaged in Debian,
|
||||||
|
# the latter may be used for local directories served by the web server. If
|
||||||
|
# your system is serving content from a sub-directory in /srv you must allow
|
||||||
|
# access here, or in any related virtual host.
|
||||||
|
<Directory />
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /usr/share>
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
#<Directory /srv/>
|
||||||
|
# Options Indexes FollowSymLinks
|
||||||
|
# AllowOverride All
|
||||||
|
# Require all granted
|
||||||
|
#</Directory>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AccessFileName: The name of the file to look for in each directory
|
||||||
|
# for additional configuration directives. See also the AllowOverride
|
||||||
|
# directive.
|
||||||
|
#
|
||||||
|
AccessFileName .htaccess
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following lines prevent .htaccess and .htpasswd files from being
|
||||||
|
# viewed by Web clients.
|
||||||
|
#
|
||||||
|
<FilesMatch "^\.ht">
|
||||||
|
Require all denied
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following directives define some format nicknames for use with
|
||||||
|
# a CustomLog directive.
|
||||||
|
#
|
||||||
|
# These deviate from the Common Log Format definitions in that they use %O
|
||||||
|
# (the actual bytes sent including headers) instead of %b (the size of the
|
||||||
|
# requested file), because the latter makes it impossible to detect partial
|
||||||
|
# requests.
|
||||||
|
#
|
||||||
|
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
|
||||||
|
# Use mod_remoteip instead.
|
||||||
|
#
|
||||||
|
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
||||||
|
#LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||||
|
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
||||||
|
LogFormat "%{Referer}i -> %U" referer
|
||||||
|
LogFormat "%{User-agent}i" agent
|
||||||
|
|
||||||
|
# Include of directories ignores editors' and dpkg's backup files,
|
||||||
|
# see README.Debian for details.
|
||||||
|
|
||||||
|
# Include generic snippets of statements
|
||||||
|
IncludeOptional conf-enabled/*.conf
|
||||||
|
|
||||||
|
# Include the virtual host configurations:
|
||||||
|
IncludeOptional sites-enabled/*.conf
|
||||||
|
|
||||||
|
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||||
|
serverName secuNotifyHTTP
|
160
install/secu/build
Normal file
160
install/secu/build
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
const wpLog = '/var/www/html/wp-config.php'
|
||||||
|
if (fs.existsSync(wpLog)) console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(wpLog)) {
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] == 5) {
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl 123.123.123.123 ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert: \n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Live view of the counts
|
||||||
|
console.log(counts)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
BIN
install/secu/csf
Executable file
BIN
install/secu/csf
Executable file
Binary file not shown.
BIN
install/secu/make/new
Executable file
BIN
install/secu/make/new
Executable file
Binary file not shown.
180
install/secu/make/new.js
Normal file
180
install/secu/make/new.js
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
try {
|
||||||
|
if (fs.existsSync("/var/www/html/wp-config.php")) {
|
||||||
|
console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php") && requestInfo.includes("POST")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] === 5) {
|
||||||
|
console.log("counts: " + counts[x])
|
||||||
|
counts = {}
|
||||||
|
|
||||||
|
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert:\n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
// Live view of the counts
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if (blockedIPs.length == 0) {
|
||||||
|
console.log("No IPs have been blocked yet.")
|
||||||
|
} else {
|
||||||
|
console.log("Blocked IP List (Since Service start): " + blockedIPs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
|
||||||
|
fs.exists("/var/log/apache2/access.log", function (isExist) {
|
||||||
|
if (isExist) {
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
||||||
|
} else {
|
||||||
|
console.log("ApacheHTTP Server is not installed, not enabling WP protection.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
install/secu/make/node_modules/.package-lock.json
generated
vendored
Normal file
20
install/secu/make/node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "make",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/cmd-promise": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cmd-promise/-/cmd-promise-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-PPUTIiAZi1HBbakt44ag03Q9u1w="
|
||||||
|
},
|
||||||
|
"node_modules/tail": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/tail/-/tail-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-PX8klSxW1u3SdgDrDeewh5GNE+hkJ4h02JvHfV6YrHqWOVJ88nUdSQqtsUf/gWhgZlPAws3fiZ+F1f8euspcuQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
install/secu/make/node_modules/cmd-promise/.npmignore
generated
vendored
Normal file
6
install/secu/make/node_modules/cmd-promise/.npmignore
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
node_modules/
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
$RECYCLE.BIN/
|
164
install/secu/make/node_modules/cmd-promise/README.md
generated
vendored
Normal file
164
install/secu/make/node_modules/cmd-promise/README.md
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
|
||||||
|
# CMD Promise
|
||||||
|
|
||||||
|
Node command line interface with a simple Promise based API.
|
||||||
|
|
||||||
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||||
|
[![Version](https://img.shields.io/npm/v/cmd-promise.svg)](https://www.npmjs.com/package/cmd-promise)
|
||||||
|
[![Downloads](https://img.shields.io/npm/dt/cmd-promise.svg)](https://www.npmjs.com/package/cmd-promise)
|
||||||
|
|
||||||
|
Inspired by [node-cmd](https://github.com/RIAEvangelist/node-cmd).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Simple Promise based API.
|
||||||
|
- Single or multiple commands in one call.
|
||||||
|
- Passes the [`exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) node options through.
|
||||||
|
- Returns an `object` containing both `stdout` and `stderr`.
|
||||||
|
- Optionally return the [child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess) instead of the output.
|
||||||
|
- Zero dependencies.
|
||||||
|
|
||||||
|
## Requirments
|
||||||
|
|
||||||
|
Uses native node promises (including `Promise.all` with generic iterables) so requires at least node version 4.0.0. See [http://node.green/](http://node.green/#ES2015-built-ins-Promise).
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
`npm install cmd-promise`
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Single command
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
cmd(`node -v`).then(out => {
|
||||||
|
console.log('out =', out)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
||||||
|
|
||||||
|
// out = { stdout: 'v4.2.2\r\n', stderr: '' }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Multiple commands
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
const commands = `
|
||||||
|
node -v
|
||||||
|
npm -v
|
||||||
|
`
|
||||||
|
|
||||||
|
cmd(commands).then(out => {
|
||||||
|
console.log('out =', out)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
||||||
|
|
||||||
|
// out = [ { stdout: 'v4.2.2\r\n', stderr: '' }, { stdout: '4.4.1\n', stderr: '' } ]
|
||||||
|
// out[0].stdout = v4.2.2
|
||||||
|
```
|
||||||
|
|
||||||
|
### More involved example
|
||||||
|
|
||||||
|
```js
|
||||||
|
const semver = require('semver') // https://github.com/npm/node-semver
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
const commands = `
|
||||||
|
npm view npm version
|
||||||
|
npm -v
|
||||||
|
`
|
||||||
|
|
||||||
|
cmd(commands).then(out => {
|
||||||
|
return {
|
||||||
|
npm: out[0].stdout.replace(/\n/g, ''),
|
||||||
|
me: out[1].stdout.replace(/\n/g, '')
|
||||||
|
}
|
||||||
|
}).then(versions => {
|
||||||
|
if (semver.lt(versions.me, versions.npm)) {
|
||||||
|
console.log(`My npm version is out of date (npm install npm@latest -g).`)
|
||||||
|
} else {
|
||||||
|
console.log(`My npm version is up to date! :-)`)
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Return the child process instead
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('../cmd-promise')
|
||||||
|
|
||||||
|
const options = { returnProcess: true }
|
||||||
|
|
||||||
|
cmd(`node -v`, options).then(childProcess => {
|
||||||
|
console.log('pid =', childProcess.pid)
|
||||||
|
childProcess.stdout.on('data', stdout => {
|
||||||
|
console.log('stdout =', stdout)
|
||||||
|
})
|
||||||
|
childProcess.stderr.on('data', stderr => {
|
||||||
|
console.log('stderr =', stderr)
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pass exec() options
|
||||||
|
|
||||||
|
Pass [`child_process.exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) options as defined in the node docs.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('../cmd-promise')
|
||||||
|
|
||||||
|
const execOptions = { timeout: 1000 }
|
||||||
|
|
||||||
|
cmd(`node -v`, {}, execOptions).then(out => {
|
||||||
|
console.log('out =', out)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
`cmd(commands [,options] [,execOptions]) -> Promise`
|
||||||
|
|
||||||
|
- **commands** (string) Single or multiple line string of commands to execute.
|
||||||
|
- **options** (object)
|
||||||
|
- `returnProcess` (boolean) Return the child process instead of waiting on and returning the outcome. Default is `false`.
|
||||||
|
- **execOptions** (object) Options as passed to the [`exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) method of the [child_process](https://nodejs.org/api/child_process.html) node module.
|
||||||
|
|
||||||
|
Returns a Promise.
|
||||||
|
|
||||||
|
For **single** commands the promises return value is an `object` containing `stdout` and `stderr` properties. If `options.returnProcess` is set to `true` the return value is the [child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess) instead.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
cmd(`node -v`).then(out => {
|
||||||
|
console.log('out.stdout =', out.stdout) // v4.2.2
|
||||||
|
console.log('out.stderr =', out.stderr)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
For **multiple line** command calls the promises return value is an array of `object`'s containing `stdout` and `stderr` properties. If `options.returnProcess` is set to `true` the return value is an array of [child processes](https://nodejs.org/api/child_process.html#child_process_class_childprocess) instead.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
const commands = `
|
||||||
|
node -v
|
||||||
|
npm -v
|
||||||
|
`
|
||||||
|
|
||||||
|
cmd(commands).then(out => {
|
||||||
|
console.log('out[0] =', out[0]) // result from 'node -v'
|
||||||
|
console.log('out[1] =', out[1]) // result from 'npm -v'
|
||||||
|
})
|
||||||
|
```
|
88
install/secu/make/node_modules/cmd-promise/cmd-promise.js
generated
vendored
Normal file
88
install/secu/make/node_modules/cmd-promise/cmd-promise.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
const exec = require('child_process').exec
|
||||||
|
|
||||||
|
/**
|
||||||
|
* does the given object have the given property
|
||||||
|
* @param {object} obj object to check.
|
||||||
|
* @param {string} prop property to check for.
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
function hasProp (obj, prop) {
|
||||||
|
return obj.hasOwnProperty(prop)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is this a string please sir?
|
||||||
|
* @param {string} str string (or is it?) to check.
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
function isString (str) {
|
||||||
|
return (typeof str === 'string' || str instanceof String)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wrapper for child_process.exec()
|
||||||
|
* @param {string} command command line command to run.
|
||||||
|
* @param {object} options cmd-promise options.
|
||||||
|
* @param {object} execOptions exec() options object as outlined in the node docs.
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
function runCommand (command, options, execOptions) {
|
||||||
|
// defaults
|
||||||
|
if (!options) { options = {} }
|
||||||
|
if (!execOptions) { execOptions = {} }
|
||||||
|
|
||||||
|
// resolve to the child process?
|
||||||
|
const returnProcess = hasProp(options, 'returnProcess') ? options.returnProcess : false
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (returnProcess) {
|
||||||
|
// resolve to the child process, don't wait for the output
|
||||||
|
resolve(exec(command, execOptions))
|
||||||
|
} else {
|
||||||
|
// resolve to the output, using the callback
|
||||||
|
exec(command, execOptions, (error, stdout, stderr) => {
|
||||||
|
if (error) { return reject(error) }
|
||||||
|
resolve({ stdout, stderr })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run one or many commands
|
||||||
|
* @param {string} commands command line command(s) string to run.
|
||||||
|
* @param {object} options options object as outlined in the node docs.
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
function cmdPromise (commands, options, execOptions) {
|
||||||
|
// make sure the command is a string
|
||||||
|
if (!isString(commands)) {
|
||||||
|
return Promise.reject(new Error('Command not a string.'))
|
||||||
|
}
|
||||||
|
|
||||||
|
// do we have multiple lines?
|
||||||
|
if (commands.indexOf('\n') > -1) {
|
||||||
|
// split by new lines
|
||||||
|
const arrSplit = commands.split(/\n/g)
|
||||||
|
|
||||||
|
// remove empty array elements
|
||||||
|
const arrFiltered = arrSplit.filter(ele => ele.length)
|
||||||
|
|
||||||
|
// trim each array element
|
||||||
|
const arrTrimmed = arrFiltered.map(ele => ele.trim())
|
||||||
|
|
||||||
|
// array of command promises
|
||||||
|
const arrOut = arrTrimmed.map(command => {
|
||||||
|
return runCommand(command, options, execOptions)
|
||||||
|
})
|
||||||
|
|
||||||
|
// multiple lines, return an array of outs
|
||||||
|
return Promise.all(arrOut)
|
||||||
|
} else {
|
||||||
|
// one line, run it
|
||||||
|
return runCommand(commands, options, execOptions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = cmdPromise
|
21
install/secu/make/node_modules/cmd-promise/package.json
generated
vendored
Normal file
21
install/secu/make/node_modules/cmd-promise/package.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "cmd-promise",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"description": "Node command line interface with a simple Promise based API.",
|
||||||
|
"main": "cmd-promise.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": ""
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Stephen Last",
|
||||||
|
"email": "stephen.last@gmail.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"semver": "^5.3.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/stephen-last/cmd-promise.git"
|
||||||
|
}
|
||||||
|
}
|
25
install/secu/make/node_modules/cmd-promise/test/my-npm-version.js
generated
vendored
Normal file
25
install/secu/make/node_modules/cmd-promise/test/my-npm-version.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
const semver = require('semver')
|
||||||
|
const cmd = require('../cmd-promise')
|
||||||
|
|
||||||
|
console.log('cmd-promise: More involved example.')
|
||||||
|
|
||||||
|
const commands = `
|
||||||
|
npm view npm version
|
||||||
|
npm -v
|
||||||
|
`
|
||||||
|
|
||||||
|
cmd(commands).then(out => {
|
||||||
|
return {
|
||||||
|
npm: out[0].stdout.replace(/\n/g, ''),
|
||||||
|
me: out[1].stdout.replace(/\n/g, '')
|
||||||
|
}
|
||||||
|
}).then(versions => {
|
||||||
|
if (semver.lt(versions.me, versions.npm)) {
|
||||||
|
console.log(`My npm version is out of date (npm install npm@latest -g).`)
|
||||||
|
} else {
|
||||||
|
console.log(`My npm version is up to date! :-)`)
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
18
install/secu/make/node_modules/cmd-promise/test/process.js
generated
vendored
Normal file
18
install/secu/make/node_modules/cmd-promise/test/process.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
const cmd = require('../cmd-promise')
|
||||||
|
|
||||||
|
console.log('cmd-promise: Return child process instead of output.')
|
||||||
|
|
||||||
|
const options = { returnProcess: true }
|
||||||
|
|
||||||
|
cmd(`node -v`, options).then(childProcess => {
|
||||||
|
console.log('pid =', childProcess.pid)
|
||||||
|
childProcess.stdout.on('data', stdout => {
|
||||||
|
console.log('stdout =', stdout)
|
||||||
|
})
|
||||||
|
childProcess.stderr.on('data', stderr => {
|
||||||
|
console.log('stderr =', stderr)
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
17
install/secu/make/node_modules/cmd-promise/test/simple.js
generated
vendored
Normal file
17
install/secu/make/node_modules/cmd-promise/test/simple.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
const cmd = require('../cmd-promise')
|
||||||
|
|
||||||
|
console.log('cmd-promise: One or multiple commands.')
|
||||||
|
|
||||||
|
// const single = `node -v`
|
||||||
|
|
||||||
|
const multiple = `
|
||||||
|
node -v
|
||||||
|
npm -v
|
||||||
|
`
|
||||||
|
|
||||||
|
cmd(multiple).then(out => {
|
||||||
|
console.log('out =', out)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err =', err)
|
||||||
|
})
|
3
install/secu/make/node_modules/tail/.github/FUNDING.yml
generated
vendored
Normal file
3
install/secu/make/node_modules/tail/.github/FUNDING.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: lucagrulla
|
7
install/secu/make/node_modules/tail/.github/dependabot.yml
generated
vendored
Normal file
7
install/secu/make/node_modules/tail/.github/dependabot.yml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
open-pull-requests-limit: 10
|
67
install/secu/make/node_modules/tail/.github/workflows/codeql-analysis.yml
generated
vendored
Normal file
67
install/secu/make/node_modules/tail/.github/workflows/codeql-analysis.yml
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '16 13 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'javascript' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
21
install/secu/make/node_modules/tail/LICENSE
generated
vendored
Normal file
21
install/secu/make/node_modules/tail/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2011 2012 2013 Forward
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
122
install/secu/make/node_modules/tail/README.md
generated
vendored
Normal file
122
install/secu/make/node_modules/tail/README.md
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
# Tail
|
||||||
|
|
||||||
|
The **zero** dependency Node.js module for tailing a file
|
||||||
|
|
||||||
|
[![NPM](https://nodei.co/npm/tail.png?downloads=true&downloadRank=true)](https://nodei.co/npm/tail.png?downloads=true&downloadRank=true)
|
||||||
|
|
||||||
|
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/lucagrulla/node-tail/blob/master/LICENSE)
|
||||||
|
[![npm](https://img.shields.io/npm/v/tail.svg?style=plastic)](https://www.npmjs.com/package/tail)
|
||||||
|
![npm](https://img.shields.io/npm/dm/tail.svg)
|
||||||
|
|
||||||
|
Made with ❤️ by [Luca Grulla](https://www.lucagrulla.com)
|
||||||
|
|
||||||
|
1. TOC
|
||||||
|
{:toc}
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install tail
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
tail = new Tail("fileToTail");
|
||||||
|
|
||||||
|
tail.on("line", function(data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
tail.on("error", function(error) {
|
||||||
|
console.log('ERROR: ', error);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to stop tail:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
tail.unwatch()
|
||||||
|
```
|
||||||
|
|
||||||
|
To start watching again:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
tail.watch()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The only mandatory parameter is the path to the file to tail.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var fileToTail = "/path/to/fileToTail.txt";
|
||||||
|
new Tail(fileToTail)
|
||||||
|
```
|
||||||
|
|
||||||
|
If the file is **missing or invalid** ```Tail``` constructor will throw an Exception and won't initialize.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
try {
|
||||||
|
new Tail('missingFile.txt')
|
||||||
|
} catch (ex) {
|
||||||
|
console.log(ex)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional parameters can be passed via a hash:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var options= {separator: /[\r]{0,1}\n/, fromBeginning: false, fsWatchOptions: {}, follow: true, logger: console}
|
||||||
|
new Tail(fileToTail, options)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Constructor parameters
|
||||||
|
|
||||||
|
* `separator`: the line separator token (default: `/[\r]{0,1}\n/` to handle linux/mac (9+)/windows). Pass `null` for is binary files with no line separator.
|
||||||
|
* `fsWatchOptions`: the full set of options that can be passed to `fs.watch` as per node documentation (default: {}).
|
||||||
|
* `fromBeginning`: tail from the beginning of the file (default: `false`). If `fromBeginning` is true `nLines` will be ignored.
|
||||||
|
* `follow`: simulate `tail -F` option. In the case the file is moved/renamed/logrotated, if set to `true` will start tailing again after a 1 second delay; if set to `false` it will emit an error event (default: `true`).
|
||||||
|
* `logger`: a logger object(default: no logger). The passed logger should follow the folliwing signature:
|
||||||
|
* `info([data][, ...])`
|
||||||
|
* `error([data][, ...])`
|
||||||
|
* `nLines`: tail from the last n lines. (default: `undefined`). Ignored if `fromBeginning` is set to `true`.
|
||||||
|
* `useWatchFile`: if set to `true` will force the use of `fs.watchFile` over delegating to the library the choice between `fs.watch` and `fs.watchFile` (default: `false`).
|
||||||
|
* `encoding`: the file encoding (default:`utf-8`).
|
||||||
|
* `flushAtEOF`: set to `true` to force flush of content when end of file is reached. Useful when there's no separator character at the end of the file (default: `false`).
|
||||||
|
|
||||||
|
## Emitted events
|
||||||
|
|
||||||
|
`Tail` emits two events:
|
||||||
|
|
||||||
|
* line
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
tail.on('line', (data) => {
|
||||||
|
console.log(data)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
* error
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
tail.on('error', (err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
The error emitted is either the underline exception or a descriptive string.
|
||||||
|
|
||||||
|
## How to contribute
|
||||||
|
Node Tail code repo is [here](https://github.com/lucagrulla/node-tail/)
|
||||||
|
Tail is written in ES6. Pull Requests are welcome.
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
Tail was born as part of a data firehose. Read more about that project [here](https://www.lucagrulla.com/posts/building-a-firehose-with-nodejs/).
|
||||||
|
Tail originally was written in [CoffeeScript](https://coffeescript.org/). Since December 2020 it's pure ES6.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT. Please see [License](https://github.com/lucagrulla/node-tail/blob/master/LICENSE) file for more details.
|
233
install/secu/make/node_modules/tail/lib/tail.js
generated
vendored
Normal file
233
install/secu/make/node_modules/tail/lib/tail.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
let events = require(`events`)
|
||||||
|
let fs = require('fs')
|
||||||
|
let path = require('path')
|
||||||
|
|
||||||
|
// const environment = process.env['NODE_ENV'] || 'development'
|
||||||
|
|
||||||
|
class devNull {
|
||||||
|
info() { };
|
||||||
|
error() { };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Tail extends events.EventEmitter {
|
||||||
|
|
||||||
|
constructor(filename, options = {}) {
|
||||||
|
super();
|
||||||
|
this.filename = filename;
|
||||||
|
this.absPath = path.dirname(this.filename);
|
||||||
|
this.separator = (options.separator !== undefined) ? options.separator : /[\r]{0,1}\n/;// null is a valid param
|
||||||
|
this.fsWatchOptions = options.fsWatchOptions || {};
|
||||||
|
this.follow = options['follow'] != undefined ? options['follow'] : true;
|
||||||
|
this.logger = options.logger || new devNull();
|
||||||
|
this.useWatchFile = options.useWatchFile || false;
|
||||||
|
this.flushAtEOF = options.flushAtEOF || false;
|
||||||
|
this.encoding = options.encoding || 'utf-8';
|
||||||
|
const fromBeginning = options.fromBeginning || false;
|
||||||
|
this.nLines = options.nLines || undefined;
|
||||||
|
|
||||||
|
this.logger.info(`Tail starting...`)
|
||||||
|
this.logger.info(`filename: ${this.filename}`);
|
||||||
|
this.logger.info(`encoding: ${this.encoding}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.accessSync(this.filename, fs.constants.F_OK);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code == 'ENOENT') {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buffer = '';
|
||||||
|
this.internalDispatcher = new events.EventEmitter();
|
||||||
|
this.queue = [];
|
||||||
|
this.isWatching = false;
|
||||||
|
this.pos = 0;
|
||||||
|
|
||||||
|
// this.internalDispatcher.on('next',this.readBlock);
|
||||||
|
this.internalDispatcher.on('next', () => {
|
||||||
|
this.readBlock();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.logger.info(`fromBeginning: ${fromBeginning}`);
|
||||||
|
let startingCursor;
|
||||||
|
if (fromBeginning) {
|
||||||
|
startingCursor = 0;
|
||||||
|
} else if (this.nLines !== undefined) {
|
||||||
|
const data = fs.readFileSync(this.filename, {
|
||||||
|
flag: 'r',
|
||||||
|
encoding: this.encoding
|
||||||
|
});
|
||||||
|
const tokens = data.split(this.separator);
|
||||||
|
const dropLastToken = (tokens[tokens.length - 1] === '') ? 1 : 0;//if the file ends with empty line ignore line NL
|
||||||
|
if (tokens.length - this.nLines - dropLastToken <= 0) {
|
||||||
|
//nLines is bigger than avaiable tokens: tail from the begin
|
||||||
|
startingCursor = 0;
|
||||||
|
} else {
|
||||||
|
const match = data.match(new RegExp(`(?:[^\r\n]*[\r]{0,1}\n){${tokens.length - this.nLines - dropLastToken}}`));
|
||||||
|
startingCursor = (match && match.length) ? Buffer.byteLength(match[0], this.encoding) : this.latestPosition();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startingCursor = this.latestPosition();
|
||||||
|
}
|
||||||
|
if (startingCursor === undefined) throw new Error("Tail can't initialize.");
|
||||||
|
const flush = fromBeginning || (this.nLines != undefined);
|
||||||
|
try {
|
||||||
|
this.watch(startingCursor, flush);
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(`watch for ${this.filename} failed: ${err}`);
|
||||||
|
this.emit("error", `watch for ${this.filename} failed: ${err}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
latestPosition() {
|
||||||
|
try {
|
||||||
|
return fs.statSync(this.filename).size;
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(`size check for ${this.filename} failed: ${err}`);
|
||||||
|
this.emit("error", `size check for ${this.filename} failed: ${err}`);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readBlock() {
|
||||||
|
if (this.queue.length >= 1) {
|
||||||
|
const block = this.queue[0];
|
||||||
|
if (block.end > block.start) {
|
||||||
|
let stream = fs.createReadStream(this.filename, { start: block.start, end: block.end - 1, encoding: this.encoding });
|
||||||
|
stream.on('error', (error) => {
|
||||||
|
this.logger.error(`Tail error: ${error}`);
|
||||||
|
this.emit('error', error);
|
||||||
|
});
|
||||||
|
stream.on('end', () => {
|
||||||
|
let _ = this.queue.shift();
|
||||||
|
if (this.queue.length > 0) {
|
||||||
|
this.internalDispatcher.emit('next');
|
||||||
|
}
|
||||||
|
if (this.flushAtEOF && this.buffer.length > 0) {
|
||||||
|
this.emit('line', this.buffer);
|
||||||
|
this.buffer = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
stream.on('data', (d) => {
|
||||||
|
if (this.separator === null) {
|
||||||
|
this.emit("line", d);
|
||||||
|
} else {
|
||||||
|
this.buffer += d;
|
||||||
|
let parts = this.buffer.split(this.separator);
|
||||||
|
this.buffer = parts.pop();
|
||||||
|
for (const chunk of parts) {
|
||||||
|
this.emit("line", chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
change() {
|
||||||
|
let p = this.latestPosition()
|
||||||
|
if (p < this.currentCursorPos) {//scenario where text is not appended but it's actually a w+
|
||||||
|
this.currentCursorPos = p
|
||||||
|
} else if (p > this.currentCursorPos) {
|
||||||
|
this.queue.push({ start: this.currentCursorPos, end: p });
|
||||||
|
this.currentCursorPos = p
|
||||||
|
if (this.queue.length == 1) {
|
||||||
|
this.internalDispatcher.emit("next");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(startingCursor, flush) {
|
||||||
|
if (this.isWatching) return;
|
||||||
|
this.logger.info(`filesystem.watch present? ${fs.watch != undefined}`);
|
||||||
|
this.logger.info(`useWatchFile: ${this.useWatchFile}`);
|
||||||
|
|
||||||
|
this.isWatching = true;
|
||||||
|
this.currentCursorPos = startingCursor;
|
||||||
|
//force a file flush is either fromBegining or nLines flags were passed.
|
||||||
|
if (flush) this.change();
|
||||||
|
|
||||||
|
if (!this.useWatchFile && fs.watch) {
|
||||||
|
this.logger.info(`watch strategy: watch`);
|
||||||
|
this.watcher = fs.watch(this.filename, this.fsWatchOptions, (e, filename) => { this.watchEvent(e, filename); });
|
||||||
|
} else {
|
||||||
|
this.logger.info(`watch strategy: watchFile`);
|
||||||
|
fs.watchFile(this.filename, this.fsWatchOptions, (curr, prev) => { this.watchFileEvent(curr, prev) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rename(filename) {
|
||||||
|
//TODO
|
||||||
|
//MacOS sometimes throws a rename event for no reason.
|
||||||
|
//Different platforms might behave differently.
|
||||||
|
//see https://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener
|
||||||
|
//filename might not be present.
|
||||||
|
//https://nodejs.org/api/fs.html#fs_filename_argument
|
||||||
|
//Better solution would be check inode but it will require a timeout and
|
||||||
|
// a sync file read.
|
||||||
|
if (filename === undefined || filename !== this.filename) {
|
||||||
|
this.unwatch();
|
||||||
|
if (this.follow) {
|
||||||
|
this.filename = path.join(this.absPath, filename);
|
||||||
|
this.rewatchId = setTimeout((() => {
|
||||||
|
try {
|
||||||
|
this.watch(this.currentCursorPos);
|
||||||
|
} catch (ex) {
|
||||||
|
this.logger.error(`'rename' event for ${this.filename}. File not available anymore.`);
|
||||||
|
this.emit("error", ex);
|
||||||
|
}
|
||||||
|
}), 1000);
|
||||||
|
} else {
|
||||||
|
this.logger.error(`'rename' event for ${this.filename}. File not available anymore.`);
|
||||||
|
this.emit("error", `'rename' event for ${this.filename}. File not available anymore.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// this.logger.info("rename event but same filename")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watchEvent(e, evtFilename) {
|
||||||
|
try {
|
||||||
|
if (e === 'change') {
|
||||||
|
this.change();
|
||||||
|
} else if (e === 'rename') {
|
||||||
|
this.rename(evtFilename);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(`watchEvent for ${this.filename} failed: ${err}`);
|
||||||
|
this.emit("error", `watchEvent for ${this.filename} failed: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watchFileEvent(curr, prev) {
|
||||||
|
if (curr.size > prev.size) {
|
||||||
|
this.currentCursorPos = curr.size; //Update this.currentCursorPos so that a consumer can determine if entire file has been handled
|
||||||
|
this.queue.push({ start: prev.size, end: curr.size });
|
||||||
|
if (this.queue.length == 1) {
|
||||||
|
this.internalDispatcher.emit("next");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unwatch() {
|
||||||
|
if (this.watcher) {
|
||||||
|
this.watcher.close();
|
||||||
|
} else {
|
||||||
|
fs.unwatchFile(this.filename);
|
||||||
|
}
|
||||||
|
if (this.rewatchId) {
|
||||||
|
clearTimeout(this.rewatchId);
|
||||||
|
this.rewatchId = undefined;
|
||||||
|
}
|
||||||
|
this.isWatching = false;
|
||||||
|
this.queue = [];// TODO: is this correct behaviour?
|
||||||
|
if (this.logger) {
|
||||||
|
this.logger.info(`Unwatch ${this.filename}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.Tail = Tail
|
40
install/secu/make/node_modules/tail/package.json
generated
vendored
Normal file
40
install/secu/make/node_modules/tail/package.json
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"author": {
|
||||||
|
"name": "Luca Grulla",
|
||||||
|
"url": "https://www.lucagrulla.com"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
"Luca Grulla",
|
||||||
|
"Tom Hall"
|
||||||
|
],
|
||||||
|
"name": "tail",
|
||||||
|
"description": "tail a file in node",
|
||||||
|
"keywords": [
|
||||||
|
"tail",
|
||||||
|
"file",
|
||||||
|
"logs"
|
||||||
|
],
|
||||||
|
"version": "2.2.4",
|
||||||
|
"homepage": "https://www.lucagrulla.com/node-tail",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/lucagrulla/node-tail.git"
|
||||||
|
},
|
||||||
|
"main": "lib/tail",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "rm -f ./lib/** && cp src/tail.js ./lib/",
|
||||||
|
"prepare": "npm run build",
|
||||||
|
"prepublishOnly": "npm run test",
|
||||||
|
"test": "mocha",
|
||||||
|
"coverage": "nyc npm run test"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"chai": "4.x",
|
||||||
|
"mocha": "9.x",
|
||||||
|
"nyc": "^15.1.0"
|
||||||
|
}
|
||||||
|
}
|
38
install/secu/make/package-lock.json
generated
Normal file
38
install/secu/make/package-lock.json
generated
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "make",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"cmd-promise": "^1.2.0",
|
||||||
|
"tail": "^2.2.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cmd-promise": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cmd-promise/-/cmd-promise-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-PPUTIiAZi1HBbakt44ag03Q9u1w="
|
||||||
|
},
|
||||||
|
"node_modules/tail": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/tail/-/tail-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-PX8klSxW1u3SdgDrDeewh5GNE+hkJ4h02JvHfV6YrHqWOVJ88nUdSQqtsUf/gWhgZlPAws3fiZ+F1f8euspcuQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cmd-promise": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cmd-promise/-/cmd-promise-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-PPUTIiAZi1HBbakt44ag03Q9u1w="
|
||||||
|
},
|
||||||
|
"tail": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/tail/-/tail-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-PX8klSxW1u3SdgDrDeewh5GNE+hkJ4h02JvHfV6YrHqWOVJ88nUdSQqtsUf/gWhgZlPAws3fiZ+F1f8euspcuQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
install/secu/make/package.json
Normal file
6
install/secu/make/package.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"cmd-promise": "^1.2.0",
|
||||||
|
"tail": "^2.2.4"
|
||||||
|
}
|
||||||
|
}
|
173
install/secu/make/v1.1.js
Normal file
173
install/secu/make/v1.1.js
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
const wpLog = '/var/www/html/wp-config.php'
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(wpLog)) {
|
||||||
|
console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] == 5) {
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl 123.123.123.123 ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert: \n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Live view of the counts
|
||||||
|
console.log(counts)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
const path = '/var/log/apache2/access.log'
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(path)) {
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
console.log("I could not find any WP instaltion within the /var/www/html directory\nNOT loading the WP Log listener")
|
||||||
|
}
|
||||||
|
|
161
install/secu/make/v1.js
Normal file
161
install/secu/make/v1.js
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
const wpLog = '/var/www/html/wp-config.php'
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(wpLog)) {
|
||||||
|
console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] == 5) {
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl 123.123.123.123 ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert: \n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Live view of the counts
|
||||||
|
console.log(counts)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
BIN
install/secu/make/vs
Executable file
BIN
install/secu/make/vs
Executable file
Binary file not shown.
172
install/secu/make/vs.js
Normal file
172
install/secu/make/vs.js
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
try {
|
||||||
|
if (fs.existsSync("/var/www/html/wp-config.php")) {
|
||||||
|
console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php") && requestInfo.includes("POST")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] == 5) {
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert:\n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Live view of the counts
|
||||||
|
console.log(counts)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
|
||||||
|
fs.exists("/var/log/apache2/access.log", function (isExist) {
|
||||||
|
if (isExist) {
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
||||||
|
} else {
|
||||||
|
console.log("ApacheHTTP Server is not installed, not enabling WP protection.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
172
install/secu/make/vs_.js
Normal file
172
install/secu/make/vs_.js
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
// Lets use some libs to help us out.
|
||||||
|
const fs = require('fs')
|
||||||
|
Tail = require('tail').Tail;
|
||||||
|
|
||||||
|
sshTail = new Tail("/var/log/auth.log");
|
||||||
|
const cmd = require('cmd-promise')
|
||||||
|
|
||||||
|
// Setting up our main storage logic - for now this program does not use a database system.
|
||||||
|
let serverStatusCount = 0;
|
||||||
|
let attackData = []
|
||||||
|
let blockedIPs = []
|
||||||
|
let ipToBlock
|
||||||
|
|
||||||
|
console.log("Welcome to the security notification system secuNotify by Discord-Linux!");
|
||||||
|
console.log("We currently will notify you about login events, such as failed logins and successful logins.");
|
||||||
|
|
||||||
|
// Setting up our notification function - This allows us to direct message our user.
|
||||||
|
function notify(message) {
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const notif = spawn('notif', [message]);
|
||||||
|
|
||||||
|
notif.stdout.on('data', (data) => {
|
||||||
|
console.log(`stdout: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.stderr.on('data', (data) => {
|
||||||
|
console.error(`stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
notif.on('close', (code) => {
|
||||||
|
console.log(`Code: ${code} - Continuing to monitor`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenAuthLog(logLocation) {
|
||||||
|
sshTail.on("line", function (info) {
|
||||||
|
let infoString = info.toString();
|
||||||
|
|
||||||
|
if (infoString.includes("Failed password for root")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoString.includes("Accepted password for")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This does mean that someone (Maybe you) has logged in successfully!");
|
||||||
|
}
|
||||||
|
if (infoString.includes("Invalid user")) {
|
||||||
|
console.log(info);
|
||||||
|
notify("secuNotify Service Alert: \n" + info + "This means that someone (Maybe you) has tried to login with an invalid username!");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
function listenWPLog(logLocation) {
|
||||||
|
// Check to see if we are a wordpress user, if so, activate the wordpress notification service
|
||||||
|
try {
|
||||||
|
if (fs.existsSync("/var/www/html/wp-config.php")) {
|
||||||
|
console.log("We are a wordpress user, activating wordpress notification service");
|
||||||
|
|
||||||
|
// Tail Logs section, if we have a lot, it will have a listeniner below.
|
||||||
|
wpTail.on("line", function (info) {
|
||||||
|
|
||||||
|
// Convert Data to String
|
||||||
|
let requestInfo = info.toString()
|
||||||
|
// FIND IP Address from this request
|
||||||
|
var ipRegEx = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; // RegEx IPAddress Format
|
||||||
|
var ipRegExMatched = requestInfo.match(ipRegEx); // Set up our match
|
||||||
|
let remoteIP = ipRegExMatched[0] // Set our var
|
||||||
|
|
||||||
|
// // Grab the whitelist
|
||||||
|
// let whitelistData = process.env.WHITELIST
|
||||||
|
// let whitelist = whitelistData.split(",")
|
||||||
|
|
||||||
|
// // If an IP is found to be in the whitelist, return as to do nothing.
|
||||||
|
// for (const [key, value] of Object.entries(whitelist)) {
|
||||||
|
// if (value === remoteIP) return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Filtering out any server-status requests - These are annoying.
|
||||||
|
if (requestInfo.includes("server-status")) {
|
||||||
|
// Add to the server status count so we may keep track of these requests.
|
||||||
|
serverStatusCount++
|
||||||
|
// Lets return the data as no not proceed with any further code, as it is not needed.
|
||||||
|
// We return to stdout here to update the cli without adding a new line line a clock
|
||||||
|
return process.stdout.write("Server Status Count: " + serverStatusCount + "\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If request contans wp-login lets process its request
|
||||||
|
if (requestInfo.includes("wp-login.php")) {
|
||||||
|
// Lets start the process of logging attack attempts to determine request intent.
|
||||||
|
// Over the threshhold here will automatically CSF D the IP Address.
|
||||||
|
// In this simple version, we will just log each IP Address as they come in within an array
|
||||||
|
// We will then roll and count this array after each detection to determine the IPs intent.
|
||||||
|
console.log("---------\nWP LOGIN REQUEST DETECTED!\n---------")
|
||||||
|
console.log(info + "\n----------");
|
||||||
|
attackData.push(remoteIP)
|
||||||
|
|
||||||
|
// Lets count the attack data per IP Address to ensure its logged properly.
|
||||||
|
var counts = {};
|
||||||
|
|
||||||
|
// For each IP Address recorded into the main attackData array, count them and see outmany bad requests they have made.
|
||||||
|
attackData.forEach(function (x) {
|
||||||
|
// Add a point for each entry
|
||||||
|
counts[x] = (counts[x] || 0) + 1;
|
||||||
|
//
|
||||||
|
for ([key, value] of Object.entries(counts)) {
|
||||||
|
// If the count has hit the blockON Count we start the blocking process
|
||||||
|
|
||||||
|
if (counts[x] == 5) {
|
||||||
|
// Preserve the key for later blocklist addition
|
||||||
|
ipToBlock = key
|
||||||
|
|
||||||
|
// Check the already blocked IPs - If the remoteIP is in the list do nothing
|
||||||
|
if (blockedIPs.includes(key)) {
|
||||||
|
return
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The remoteIP is not listed, lets add it.
|
||||||
|
blockedIPs.push(ipToBlock)
|
||||||
|
// Let the log know we are blocking the IP
|
||||||
|
console.log("Starting to block bad IP")
|
||||||
|
// Run the block, wait for the promise - Requests are still going on
|
||||||
|
cmd(`/var/tools/firewallctl ` + key + " WP-Login Brute Force Blocked Via secuNotify").then(out => {
|
||||||
|
notify("secuNotify Service Alert:\n " + key + " has been blocked for 5 bad wordpress login attempts!");
|
||||||
|
|
||||||
|
// The block has finished - remoteIP no longer has access
|
||||||
|
}).catch(err => {
|
||||||
|
// IF we see an error, give its output
|
||||||
|
console.log('CSF Error: ', err)
|
||||||
|
}).then(out2 => {
|
||||||
|
// Set IPBLOCK to null for a reset and start scanning for new attacks
|
||||||
|
ipToBlock = null;
|
||||||
|
console.log("Attack Stopped, Looking for new attacks....")
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Live view of the counts
|
||||||
|
console.log(counts)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenAuthLog("/var/log/auth.log")
|
||||||
|
|
||||||
|
fs.exists("/var/log/apache2/access.log", function (isExist) {
|
||||||
|
if (isExist) {
|
||||||
|
wpTail = new Tail("/var/log/apache2/access.log");
|
||||||
|
listenWPLog("/var/log/apache2/access.log")
|
||||||
|
} else {
|
||||||
|
console.log("ApacheHTTP Server is not installed, not enabling WP protection.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
install/secu/secuNotify
Executable file
BIN
install/secu/secuNotify
Executable file
Binary file not shown.
15
install/secu/secuNotify.service
Normal file
15
install/secu/secuNotify.service
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=secunotify service
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=
|
||||||
|
WorkingDirectory=/var/tools/
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
ExecStart=/var/tools/secuNotify
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
BIN
install/secu/secuNotifyold
Executable file
BIN
install/secu/secuNotifyold
Executable file
Binary file not shown.
26
install/startfiles/base
Normal file
26
install/startfiles/base
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export CID=$(basename $(cat /proc/1/cpuset))
|
||||||
|
service ssh start
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
#DISCORD-LINUX AUTOINSTALLER
|
||||||
|
#DONOTREMOVE
|
||||||
|
#webmin
|
||||||
|
#osjs
|
||||||
|
#wp
|
||||||
|
#ENDDONOTREMOVE
|
||||||
|
|
||||||
|
#ADD ANY SERVICES YOU NEED TO BOOT ON START UP BELOW
|
||||||
|
#DO NOT ADD ANY LINES BELOW THE TAIL -F /DEV/NULL
|
||||||
|
#DOING SO WILL BREAK YOUR CONTAINER.
|
||||||
|
|
||||||
|
#CUSTOM SERVICES START
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#CUSTOM SERVICES END
|
||||||
|
|
||||||
|
#DONOTREMOVEEVER
|
||||||
|
tail -f /dev/null
|
||||||
|
#DONOTPUTANYTHINGBELOWTHISLINEEVER
|
15
install/startfiles/dlinux-service.service
Normal file
15
install/startfiles/dlinux-service.service
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=dlinux service
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=
|
||||||
|
WorkingDirectory=/root/.service
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
ExecStart=/usr/bin/node /root/.service/dlinux
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
6
install/startfiles/webmin
Normal file
6
install/startfiles/webmin
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export CID=$(basename $(cat /proc/1/cpuset))
|
||||||
|
service ssh start
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
service webmin start
|
||||||
|
tail -f /dev/null
|
71
install/whoogle/config
Normal file
71
install/whoogle/config
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# ----------------------------------
|
||||||
|
# Rename to "whoogle.env" before use
|
||||||
|
# ----------------------------------
|
||||||
|
# You can set Whoogle environment variables here, but must
|
||||||
|
# modify your deployment to enable these values:
|
||||||
|
# - Local: Set WHOOGLE_DOTENV=1
|
||||||
|
# - docker-compose: Uncomment the env_file option
|
||||||
|
# - docker: Add "--env-file ./whoogle.env" to your build command
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#WHOOGLE_CSP=1
|
||||||
|
#HTTPS_ONLY=1
|
||||||
|
|
||||||
|
# Restrict results to only those near a particular city
|
||||||
|
#WHOOGLE_CONFIG_NEAR=denver
|
||||||
|
|
||||||
|
# See app/static/settings/countries.json for values
|
||||||
|
WHOOGLE_CONFIG_COUNTRY=US
|
||||||
|
|
||||||
|
# See app/static/settings/languages.json for values
|
||||||
|
WHOOGLE_CONFIG_LANGUAGE=lang_en
|
||||||
|
|
||||||
|
# See app/static/settings/languages.json for values
|
||||||
|
WHOOGLE_CONFIG_SEARCH_LANGUAGE=lang_en
|
||||||
|
|
||||||
|
# Disable changing of config from client
|
||||||
|
WHOOGLE_CONFIG_DISABLE=0
|
||||||
|
|
||||||
|
# Block websites from search results (comma-separated list)
|
||||||
|
#WHOOGLE_CONFIG_BLOCK=pinterest.com,whitehouse.gov
|
||||||
|
|
||||||
|
# Theme (light, dark, or system)
|
||||||
|
WHOOGLE_CONFIG_THEME=dark
|
||||||
|
|
||||||
|
# Safe search mode
|
||||||
|
#WHOOGLE_CONFIG_SAFE=1
|
||||||
|
|
||||||
|
# Use social media site alternatives (nitter, bibliogram, etc)
|
||||||
|
#WHOOGLE_CONFIG_ALTS=1
|
||||||
|
|
||||||
|
# Use Tor if available
|
||||||
|
WHOOGLE_CONFIG_TOR=1
|
||||||
|
|
||||||
|
# Open results in new tab
|
||||||
|
#WHOOGLE_CONFIG_NEW_TAB=1
|
||||||
|
|
||||||
|
# Enable View Image option
|
||||||
|
WHOOGLE_CONFIG_VIEW_IMAGE=1
|
||||||
|
|
||||||
|
# Search using GET requests only (exposes query in logs)
|
||||||
|
#WHOOGLE_CONFIG_GET_ONLY=1
|
||||||
|
|
||||||
|
# Remove everything except basic result cards from all search queries
|
||||||
|
#WHOOGLE_MINIMAL=0
|
||||||
|
|
||||||
|
# Set the number of results per page
|
||||||
|
#WHOOGLE_RESULTS_PER_PAGE=10
|
||||||
|
|
||||||
|
# Controls visibility of autocomplete/search suggestions
|
||||||
|
#WHOOGLE_AUTOCOMPLETE=1
|
||||||
|
|
||||||
|
# The port where Whoogle will be exposed
|
||||||
|
EXPOSE_PORT=5000
|
||||||
|
|
||||||
|
# Set instance URL
|
||||||
|
#WHOOGLE_CONFIG_URL=https://<whoogle url>/
|
||||||
|
|
||||||
|
# Set custom CSS styling/theming
|
||||||
|
#WHOOGLE_CONFIG_STYLE=":root { /* LIGHT THEME COLORS */ --whoogle-background: #d8dee9; --whoogle-accent: #2e3440; --whoogle-text: #3B4252; --whoogle-contrast-text: #eceff4; --whoogle-secondary-text: #70757a; --whoogle-result-bg: #fff; --whoogle-result-title: #4c566a; --whoogle-result-url: #81a1c1; --whoogle-result-visited: #a3be8c; /* DARK THEME COLORS */ --whoogle-dark-background: #222; --whoogle-dark-accent: #685e79; --whoogle-dark-text: #fff; --whoogle-dark-contrast-text: #000; --whoogle-dark-secondary-text: #bbb; --whoogle-dark-result-bg: #000; --whoogle-dark-result-title: #1967d2; --whoogle-dark-result-url: #4b11a8; --whoogle-dark-result-visited: #bbbbff; }"
|
9
install/whoogle/whoogleStart.json
Normal file
9
install/whoogle/whoogleStart.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"apps": [
|
||||||
|
{
|
||||||
|
"name": "Whoogle",
|
||||||
|
"script": "bash -c ./run",
|
||||||
|
"args" : ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
63
mc-64
Normal file
63
mc-64
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux MineCraft Server Automated installer"
|
||||||
|
echo "This will install MineCraft Sever on your system"
|
||||||
|
echo "A random port on your container will be selected."
|
||||||
|
printf "\n"
|
||||||
|
echo "Running this sever does require the Discord-Linux Power Plan"
|
||||||
|
echo "You may purchase this plan here: https://store.discord-linux.com/product/discord-power-upgrade/"
|
||||||
|
printf "\n"
|
||||||
|
echo "Sleeping for 30 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
wget -q -O - https://ssh.surf/notifyx64 | bash
|
||||||
|
|
||||||
|
notif "Welcome to the MineCraft Server installer for Discord-Linux, the installation is starting and will complete in 45 seconds"
|
||||||
|
apt update
|
||||||
|
useradd mc
|
||||||
|
mkdir -vp /home/mc
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
wget -O /home/mc/server.jar https://papermc.io/api/v2/projects/paper/versions/1.18.2/builds/234/downloads/paper-1.18.2-234.jar
|
||||||
|
|
||||||
|
|
||||||
|
wget -O /home/mc/minecraft-server.json https://ssh.surf/install/mc/minecraft-server.json
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /home/mc/eula.txt https://ssh.surf/install/mc/eula
|
||||||
|
|
||||||
|
chown -R mc:mc /home/mc/
|
||||||
|
|
||||||
|
pm2 start /home/mc/minecraft-server.json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "sleeping 30 seconds to allow the server to generate"
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo "Shutting down the MC server for port configuration"
|
||||||
|
|
||||||
|
pm2 delete all
|
||||||
|
|
||||||
|
echo "killing any possible running instances of java"
|
||||||
|
pkill java -9
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "Setting port in our config"
|
||||||
|
#sed -i "s/25565/${port}/g" /home/mc/server.properties
|
||||||
|
sed -i "s/max-players=20/max-players=4/g" /home/mc/server.properties
|
||||||
|
sed -i "s/A Minecraft Server/An MC Server running on Discord-Linux/g" /home/mc/server.properties
|
||||||
|
|
||||||
|
echo "Starting the server for final launch"
|
||||||
|
pm2 start /home/mc/minecraft-server.json
|
||||||
|
relayPort 25565
|
||||||
|
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
echo "Your installation has completed, connect to your MineCraft Server via hyper relay: $(hostname)-25565"
|
||||||
|
notif "Your installation has completed, connect to your MineCraft Server via via hyper relay: $(hostname)-25565"
|
||||||
|
echo "Please allow up to 5 minutes for the server to start up"
|
||||||
|
|
BIN
notify-x64
Normal file
BIN
notify-x64
Normal file
Binary file not shown.
55
ols-64
Executable file
55
ols-64
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux OpenLiteSpeed Automated installer for dLinux64"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
apt update
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notify-x64 && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the OpenLiteSpeed Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl python unzip zip
|
||||||
|
echo "deb http://rpms.litespeedtech.com/debian/ focal main" > /etc/apt/sources.list.d/lst_debian_repo.list
|
||||||
|
echo "#deb http://rpms.litespeedtech.com/edge/debian/ focal main" >> /etc/apt/sources.list.d/lst_debian_repo.list
|
||||||
|
|
||||||
|
wget -O /etc/apt/trusted.gpg.d/lst_debian_repo.gpg http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg
|
||||||
|
wget -O /etc/apt/trusted.gpg.d/lst_repo.gpg http://rpms.litespeedtech.com/debian/lst_repo.gpg
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install openlitespeed
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp80
|
||||||
|
|
||||||
|
/usr/local/lsws/bin/lswsctrl start
|
||||||
|
|
||||||
|
service webmin start
|
||||||
|
|
||||||
|
relayPort 7000
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
url=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-80-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
backendurl=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-7000-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
echo "referers=$url" >> /etc/webmin/config
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/#ols/usr/local/lsws/bin/lswsctrl start \&\& relayPort 7000/g" /start.sh
|
||||||
|
|
||||||
|
notif "Your webserver URL is https://$url"
|
||||||
|
notif "Your ADMIN URL is https://$backendurl"
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: https://$url"
|
||||||
|
|
||||||
|
|
125
osjs-webdesktop-64
Executable file
125
osjs-webdesktop-64
Executable file
@ -0,0 +1,125 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux OSjs Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when this process is complete."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "Sleeping for 5 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notify-x64 && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the OSjs Automated installer for Discord-Linux, we will begin by updating your system. Please wait..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libpam-dev perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl python unzip zip
|
||||||
|
|
||||||
|
#https://askubuntu.com/questions/916199/install-apt-show-versions-inside-an-ubuntu-docker-container
|
||||||
|
|
||||||
|
sh /var/tools/getsystemctl.sh
|
||||||
|
|
||||||
|
notif "The system has been updated and systemD has been patched, we are now starting to install the required NPM's for OSjs"
|
||||||
|
|
||||||
|
mkdir -vp /webos
|
||||||
|
|
||||||
|
cd /webos && git clone https://github.com/os-js/OS.js.git
|
||||||
|
|
||||||
|
mv /webos/OS.js /webos/OSjs
|
||||||
|
|
||||||
|
cd /webos/OSjs && rm -f package-lock.json
|
||||||
|
|
||||||
|
echo "Installing main packages..."
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "The Core OSjs Packages have been installed, we are now starting to install the Applications for OSJS Via NPM"
|
||||||
|
|
||||||
|
npm install @osjs/textpad-application
|
||||||
|
npm install --save --production @osjs/draw-application
|
||||||
|
npm install --save --production @osjs/filemanager-application
|
||||||
|
npm install @osjs/settings-application
|
||||||
|
npm install @osjs/writer-application
|
||||||
|
npm install --save --production @osjs/xterm-application
|
||||||
|
npm install --save --production @osjs/ace-application
|
||||||
|
npm install @osjs/xpra-application
|
||||||
|
npm install @osjs/vnc-application
|
||||||
|
npm install @osjs/epub-application
|
||||||
|
npm install @osjs/webodf-application
|
||||||
|
npm install @osjs/wolfenstein3d-application
|
||||||
|
npm install @osjs/tetris-application
|
||||||
|
npm install @osjs/standard-theme
|
||||||
|
npm install @osjs/standard-dark-theme
|
||||||
|
npm install @osjs/gnome-icons
|
||||||
|
npm install @osjs/freedesktop-sounds
|
||||||
|
npm install --save --production @osjs/pam-auth
|
||||||
|
|
||||||
|
echo "Fixing detected vulns"
|
||||||
|
|
||||||
|
npm audit fix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "We are almost finished, we are now configuring OSjs and starting the server"
|
||||||
|
|
||||||
|
echo "removing config files..."
|
||||||
|
rm -f src/server/index.js
|
||||||
|
|
||||||
|
rm -f src/server/config.js
|
||||||
|
|
||||||
|
rm -f src/client/config.js
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing our own customized config files"
|
||||||
|
|
||||||
|
wget -O src/server/index.js https://ssh.surf/install/osjs/osjs_server_index.js
|
||||||
|
|
||||||
|
wget -O src/server/config.js https://ssh.surf/install/osjs/osjs_server_config.js
|
||||||
|
|
||||||
|
wget -O src/client/config.js https://ssh.surf/install/osjs/osjs_client_config.js
|
||||||
|
|
||||||
|
wget -O src/client/wallpaper.jpg https://ssh.surf/wallpaper.jpg
|
||||||
|
|
||||||
|
wget -O osjsStart.json https://ssh.surf/install/osjs/osjsStart.json
|
||||||
|
|
||||||
|
|
||||||
|
echo "Setting port in our config"
|
||||||
|
sed -i "s/CUSTOM/10001/g" src/server/config.js
|
||||||
|
|
||||||
|
echo "Discovering all installed packages..."
|
||||||
|
npm run package:discover
|
||||||
|
|
||||||
|
echo "Building the client..."
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
rm -f /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png
|
||||||
|
|
||||||
|
wget -O /webos/OSjs/dist/f4cfc6708cf6bfc17d4b1e775f594ae2.png https://ssh.surf/wallpaper.png
|
||||||
|
|
||||||
|
cd /webos/OSjs && pm2 start osjsStart.json
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
relayPort 10001
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
url=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-10001-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
|
||||||
|
|
||||||
|
echo "cd /webos/OSjs && pm2 start osjsStart.json" > /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/osjsboot.sh
|
||||||
|
|
||||||
|
sed -i "s/#osjs/cd \/webos\/OSjs \&\& pm2 start osjsStart.json \&\& relayPort 1001/g" /start.sh
|
||||||
|
|
||||||
|
notif "Your OSJS installation has completed and should be running at this time, you may access your installation at: https://$url"
|
||||||
|
|
||||||
|
echo "Your OSJs installation has completed and should be running at this time, you may access your installation at: https://$url"
|
4
resolv
Normal file
4
resolv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
search vcn07112203.oraclevcn.com subnet07112203.vcn07112203.oraclevcn.com
|
||||||
|
nameserver 169.254.169.254
|
||||||
|
nameserver 127.0.0.11
|
||||||
|
options ndots:0
|
2
run/script
Normal file
2
run/script
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo hi
|
54
send-to-log-64
Normal file
54
send-to-log-64
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Welcome to the Send-To-Log system installer"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notify-x64 && chmod +x /usr/bin/notif
|
||||||
|
notif Welcome to the Send-To-Log installer, we will pick a port and provide you a URL when complete.
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake git libjson-c-dev libwebsockets-dev screen
|
||||||
|
|
||||||
|
|
||||||
|
notif Cloning and Configuring our Software
|
||||||
|
|
||||||
|
# Move to our tmp directory
|
||||||
|
cd /tmp
|
||||||
|
# Clone the repo
|
||||||
|
git clone https://github.com/tsl0922/ttyd.git
|
||||||
|
# Move and build!
|
||||||
|
cd ttyd && mkdir build && cd build
|
||||||
|
# Install
|
||||||
|
cd /tmp/ttyd/build && cmake ..
|
||||||
|
cd /tmp/ttyd/build && make && sudo make install
|
||||||
|
|
||||||
|
# lets download our start up files backend and frontend.
|
||||||
|
wget -q -O /etc/systemd/system/s2l.service https://ssh.surf/install/s2l/s2l-service.service
|
||||||
|
|
||||||
|
wget -q -O /etc/s2l.json https://ssh.surf/install/s2l/s2l-pm2.json
|
||||||
|
|
||||||
|
wget -q -O /usr/bin/s2l https://ssh.surf/install/s2l/input.sh
|
||||||
|
|
||||||
|
chmod +x /usr/bin/s2l
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/changeme/7070/g" /etc/s2l.json
|
||||||
|
sed -i "s/#s2lmain/systemctl start s2l && sleep 5/g" /start.sh
|
||||||
|
sed -i "s/#s2lsecond/pm2 start \/etc\/s2l.json/g" /start.sh
|
||||||
|
cd /
|
||||||
|
systemctl start s2l
|
||||||
|
sleep 5
|
||||||
|
pm2 start /etc/s2l.json
|
||||||
|
sleep 10
|
||||||
|
relayPort 7070
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
url=$(grep -hPo "(?<=listening ).*" /root/.pm2/logs/Relay-7070-out.log | head -n 1 | sed 's/$/.virt.fun/')
|
||||||
|
|
||||||
|
|
||||||
|
echo "Done, you may access s2l at https://$url"
|
||||||
|
notif Done, you may access s2l at https://$url
|
||||||
|
notif Send commands using s2l commandhere or on the bot ^s commandhere
|
29
test.go
Normal file
29
test.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// webserver that says hello
|
||||||
|
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", handler)
|
||||||
|
http.ListenAndServe(":8080", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "Hello, world!")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// $ go run test.go
|
||||||
|
// Hello, world!
|
||||||
|
// $
|
||||||
|
|
||||||
|
|
5
ubuntu/auto-install
Normal file
5
ubuntu/auto-install
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
wget -q -O /usr/bin/auto-install https://ssh.surf/auto-install.sh
|
||||||
|
chmod +x /usr/bin/auto-install
|
||||||
|
echo "The Discord-Linux AutoInstaller has been installed successfully"
|
||||||
|
|
18
ubuntu/auto-install.sh
Executable file
18
ubuntu/auto-install.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Welcome to the Discord-Linux Automated-Installer"
|
||||||
|
echo "To view the currently avalible software, use: auto-install list"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OperatingSystem=$(cat /var/OS)
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
if [ "$1" == "list" ]
|
||||||
|
then
|
||||||
|
curl https://ssh.surf/$OperatingSystem/list
|
||||||
|
else
|
||||||
|
wget -q -O - https://ssh.surf/$OperatingSystem/$1 | bash
|
||||||
|
fi
|
||||||
|
|
58
ubuntu/code-server
Normal file
58
ubuntu/code-server
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux CodeServer Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Code-Server Automated installer for Discord-Linux ARM, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
wget -q https://github.com/coder/code-server/releases/download/v3.12.0/code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Installing Code-Server 3.12 using DPKG"
|
||||||
|
|
||||||
|
dpkg -i code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
rm -f code-server_3.12.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Downloading our configurations"
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.json https://ssh.surf/install/code-server/startCodeServer.json
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.sh https://ssh.surf/install/code-server/startCodeServer.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
mkdir -vp /root/.config/code-server/
|
||||||
|
|
||||||
|
wget -q -O /root/.config/code-server/config.yaml https://ssh.surf/install/code-server/config.yaml
|
||||||
|
|
||||||
|
PASS=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/replaceme/${PASS}/g" ~/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
sed -i "s/#code-server/cd \/var\/tools \&\& pm2 start startCodeServer.json \&\& relayPort 8080/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/127.0.0.1:8080/0.0.0.0:${port}/g" /root/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
pm2 start /var/tools/startCodeServer.json
|
||||||
|
|
||||||
|
|
||||||
|
notif "The installation has completed. You may access your install at: http://ssh.surf:$port with the password $PASS"
|
58
ubuntu/cs-test
Normal file
58
ubuntu/cs-test
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux CodeServer Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the Code-Server Automated installer for Discord-Linux ARM, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
wget -q https://github.com/coder/code-server/releases/download/v4.4.0/code-server_4.4.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Installing Code-Server code-server_4.4.0_arm64.deb using DPKG"
|
||||||
|
|
||||||
|
dpkg -i code-server_4.4.0_arm64.deb
|
||||||
|
|
||||||
|
rm -f code-server_4.4.0_arm64.deb
|
||||||
|
|
||||||
|
notif "Downloading our configurations"
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.json https://ssh.surf/install/code-server/startCodeServer.json
|
||||||
|
|
||||||
|
wget -q -O /var/tools/startCodeServer.sh https://ssh.surf/install/code-server/startCodeServer.sh
|
||||||
|
|
||||||
|
chmod +x /var/tools/startCodeServer.sh
|
||||||
|
|
||||||
|
mkdir -vp /root/.config/code-server/
|
||||||
|
|
||||||
|
wget -q -O /root/.config/code-server/config.yaml https://ssh.surf/install/code-server/config.yaml
|
||||||
|
|
||||||
|
PASS=$(openssl rand -hex 12)
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/replaceme/${PASS}/g" ~/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
sed -i "s/#code-server/cd \/var\/tools \&\& pm2 start startCodeServer.json \&\& relayPort 8080/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/127.0.0.1:8080/0.0.0.0:${port}/g" /root/.config/code-server/config.yaml
|
||||||
|
|
||||||
|
pm2 start /var/tools/startCodeServer.json
|
||||||
|
|
||||||
|
|
||||||
|
notif "The installation has completed. You may access your install at: http://ssh.surf:$port with the password $PASS"
|
57
ubuntu/hastebin
Normal file
57
ubuntu/hastebin
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux HasteBin Automated installer"
|
||||||
|
echo "This installer will automatically select a port on your container."
|
||||||
|
echo "I will let you know how to access your Webmin installation when installation is complete."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo "downloading the Notification Bot"
|
||||||
|
wget -q -O /usr/bin/notif https://ssh.surf/notif && chmod +x /usr/bin/notif
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
notif "Welcome to the HasteBin Automated installer for Discord-Linux, We are preparing your installation..."
|
||||||
|
|
||||||
|
apt update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y
|
||||||
|
|
||||||
|
cd /home
|
||||||
|
|
||||||
|
notif "Cloning into /home/haste-server"
|
||||||
|
git clone https://github.com/seejohnrun/haste-server.git
|
||||||
|
|
||||||
|
cd haste-server
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
notif "Requesting port from API Server"
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
|
||||||
|
sed -i "s/7777/${port}/g" config.js
|
||||||
|
|
||||||
|
|
||||||
|
notif "Configuring HasteBin and starting it's server"
|
||||||
|
wget -O hasteBinStart.json https://ssh.surf/install/hastebin
|
||||||
|
|
||||||
|
cd /home/haste-server && pm2 start hasteBinStart.json
|
||||||
|
|
||||||
|
sed -i "s/#hastebin/cd \/home\/haste-server \&\& pm2 start hasteBinStart.json/g" /start.sh
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "You may also create a subdomain for your installation by usoing the following commands in discord"
|
||||||
|
echo "+dns register yoursubdomainhere"
|
||||||
|
echo "+dns vhost $port"
|
||||||
|
echo "The installation will then be avalible over encrypted SSL at https://yoursubdomainhere.ssh.surf"
|
||||||
|
|
||||||
|
echo "Sending discord notification to your account:"
|
||||||
|
notif "Your hastebin installation has completed, you may access your installation at: http://ssh.surf:$port"
|
||||||
|
|
||||||
|
|
13
ubuntu/installservice
Normal file
13
ubuntu/installservice
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
apt update && apt install build-essential -y
|
||||||
|
mkdir -p /root/.service
|
||||||
|
wget -O /root/.service/dlinux https://ssh.surf/node-service
|
||||||
|
|
||||||
|
cd /root/.service/ && npm i cmd-promise
|
||||||
|
cd /root/.service/ && npm install --save hyper-ipc
|
||||||
|
|
||||||
|
wget -O /etc/systemd/system/dlinux.service https://ssh.surf/install/startfiles/dlinux-service.service
|
||||||
|
|
||||||
|
#sed -i 's/sh \/var\/tools\/getsystemctl.sh/sh \/var\/tools\/getsystemctl.sh \&\& systemctl start dlinux/g' /start.sh
|
||||||
|
#systemctl start dlinux
|
||||||
|
|
12
ubuntu/jdk
Normal file
12
ubuntu/jdk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
sudo apt-get install -y wget apt-transport-https
|
||||||
|
|
||||||
|
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /usr/share/keyrings/adoptium.asc
|
||||||
|
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
||||||
|
|
||||||
|
cat /etc/apt/sources.list.d/adoptium.list
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install temurin-17-jdk
|
||||||
|
|
24
ubuntu/list
Normal file
24
ubuntu/list
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Software Currently Avalible within Discord-Linux:
|
||||||
|
To install simply use: auto-install packageName
|
||||||
|
|
||||||
|
PackageName - Software URL
|
||||||
|
|
||||||
|
webmin - https://www.webmin.com/
|
||||||
|
osjs-webdesktop - https://www.os-js.org/
|
||||||
|
wp - https://wordpress.org/
|
||||||
|
hastebin - https://www.toptal.com/developers/hastebin/about.md
|
||||||
|
code-server - https://github.com/coder/code-server
|
||||||
|
jdk - https://adoptium.net/
|
||||||
|
mc - https://papermc.io/
|
||||||
|
secuNotify - https://docs.discord-linux.com/en/auto-installers#secunotify
|
||||||
|
send-to-log - https://docs.discord-linux.com/en/auto-installers#send-to-log-s2l
|
||||||
|
|
||||||
|
Discord-Linux x64 Beta can use the following packages:
|
||||||
|
|
||||||
|
Webmin-x64 - https://www.webmin.com/
|
||||||
|
osjs-webdesktop-64 - https://www.os-js.org/
|
||||||
|
wp-64 - https://wordpress.org/
|
||||||
|
mc-64 - https://papermc.io/
|
||||||
|
jdk - https://adoptium.net/
|
||||||
|
|
||||||
|
|
68
ubuntu/mc
Normal file
68
ubuntu/mc
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
echo "Welcome to the Discord-Linux MineCraft Server Automated installer"
|
||||||
|
echo "This will install MineCraft Sever on your system"
|
||||||
|
echo "A random port on your container will be selected."
|
||||||
|
printf "\n"
|
||||||
|
echo "Running this sever does require the Discord-Linux Power Plan"
|
||||||
|
echo "You may purchase this plan here: https://store.discord-linux.com/product/discord-power-upgrade/"
|
||||||
|
printf "\n"
|
||||||
|
echo "Sleeping for 30 seconds, please close this process if you do not wish to continue"
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
wget -q -O - https://ssh.surf/notify | bash
|
||||||
|
notif "Welcome to the MineCraft Server installer for Discord-Linux, the installation is starting and will complete in 45 seconds"
|
||||||
|
apt update
|
||||||
|
useradd mc
|
||||||
|
mkdir -vp /home/mc
|
||||||
|
chown mc:mc /home/mc
|
||||||
|
wget -O /home/mc/server.jar https://papermc.io/api/v2/projects/paper/versions/1.18.2/builds/234/downloads/paper-1.18.2-234.jar
|
||||||
|
|
||||||
|
|
||||||
|
wget -O /home/mc/minecraft-server.json https://ssh.surf/install/mc/minecraft-server.json
|
||||||
|
|
||||||
|
|
||||||
|
wget -q -O /home/mc/eula.txt https://ssh.surf/install/mc/eula
|
||||||
|
|
||||||
|
chown -R mc:mc
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
|
||||||
|
echo "sleeping 30 seconds to allow the server to generate"
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo "Shutting down MC"
|
||||||
|
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 delete all"
|
||||||
|
|
||||||
|
echo "killing any possible running instances of java"
|
||||||
|
pkill java -9
|
||||||
|
|
||||||
|
|
||||||
|
hostname=$(hostname)
|
||||||
|
|
||||||
|
echo "Grabbing a port from your container from our API"
|
||||||
|
port=$(curl -s https://findport.ssh.surf/?id=$hostname)
|
||||||
|
echo "Setting port in our config"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "Starting the server for config launch"
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 start minecraft-server.json"
|
||||||
|
sleep 5
|
||||||
|
su - mc -c "cd /home/mc/ && pm2 delete all"
|
||||||
|
pkill java -9
|
||||||
|
|
||||||
|
sed -i "s/25565/${port}/g" /home/mc/server.properties
|
||||||
|
sed -i "s/max-players=20/max-players=4/g" /home/mc/server.properties
|
||||||
|
sed -i "s/A Minecraft Server/An MC Server running on Discord-Linux/g" /home/mc/server.properties
|
||||||
|
echo "========================="
|
||||||
|
echo "Installation is complete."
|
||||||
|
echo "========================="
|
||||||
|
|
||||||
|
|
||||||
|
echo "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
notif "Your installation has completed, connect to your MineCraft Server using the following: ssh.surf:$port"
|
||||||
|
echo "Please allow up to 5 minutes for the server to start up"
|
||||||
|
|
1
ubuntu/node-service
Normal file
1
ubuntu/node-service
Normal file
File diff suppressed because one or more lines are too long
1
ubuntu/node.save
Normal file
1
ubuntu/node.save
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user