Added sym link to /usr/local/bin/Neato

main
Robert 2 years ago
parent 912fdfa49c
commit 4c47312e5e
  1. 29
      README.md
  2. 3
      app/neato.php
  3. 31
      build/install_neato.sh
  4. 6
      build/make-sums.sh
  5. 2
      build/neato_deploy.sh

@ -3,14 +3,19 @@
``` ```
$ git clone https://git.mysnippetsofcode.com/tts/neatoDeploy.git $ git clone https://git.mysnippetsofcode.com/tts/neatoDeploy.git
$ cd neatoDeploy $ cd neatoDeploy
$ nano app/neato.php $ sudo ./make-installer.sh
# Change the line that reads $pk = "Passphase"; // XOR for sha256sum, CHANGE ME!!
# Save it, then run:
$ ./make-installer.sh
``` ```
## Copy to Server
Then scp over the neato_deploy.tar.gz.self to your sever. Then scp over the neato_deploy.tar.gz.self to your sever.
```
on the server: $ sudo ./neato_deploy.tar.gz.self $ scp neato_deploy.tar.gz.self myservernameHERE:/home/MyUSERNAME_HERE/
```
## Run Installer on Server
on the server:
```
$ cd /home/MyUSERNAME_HERE
$ sudo ./neato_deploy.tar.gz.self
```
## Clean up ## Clean up
``` ```
$ rm neato_deploy.tar.gz.self $ rm neato_deploy.tar.gz.self
@ -18,21 +23,15 @@ $ rm install_neato.sh
``` ```
## Make sha256sum (& xor static pwd) on TRUSTED scripts ## Make sha256sum (& xor static pwd) on TRUSTED scripts
``` ```
$ sudo -i $ sudo /opt/neatoDeployments/make-sums.sh
$ cd /opt/neatoDemployments
$ ./make-sums.sh
# if done as ROOT type $ exit
# to exit!
``` ```
## Do Deployments... ## Do Deployments...
``` ```
$ cd /opt/neatoDemployments
# Pull and RUN deployment script from your web site # Pull and RUN deployment script from your web site
$ ./neato_deploy.sh http://EXAMPLE_Site.com/MY_Deployment.txt $ Neato http://EXAMPLE_Site.com/MY_Deployment.txt
# OR Run a local file deployment # OR Run a local file deployment
$ sudo ./neato_deploy.sh security_audit $ sudo Neato security_audit
``` ```
Note that deployment files are named with the prefix of deploy_ Note that deployment files are named with the prefix of deploy_

