On 08/16/2015 11:12 PM, Sunil Mohan Adapa wrote: > Package: freedombox-setup > Version: 0.5 > Severity: normal > > For many of the diagnositcs tests, the proper location now is Plinth. This > because Plinth now installs, configures and otherwise manages the application. > Plinth has a framework for diagnostics now. > > - JWChat/XMPP tests: JWChat/Ejabberd are installed and managed by Plinth. > > - LDAP tests: LDAP tests have already been moved to Plinth. They need to be > removed here. > > - Provixy tests: Installation is optional and has been moved to Plinth. > > - Tor tests: Installation will be optional and will be moved to Plinth. > > - DNS tests: DNS tests are not very relevant now. TheOnly when > network-manager > is configured with a shared connection this applicable. Also it is very > interface specific. > > - This leaves only NTP and Plinth tests. Which we can consider moving to > Plinth also. > >
Attached patch completely removes the testsuite from freedomxbox-setup. This complements the pull request in Plinth that adds all the tests to Plinth. I have not tested the patch in hope to test all the cleanups in one go before the release. -- Sunil
From 20cba81969dc79855c10bba197a07e3ed42bb70c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa <su...@medhas.org> Date: Fri, 21 Aug 2015 22:45:34 +0530 Subject: [PATCH 1/2] Move testsuite over to Plinth --- debian/freedombox-setup.install | 1 - testsuite/check | 7 ---- testsuite/dns-server.test | 18 ---------- testsuite/jwchat.test | 37 -------------------- testsuite/ldap-server.test | 12 ------- testsuite/ntp.test | 18 ---------- testsuite/plinth-server.test | 19 ---------- testsuite/testsuite-functions | 43 ----------------------- testsuite/tor-client.test | 77 ----------------------------------------- testsuite/web-proxy.test | 35 ------------------- testsuite/xmpp-server.test | 15 -------- 11 files changed, 282 deletions(-) delete mode 100755 testsuite/check delete mode 100755 testsuite/dns-server.test delete mode 100755 testsuite/jwchat.test delete mode 100755 testsuite/ldap-server.test delete mode 100755 testsuite/ntp.test delete mode 100755 testsuite/plinth-server.test delete mode 100644 testsuite/testsuite-functions delete mode 100755 testsuite/tor-client.test delete mode 100755 testsuite/web-proxy.test delete mode 100755 testsuite/xmpp-server.test diff --git a/debian/freedombox-setup.install b/debian/freedombox-setup.install index 8bfed71..35e9e55 100644 --- a/debian/freedombox-setup.install +++ b/debian/freedombox-setup.install @@ -1,6 +1,5 @@ setup usr/lib/freedombox setup.d usr/lib/freedombox -testsuite usr/lib/freedombox first-run.d usr/lib/freedombox sysctl.d/freedombox-setup.conf etc/sysctl.d sbin/copy2dream usr/sbin diff --git a/testsuite/check b/testsuite/check deleted file mode 100755 index 451a386..0000000 --- a/testsuite/check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -cd $(dirname $0) - -for test in ./*.test ; do - $test -done diff --git a/testsuite/dns-server.test b/testsuite/dns-server.test deleted file mode 100755 index 7f99809..0000000 --- a/testsuite/dns-server.test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -netstat_check domain udp DNS -netstat_check domain udp6 DNS - -if dig -4 test.dnssec-or-not.net TXT | grep -q 'Yes, you are using DNSSEC' ; then - success "$0: DNSSEC is enabled on IPv4" -else - error "$0: DNSSEC is not enabled on IPv4" -fi - -if dig -6 test.dnssec-or-not.net TXT | grep -q 'Yes, you are using DNSSEC' ; then - success "$0: DNSSEC is enabled on IPv6" -else - error "$0: DNSSEC is not enabled on IPv6" -fi diff --git a/testsuite/jwchat.test b/testsuite/jwchat.test deleted file mode 100755 index 0497244..0000000 --- a/testsuite/jwchat.test +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -if [ ! -e /etc/apache2/conf-enabled/jwchat-plinth.conf ] ; then - skip "$0: jwchat is not enabled." - exit 0 -fi - -# Check if we can access jwchat on each IP address. - -ips=$(ip -4 -o addr | awk '!/^[0-9]*: ?lo|link\/ether/ {gsub("/", " "); print $4}') - -for ip in $ips -do - url="http://$ip/jwchat" - if wget -q -O /dev/null "$url" ; then - success "$0: HTTP access to $url worked" - else - error "$0: HTTP access to $url did not work" - fi -done - - -# Check if we can access jwchat using hostname. - -url="http://$(uname -n)/jwchat" -if wget -4 -q -O /dev/null "$url" ; then - success "$0: HTTP access to $url worked using IPv4" -else - error "$0: HTTP access to $url did not work using IPv4" -fi -if wget -6 -q -O /dev/null "$url" ; then - success "$0: HTTP access to $url worked using IPv6" -else - error "$0: HTTP access to $url did not work using IPv6" -fi diff --git a/testsuite/ldap-server.test b/testsuite/ldap-server.test deleted file mode 100755 index e0d529e..0000000 --- a/testsuite/ldap-server.test +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -ldapuri=ldapi:// - -if ldapsearch -x -H ldapi:// -b '' -s base 2>/dev/null | \ - grep -qa OpenLDAProotDSE ; then - success "$0: ldap server on $ldapuri responded" -else - error "$0: unable to find LDAP root DSE on $ldapuri" -fi diff --git a/testsuite/ntp.test b/testsuite/ntp.test deleted file mode 100755 index b7c65fb..0000000 --- a/testsuite/ntp.test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -e -# -# Test if the NTP configuration is correct. - -. $(dirname $0)/testsuite-functions - -if [ ! -x /usr/bin/ntpq ] ; then - error "$0: The /usr/bin/ntpq binary is missing." - exit 1 -fi - -servercount=$(ntpq -c lpeers | tail -n +3 | awk '{print $1}' |wc -l) - -if [ 0 -lt $servercount ] ; then - success "$0: NTP client in contact with $servercount servers." -else - error "$0: NTP client not in contact with any servers." -fi diff --git a/testsuite/plinth-server.test b/testsuite/plinth-server.test deleted file mode 100755 index 4c61baa..0000000 --- a/testsuite/plinth-server.test +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -netstat_check 8000 tcp Plinth -netstat_check 8000 tcp6 Plinth - -url="http://$(uname -n)/plinth/" -# Not checking certificate as it probably is self signed -if wget -4 --no-check-certificate -q -O /dev/null "$url" ; then - success "$0: HTTP access to $url worked using IPv4" -else - error "$0: HTTP access to $url did not work using IPv4" -fi -if wget -6 --no-check-certificate -q -O /dev/null "$url" ; then - success "$0: HTTP access to $url worked using IPv6" -else - error "$0: HTTP access to $url did not work using IPv6" -fi diff --git a/testsuite/testsuite-functions b/testsuite/testsuite-functions deleted file mode 100644 index ae65062..0000000 --- a/testsuite/testsuite-functions +++ /dev/null @@ -1,43 +0,0 @@ -# -*- shell-script -*- - -success() { - echo "success: $@" -} - -error() { - echo "error: $@" -} - -skip() { - echo "skip: $@" -} - -# Check if something is listening on the given port and protocol -netstat_check() { - port=$1 - proto=$2 - service="$3" - - if netstat -a --numeric-hosts 2>&1 | grep ":$port " | grep -q "^$proto" ; then - success "$0: $service service is listening on $port/$proto." - true - else - error "$0: $service service is not listening on $port/$proto." - false - fi -} - -# Check if something is listening on the given socket and protocol -netstat_check_socket() { - socket=$1 - proto=$2 - service="$3" - - if netstat -a --numeric-hosts 2>&1 | grep "$socket " | grep -q "^$proto" ; then - success "$0: $service service is listening on $socket/$proto." - true - else - error "$0: $service service is not listening on $socket/$proto." - false - fi -} diff --git a/testsuite/tor-client.test b/testsuite/tor-client.test deleted file mode 100755 index 27c7cda..0000000 --- a/testsuite/tor-client.test +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -netstat_check `tor-get-orport` tcp tor -netstat_check `tor-get-orport` tcp6 tor -netstat_check 9050 tcp tor -netstat_check 9050 tcp6 tor -netstat_check 9040 tcp tor -netstat_check 9040 tcp6 tor -netstat_check 9053 udp tor -netstat_check 9053 udp6 tor - -# Tor control socket -ip="127.0.0.1" -if `echo QUIT | nc $ip 9051 2>&1 | grep -q "250 closing connection"` ; then - success "$0: Tor control socket is listening on $ip." -else - error "$0: Tor control socket is not listening on $ip." -fi - -ips=$(ip -4 -o addr | awk '!/^[0-9]*: ?lo|link\/ether/ {gsub("/", " "); print $4}') -for ip in $ips -do - # Check that Tor control socket only listens on localhost. - if `echo QUIT | nc $ip 9051 2>&1 | grep -q "250 closing connection"` ; then - error "$0: Tor control socket is listening on $ip." - else - success "$0: Tor control socket is not listening on $ip." - fi -done - -# Check that Tor Socks listens on every interface with a static IP. -static_ips=$(awk '/ address/ {print $2}' /etc/network/interfaces) -for static_ip in $static_ips -do - netstat_check_socket $static_ip:9050 tcp tor -done - -# Check obfsproxy transports -transports="obfs3 scramblesuit" -for transport in $transports -do - port=`grep $transport /var/lib/tor/state | awk -F'[: ]*' '{print $4}'` - if [ -z "$port" ] ; then - error "$0: $transport transport is not registered." - else - success "$0: $transport transport is registered on port $port." - netstat_check $port tcp obfsproxy - fi -done - -if torsocks wget -4 -O - http://www.debian.org/ 2>/dev/null | \ - grep -q '<html'; then - success "$0: HTTP request to www.debian.org via TOR on IPv4 works." -else - error "$0: HTTP request to www.debian.org via TOR on IPv4 fail." -fi -if torsocks wget -6 -O - http://www.debian.org/ 2>/dev/null | \ - grep -q '<html'; then - success "$0: HTTP request to www.debian.org via TOR on IPv6 works." -else - error "$0: HTTP request to www.debian.org via TOR on IPv6 fail." -fi - -if torsocks wget -4 -O - https://check.torproject.org/ 2>/dev/null | \ - grep -q 'Congratulations. This browser is configured to use Tor.'; then - success "$0: HTTP request to check.torproject.org via TOR on IPv4 confirm that TOR is used." -else - error "$0: HTTP request to check.torproject.org via TOR on IPv4 confirm that TOR is not used." -fi -if torsocks wget -6 -O - https://check.torproject.org/ 2>/dev/null | \ - grep -q 'Congratulations. This browser is configured to use Tor.'; then - success "$0: HTTP request to check.torproject.org via TOR on IPv6 confirm that TOR is used." -else - error "$0: HTTP request to check.torproject.org via TOR on IPv6 confirm that TOR is not used." -fi diff --git a/testsuite/web-proxy.test b/testsuite/web-proxy.test deleted file mode 100755 index 3220c1e..0000000 --- a/testsuite/web-proxy.test +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -if ! systemctl is-enabled privoxy > /dev/null ; then - skip "$0: Privoxy is disabled" - exit 0 -fi - -netstat_check 8118 tcp privoxy -netstat_check 8118 tcp6 privoxy - -if http_proxy=http://localhost:8118 wget -4 -O - http://www.debian.org/ 2>/dev/null | \ - grep -q '<html'; then - success "$0: HTTP request to www.debian.org via privoxy using IPv4 works." -else - error "$0: HTTP request to www.debian.org via privoxy using IPv4 fail." -fi -if http_proxy=http://localhost:8118 wget -6 -O - http://www.debian.org/ 2>/dev/null | \ - grep -q '<html'; then - success "$0: HTTP request to www.debian.org via privoxy using IPv6 works." -else - error "$0: HTTP request to www.debian.org via privoxy using IPv6 fail." -fi - -ips=$(ip -4 -o addr | awk '!/^[0-9]*: ?lo|link\/ether/ {gsub("/", " "); print $4}') -for ip in $ips -do - if http_proxy=http://$ip:8118 wget -O - http://www.debian.org/ 2>/dev/null | \ - grep -q '<html'; then - success "$0: HTTP request to www.debian.org via privoxy on $ip:8118 works." - else - error "$0: HTTP request to www.debian.org via privoxy on $ip:8118 fail." - fi -done diff --git a/testsuite/xmpp-server.test b/testsuite/xmpp-server.test deleted file mode 100755 index 064cdb1..0000000 --- a/testsuite/xmpp-server.test +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/testsuite-functions - -if ! which ejabberdctl ; then - skip "$0: ejabberd is not installed." - exit 0 -fi - -netstat_check xmpp-client tcp XMPP -netstat_check xmpp-client tcp6 XMPP -netstat_check xmpp-server tcp XMPP -netstat_check xmpp-server tcp6 XMPP -netstat_check 5280 tcp XMPP -netstat_check 5280 tcp6 XMPP -- 2.1.4 From 4fe09470f32e7ea1dbbef75e5311e991adb53f75 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa <su...@medhas.org> Date: Fri, 21 Aug 2015 22:45:53 +0530 Subject: [PATCH 2/2] Remove unused tor-get-orport binary --- sbin/tor-get-orport | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100755 sbin/tor-get-orport diff --git a/sbin/tor-get-orport b/sbin/tor-get-orport deleted file mode 100755 index 65c3d0d..0000000 --- a/sbin/tor-get-orport +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -# Get ORPort number from Tor control port. -# Usage: tor-get-orport -# -# Tor control port must be enabled on localhost port 9051. -# - -cookie=`perl -e 'my $a=do{local(@ARGV,$/)="/var/run/tor/control.authcookie"; <>}; warn unpack("H*",$a)' 2>&1 | awk '{print $1}'` - -response=`nc localhost 9051` <<EOF -AUTHENTICATE $cookie -GETINFO net/listeners/or -QUIT -EOF - -echo $response | awk -F'[:\"]' '/net\/listeners\/or/ { print $3 }' -- 2.1.4
signature.asc
Description: OpenPGP digital signature