add-sftp-user/manifest.jps

94 lines
2.3 KiB
Plaintext
Raw Normal View History

2023-10-26 15:54:56 +00:00
type: update
name: Add SFTP User
2023-10-27 15:22:09 +00:00
2023-10-26 15:54:56 +00:00
targetNodes:
nodeGroup: cp
settings:
sfpform:
fields:
- type: string
inputType: text
name: root_directory
caption: Root Directory
default: "/var/www/webroot/ROOT"
required: true
2023-10-30 12:52:48 +00:00
- type: checkbox
name: agree_creation
caption: I agree to the creation of a folder and SFTP account.
required: true
2023-10-26 15:54:56 +00:00
- type: checkbox
name: enable_ssh
caption: Also enable SSH access
default: false
globals:
username: "user${fn.random(10000,99999)}"
password: ${fn.password(min)}
sftpHost: ${env.domain}
sftpPort: 22
onInstall:
2023-10-30 12:52:48 +00:00
- cmd[cp]: mkdir -p /home/jelastic/add-sftp-user-addon/
- cmd[cp]: wget https://deploy-proxy.mightybox.io/addons/add-sftp-user/raw/branch/main/add-sftp.sh -O /home/jelastic/add-sftp-user-addon/add-sftp.sh
- cmd[cp]: chmod +x /home/jelastic/add-sftp-user-addon/*.sh
- cmd[cp]:
commands:
- echo -e "\nMatch User user*\nPasswordAuthentication yes" >> /etc/ssh/sshd_config
user: root
- cmd[cp]:
commands:
- chown root:root /var/www/webroot/ROOT
- chmod 755 /var/www/webroot/ROOT
user: root
- cmd[cp]:
commands:
- systemctl restart sshd
user: root
2023-10-27 15:17:35 +00:00
- return: installSuccess
2023-10-26 15:54:56 +00:00
actions:
add_sftp_user:
2023-10-30 12:52:48 +00:00
- cmd[cp]:
commands: bash /home/jelastic/add-sftp-user-addon/add-sftp.sh
user: root
2023-10-30 13:13:03 +00:00
- if ("${response.exitStatus}" != "0"):
return: sftpError
2023-10-27 14:37:19 +00:00
- return: sftpSuccess
responses:
2023-10-27 15:17:35 +00:00
installSuccess:
2023-10-27 16:31:40 +00:00
type: success
2023-10-27 15:17:35 +00:00
message: "Installed Successfully"
2023-10-30 13:13:03 +00:00
sftpError:
type: error
message: "Failed to add SFTP user. Please check the server logs for more details."
2023-10-27 14:37:19 +00:00
sftpSuccess:
type: success
email: |-
Connection Details<br><br>
SFTP Host: ${globals.sftpHost}<br><br>
Port: ${globals.sftpPort}<br>
<br><br>
Login Credentials<br>
Username: ${globals.username}<br><br>
Password: ${globals.password}
message:
en: |-
Connection Details
2023-10-26 15:54:56 +00:00
2023-10-27 14:37:19 +00:00
SFTP Host: ${globals.sftpHost}
2023-10-26 15:54:56 +00:00
2023-10-27 14:37:19 +00:00
Port: ${globals.sftpPort}
2023-10-26 15:54:56 +00:00
2023-10-27 14:37:19 +00:00
Login Credentials
2023-10-26 15:54:56 +00:00
2023-10-27 14:37:19 +00:00
Username: ${globals.username}
2023-10-26 15:54:56 +00:00
2023-10-27 14:37:19 +00:00
Password: ${globals.password}
2023-10-26 15:54:56 +00:00
buttons:
- settings: sfpform
action: add_sftp_user
caption: Add SFTP/SSH User
2023-10-27 16:31:40 +00:00
confirmText: "Are you sure you want to add this SFTP user?"