@ -5,6 +5,9 @@ ini_set('display_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
$cwd = getcwd(); $cwd = getcwd();
if (! str_contains($cwd, "neato")) {
$cwd = "/opt/neatoDeployments";
}
$pk = file_get_contents($cwd . "/sumfiles.sig"); $pk = file_get_contents($cwd . "/sumfiles.sig");
if ($pk === false) { if ($pk === false) {

@ -1,6 +1,13 @@
#!/bin/bash #!/bin/bash
MY_GROUP=www-data MY_GROUP=www-data
PHPCLI='php8.3-cli'
PHPMBString='php8.3-mbstring'
if [ "$EUID" -ne 0 ]; then
/usr/bin/echo "Please run as root!"
exit
fi
# Function to check if a group exists # Function to check if a group exists
group_exists() { group_exists() {
if getent group "$1" >/dev/null 2>&1; then if getent group "$1" >/dev/null 2>&1; then
@ -14,19 +21,11 @@ if ! group_exists "$MY_GROUP"; then
groupadd "$MY_GROUP" groupadd "$MY_GROUP"
fi fi
PHPCLI='php8.3-cli'
PHPMBString='php8.3-mbstring'
if [ "$EUID" -ne 0 ]; then
/usr/bin/echo "Please run as root!"
exit
fi
current_directory=$(pwd) current_directory=$(pwd)
target_directory="/opt/neatoDeploy" avoid_target_directory="neatoDeploy"
if [ "$current_directory" == "$target_directory" ] || [ "$current_directory" == "$target_directory/build" ]; then if [[ $current_directory == *$avoid_target_directory ]] || [[ $current_directory == *$avoid_target_directory/build ]]; then
/usr/bin/echo "Do not run this script inside of source folder /opt/neatoDeploy/build!" /usr/bin/echo "Do not run this script inside of source folder ... neatoDeploy* !"
exit 1 exit 1
fi fi
@ -41,7 +40,7 @@ fi
/usr/bin/mv deploy_files/deploy_*.php /opt/neatoDeployments/deploy_files/ /usr/bin/mv deploy_files/deploy_*.php /opt/neatoDeployments/deploy_files/
/usr/bin/rmdir deploy_files /usr/bin/rmdir deploy_files
pushd /opt/neatoDeployments pushd /opt/neatoDeployments || exit 1
/usr/bin/dpkg -s software-properties-common 2>/dev/null >/dev/null || /usr/bin/apt-get install -y software-properties-common /usr/bin/dpkg -s software-properties-common 2>/dev/null >/dev/null || /usr/bin/apt-get install -y software-properties-common
/usr/bin/dpkg -s $PHPCLI 2>/dev/null >/dev/null || /usr/bin/add-apt-repository ppa:ondrej/php -y /usr/bin/dpkg -s $PHPCLI 2>/dev/null >/dev/null || /usr/bin/add-apt-repository ppa:ondrej/php -y
@ -60,7 +59,11 @@ pushd /opt/neatoDeployments
/usr/bin/chmod 664 neato_deploy_php_cli.ini /usr/bin/chmod 664 neato_deploy_php_cli.ini
/usr/bin/chmod 664 deploy_files/deploy_*.php /usr/bin/chmod 664 deploy_files/deploy_*.php
popd popd || exit 1
if [ ! -L /usr/local/bin/Neato ]; then
ln -s /opt/neatoDeployments/neato_deploy.sh /usr/local/bin/Neato
fi
/usr/bin/echo -e "\nRemove the install_neato.sh file!" /usr/bin/echo -e "\nRemove the install_neato.sh file!"
/usr/bin/echo -e "\nRemove the neato_deploy.tar.gz.self file!" /usr/bin/echo -e "\nRemove the neato_deploy.tar.gz.self file!"

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
pushd /opt/neatoDeployments || exit 1
if [ ! -d sums ]; then if [ ! -d sums ]; then
mkdir sums mkdir sums
fi fi
@ -6,7 +7,7 @@ fi
if which "openssl" >/dev/null 2>&1; then if which "openssl" >/dev/null 2>&1; then
file_to_verify="/opt/neatoDeployments/neatoDeploy.phar" file_to_verify="/opt/neatoDeployments/neatoDeploy.phar"
signature_file="/opt/neatoDeployments/neatoDeploy.phar.sig" signature_file="/opt/neatoDeployments/neatoDeploy.phar.sig"
public_key_file="neatoDeploy.phar.pubkey" public_key_file="/opt/neatoDeployments/neatoDeploy.phar.pubkey"
# Verify the signature # Verify the signature
openssl dgst -sha256 -verify "$public_key_file" -signature "$signature_file" "$file_to_verify" openssl dgst -sha256 -verify "$public_key_file" -signature "$signature_file" "$file_to_verify"
@ -22,7 +23,6 @@ else
echo "openssl is not installed!!" echo "openssl is not installed!!"
fi fi
for file in deploy_files/deploy_*.php; do for file in deploy_files/deploy_*.php; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
echo -e "Making sum file for: $file \r\n" echo -e "Making sum file for: $file \r\n"
@ -33,4 +33,4 @@ for file in deploy_files/deploy_*.php; do
php -c /opt/neatoDeployments/neato_deploy_php_cli.ini -f /opt/neatoDeployments/neatoDeploy.phar "$new_file_name" -marksafe -skipdeploy php -c /opt/neatoDeployments/neato_deploy_php_cli.ini -f /opt/neatoDeployments/neatoDeploy.phar "$new_file_name" -marksafe -skipdeploy
fi fi
done done
popd || exit 1

@ -3,7 +3,7 @@
if which "openssl" >/dev/null 2>&1; then if which "openssl" >/dev/null 2>&1; then
file_to_verify="/opt/neatoDeployments/neatoDeploy.phar" file_to_verify="/opt/neatoDeployments/neatoDeploy.phar"
signature_file="/opt/neatoDeployments/neatoDeploy.phar.sig" signature_file="/opt/neatoDeployments/neatoDeploy.phar.sig"
public_key_file="neatoDeploy.phar.pubkey" public_key_file="/opt/neatoDeployments/neatoDeploy.phar.pubkey"
# Verify the signature # Verify the signature
openssl dgst -sha256 -verify "$public_key_file" -signature "$signature_file" "$file_to_verify" openssl dgst -sha256 -verify "$public_key_file" -signature "$signature_file" "$file_to_verify"

Loading…
Cancel
Save