1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/torrelay_ynh.git synced 2024-09-03 20:26:36 +02:00

Merge pull request #5 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2023-04-29 16:31:53 +02:00 committed by GitHub
commit 5e23c9e879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 79 additions and 319 deletions

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
The Tor network relies on volunteers to donate bandwidth. The more people who run relays, the better the Tor network will be. The current Tor network is quite small compared to the number of people who need to use Tor, which means we need more dedicated volunteers like you to run relays. The Tor network relies on volunteers to donate bandwidth. The more people who run relays, the better the Tor network will be. The current Tor network is quite small compared to the number of people who need to use Tor, which means we need more dedicated volunteers like you to run relays.
**Shipped version:** 0.4.7.13~ynh1 **Shipped version:** 0.4.7.13~ynh3
## Documentation and resources ## Documentation and resources
* Official app website: <https://www.torproject.org/> * Official app website: <https://www.torproject.org/>

View file

@ -18,7 +18,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
The Tor network relies on volunteers to donate bandwidth. The more people who run relays, the better the Tor network will be. The current Tor network is quite small compared to the number of people who need to use Tor, which means we need more dedicated volunteers like you to run relays. The Tor network relies on volunteers to donate bandwidth. The more people who run relays, the better the Tor network will be. The current Tor network is quite small compared to the number of people who need to use Tor, which means we need more dedicated volunteers like you to run relays.
**Version incluse :** 0.4.7.13~ynh1 **Version incluse :** 0.4.7.13~ynh3
## Documentations et ressources ## Documentations et ressources
* Site officiel de lapp : <https://www.torproject.org/> * Site officiel de lapp : <https://www.torproject.org/>

View file

@ -3,14 +3,14 @@ BridgeRelay 1
# Replace "TODO1" with a Tor port of your choice. # Replace "TODO1" with a Tor port of your choice.
# This port must be externally reachable. # 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. # 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 ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy
# Replace "TODO2" with an obfs4 port of your choice. # 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. # 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. # 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". # 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. # "Ext" means "extended", not "external". Don't try to set a specific port number, nor listen on 0.0.0.0.

View file

View file

@ -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.7.13~ynh1",
"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"
}
]
}
}

64
manifest.toml Normal file
View file

@ -0,0 +1,64 @@
packaging_format = 2
id = "torrelay"
name = "Tor relay"
description.en = "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.7.13~ynh3"
maintainers = []
[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"
[integration]
yunohost = ">= 11.1.17"
architectures = ["amd64", "arm64", "i386"]
multi_instance = false
ldap ="not_relevant"
sso = "not_relevant"
disk = "50M"
ram.build = "100M"
ram.runtime = "50M"
[install]
[install.domain]
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 = "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 = "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]
packages = "apt-transport-https obfs4proxy"
extras.tor.repo = "deb https://deb.torproject.org/torproject.org bullseye main"
extras.tor.key = "https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc"
extras.tor.packages = "tor tor-geoipdb deb.torproject.org-keyring"

View file

@ -4,10 +4,6 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
pkg_dependencies="apt-transport-https obfs4proxy"
pkg_dependencies_extra="tor tor-geoipdb deb.torproject.org-keyring"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -10,23 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================

View file

@ -9,59 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
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
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -76,35 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
# 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
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
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
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -115,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" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,61 +9,13 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
contact=$YNH_APP_ARG_CONTACT
nickname=$YNH_APP_ARG_NICKNAME
app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
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=contact --value=$contact
ynh_app_setting_set --app=$app --key=nickname --value=$nickname ynh_app_setting_set --app=$app --key=nickname --value=$nickname
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find free ports
or_port=$(ynh_find_port --port=9002)
obfs4_port=$(ynh_find_port --port=$(($or_port + 1)))
# Find an available port
ynh_app_setting_set --app=$app --key=or_port --value=$or_port
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
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_install_app_dependencies "$pkg_dependencies"
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 # ADD A CONFIGURATION
#================================================= #=================================================
@ -79,7 +31,7 @@ chown :debian-tor /etc/tor/torrc
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 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 # START SYSTEMD SERVICE

View file

@ -9,17 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
or_port=$(ynh_app_setting_get --app=$app --key=or_port)
obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -41,30 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service=tor ynh_remove_systemd_config --service=tor
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
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 # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -10,36 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
or_port=$(ynh_app_setting_get --app=$app --key=or_port)
obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port)
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
# Define and install dependencies
ynh_install_app_dependencies "$pkg_dependencies"
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 # 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 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 # START SYSTEMD SERVICE

View file

@ -9,39 +9,12 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
or_port=$(ynh_app_setting_get --app=$app --key=or_port)
obfs4_port=$(ynh_app_setting_get --app=$app --key=obfs4_port)
contact=$(ynh_app_setting_get --app=$app --key=contact)
nickname=$(ynh_app_setting_get --app=$app --key=nickname)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # 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" ynh_systemd_action --service_name=tor --action="stop" --log_path="systemd"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_install_app_dependencies "$pkg_dependencies"
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 # UPDATE A CONFIG FILE
#================================================= #=================================================
@ -75,7 +39,7 @@ chown :debian-tor /etc/tor/torrc
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 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 # START SYSTEMD SERVICE

View file

@ -1,3 +1,10 @@
test_format = 1.0 test_format = 1.0
[default] [default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.nickname = "john"
args.contact = "address@email.com"