From fa40a5cf3b0f3f46c54e61b29094c9ab486b3c9a Mon Sep 17 00:00:00 2001 From: ljf Date: Fri, 1 Sep 2017 03:10:31 +0200 Subject: [PATCH 01/17] [enh] Bootprompt is back --- bin/yunoprompt | 103 ++++++++++++++++++++++++++++++++++ data/other/yunoprompt.service | 14 +++++ debian/postinst | 3 + 3 files changed, 120 insertions(+) create mode 100644 bin/yunoprompt create mode 100644 data/other/yunoprompt.service diff --git a/bin/yunoprompt b/bin/yunoprompt new file mode 100644 index 000000000..212debdc9 --- /dev/null +++ b/bin/yunoprompt @@ -0,0 +1,103 @@ +#!/bin/bash + +ip=$(hostname --all-ip-address) + +i=0 +for key in /etc/ssh/ssh_host_*_key.pub ; do + output=$(ssh-keygen -l -f $key) + fingerprint[$i]=" - $(echo $output | cut -d' ' -f2) $(echo $output| cut -d' ' -f4)" + i=$(($i + 1)) +done + +cat > /etc/issue.net << EOF + '. ' '' -d. + /M+ h- .shh/ // /NMy- hMdosso + 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ + sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' + .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. + mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: + 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - + hy /yy: :- -. -Nh ' + . + +IP: ${ip} +SSH fingerprints: +${fingerprint[0]} +${fingerprint[1]} +${fingerprint[2]} +${fingerprint[3]} +${fingerprint[4]} +EOF +if [[ ! -f /etc/yunohost/installed ]] +then + if [[ ! -f /etc/yunohost/from_script ]] + then +sleep 5 +chvt 2 +cat << EOF + '. ' '' -d. + /M+ h- .shh/ // /NMy- hMdosso + 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ + sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' + .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. + mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: + 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - + hy /yy: :- -. -Nh ' + . + +IP: ${ip} +SSH fingerprints*: +${fingerprint[0]} +${fingerprint[1]} +${fingerprint[2]} +${fingerprint[3]} +${fingerprint[4]} +EOF + +echo -e "\e[m Post-installation \e[0m" +cat << EOF +Congratulations! YunoHost has been successfully installed. +Two more steps are required to activate the services of your server. +EOF +read -p "Proceed to post-installation? (y/n) " -n 1 + RESULT=1 + while [ $RESULT -gt 0 ]; do + if [[ $REPLY =~ ^[Nn]$ ]]; then + chvt 1 + exit 0 + fi + echo -e "\n" + /usr/bin/yunohost tools postinstall + let RESULT=$? + if [ $RESULT -gt 0 ]; then + echo -e "\n" + read -p "Retry? (y/n) " -n 1 + fi + done + fi +else # YunoHost is already post-installed + + domain=$(cat /etc/yunohost/current_host) +cat > /etc/issue << EOF + '. ' '' -d. + /M+ h- .shh/ // /NMy- hMdosso + 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ + sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' + .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. + mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: + 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - + hy /yy: :- -. -Nh ' + . + +IP: ${ip} +SSH fingerprints: +${fingerprint[0]} +${fingerprint[1]} +${fingerprint[2]} +${fingerprint[3]} +${fingerprint[4]} +EOF + + +fi + diff --git a/data/other/yunoprompt.service b/data/other/yunoprompt.service new file mode 100644 index 000000000..3c4df50f9 --- /dev/null +++ b/data/other/yunoprompt.service @@ -0,0 +1,14 @@ +[Unit] +Description=YunoHost boot prompt +After=getty@tty2.service + +[Service] +Type=simple +ExecStart=/usr/bin/yunoprompt +StandardInput=tty +TTYPath=/dev/tty2 +TTYReset=yes +TTYVHangup=yes + +[Install] +WantedBy=default.target diff --git a/debian/postinst b/debian/postinst index 7e91ffbb3..39063694b 100644 --- a/debian/postinst +++ b/debian/postinst @@ -24,6 +24,9 @@ do_configure() { "consider to start it by doing 'service yunohost-firewall start'." fi + # Yunoprompt + systemctl enable yunoprompt.service + # remove old PAM config and update it [[ ! -f /usr/share/pam-configs/my_mkhomedir ]] \ || rm /usr/share/pam-configs/my_mkhomedir From 6bbcf0ee95e03781f30b89a156f6f8ba9f7dbc2f Mon Sep 17 00:00:00 2001 From: ljf Date: Fri, 1 Sep 2017 03:16:52 +0200 Subject: [PATCH 02/17] [fix] Missing install path --- debian/install | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/install b/debian/install index 70add7992..e9c79e963 100644 --- a/debian/install +++ b/debian/install @@ -3,6 +3,7 @@ sbin/* /usr/sbin/ data/bash-completion.d/yunohost /etc/bash_completion.d/ data/actionsmap/* /usr/share/moulinette/actionsmap/ data/hooks/* /usr/share/yunohost/hooks/ +data/other/yunoprompt.service /etc/systemd/system/ data/other/* /usr/share/yunohost/yunohost-config/moulinette/ data/templates/* /usr/share/yunohost/templates/ data/helpers /usr/share/yunohost/ From bd2ea3c12cf81eba6879de6d67c44bad3e66b96e Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 3 Oct 2017 18:46:29 +0200 Subject: [PATCH 03/17] [fix] Limit ascii logo to 79 characters --- bin/yunoprompt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index 212debdc9..9839564e3 100644 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -11,13 +11,13 @@ done cat > /etc/issue.net << EOF '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso + /M+ h- .shh/ // /NMy- hMdosso 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' + hy /yy: :- -. -Nh ' . IP: ${ip} From 44676438fe642b4843ecb56cae7a95d4e4c16b8b Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 3 Oct 2017 18:47:52 +0200 Subject: [PATCH 04/17] [fix] Limit ascii 2nd and 3rd logo to 79 char --- bin/yunoprompt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index 9839564e3..200e81933 100644 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -36,13 +36,13 @@ sleep 5 chvt 2 cat << EOF '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso + /M+ h- .shh/ // /NMy- hMdosso 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' + hy /yy: :- -. -Nh ' . IP: ${ip} @@ -80,13 +80,13 @@ else # YunoHost is already post-installed domain=$(cat /etc/yunohost/current_host) cat > /etc/issue << EOF '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso + /M+ h- .shh/ // /NMy- hMdosso 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' + hy /yy: :- -. -Nh ' . IP: ${ip} From f25ef833e935a2b8d70acde8863a6bd8b80eabfa Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 3 Oct 2017 18:50:46 +0200 Subject: [PATCH 05/17] [fix] Remove dead code --- bin/yunoprompt | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index 200e81933..83b28296f 100644 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -77,7 +77,6 @@ read -p "Proceed to post-installation? (y/n) " -n 1 fi else # YunoHost is already post-installed - domain=$(cat /etc/yunohost/current_host) cat > /etc/issue << EOF '. ' '' -d. /M+ h- .shh/ // /NMy- hMdosso From 75fc1c03c59e6ca8d36d6728f3e7d3376819aeb5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 8 May 2018 20:32:34 +0200 Subject: [PATCH 06/17] Factorize the building of the logo at the top of the script --- bin/yunoprompt | 88 +++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 54 deletions(-) mode change 100644 => 100755 bin/yunoprompt diff --git a/bin/yunoprompt b/bin/yunoprompt old mode 100644 new mode 100755 index 83b28296f..bb71e96b9 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -1,7 +1,9 @@ #!/bin/bash +# Fetch ips ip=$(hostname --all-ip-address) +# Fetch SSH fingerprints i=0 for key in /etc/ssh/ssh_host_*_key.pub ; do output=$(ssh-keygen -l -f $key) @@ -9,7 +11,11 @@ for key in /etc/ssh/ssh_host_*_key.pub ; do i=$(($i + 1)) done -cat > /etc/issue.net << EOF +# +# Build the logo +# + +LOGO=$(cat << 'EOF' '. ' '' -d. /M+ h- .shh/ // /NMy- hMdosso 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ @@ -19,7 +25,18 @@ cat > /etc/issue.net << EOF 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - hy /yy: :- -. -Nh ' . - +EOF +) + +# ' Put a quote in comment to make vim happy about syntax highlighting :s + +# +# Build the actual message +# + +LOGO_AND_FINGERPRINTS=$(cat << EOF +"$LOGO" + IP: ${ip} SSH fingerprints: ${fingerprint[0]} @@ -28,38 +45,22 @@ ${fingerprint[2]} ${fingerprint[3]} ${fingerprint[4]} EOF +) + + +echo "$LOGO_AND_FINGERPRINTS" > /etc/issue.net + if [[ ! -f /etc/yunohost/installed ]] then - if [[ ! -f /etc/yunohost/from_script ]] - then -sleep 5 -chvt 2 -cat << EOF - '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso - 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ - sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' - .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. - mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: - 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' - . - -IP: ${ip} -SSH fingerprints*: -${fingerprint[0]} -${fingerprint[1]} -${fingerprint[2]} -${fingerprint[3]} -${fingerprint[4]} -EOF - -echo -e "\e[m Post-installation \e[0m" -cat << EOF -Congratulations! YunoHost has been successfully installed. -Two more steps are required to activate the services of your server. -EOF -read -p "Proceed to post-installation? (y/n) " -n 1 + if [[ ! -f /etc/yunohost/from_script ]] + then + sleep 5 + chvt 2 + echo "$LOGO_AND_FINGERPRINTS" + echo -e "\e[m Post-installation \e[0m" + echo "Congratulations! YunoHost has been successfully installed. + Two more steps are required to activate the services of your server." + read -p "Proceed to post-installation? (y/n) " -n 1 RESULT=1 while [ $RESULT -gt 0 ]; do if [[ $REPLY =~ ^[Nn]$ ]]; then @@ -76,27 +77,6 @@ read -p "Proceed to post-installation? (y/n) " -n 1 done fi else # YunoHost is already post-installed - -cat > /etc/issue << EOF - '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso - 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ - sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' - .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. - mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: - 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' - . - -IP: ${ip} -SSH fingerprints: -${fingerprint[0]} -${fingerprint[1]} -${fingerprint[2]} -${fingerprint[3]} -${fingerprint[4]} -EOF - - + echo "$LOGO_AND_FINGERPRINTS" > /etc/issue fi From a897ec94f8b6a2265f5c2827ecaacbc9bd4f2000 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 15 May 2018 19:40:04 +0200 Subject: [PATCH 07/17] Remove a line which I added for test / debug --- bin/yunoprompt | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index bb71e96b9..ab9068d26 100755 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -47,9 +47,6 @@ ${fingerprint[4]} EOF ) - -echo "$LOGO_AND_FINGERPRINTS" > /etc/issue.net - if [[ ! -f /etc/yunohost/installed ]] then if [[ ! -f /etc/yunohost/from_script ]] From 2a4713f785c205a8ad13ba8d136da63779024756 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 17 May 2018 22:23:18 +0200 Subject: [PATCH 08/17] Alternative logo + misc tweak / cleaning --- bin/yunoprompt | 64 ++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index ab9068d26..5a7992789 100755 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -16,15 +16,13 @@ done # LOGO=$(cat << 'EOF' - '. ' '' -d. - /M+ h- .shh/ // /NMy- hMdosso - 'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+ - sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM' - .sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM. - mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M: - 'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. - - hy /yy: :- -. -Nh ' - . + .--------------. + | \\ / _ _ | + | | |_|| |(_) | + | | + | |_| _ __|_ | + | | |(_)_\\ | | + '______________' EOF ) @@ -35,15 +33,17 @@ EOF # LOGO_AND_FINGERPRINTS=$(cat << EOF -"$LOGO" -IP: ${ip} -SSH fingerprints: -${fingerprint[0]} -${fingerprint[1]} -${fingerprint[2]} -${fingerprint[3]} -${fingerprint[4]} +$LOGO + + IP: ${ip} + SSH fingerprints: + ${fingerprint[0]} + ${fingerprint[1]} + ${fingerprint[2]} + ${fingerprint[3]} + ${fingerprint[4]} + EOF ) @@ -55,25 +55,23 @@ then chvt 2 echo "$LOGO_AND_FINGERPRINTS" echo -e "\e[m Post-installation \e[0m" - echo "Congratulations! YunoHost has been successfully installed. - Two more steps are required to activate the services of your server." + echo "Congratulations! YunoHost has been successfully installed.\nTwo more steps are required to activate the services of your server." read -p "Proceed to post-installation? (y/n) " -n 1 - RESULT=1 - while [ $RESULT -gt 0 ]; do - if [[ $REPLY =~ ^[Nn]$ ]]; then + RESULT=1 + while [ $RESULT -gt 0 ]; do + if [[ $REPLY =~ ^[Nn]$ ]]; then chvt 1 - exit 0 - fi - echo -e "\n" - /usr/bin/yunohost tools postinstall - let RESULT=$? - if [ $RESULT -gt 0 ]; then - echo -e "\n" - read -p "Retry? (y/n) " -n 1 - fi - done + exit 0 + fi + echo -e "\n" + /usr/bin/yunohost tools postinstall + let RESULT=$? + if [ $RESULT -gt 0 ]; then + echo -e "\n" + read -p "Retry? (y/n) " -n 1 + fi + done fi else # YunoHost is already post-installed echo "$LOGO_AND_FINGERPRINTS" > /etc/issue fi - From 02842b311d19e1ef403c5b501896ae619628896c Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 17 May 2018 06:00:04 +0200 Subject: [PATCH 09/17] [enh] add service descriptions to en.json --- locales/en.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/locales/en.json b/locales/en.json index 86f36749b..3e64b1973 100644 --- a/locales/en.json +++ b/locales/en.json @@ -335,6 +335,24 @@ "service_conf_up_to_date": "The configuration is already up-to-date for service '{service}'", "service_conf_updated": "The configuration has been updated for service '{service}'", "service_conf_would_be_updated": "The configuration would have been updated for service '{service}'", + "service_description_avahi-daemon": "Avahi mDNS/DNS-SD Stack", + "service_description_dnsmasq": "dnsmasq - A lightweight DHCP and caching DNS server", + "service_description_dovecot": "Dovecot IMAP/POP3 email server", + "service_description_fail2ban": "Start/stop fail2ban", + "service_description_glances": "Starts and daemonize Glances server", + "service_description_metronome": "Metronome XMPP Server", + "service_description_mysql": "Start and stop the mysql database server daemon", + "service_description_nginx": "A high performance web server and a reverse proxy server", + "service_description_nslcd": "LDAP connection daemon", + "service_description_php5-fpm": "The PHP FastCGI Process Manager", + "service_description_postfix": "Postfix Mail Transport Agent", + "service_description_redis-server": "Advanced key-value store", + "service_description_rmilter": "Another sendmail milter for different mail checks", + "service_description_rspamd": "rapid spam filtering system", + "service_description_slapd": "OpenLDAP standalone server (Lightweight Directory Access Protocol)", + "service_description_ssh": "OpenBSD Secure Shell server", + "service_description_yunohost-api": "YunoHost API Server", + "service_description_yunohost-firewall": "YunoHost Firewall", "service_disable_failed": "Unable to disable service '{service:s}'\n\nRecent service logs:{logs:s}", "service_disabled": "The service '{service:s}' has been disabled", "service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}", From 357be33583f6b23a50853fd3f85dc83a81b11114 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 17 May 2018 06:20:01 +0200 Subject: [PATCH 10/17] [enh] uses services descriptions translatables --- src/yunohost/service.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index d02adc083..96fd8ff92 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -227,6 +227,15 @@ def service_status(names=[]): status = _get_service_information_from_systemd(name) + translation_key = "service_description_%s" % name + description = m18n.n(translation_key) + + # that mean that we don't have a translation for this string + # that's the only way to test for that for now + # if we don't have it, uses the one provide by systemd + if description == translation_key: + description = str(status.get("Description", "")) + result[name] = { 'status': str(status.get("SubState", "unknown")), 'loaded': "enabled" if str(status.get("LoadState", "unknown")) == "loaded" else str(status.get("LoadState", "unknown")), @@ -235,7 +244,7 @@ def service_status(names=[]): "timestamp": str(status.get("ActiveEnterTimestamp", "unknown")), "human": datetime.fromtimestamp(status.get("ActiveEnterTimestamp") / 1000000).strftime("%F %X"), }, - 'description': str(status.get("Description", "")), + 'description': description, 'service_file_path': str(status.get("FragmentPath", "unknown")), } From 72bd201cb2efc5f67df29a2eb6384e2a5770fc3f Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 18 May 2018 04:31:09 +0200 Subject: [PATCH 11/17] [enh] import services descriptions from https://pad.aquilenet.fr/p/8Cg5Miv6Of Thanks to everyone who contributed <3 Co-authored-by: ariasuni Co-authored-by: Haelwenn (lanodan) Monnier --- locales/en.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/locales/en.json b/locales/en.json index 3e64b1973..e7bfd2ded 100644 --- a/locales/en.json +++ b/locales/en.json @@ -335,24 +335,24 @@ "service_conf_up_to_date": "The configuration is already up-to-date for service '{service}'", "service_conf_updated": "The configuration has been updated for service '{service}'", "service_conf_would_be_updated": "The configuration would have been updated for service '{service}'", - "service_description_avahi-daemon": "Avahi mDNS/DNS-SD Stack", - "service_description_dnsmasq": "dnsmasq - A lightweight DHCP and caching DNS server", - "service_description_dovecot": "Dovecot IMAP/POP3 email server", - "service_description_fail2ban": "Start/stop fail2ban", - "service_description_glances": "Starts and daemonize Glances server", - "service_description_metronome": "Metronome XMPP Server", - "service_description_mysql": "Start and stop the mysql database server daemon", - "service_description_nginx": "A high performance web server and a reverse proxy server", - "service_description_nslcd": "LDAP connection daemon", - "service_description_php5-fpm": "The PHP FastCGI Process Manager", - "service_description_postfix": "Postfix Mail Transport Agent", - "service_description_redis-server": "Advanced key-value store", - "service_description_rmilter": "Another sendmail milter for different mail checks", - "service_description_rspamd": "rapid spam filtering system", - "service_description_slapd": "OpenLDAP standalone server (Lightweight Directory Access Protocol)", - "service_description_ssh": "OpenBSD Secure Shell server", - "service_description_yunohost-api": "YunoHost API Server", - "service_description_yunohost-firewall": "YunoHost Firewall", + "service_description_avahi-daemon": "allows to reach your server using yunohost.local on your local network", + "service_description_dnsmasq": "handles domain name resolution (DNS)", + "service_description_dovecot": "allows e-mail client to access/fetch email (via IMAP and POP3)", + "service_description_fail2ban": "protects against bruteforce and other kind of attacks from the Internet", + "service_description_glances": "monitors system information on your server", + "service_description_metronome": "manage XMPP instant messaging accounts", + "service_description_mysql": "stores applications data (SQL database)", + "service_description_nginx": "serves or provides access to all the websites hosted on your server", + "service_description_nslcd": "handles YunoHost user shell connection", + "service_description_php5-fpm": "runs applications written in PHP with nginx", + "service_description_postfix": "used to send and receive emails", + "service_description_redis-server": "a specialized database used for rapid data access, task queue and communication between programs", + "service_description_rmilter": "checks various parameters in emails", + "service_description_rspamd": "filters spam, and other email-related features", + "service_description_slapd": "stores users, domains and related information", + "service_description_ssh": "allows you to connect remotely to your server via a terminal (SSH protocol)", + "service_description_yunohost-api": "manages interactions between the YunoHost web interface and the system", + "service_description_yunohost-firewall": "manages open and close connexion ports to services", "service_disable_failed": "Unable to disable service '{service:s}'\n\nRecent service logs:{logs:s}", "service_disabled": "The service '{service:s}' has been disabled", "service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}", From 23474558fcca8234d7ea3c18c80e63427df6cdc0 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 18 May 2018 04:38:11 +0200 Subject: [PATCH 12/17] [mod] anglish --- src/yunohost/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 96fd8ff92..69b2bb9fc 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -232,7 +232,7 @@ def service_status(names=[]): # that mean that we don't have a translation for this string # that's the only way to test for that for now - # if we don't have it, uses the one provide by systemd + # if we don't have it, uses the one provided by systemd if description == translation_key: description = str(status.get("Description", "")) From d77c616d71eb7a48f6e613b49129f8494830dfb7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 20 May 2018 21:09:18 +0200 Subject: [PATCH 13/17] Return None directly if we try to calculate the hash of a file that does not exists --- src/yunohost/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index d02adc083..866fab414 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -713,6 +713,10 @@ def _get_files_diff(orig_file, new_file, as_string=False, skip_header=True): def _calculate_hash(path): """Calculate the MD5 hash of a file""" + + if not os.path.exists(path): + return None + hasher = hashlib.md5() try: @@ -889,7 +893,7 @@ def _get_journalctl_logs(service): import traceback return "error while get services logs from journalctl:\n%s" % traceback.format_exc() - + def manually_modified_files_compared_to_debian_default(): # from https://serverfault.com/a/90401 From c0be9676e37c9a6b13c48070b29897e1efefc1a7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 21 May 2018 00:46:48 +0200 Subject: [PATCH 14/17] Rework condition (and remove the 'from_script' flag) --- bin/yunoprompt | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index 5a7992789..b92f2d209 100755 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -47,31 +47,28 @@ $LOGO EOF ) -if [[ ! -f /etc/yunohost/installed ]] +if [[ -f /etc/yunohost/installed ]] then - if [[ ! -f /etc/yunohost/from_script ]] - then - sleep 5 - chvt 2 - echo "$LOGO_AND_FINGERPRINTS" - echo -e "\e[m Post-installation \e[0m" - echo "Congratulations! YunoHost has been successfully installed.\nTwo more steps are required to activate the services of your server." - read -p "Proceed to post-installation? (y/n) " -n 1 - RESULT=1 - while [ $RESULT -gt 0 ]; do - if [[ $REPLY =~ ^[Nn]$ ]]; then - chvt 1 - exit 0 - fi - echo -e "\n" - /usr/bin/yunohost tools postinstall - let RESULT=$? - if [ $RESULT -gt 0 ]; then - echo -e "\n" - read -p "Retry? (y/n) " -n 1 - fi - done - fi -else # YunoHost is already post-installed echo "$LOGO_AND_FINGERPRINTS" > /etc/issue +else + sleep 5 + chvt 2 + echo "$LOGO_AND_FINGERPRINTS" + echo -e "\e[m Post-installation \e[0m" + echo "Congratulations! YunoHost has been successfully installed.\nTwo more steps are required to activate the services of your server." + read -p "Proceed to post-installation? (y/n) " -n 1 + RESULT=1 + while [ $RESULT -gt 0 ]; do + if [[ $REPLY =~ ^[Nn]$ ]]; then + chvt 1 + exit 0 + fi + echo -e "\n" + /usr/bin/yunohost tools postinstall + let RESULT=$? + if [ $RESULT -gt 0 ]; then + echo -e "\n" + read -p "Retry? (y/n) " -n 1 + fi + done fi From eb76ca3fafd71f15f3096c928c614eccc0c4d483 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 21 May 2018 00:48:39 +0200 Subject: [PATCH 15/17] Change logo again ('Modular' font from patorjk.com) --- bin/yunoprompt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/yunoprompt b/bin/yunoprompt index b92f2d209..de05dd6fa 100755 --- a/bin/yunoprompt +++ b/bin/yunoprompt @@ -16,13 +16,13 @@ done # LOGO=$(cat << 'EOF' - .--------------. - | \\ / _ _ | - | | |_|| |(_) | - | | - | |_| _ __|_ | - | | |(_)_\\ | | - '______________' + __ __ __ __ __ _ _______ __ __ _______ _______ _______ + | | | || | | || | | || || | | || || || | + | |_| || | | || |_| || _ || |_| || _ || _____||_ _| + | || |_| || || | | || || | | || |_____ | | + |_ _|| || _ || |_| || _ || |_| ||_____ | | | + | | | || | | || || | | || | _____| | | | + |___| |_______||_| |__||_______||__| |__||_______||_______| |___| EOF ) From e7a4b6df2c27027fd4e0a6cf22f85e450652df9e Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Mon, 21 May 2018 01:28:08 +0200 Subject: [PATCH 16/17] [enh] Add postgresql helpers (#238) * [enh] Add postgresql helpers * Updated from experimental helpers repo * Update postgresql helpers, c.f. Experimental_helpers/#13 --- data/helpers.d/psql | 150 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 data/helpers.d/psql diff --git a/data/helpers.d/psql b/data/helpers.d/psql new file mode 100644 index 000000000..ddacbef8c --- /dev/null +++ b/data/helpers.d/psql @@ -0,0 +1,150 @@ +# Create a master password and set up global settings +# Please always call this script in install and restore scripts +# +# usage: ynh_psql_test_if_first_run +ynh_psql_test_if_first_run() { + if [ -f /etc/yunohost/psql ]; + then + echo "PostgreSQL is already installed, no need to create master password" + else + pgsql=$(ynh_string_random) + pg_hba="" + echo "$pgsql" >> /etc/yunohost/psql + + if [ -e /etc/postgresql/9.4/ ] + then + pg_hba=/etc/postgresql/9.4/main/pg_hba.conf + elif [ -e /etc/postgresql/9.6/ ] + then + pg_hba=/etc/postgresql/9.6/main/pg_hba.conf + else + ynh_die "postgresql shoud be 9.4 or 9.6" + fi + + systemctl start postgresql + sudo --login --user=postgres psql -c"ALTER user postgres WITH PASSWORD '$pgsql'" postgres + + # force all user to connect to local database using passwords + # https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF + # Note: we can't use peer since YunoHost create users with nologin + # See: https://github.com/YunoHost/yunohost/blob/unstable/data/helpers.d/user + sed -i '/local\s*all\s*all\s*peer/i \ + local all all password' "$pg_hba" + systemctl enable postgresql + systemctl reload postgresql + fi +} + +# Open a connection as a user +# +# example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;" +# example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql +# +# usage: ynh_psql_connect_as user pwd [db] +# | arg: user - the user name to connect as +# | arg: pwd - the user password +# | arg: db - the database to connect to +ynh_psql_connect_as() { + user="$1" + pwd="$2" + db="$3" + sudo --login --user=postgres PGUSER="$user" PGPASSWORD="$pwd" psql "$db" +} + +# # Execute a command as root user +# +# usage: ynh_psql_execute_as_root sql [db] +# | arg: sql - the SQL command to execute +# | arg: db - the database to connect to +ynh_psql_execute_as_root () { + sql="$1" + sudo --login --user=postgres psql <<< "$sql" +} + +# Execute a command from a file as root user +# +# usage: ynh_psql_execute_file_as_root file [db] +# | arg: file - the file containing SQL commands +# | arg: db - the database to connect to +ynh_psql_execute_file_as_root() { + file="$1" + db="$2" + sudo --login --user=postgres psql "$db" < "$file" +} + +# Create a database, an user and its password. Then store the password in the app's config +# +# After executing this helper, the password of the created database will be available in $db_pwd +# It will also be stored as "psqlpwd" into the app settings. +# +# usage: ynh_psql_setup_db user name [pwd] +# | arg: user - Owner of the database +# | arg: name - Name of the database +# | arg: pwd - Password of the database. If not given, a password will be generated +ynh_psql_setup_db () { + db_user="$1" + db_name="$2" + new_db_pwd=$(ynh_string_random) # Generate a random password + # If $3 is not given, use new_db_pwd instead for db_pwd. + db_pwd="${3:-$new_db_pwd}" + ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database + ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Store the password in the app's config +} + +# Create a database and grant privilegies to a user +# +# usage: ynh_psql_create_db db [user [pwd]] +# | arg: db - the database name to create +# | arg: user - the user to grant privilegies +# | arg: pwd - the user password +ynh_psql_create_db() { + db="$1" + user="$2" + pwd="$3" + ynh_psql_create_user "$user" "$pwd" + sudo --login --user=postgres createdb --owner="$user" "$db" +} + +# Drop a database +# +# usage: ynh_psql_drop_db db +# | arg: db - the database name to drop +# | arg: user - the user to drop +ynh_psql_remove_db() { + db="$1" + user="$2" + sudo --login --user=postgres dropdb "$db" + ynh_psql_drop_user "$user" +} + +# Dump a database +# +# example: ynh_psql_dump_db 'roundcube' > ./dump.sql +# +# usage: ynh_psql_dump_db db +# | arg: db - the database name to dump +# | ret: the psqldump output +ynh_psql_dump_db() { + db="$1" + sudo --login --user=postgres pg_dump "$db" +} + + +# Create a user +# +# usage: ynh_psql_create_user user pwd [host] +# | arg: user - the user name to create +ynh_psql_create_user() { + user="$1" + pwd="$2" + sudo --login --user=postgres psql -c"CREATE USER $user WITH PASSWORD '$pwd'" postgres +} + +# Drop a user +# +# usage: ynh_psql_drop_user user +# | arg: user - the user name to drop +ynh_psql_drop_user() { + user="$1" + sudo --login --user=postgres dropuser "$user" +} From 911a4ec507f67749a9eb7ebb10387c0bb57d90e7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 28 May 2018 02:24:34 +0200 Subject: [PATCH 17/17] Merge with unstable, update changelog --- debian/changelog | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/debian/changelog b/debian/changelog index da5428e22..60467eec7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,24 @@ +yunohost (2.7.13.3) testing; urgency=low + + * [enh] Add postgresql helpers (#238) + * [enh] Bring back the bootprompt (#363) + * [enh] Allow to disable the backup during the upgrade (#431) + * [fix] Remove warning from equivs (#439) + * [enh] Add SOURCE_EXTRACT (true/false) in ynh_setup_source (#460) + * [enh] More debug output in services.py (#468) + * [enh] Be able to use more variables in template for nginx conf (#462) + * [enh] Upgrade Meltdown / Spectre diagnosis (#464) + * [enh] Check services status via dbus (#469, #478, #479) + * [mod] Cleaning in services.py code (#470, #472) + * [enh] Improvate and translate service descriptions (#476) + * [fix] Fix "untrusted TLS connection" in mail logs (#471) + * [fix] Make apt-get helper not quiet so we can debug (#475) + * [i18n] Improve Occitan, Portuguese, Arabic, French translations + + Contributors : ljf, Maniack, Josue, Aleks, Bram, Quent-in, itxtoledo, ButterflyOfFire, Jibec, ariasuni, Haelwenn + + -- Alexandre Aubin Mon, 28 May 2018 02:23:00 +0000 + yunohost (2.7.13.2) testing; urgency=low * [fix] Fix an error with services marked as None (#466)