socsvn commit: r237004 - in soc2012/tzabal/client-side/akcrs-head/usr.sbin: crashinfo crashreport

tzabal at FreeBSD.org tzabal at FreeBSD.org
Sun Jun 3 15:35:57 UTC 2012


Author: tzabal
Date: Sun Jun  3 15:35:54 2012
New Revision: 237004
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237004

Log:
  Add the code that implements the method for sending the report to the Central Collector machine. Method used: SSH (OpenSSH) with public-key authentication. Trivial change to /usr.sbin/crashinfo - follow the '3 echos, command, echo' scheme in the code that prints the capture buffer of ddb.

Modified:
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh

Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh
==============================================================================
--- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh	Sun Jun  3 14:54:50 2012	(r237003)
+++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh	Sun Jun  3 15:35:54 2012	(r237004)
@@ -307,10 +307,9 @@
 echo "kernel config"
 echo
 config -x $KERNEL
-
 echo
+
 echo "------------------------------------------------------------------------"
 echo "ddb capture buffer"
 echo
-
 ddb capture -M $VMCORE -N $KERNEL print

Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh
==============================================================================
--- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh	Sun Jun  3 14:54:50 2012	(r237003)
+++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh	Sun Jun  3 15:35:54 2012	(r237004)
@@ -17,7 +17,7 @@
 
 error()
 {
-	echo "${PROG}: ERROR: $*" 1>&2
+	echo "${PROG}: Error: $*" 1>&2
 }
 
 
@@ -123,24 +123,68 @@
 echo ${_email} | egrep '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$' \
  > /dev/null
 
-if [ "$?" -ne "0" ]; then
+if [ "$?" != "0" ]; then
 	error "Email address ${_email} is invalid."
 	exit 7
 fi
 
 
 ## Bundle the report
-report="report.tar"
+report="report.tar.gz"
 email_file=`mktemp /tmp/crashreport.XXXXXX`
-
 echo "${_email}" > ${email_file}
-tar -c -f ${report} ${_dumpdir}/${_file} ${email_file}
+
+tar -czf ${report} -C ${_dumpdir} ${_file} -C `dirname ${email_file}` \
+ `basename ${email_file}`
+
+if [ "$?" != "0" ]; then
+	error 'An error occurred when bundling the report.'
+	exit 8
+fi
 
 
 ## Send the report to the Central Collector machine
 user="reporter"
 hostname="akcrs.dyndns.org"
-scp -q ${report} ${user}@${hostname}:
+
+# Host public key
+host_public_key_file=`mktemp /tmp/crashreport.XXXXXX`
+echo "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIb\
+mlzdHAyNTYAAABBBIhASIzluEhQKC/R3aVYpdV7IU14XCDKnXp8c1/Bc2m6ri7S\
+aW0sJxihnGjgm4n3XFa+s5FpjHbN4snK4NAuDEY=" > ${host_public_key_file}
+
+# User private key
+user_private_key_file=`mktemp /tmp/crashreport.XXXXXX`
+echo "-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAxpufuG9WyYDhq/96/EmIrLd+ent/nZns7eHA41zeiSObGgTO
+Rml6w6aXSWglUzv3RHDilXYWcUpZ61ke5bf+coVARmfqp5qhpwxvoGr2//jD4R0x
+PLCY1U2bZKxEJhhresWQIhhF9TZ6zYRpkm3to9PpsqTfR812gDcKjBAZ3+RGGBhR
+7q/LNiXVasMyIplSobcZvC+5klh4J/N2u4teC9BruxVTBScyqsayJg1V4g4OmzZY
+VY0tHKOivn55X2tb5a9mKpKWxJY6OYo0r/3bqqfFC+b58hYSy51HR3mCpJBQJGgH
+a2uab/TEJ3i/A4Hnfv6iRDqhdxXfgPc3WetVrwIDAQABAoIBAFpXYfDwXGbuhDjL
+zrLB9DS0hwjJ8o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+qzSFo5qoSxa7siIRJf5/R3Cz6QRSy
+/Fn0mQpcI8AZkF96dt5thwIA5X2HmpxURI4gbmUHbXIq8+H9pHzQ8wPK6JeqEzxC
+4A2OywvWcs45QnlxYmKUIL6x8stKQAbtuHkbda3v/4ts/+6Y0jss
+-----END RSA PRIVATE KEY-----" > ${user_private_key_file}
+
+scp -q -o GlobalKnownHostsFile=${host_public_key_file} BatchMode=yes \
+ -i ${user_private_key_file} ${report} ${user}@${hostname}:
 
 
 # Everything went smoothly


More information about the svn-soc-all mailing list