diff --git a/conf/torrc b/conf/torrc index 16e014d..6938ea9 100644 --- a/conf/torrc +++ b/conf/torrc @@ -3,14 +3,14 @@ BridgeRelay 1 # Replace "TODO1" with a Tor port of your choice. # This port must be externally reachable. # Avoid port 9001 because it's commonly associated with Tor and censors may be scanning the Internet for this port. -ORPort __OR_PORT__ +ORPort __PORT_OR__ ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy # Replace "TODO2" with an obfs4 port of your choice. # This port must be externally reachable and must be different from the one specified for ORPort. # Avoid port 9001 because it's commonly associated with Tor and censors may be scanning the Internet for this port. -ServerTransportListenAddr obfs4 0.0.0.0:__OBFS4_PORT__ +ServerTransportListenAddr obfs4 0.0.0.0:__PORT_OBFS4__ # Local communication port between Tor and obfs4. Always set this to "auto". # "Ext" means "extended", not "external". Don't try to set a specific port number, nor listen on 0.0.0.0. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 55d1a7d..0000000 --- a/manifest.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "Tor relay", - "id": "torrelay", - "packaging_format": 1, - "description": { - "en": "Defend Your Privacy! How To Create Your Own Tor Relay!", - "fr": "Defend Your Privacy! How To Create Your Own Tor Relay!" - }, - "version": "0.4.6.10~ynh2", - "url": "https://www.torproject.org/", - "upstream": { - "license": "BSD-3-Clause", - "website": "https://www.torproject.org/", - "admindoc": "https://community.torproject.org/relay/setup/bridge/debian-ubuntu/", - "code": "https://github.com/torproject/tor" - }, - "license": "BSD-3-Clause", - "maintainer": { - "name": "", - "email": "" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "contact", - "type": "string", - "ask": { - "en": "Choose an email address so we can contact you if there are problems with your bridge. This is optional but encouraged.", - "fr": "" - }, - "default": "address@email.com" - }, - { - "name": "nickname", - "type": "string", - "ask": { - "en": "Pick a nickname that you like for your bridge. This is optional.", - "fr": "" - }, - "default": "PickANickname" - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 977ed5f..ea56628 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,7 +3,7 @@ packaging_format = 2 id = "torrelay" name = "Tor relay" description.en = "Defend Your Privacy! How To Create Your Own Tor Relay!" -description.fr = "Defend Your Privacy! How To Create Your Own Tor Relay!" +description.fr = "Défendez votre vie privée ! Comment créer votre propre relais Tor !" version = "0.4.6.10~ynh2" @@ -14,44 +14,51 @@ license = "BSD-3-Clause" website = "https://www.torproject.org/" admindoc = "https://community.torproject.org/relay/setup/bridge/debian-ubuntu/" code = "https://github.com/torproject/tor" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.3.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.17" +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap ="not_relevant" +sso = "not_relevant" +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true [install.contact] ask.en = "Choose an email address so we can contact you if there are problems with your bridge. This is optional but encouraged." - ask.fr = "" + ask.fr = "Choisissez une adresse e-mail afin que nous puissions vous contacter en cas de problème avec votre pont. Ceci est facultatif mais encouragé." type = "string" default = "address@email.com" [install.nickname] ask.en = "Pick a nickname that you like for your bridge. This is optional." - ask.fr = "" + ask.fr = "Choisissez un surnom que vous aimez pour votre pont. Ceci est facultatif." type = "string" default = "PickANickname" [resources] + + [resources.ports] + or.default = 9002 + or.exposed = "Both" + obfs4.default = 9003 + obfs4.exposed = "Both" + [resources.system_user] [resources.install_dir] [resources.permissions] - [[resources.apt.extras]] - repo = "deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" - key = "https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc" - packages = "#FIXME#$pkg_dependencies_extra" + + [resources.apt] + packages = "apt-transport-https obfs4proxy" + + extras.tor.repo = "deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" + extras.tor.key = "https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc" + extras.tor.packages = "tor tor-geoipdb deb.torproject.org-keyring" diff --git a/scripts/_common.sh b/scripts/_common.sh index fd5c015..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,10 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="apt-transport-https obfs4proxy" -pkg_dependencies_extra="tor tor-geoipdb deb.torproject.org-keyring" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index ebcb35a..72da480 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,23 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index fc2d8a7..ae914ad 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,59 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -78,36 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= @@ -117,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 259efac..1ec57f4 100755 --- a/scripts/install +++ b/scripts/install @@ -9,61 +9,13 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? contact=$YNH_APP_ARG_CONTACT -#REMOVEME? nickname=$YNH_APP_ARG_NICKNAME - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=contact --value=$contact ynh_app_setting_set --app=$app --key=nickname --value=$nickname -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find free ports -#REMOVEME? or_port=$(ynh_find_port --port=9002) -#REMOVEME? obfs4_port=$(ynh_find_port --port=$(($or_port + 1))) - -# Find an available port -#REMOVEME? ynh_app_setting_set --app=$app --key=or_port --value=$or_port -#REMOVEME? ynh_app_setting_set --app=$app --key=obfs4_port --value=$obfs4_port - -# Open the port -ynh_script_progression --message="Configuring firewall..." --weight=1 -ynh_exec_warn_less yunohost firewall allow Both $or_port -ynh_exec_warn_less yunohost firewall allow Both $obfs4_port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 - -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" --package="$pkg_dependencies_extra" --key="https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc" - #================================================= # ADD A CONFIGURATION #================================================= @@ -79,7 +31,7 @@ chown :debian-tor /etc/tor/torrc #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$or_port" --test_status="pgrep tor" +yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_or" --test_status="pgrep tor" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 0129261..cb19bf4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? or_port=$(ynh_app_setting_get --app=$app --key=or_port) -#REMOVEME? obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port) - #================================================= # STANDARD REMOVE #================================================= @@ -41,30 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config --service=tor -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=3 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $or_port$" -then - ynh_script_progression --message="Closing port $or_port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $or_port -fi - -if yunohost firewall list | grep -q "\- $obfs4_port$" -then - ynh_script_progression --message="Closing port $obfs4_port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $obfs4_port -fi - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 51d9270..203d3a2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,36 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? or_port=$(ynh_app_setting_get --app=$app --key=or_port) -#REMOVEME? obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port) - -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=10 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" --package="$pkg_dependencies_extra" --key="https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc" - #================================================= # RESTORE VARIOUS FILES #================================================= @@ -52,7 +22,7 @@ ynh_restore_file --origin_path="/etc/tor/torrc" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$or_port" --test_status="pgrep tor" +yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_or" --test_status="pgrep tor" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 990ba41..286a0d4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,39 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? or_port=$(ynh_app_setting_get --app=$app --key=or_port) -#REMOVEME? obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port) -#REMOVEME? contact=$(ynh_app_setting_get --app=$app --key=contact) -#REMOVEME? nickname=$(ynh_app_setting_get --app=$app --key=nickname) - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -51,15 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=tor --action="stop" --log_path="systemd" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10 - -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" --package="$pkg_dependencies_extra" --key="https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc" - #================================================= # UPDATE A CONFIG FILE #================================================= @@ -75,7 +39,7 @@ chown :debian-tor /etc/tor/torrc #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$or_port" --test_status="pgrep tor" +yunohost service add tor --description="Tor Relay" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_or" --test_status="pgrep tor" #================================================= # START SYSTEMD SERVICE