1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh.git synced 2024-09-03 20:26:26 +02:00
This commit is contained in:
YunoHost Bot 2024-08-31 13:31:03 +02:00 committed by GitHub
commit 8b26051fdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 112 additions and 100 deletions

View file

@ -1,6 +1,7 @@
# All available README files by language # All available README files by language
- [Read the README in English](README.md) - [Read the README in English](README.md)
- [Lea el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md) - [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md) - [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md) - [Le o README en galego](README_gl.md)

View file

@ -25,6 +25,10 @@ A data size quota is also set on the directory.
**Shipped version:** 1.3~ynh3 **Shipped version:** 1.3~ynh3
## :red_circle: Antifeatures
- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc.
## Documentation and resources ## Documentation and resources
- Upstream app code repository: <https://github.com/maniackcrudelis/ssh_chroot> - Upstream app code repository: <https://github.com/maniackcrudelis/ssh_chroot>

50
README_es.md Normal file
View file

@ -0,0 +1,50 @@
<!--
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
No se debe editar a mano.
-->
# ssh chroot directory para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/ssh_chroot_dir.svg)](https://dash.yunohost.org/appci/app/ssh_chroot_dir) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.maintain.svg)
[![Instalar ssh chroot directory con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ssh_chroot_dir)
*[Leer este README en otros idiomas.](./ALL_README.md)*
> *Este paquete le permite instalarssh chroot directory rapidamente y simplement en un servidor YunoHost.*
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
## Descripción general
This app provides a directory, accessible via ssh of sftp, to a new user.
A "chroot jail" limits the commands the user can use, so you can rest assured that
they can't access your server's contents outside of the provided directory.
A data size quota is also set on the directory.
**Versión actual:** 1.3~ynh3
## :red_circle: Características no deseables
- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc.
## Documentaciones y recursos
- Repositorio del código fuente oficial de la aplicación : <https://github.com/maniackcrudelis/ssh_chroot>
- Catálogo YunoHost: <https://apps.yunohost.org/app/ssh_chroot_dir>
- Reportar un error: <https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh/issues>
## Información para desarrolladores
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh/tree/testing
Para probar la rama `testing`, sigue asÍ:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh/tree/testing --debug
o
sudo yunohost app upgrade ssh_chroot_dir -u https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh/tree/testing --debug
```
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>

View file

@ -25,6 +25,10 @@ A data size quota is also set on the directory.
**Paketatutako bertsioa:** 1.3~ynh3 **Paketatutako bertsioa:** 1.3~ynh3
## :red_circle: Ezaugarri zalantzagarriak
- **Jatorrizko garapena utzita**: Software honek ez du arduradunik. Denborak aurrera egin ahala funtzionatzeari utziko dio, konpondu gabeko segurtasun arazoak izango ditu, etab.
## Dokumentazioa eta baliabideak ## Dokumentazioa eta baliabideak
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/maniackcrudelis/ssh_chroot> - Jatorrizko aplikazioaren kode-gordailua: <https://github.com/maniackcrudelis/ssh_chroot>

View file

@ -25,6 +25,10 @@ A data size quota is also set on the directory.
**Version incluse:** 1.3~ynh3 **Version incluse:** 1.3~ynh3
## :red_circle: Anti-fonctionnalités
- **Application non maintenue **: Ce logiciel n'est plus maintenu. Attendez-vous à ce qu'il ne fonctionne plus avec le temps, et que l'on découvre des failles de sécurité qui ne seront pas corrigées, etc.
## Documentations et ressources ## Documentations et ressources
- Dépôt de code officiel de lapp: <https://github.com/maniackcrudelis/ssh_chroot> - Dépôt de code officiel de lapp: <https://github.com/maniackcrudelis/ssh_chroot>

View file

@ -25,6 +25,10 @@ A data size quota is also set on the directory.
**Versión proporcionada:** 1.3~ynh3 **Versión proporcionada:** 1.3~ynh3
## :red_circle: Debes considerar
- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc.
## Documentación e recursos ## Documentación e recursos
- Repositorio de orixe do código: <https://github.com/maniackcrudelis/ssh_chroot> - Repositorio de orixe do código: <https://github.com/maniackcrudelis/ssh_chroot>

View file

@ -3,7 +3,7 @@
请勿手动编辑。 请勿手动编辑。
--> -->
# YunoHost 的 ssh chroot directory # YunoHost 的 ssh chroot directory
[![集成程度](https://dash.yunohost.org/integration/ssh_chroot_dir.svg)](https://dash.yunohost.org/appci/app/ssh_chroot_dir) ![工作状态](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.maintain.svg) [![集成程度](https://dash.yunohost.org/integration/ssh_chroot_dir.svg)](https://dash.yunohost.org/appci/app/ssh_chroot_dir) ![工作状态](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/ssh_chroot_dir.maintain.svg)
@ -25,6 +25,10 @@ A data size quota is also set on the directory.
**分发版本:** 1.3~ynh3 **分发版本:** 1.3~ynh3
## :red_circle: 负面特征
- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc.
## 文档与资源 ## 文档与资源
- 上游应用代码库: <https://github.com/maniackcrudelis/ssh_chroot> - 上游应用代码库: <https://github.com/maniackcrudelis/ssh_chroot>

View file

@ -16,7 +16,8 @@ license = "GPL-3.0"
code = "https://github.com/maniackcrudelis/ssh_chroot" code = "https://github.com/maniackcrudelis/ssh_chroot"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = "not_relevant" ldap = "not_relevant"

View file

@ -7,7 +7,7 @@ user_dir="$data_dir/$ssh_user"
#================================================= #=================================================
IS_PACKAGE_CHECK () { IS_PACKAGE_CHECK () {
if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then if ynh_in_ci_tests; then
return 0 return 0
else else
return 1 return 1
@ -17,7 +17,3 @@ IS_PACKAGE_CHECK () {
#================================================= #=================================================
# FUTUR OFFICIAL HELPERS # FUTUR OFFICIAL HELPERS
#================================================= #=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -1,34 +1,25 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$data_dir/$ssh_user" --is_big ynh_backup "$data_dir/$ssh_user"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,24 +1,18 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=2 ynh_script_progression "Validating installation parameters..."
# Correct user name # Correct user name
# An unix user name can contains only :alnum: and . - _ # An unix user name can contains only :alnum: and . - _
# Replace all other characters by _ # Replace all other characters by _
ssh_user=${ssh_user//[^[:alnum:].\-_]/_} ssh_user=${ssh_user//[^[:alnum:].\-_]/_}
ynh_app_setting_set --app="$app" --key=ssh_user --value="$ssh_user" ynh_app_setting_set --key=ssh_user --value="$ssh_user"
if ynh_system_user_exists "$ssh_user"; then if ynh_system_user_exists "$ssh_user"; then
ynh_die "This user already exist!" ynh_die "This user already exist!"
@ -28,12 +22,10 @@ if test -z "$password" && test -z "$pub_key"; then
ynh_die "You can't left empty both password and public key. Please fill at least one of them." ynh_die "You can't left empty both password and public key. Please fill at least one of them."
fi fi
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
@ -44,7 +36,7 @@ mkdir -p "$data_dir/$ssh_user"
#================================================= #=================================================
# INSTALL QUOTAS SYSTEM # INSTALL QUOTAS SYSTEM
#================================================= #=================================================
ynh_script_progression --message="Install quotas system" --weight=3 ynh_script_progression "Install quotas system"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK; then
@ -57,7 +49,7 @@ fi
#================================================= #=================================================
# CONFIGURE FSTAB TO SUPPORT QUOTAS # CONFIGURE FSTAB TO SUPPORT QUOTAS
#================================================= #=================================================
ynh_script_progression --message="Configure fstab to support quotas" --weight=3 ynh_script_progression "Configure fstab to support quotas"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
# Set fstab # Set fstab
@ -76,7 +68,7 @@ fi
#================================================= #=================================================
# CREATE THE USER WITH CHROOT_MANAGER # CREATE THE USER WITH CHROOT_MANAGER
#================================================= #=================================================
ynh_script_progression --message="Create the user with Chroot_manager" --weight=5 ynh_script_progression "Create the user with Chroot_manager"
chroot_manager_args=() chroot_manager_args=()
@ -99,15 +91,12 @@ fi
ln -sf "$install_dir/chroot_manager.sh" "$data_dir/chroot_manager" ln -sf "$install_dir/chroot_manager.sh" "$data_dir/chroot_manager"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R root: "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R root: "$install_dir"
#================================================= #=================================================
# DISCLAIMER # DISCLAIMER
#================================================= #=================================================
@ -122,7 +111,7 @@ fi
#================================================= #=================================================
# Not really settings, but required for POST_INSTALL.md # Not really settings, but required for POST_INSTALL.md
ynh_app_setting_set --app="$app" --key="domain" --value="$(yunohost domain list --json | jq -r '.["main"]')" ynh_app_setting_set --key="domain" --value="$(yunohost domain list --json | jq -r '.["main"]')"
ynh_app_setting_set --app="$app" --key="ssh_port" --value="$(grep "^Port " /etc/ssh/sshd_config | awk '{print $2}')" ynh_app_setting_set --key="ssh_port" --value="$(grep "^Port " /etc/ssh/sshd_config | awk '{print $2}')"
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,7 +8,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE QUOTAS OPTIONS IN FSTAB # REMOVE QUOTAS OPTIONS IN FSTAB
#================================================= #=================================================
ynh_script_progression --message="Remove quotas options in fstab" --weight=3 ynh_script_progression "Remove quotas options in fstab"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK; then
@ -32,22 +26,20 @@ fi
#================================================= #=================================================
# REMOVE THE USER WITH CHROOT_MANAGER # REMOVE THE USER WITH CHROOT_MANAGER
#================================================= #=================================================
ynh_script_progression --message="Remove the user with Chroot_manager" --weight=3 ynh_script_progression "Remove the user with Chroot_manager"
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK; then
"$install_dir/chroot_manager.sh" deluser --name "$ssh_user" "$install_dir/chroot_manager.sh" deluser --name "$ssh_user"
fi fi
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# DISCLAIMER # DISCLAIMER
#================================================= #=================================================
ynh_print_info --message="The directory $data_dir hasn't been removed." ynh_print_info "The directory $data_dir hasn't been removed."
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -15,23 +9,23 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_script_progression "Restoring the data directory..."
ynh_restore_file --origin_path="$data_dir/$ssh_user" --not_mandatory ynh_restore "$data_dir/$ssh_user" || true
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# INSTALL QUOTAS SYSTEM # INSTALL QUOTAS SYSTEM
#================================================= #=================================================
ynh_script_progression --message="Install quotas system" --weight=3 ynh_script_progression "Install quotas system"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK; then
@ -45,7 +39,7 @@ fi
#================================================= #=================================================
# CONFIGURE FSTAB TO SUPPORT QUOTAS # CONFIGURE FSTAB TO SUPPORT QUOTAS
#================================================= #=================================================
ynh_script_progression --message="Configure fstab to support quotas" --weight=3 ynh_script_progression "Configure fstab to support quotas"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
# Set fstab # Set fstab
@ -64,7 +58,7 @@ fi
#================================================= #=================================================
# UPDATE THE CHROOT DIRECTORY # UPDATE THE CHROOT DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Update the chroot directory" --weight=3 ynh_script_progression "Update the chroot directory"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/ssh_chroot/ssh_chroot.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/ssh_chroot/ssh_chroot.sh
# Build the chroot # Build the chroot
@ -97,17 +91,13 @@ ln -sf "$install_dir/chroot_manager.sh" "$data_dir/chroot_manager"
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R root: $install_dir #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R root: $install_dir
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
# Not really settings, but required for POST_INSTALL.md # Not really settings, but required for POST_INSTALL.md
ynh_app_setting_set --app="$app" --key="domain" --value="$(yunohost domain list --json | jq -r '.["main"]')" ynh_app_setting_set --key="domain" --value="$(yunohost domain list --json | jq -r '.["main"]')"
ynh_app_setting_set --app="$app" --key="ssh_port" --value="$(grep "^Port " /etc/ssh/sshd_config | awk '{print $2}')" ynh_app_setting_set --key="ssh_port" --value="$(grep "^Port " /etc/ssh/sshd_config | awk '{print $2}')"
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,37 +1,23 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_script_progression "Checking version..."
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] # FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi fi
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# SOURCE LIBRARIES # SOURCE LIBRARIES
#================================================= #=================================================
@ -42,7 +28,7 @@ source "$install_dir/ssh_chroot/ssh_chroot.sh"
#================================================= #=================================================
# UPDATE THE CHROOT DIRECTORY # UPDATE THE CHROOT DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Update the chroot directory" --weight=3 ynh_script_progression "Update the chroot directory"
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/ssh_chroot/ssh_chroot.sh # https://github.com/maniackcrudelis/ssh_chroot/blob/master/ssh_chroot/ssh_chroot.sh
# Build the chroot # Build the chroot
@ -68,19 +54,15 @@ fi
ln -sf $install_dir/chroot_manager.sh "$data_dir/chroot_manager" ln -sf $install_dir/chroot_manager.sh "$data_dir/chroot_manager"
# Set permissions to app files # Set permissions to app files
chown -R root: $install_dir #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R root: $install_dir
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R root: $install_dir #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R root: $install_dir
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"