Added Uninstall
parent
f38ef098fa
commit
5bb722a83d
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Script started" >> /home/jelastic/add-sftp-user-addon/script_output.log
|
echo "Script started" >> /home/jelastic/add-sftp-user-addon/script_output.log
|
||||||
|
|
||||||
# Generate random username and password
|
|
||||||
USERNAME="user$(shuf -i 10000-99999 -n 1)"
|
USERNAME="user$(shuf -i 10000-99999 -n 1)"
|
||||||
PASSWORD=$(openssl rand -base64 12)
|
PASSWORD=$(openssl rand -base64 12)
|
||||||
|
|
||||||
|
@ -28,6 +26,5 @@ usermod -aG litespeed,root $USERNAME
|
||||||
chown $USERNAME:root $ROOT_DIRECTORY
|
chown $USERNAME:root $ROOT_DIRECTORY
|
||||||
chmod 775 $ROOT_DIRECTORY
|
chmod 775 $ROOT_DIRECTORY
|
||||||
|
|
||||||
# Get the hostname
|
|
||||||
HOSTNAME=$(hostname -f)
|
HOSTNAME=$(hostname -f)
|
||||||
echo "Script completed for user $USERNAME with hostname $HOSTNAME" >> /home/jelastic/add-sftp-user-addon/script_output.log
|
echo "Script completed for user $USERNAME with hostname $HOSTNAME" >> /home/jelastic/add-sftp-user-addon/script_output.log
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Root User
|
|
||||||
sudo su
|
|
||||||
# Update sshd_config
|
|
||||||
echo -e "\nMatch User user*\nPasswordAuthentication yes" >> /etc/ssh/sshd_config
|
|
||||||
# Adjust permissions
|
|
||||||
chown root:root /var/www/webroot/ROOT
|
|
||||||
chmod 755 /var/www/webroot/ROOT
|
|
||||||
|
|
||||||
#Restart SSH daemon
|
|
||||||
sudo systemctl restart sshd
|
|
12
manifest.jps
12
manifest.jps
|
@ -45,6 +45,8 @@ onInstall:
|
||||||
commands:
|
commands:
|
||||||
- systemctl restart sshd
|
- systemctl restart sshd
|
||||||
user: root
|
user: root
|
||||||
|
- api: environment.control.RestartContainer
|
||||||
|
nodeGroup: cp
|
||||||
- return: installSuccess
|
- return: installSuccess
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
|
@ -56,7 +58,17 @@ actions:
|
||||||
return: sftpError
|
return: sftpError
|
||||||
- return: sftpSuccess
|
- return: sftpSuccess
|
||||||
|
|
||||||
|
onUninstall:
|
||||||
|
- cmd[cp]:
|
||||||
|
commands:
|
||||||
|
- rm -rf /home/jelastic/add-sftp-user-addon/
|
||||||
|
user: root
|
||||||
|
- return: uninstallSuccess
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
|
uninstallSuccess:
|
||||||
|
type: success
|
||||||
|
message: "Uninstalled Successfully"
|
||||||
installSuccess:
|
installSuccess:
|
||||||
type: success
|
type: success
|
||||||
message: "Installed Successfully"
|
message: "Installed Successfully"
|
||||||
|
|
Loading…
Reference in New Issue