diff options
author | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-08-14 07:35:09 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-08-14 07:35:09 +0000 |
commit | 6e536803d7bbf9c217564c202901578d5f106787 (patch) | |
tree | aaa1d1c3fe4f7a2cdad616f436af8f00f2b5a9ad /sysutils | |
parent | 6c1fbb75ccb3467e58f7349f860a7590af25137f (diff) | |
download | ports-6e536803d7bbf9c217564c202901578d5f106787.tar.gz ports-6e536803d7bbf9c217564c202901578d5f106787.zip |
Notes
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/bsdstats/Makefile | 5 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics | 99 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics.in | 99 | ||||
-rw-r--r-- | sysutils/bsdstats/files/pkg-message.in | 16 | ||||
-rw-r--r-- | sysutils/bsdstats/pkg-message | 16 |
5 files changed, 141 insertions, 94 deletions
diff --git a/sysutils/bsdstats/Makefile b/sysutils/bsdstats/Makefile index ce32983741cc..a4580149c1e3 100644 --- a/sysutils/bsdstats/Makefile +++ b/sysutils/bsdstats/Makefile @@ -6,8 +6,7 @@ # PORTNAME= bsdstats -PORTVERSION= 2.2 -PORTREVISION= 1 +PORTVERSION= 3.0 CATEGORIES= sysutils DISTFILES= @@ -16,6 +15,8 @@ COMMENT= Monthly script for reporting anonymous statistics about your machine NO_BUILD= yes PLIST_FILES= etc/periodic/monthly/300.statistics +PLIST_DIRS= etc/periodic/montly \ + etc/periodic .include <bsd.port.pre.mk> diff --git a/sysutils/bsdstats/files/300.statistics b/sysutils/bsdstats/files/300.statistics index cd75357cd379..303e3807b99f 100644 --- a/sysutils/bsdstats/files/300.statistics +++ b/sysutils/bsdstats/files/300.statistics @@ -1,11 +1,10 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.10 2006-08-09 18:36:15 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.11 2006-08-14 07:35:09 scrappy Exp $ # # If there is a global system configuration file, suck it in. # -monthly_statistics_mailto="scrappy@hub.org,root" if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf @@ -15,6 +14,40 @@ fi oldmask=$(umask) umask 066 +checkin_server="bsdstats.org"; +id_token_file='/var/db/bsdstats' + +IFS=" +" + +send_devices () { + for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` + do + DRIVER=`echo $line | awk -F\@ '{print $1}'` + DEV=`echo $line | awk '{print $4}' | cut -c8-15` + CLASS=`echo $line | awk '{print $2}' | cut -c9-14` + query_string=$query_string`echo \&dev[]=$DRIVER:$DEV:$CLASS` + done + + do_fetch report_devices.php?key=$KEY$query_string +} + +get_id_token () { + if [ ! -f $id_token_file ] ; + then + IDTOKEN=$( /usr/bin/openssl rand -base64 16 ) + /usr/bin/fetch -qo $id_token_file "http://$checkin_server/scripts/getid.php?key=$IDTOKEN" + /usr/sbin/chown root:wheel $id_token_file + /bin/chmod 600 $id_token_file + echo "To protect against abuse, the initial challenge/response phase" + echo "contains a 15 minute pause. Please be patient while this time" + echo "limit elapses" + sleep 900 + fi + . $id_token_file + KEY=$( uri_escape $KEY ) +} + # RFC 2396 uri_escape () { echo ${1+$@} | sed -e ' @@ -37,57 +70,37 @@ do_fetch () { /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" } -checkin_server="bsdstats.hub.org"; case "$monthly_statistics_enable" in [Yy][Ee][Ss]) HN=`/bin/hostname` - SYS=`/usr/bin/uname -r` + REL=`/usr/bin/uname -r` ARCH=`/usr/bin/uname -m` OS=`/usr/bin/uname -s` - do_fetch getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS + get_id_token + do_fetch report_system.php?key=$KEY\&rel=$REL\&arch=$ARCH\&opsys=$OS echo "Posting monthly OS statistics to $checkin_server" case "$monthly_statistics_report_devices" in - [Yy][Ee][Ss]) -IFS=" -" - - do_fetch clear_devices.php?hn=$HN - for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` - do - DRIVER=`echo $line | awk -F\@ '{print $1}'` - VEN=`echo $line | awk '{print $4}' | cut -c12-15` - DEV=`echo $line | awk '{print $4}' | cut -c8-11` - CLASS=`echo $line | awk '{print $2}' | cut -c9-10` - SUBCLASS=`echo $line | awk '{print $2}' | cut -c11-14` - do_fetch report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&class=$CLASS\&subclass=$SUBCLASS\&hn=$HN - done - echo "Posting monthly device statistics to $checkin_server" - - line=$( sysctl -n hw.model ) - VEN=$( echo $line | cut -d ' ' -f 1 ) - DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) - n=0 - count=$( sysctl -n hw.ncpu ) - do_fetch clear_cpu.php?hn=$HN - while [ $n -lt $count ] - do - do_fetch report_cpu.php?cpu_id=CPU$n\&vendor=$VEN\&cpu_type=$DEV\&hn=$HN - n=$(( $n + 1 )) - done - echo "Posting monthly CPU statistics to $checkin_server" - - ;; - *) - echo "Posting monthly device/CPU statistics disabled" - echo " set monthly_statistics_report_devices=yes in /etc/periodic.conf" - ;; - esac + [Yy][Ee][Ss]) + send_devices + echo "Posting monthly device statistics to $checkin_server" + line=$( sysctl -n hw.model ) + VEN=$( echo $line | cut -d ' ' -f 1 ) + DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) + count=$( sysctl -n hw.ncpu ) + do_fetch report_cpu.php?key=$KEY\&cpus=$count\&vendor=$VEN\&cpu_type=$DEV + echo "Posting monthly CPU statistics to $checkin_server" + ;; + *) + echo "Posting monthly device/CPU statistics disabled" + echo ' set monthly_statistics_report_devices="YES" in /etc/periodic.conf' + ;; + esac ;; *) - echo "Posting monthly OS statistics disabled" - echo " set monthly_statistics_enable=yes in /etc/periodic.conf" - ;; + echo "Posting monthly OS statistics disabled" + echo ' set monthly_statistics_enable="YES" in /etc/periodic.conf' + ;; esac umask $oldmask diff --git a/sysutils/bsdstats/files/300.statistics.in b/sysutils/bsdstats/files/300.statistics.in index 87620710574e..9a7a7be5992b 100644 --- a/sysutils/bsdstats/files/300.statistics.in +++ b/sysutils/bsdstats/files/300.statistics.in @@ -1,11 +1,10 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.10 2006-08-09 18:36:15 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.11 2006-08-14 07:35:09 scrappy Exp $ # # If there is a global system configuration file, suck it in. # -monthly_statistics_mailto="scrappy@hub.org,root" if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf @@ -15,6 +14,40 @@ fi oldmask=$(umask) umask 066 +checkin_server="bsdstats.org"; +id_token_file='/var/db/bsdstats' + +IFS=" +" + +send_devices () { + for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` + do + DRIVER=`echo $line | awk -F\@ '{print $1}'` + DEV=`echo $line | awk '{print $4}' | cut -c8-15` + CLASS=`echo $line | awk '{print $2}' | cut -c9-14` + query_string=$query_string`echo \&dev[]=$DRIVER:$DEV:$CLASS` + done + + do_fetch report_devices.php?key=$KEY$query_string +} + +get_id_token () { + if [ ! -f $id_token_file ] ; + then + IDTOKEN=$( /usr/bin/openssl rand -base64 16 ) + /usr/bin/fetch -qo $id_token_file "http://$checkin_server/scripts/getid.php?key=$IDTOKEN" + /usr/sbin/chown root:wheel $id_token_file + /bin/chmod 600 $id_token_file + echo "To protect against abuse, the initial challenge/response phase" + echo "contains a 15 minute pause. Please be patient while this time" + echo "limit elapses" + sleep 900 + fi + . $id_token_file + KEY=$( uri_escape $KEY ) +} + # RFC 2396 uri_escape () { echo ${1+$@} | sed -e ' @@ -37,57 +70,37 @@ do_fetch () { /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" } -checkin_server="bsdstats.hub.org"; case "$monthly_statistics_enable" in [Yy][Ee][Ss]) HN=`/bin/hostname` - SYS=`/usr/bin/uname -r` + REL=`/usr/bin/uname -r` ARCH=`/usr/bin/uname -m` OS=`/usr/bin/uname -s` - do_fetch getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS + get_id_token + do_fetch report_system.php?key=$KEY\&rel=$REL\&arch=$ARCH\&opsys=$OS echo "Posting monthly OS statistics to $checkin_server" case "$monthly_statistics_report_devices" in - [Yy][Ee][Ss]) -IFS=" -" - - do_fetch clear_devices.php?hn=$HN - for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` - do - DRIVER=`echo $line | awk -F\@ '{print $1}'` - VEN=`echo $line | awk '{print $4}' | cut -c12-15` - DEV=`echo $line | awk '{print $4}' | cut -c8-11` - CLASS=`echo $line | awk '{print $2}' | cut -c9-10` - SUBCLASS=`echo $line | awk '{print $2}' | cut -c11-14` - do_fetch report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&class=$CLASS\&subclass=$SUBCLASS\&hn=$HN - done - echo "Posting monthly device statistics to $checkin_server" - - line=$( sysctl -n hw.model ) - VEN=$( echo $line | cut -d ' ' -f 1 ) - DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) - n=0 - count=$( sysctl -n hw.ncpu ) - do_fetch clear_cpu.php?hn=$HN - while [ $n -lt $count ] - do - do_fetch report_cpu.php?cpu_id=CPU$n\&vendor=$VEN\&cpu_type=$DEV\&hn=$HN - n=$(( $n + 1 )) - done - echo "Posting monthly CPU statistics to $checkin_server" - - ;; - *) - echo "Posting monthly device/CPU statistics disabled" - echo " set monthly_statistics_report_devices=yes in /etc/periodic.conf" - ;; - esac + [Yy][Ee][Ss]) + send_devices + echo "Posting monthly device statistics to $checkin_server" + line=$( sysctl -n hw.model ) + VEN=$( echo $line | cut -d ' ' -f 1 ) + DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) + count=$( sysctl -n hw.ncpu ) + do_fetch report_cpu.php?key=$KEY\&cpus=$count\&vendor=$VEN\&cpu_type=$DEV + echo "Posting monthly CPU statistics to $checkin_server" + ;; + *) + echo "Posting monthly device/CPU statistics disabled" + echo ' set monthly_statistics_report_devices="YES" in /etc/periodic.conf' + ;; + esac ;; *) - echo "Posting monthly OS statistics disabled" - echo " set monthly_statistics_enable=yes in /etc/periodic.conf" - ;; + echo "Posting monthly OS statistics disabled" + echo ' set monthly_statistics_enable="YES" in /etc/periodic.conf' + ;; esac umask $oldmask diff --git a/sysutils/bsdstats/files/pkg-message.in b/sysutils/bsdstats/files/pkg-message.in index 062bedd470ad..a5451be1769d 100644 --- a/sysutils/bsdstats/files/pkg-message.in +++ b/sysutils/bsdstats/files/pkg-message.in @@ -1,15 +1,25 @@ +This script, meant to be run monthly, submits statistics anonymously +to a central checkin server (http://bsdstats.org), in an attempt to +generate reasonably accurate demographics of both *BSD usage, as well +as devices in use. + +Steps have been taken to make eliminate security concerns brought up +in earlier releases of this, including, but not limited to, not storing +anything in the database that has been deemed as 'sensitive' (ie. IP of +the reporting server, and hostname). + ******************** To enable the port, edit or create /etc/periodic.conf and add this line: - monthly_statistics_enable=yes + monthly_statistics_enable="YES" To enable device reporting, add this line: - monthly_statistics_report_devices=yes + monthly_statistics_report_devices="YES" To run it manually the first time, just run it as: /usr/local/etc/periodic/monthly/300.statistics To view current statistics, go to: - http://bsdstats.hub.org + http://bsdstats.org ******************** diff --git a/sysutils/bsdstats/pkg-message b/sysutils/bsdstats/pkg-message index 062bedd470ad..a5451be1769d 100644 --- a/sysutils/bsdstats/pkg-message +++ b/sysutils/bsdstats/pkg-message @@ -1,15 +1,25 @@ +This script, meant to be run monthly, submits statistics anonymously +to a central checkin server (http://bsdstats.org), in an attempt to +generate reasonably accurate demographics of both *BSD usage, as well +as devices in use. + +Steps have been taken to make eliminate security concerns brought up +in earlier releases of this, including, but not limited to, not storing +anything in the database that has been deemed as 'sensitive' (ie. IP of +the reporting server, and hostname). + ******************** To enable the port, edit or create /etc/periodic.conf and add this line: - monthly_statistics_enable=yes + monthly_statistics_enable="YES" To enable device reporting, add this line: - monthly_statistics_report_devices=yes + monthly_statistics_report_devices="YES" To run it manually the first time, just run it as: /usr/local/etc/periodic/monthly/300.statistics To view current statistics, go to: - http://bsdstats.hub.org + http://bsdstats.org ******************** |