From a6b4eb633971e4725f941995990c4d4597a7b0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 23 May 2023 18:18:23 +0200 Subject: [PATCH] fix --- conf/file-server.ini | 32 ++++++++++++++++++++++++++++++++ scripts/install | 12 ++++++++++++ scripts/upgrade | 13 +++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 conf/file-server.ini diff --git a/conf/file-server.ini b/conf/file-server.ini new file mode 100644 index 0000000..dca8dc4 --- /dev/null +++ b/conf/file-server.ini @@ -0,0 +1,32 @@ + 1,1 All +[STORE_LOG] +# The server uses STM memory for persistence, +# that will be lost on restart (e.g., as with redis). +# This option enables saving memory to append only log, +# and restoring it when the server is started. +# Log is compacted on start (deleted objects are removed). +enable: on + +log_stats: off + +[AUTH] +# Set new_files option to off to completely prohibit uploading new files. +# This can be useful when you want to decommission the server, but still allow downloading the existing files. +new_files: on + +# Use create_password option to enable basic auth to upload new files. +# The password should be used as part of server address in client configuration: +# xftp://fingerprint:password@host1,host2 +# The password will not be shared with file recipients, you must share it only +# with the users who you want to allow uploading files to your server. +# create_password: password to upload files (any printable ASCII characters without whitespace, '@', ':' and '/') + +[TRANSPORT] +# host is only used to print server address on start +host: __PUBLIC_IP4__ +port: __PORT__ +log_tls_errors: off + +[FILES] +path: __DATA_DIR__ +storage_quota: 20gb diff --git a/scripts/install b/scripts/install index 130d325..51650e4 100755 --- a/scripts/install +++ b/scripts/install @@ -43,9 +43,21 @@ ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint xftp_fingerprint=$(cat /etc/opt/simplex-xftp/fingerprint) ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint +ynh_replace_string --match_string="port: 443" --replace_string="port:$port_xftp" --target_file=target_file + chown -R $app:$app "/etc/opt/simplex" chown -R $app:$app "/etc/opt/simplex-xftp" +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini" + +chmod 400 "/etc/opt/simplex-xftp/file-server.ini" +chown $app:$app "/etc/opt/simplex-xftp/file-server.ini" + #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9f9f698..dc29735 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,11 +47,24 @@ then ynh_setup_source --dest_dir="$install_dir" --source_id="xftp" fi +mkdir -p /var/opt/simplex-xftp /etc/opt/simplex-xftp +chown -R $app:$app /var/opt/simplex-xftp /etc/opt/simplex-xftp + chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x $install_dir/smp-server chmod +x $install_dir/xftp-server +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini" + +chmod 400 "/etc/opt/simplex-xftp/file-server.ini" +chown $app:$app "/etc/opt/simplex-xftp/file-server.ini" + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #=================================================