From owner-svn-soc-all@FreeBSD.ORG Wed Jul 18 17:34:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C062B106564A for ; Wed, 18 Jul 2012 17:34:04 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 Jul 2012 17:34:04 +0000 Date: Wed, 18 Jul 2012 17:34:04 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120718173404.C062B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239558 - in soc2012/tzabal/server-side: akcrs-release/9.0.0/usr.sbin/crashreportd akcrs-setup X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 17:34:07 -0000 Author: tzabal Date: Wed Jul 18 17:34:04 2012 New Revision: 239558 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239558 Log: Add the directory server-side/akcrs-setup populated with the database.sql and setup files. The file database.sql creates the database schema of the database that will store the crash reports. The file setup is an installation guide that describes the steps that need to be done in the server machine before hosting the AKCRS. Added: soc2012/tzabal/server-side/akcrs-setup/ soc2012/tzabal/server-side/akcrs-setup/database.sql soc2012/tzabal/server-side/akcrs-setup/setup Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Wed Jul 18 17:06:48 2012 (r239557) +++ soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Wed Jul 18 17:34:04 2012 (r239558) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python +#!/usr/local/bin/python -tt import os import re @@ -111,8 +111,7 @@ def create_pid_file(): pid = os.getpid() - pid_file = '/home/tzabal/Desktop/crashreportd.pid' - #pid_file = '/var/run/crashreportd.pid' + pid_file = '/var/run/crashreportd.pid' try: file_obj = open(pid_file, 'w') file_obj.write(str(pid)) @@ -125,18 +124,22 @@ return True -# The infinite loop of the daemon -interval = 10 -crashreports_dir = '/home/tzabal/Desktop/crashreports' -#crashreports_dir = '/var/spool/crashreports' -extraction_dir = '/tmp/crashreports' -counter = 1 -create_pid_file() -while True: - print "== Pass:", counter, "==" - dirlist = os.listdir(crashreports_dir) - for filename in dirlist: - print "Report:", filename - check_report(filename) - counter += 1 - time.sleep(interval) \ No newline at end of file +def main(): + # The infinite loop of the daemon + interval = 10 + crashreports_dir = '/var/spool/crashreports' + extraction_dir = '/tmp/crashreports' + counter = 1 + create_pid_file() + while True: + print "== Pass: " + counter + " ==" + dirlist = os.listdir(crashreports_dir) + for filename in dirlist: + print "Report: " + filename + check_report(filename) + counter += 1 + time.sleep(interval) + + +if __name__ == '__main__': + main() \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-setup/database.sql ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-setup/database.sql Wed Jul 18 17:34:04 2012 (r239558) @@ -0,0 +1,69 @@ +/* + * Create the database schema of the AKCRS system + * for the PostgreSQL DBMS + */ + +--DROP TABLE Submitters; +--DROP TABLE Bugs; +--DROP TABLE Reports; + + +CREATE TABLE Submitters +( + id integer, + email varchar(254) NOT NULL, + passwd varchar(12) NOT NULL, + + PRIMARY KEY (id) +); + + +CREATE TABLE Bugs +( + id integer, + state varchar(10) NOT NULL, + reported integer NOT NULL, + + PRIMARY KEY (id) +); + + +CREATE TABLE Reports +( + id integer, + bug_id integer NOT NULL, + submitter_id integer NOT NULL, + received_date date DEFAULT CURRENT_DATE, + crash_type text, + crash_date date, + hostname text, + ostype text, + osrelease text, + version text, + machine text, + ps_axl text, + vmstat_s text, + vmstat_m text, + vmstat_z text, + vmstat_i text, + pstat_T text, + pstat_s text, + iostat text, + ipcs_a text, + ipcs_T text, + nfsstat text, + netstat_s text, + netstat_m text, + netstat_id text, + netstat_anr text, + netstat_anA text, + netstat_aL text, + fstat text, + dmesg text, + kernelconfig text, + ddbcapturebuffer text, + + PRIMARY KEY (id), + FOREIGN KEY (bug_id) REFERENCES Bugs(id), + FOREIGN KEY (submitter_id) REFERENCES Reports(id) +); Added: soc2012/tzabal/server-side/akcrs-setup/setup ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-setup/setup Wed Jul 18 17:34:04 2012 (r239558) @@ -0,0 +1,81 @@ +############################################################################### +## An installation guide that should be followed by the System Administrator ## +## of the machine that will host the Server side part of the AKCRS project. ## +## ## +## After the completion of this guide, the source code of the server side ## +## part of the project could be downloaded in /usr/src and build the system. ## +############################################################################### + + +########################################################### +# Part 1. FreeBSD +########################################################### + +# Find a machine that will host the server side part of the project. +# The machine's environment should be clean, dry, secure and preferably with low temperature. + +# Install the FreeBSD 9.0-RELEASE amd64 version. +# Login to the fresh system as root. + +# Add a new user named reporter (accept the default answers) +adduser + +# Create the directory where crash reports will arrive +mkdir /var/spool/crashreports + +# Give ownership of the directory to reporter +chown reporter:reporter /var/spool/crashreports + +# Make sure that the OpenSSH daemon is enabled +cat /etc/rc.conf | grep 'sshd_enable="YES"' + +# Create a backup of the original sshd_config file +cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig + +# For protocol version 2, use the HostKey of the ECDSA algorithm (default, but declare it explicitly) +sed -E -i '' 's/^#(HostKey.*ecdsa_key)/\1/' /etc/ssh/sshd_config + +# Distribute the SSH Host public key of the ECDSA algorithm with the crash reporter program (single line) +cat /etc/ssh/ssh_host_ecdsa_key.pub + +# Login as reporter +su reporter + +# Generate the SSH User pair of keys using the ECDSA algorithm without passphrase +ssh-keygen -t ecdsa + +# Copy the generated SSH User public key into the authorized_keys file +cat ~/.ssh/id_ecdsa.pub >> ~/.ssh/authorized_keys + +# Distribute the SSH User private key with the crash reporter program (multiple lines) +cat ~/.ssh/id_ecdsa + +# Logout (back to root) +exit + +# Restart the ssh daemon to load the new configurations +/etc/rc.d/sshd restart + +# Install the FreeBSD Ports Collection +portsnap fetch extract update + + +########################################################### +# Part 2. Apache +########################################################### + + + +########################################################### +# Part 3. PostgreSQL +########################################################### + + + +########################################################### +# Part 4. Python +########################################################### + +# Install Python (default: python 2.7.3) +cd /usr/ports/lang/python +make -DBATCH install clean \ No newline at end of file