Fix bad substitution error
parent
03df2ba576
commit
cda9073a77
18
manifest.jps
18
manifest.jps
|
@ -18,12 +18,16 @@ settings:
|
|||
description: "A user-specific directory will be created under /home/username"
|
||||
required: false
|
||||
- type: string
|
||||
inputType: text
|
||||
name: username
|
||||
caption: SFTP Username
|
||||
placeholder: "Enter username"
|
||||
description: "Enter the desired username (3-32 characters, letters, numbers, and underscores only)"
|
||||
required: true
|
||||
regex: ^[a-zA-Z0-9_]{3,32}$
|
||||
regexText: "Username must be 3-32 characters long and contain only letters, numbers, and underscores"
|
||||
hideLabel: false
|
||||
hidden: false
|
||||
- type: checkbox
|
||||
name: allow
|
||||
caption: Accept User Creation
|
||||
|
@ -68,10 +72,11 @@ settings:
|
|||
|
||||
|
||||
globals:
|
||||
username: "${settings.username}"
|
||||
username: "${settings.sfpform.username}"
|
||||
password: ${fn.password(min)}
|
||||
sftpHost: ${env.domain}
|
||||
sftpPort: 22
|
||||
enable_ssh: ${settings.sfpform.enable_ssh:false}
|
||||
|
||||
onInstall:
|
||||
- cmd [cp]:
|
||||
|
@ -85,10 +90,10 @@ onInstall:
|
|||
- cmd[cp]:
|
||||
user: root
|
||||
commands: |-
|
||||
if grep -qE "^Match User user[0-9]*$" /etc/ssh/sshd_config; then
|
||||
sed -i '/^Match User user[0-9]*/!b;n;c\ PasswordAuthentication yes' /etc/ssh/sshd_config
|
||||
if grep -qE "^Match User [a-zA-Z0-9_]*$" /etc/ssh/sshd_config; then
|
||||
sed -i '/^Match User [a-zA-Z0-9_]*/!b;n;c\ PasswordAuthentication yes' /etc/ssh/sshd_config
|
||||
else
|
||||
echo -e "\n# Added by SFTP addon\nMatch User user*\n\tPasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
echo -e "\n# Added by SFTP addon\nMatch User *\n\tPasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
fi
|
||||
awk '!seen[$0]++' /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp && mv /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config
|
||||
systemctl restart sshd
|
||||
|
@ -111,9 +116,12 @@ menu:
|
|||
|
||||
actions:
|
||||
add_sftp_user:
|
||||
- setGlobals:
|
||||
enable_ssh: ${settings.sfpform.enable_ssh:false}
|
||||
- cmd[cp]:
|
||||
user: root
|
||||
commands: bash /home/jelastic/add-sftp-user-addon/add-sftp.sh "${globals.username}" "${globals.password}" "${settings.sfpform.enable_ssh}"
|
||||
commands: |-
|
||||
bash /home/jelastic/add-sftp-user-addon/add-sftp.sh "${globals.username}" "${globals.password}" "${globals.enable_ssh}"
|
||||
- cmd[cp]:
|
||||
user: root
|
||||
commands: echo $CREATED_USERNAME
|
||||
|
|
Loading…
Reference in New Issue