Added Uninstall
parent
f38ef098fa
commit
5bb722a83d
|
@ -1,8 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
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)"
|
||||
PASSWORD=$(openssl rand -base64 12)
|
||||
|
||||
|
@ -28,6 +26,5 @@ usermod -aG litespeed,root $USERNAME
|
|||
chown $USERNAME:root $ROOT_DIRECTORY
|
||||
chmod 775 $ROOT_DIRECTORY
|
||||
|
||||
# Get the hostname
|
||||
HOSTNAME=$(hostname -f)
|
||||
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:
|
||||
- systemctl restart sshd
|
||||
user: root
|
||||
- api: environment.control.RestartContainer
|
||||
nodeGroup: cp
|
||||
- return: installSuccess
|
||||
|
||||
actions:
|
||||
|
@ -56,7 +58,17 @@ actions:
|
|||
return: sftpError
|
||||
- return: sftpSuccess
|
||||
|
||||
onUninstall:
|
||||
- cmd[cp]:
|
||||
commands:
|
||||
- rm -rf /home/jelastic/add-sftp-user-addon/
|
||||
user: root
|
||||
- return: uninstallSuccess
|
||||
|
||||
responses:
|
||||
uninstallSuccess:
|
||||
type: success
|
||||
message: "Uninstalled Successfully"
|
||||
installSuccess:
|
||||
type: success
|
||||
message: "Installed Successfully"
|
||||
|
|
Loading…
Reference in New Issue