<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Chris Hardie &#187; computer science</title>
	<atom:link href="http://www.chrishardie.com/blog/tag/computer-science/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrishardie.com</link>
	<description>Personal Website and Blog for James Christopher Hardie</description>
	<lastBuildDate>Tue, 10 Apr 2012 02:20:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Solution for Google Treasure Hunt &quot;zipfile&quot; question</title>
		<link>http://www.chrishardie.com/2008/06/solution-for-google-treasure-hunt-zipfile-question/</link>
		<comments>http://www.chrishardie.com/2008/06/solution-for-google-treasure-hunt-zipfile-question/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 19:14:15 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[adventures]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[summersault]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.chrishardie.com/weblog/?p=271</guid>
		<description><![CDATA[You may or may not have been following the Google Treasure Hunt competition, a puzzle contest designed to test your knowledge of Computer Science, networking, and low-level UNIX trivia (as described on the Google blog). It&#8217;s also a way for them to find potential engineers to be assimilated &#8211;er, hired. I took one of the [...]]]></description>
			<content:encoded><![CDATA[<p>You may or may not have been following the <a href="http://treasurehunt.appspot.com/">Google Treasure Hunt competition</a>, a puzzle contest designed to test your knowledge of Computer Science, networking, and low-level UNIX trivia (as <a href="http://googleblog.blogspot.com/2008/06/treasure-hunt-last-leg-of-journey.html">described on the Google blog</a>).  It&#8217;s also a way for them to find potential engineers to be assimilated &#8211;er, hired. I took one of the questions for a spin today, and thought I&#8217;d post my methodology to solve it.  It probably wasn&#8217;t the fastest way, but it worked for me; if anyone has suggestions for improvements, let me know!  Here&#8217;s the puzzle:<br />
<span id="more-271"></span><br />
The site gives you a uniquely generated zip archive, full of directories and subdirectories and randomly named files, for you to download and extract.  Their instructions from there (also generated uniquely for me, but with the same basic challenge each time):</p>
<blockquote><p>Unzip the archive, then process the resulting files to obtain a numeric result. You&#8217;ll be taking the sum of lines from files matching a certain description, and multiplying those sums together to obtain a final result. Note that files have many different extensions, like &#8216;.pdf&#8217; and &#8216;.js&#8217;, but all are plain text files containing a small number of lines of text.</p>
<p><strong>Sum of line 4 for all files with path or name containing bar and ending in .xml</strong><br />
<strong>Sum of line 2 for all files with path or name containing bar and ending in .txt</strong><br />
Hint: If the requested line does not exist, do not increment the sum.</p>
<p>Multiply all the above sums together and enter the product below.<br />
(Note: Answer must be an exact, decimal representation of the number.) </p></blockquote>
<p>And my solution, starting from a Unix prompt in the directory where the files were unpacked to:</p>
<p><code># find . -ipath "*bar*.xml" -print | xargs grep -h -n '.*' | egrep '^4:'| cut -d':' -f2<br />
# find . -ipath "*bar*.txt" -print | xargs grep -h -n '.*' | egrep '^2:'| cut -d':' -f2</code></p>
<p>I then took the two lists of numbers, pasted them into a spreadsheet, and multiplied the two sums into the final answer.  I started to look at Unix tools to sum a list of numbers passed as arguments, but unsure if Google was timing me, I opted for the spreadsheet instead to keep it fast.</p>
<p>I could have also used &#8220;<code>cat -n</code>&#8221; to generate the line-number-prefixed output, but for some reason grep was on the brain.</p>
<p>How would you do it?</p>
<p>I like this puzzle as a potential test for a network/Unix sysadmin, and plan to use it at some point (especially since we&#8217;re trying to <a href="http://www.summersault.com/about/careers.html">hire a system administrator at Summersault</a>).  Maybe Google will release their puzzle generation code?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishardie.com/2008/06/solution-for-google-treasure-hunt-zipfile-question/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Computer Security Audit Checklist</title>
		<link>http://www.chrishardie.com/2003/04/computer-security-audit-checklist/</link>
		<comments>http://www.chrishardie.com/2003/04/computer-security-audit-checklist/#comments</comments>
		<pubDate>Tue, 22 Apr 2003 03:35:59 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.chrishardie.com/?p=1284</guid>
		<description><![CDATA[This document discusses methods for performing a thorough and effective security audit on a computer system or network. It will not specifically discuss the technical details of prevention on specific computer systems, but will rather provide a general checklist for examining the security on a computer system. (This document has aged somewhat, but the checklist [...]]]></description>
			<content:encoded><![CDATA[<p>This document discusses methods for performing a thorough and effective  security audit on a computer system or network. It  will not specifically discuss the technical details of prevention on specific  computer systems, but will rather provide a general checklist for examining the security on a computer system. (This document has aged somewhat, but the checklist items are still quite applicable. It&#8217;s too bad that computer security isn&#8217;t an area seeing more improvement.)</p>
<p>If you&#8217;re interested in having me speak to your organization about computer security, please see my page on <a title="Speaking" href="http://www.chrishardie.com/speaking/">speaking requests</a>. My company, <a href="http://www.summersault.com/">Summersault</a>, is available for certain kinds of security consulting services.</p>
<p>This document is not an authoritative or comprehensive one; you should check with the information management policy of your particular institution for steps to follow to secure your system. The author of this document shall not be liable for any damage, direct or indirect, incurred in the following of this advice. If you have experienced  a security breach, you should contact an experienced security professional to evaluate recovery options.</p>
<h2>Contents</h2>
<ol>
<li><a href="#physical">Physical Security</a></li>
<li><a href="#network">Network Security</a></li>
<li><a href="#services">Protocols / Services</a></li>
<li><a href="#user">User Security</a></li>
<li><a href="#storage">Data Storage Security</a></li>
<li><a href="#passwords">Passwords</a></li>
<li><a href="#sysadmin">System Administration</a></li>
</ol>
<h2><a id="physical" name="physical"></a>1. Physical Security</h2>
<p>Physical security is the MOST important part of maintaining the security of  a computer system, and is often overlooked by careless system administrators  who assume their occasional proximity to a system is enough protection. This  may be sufficient for some systems, but in most cases, there are more factors  to be considered before a system can be called physically safe and secure.</p>
<ul>
<li>Is the system located on a sturdy, stable surface as close to the ground  as possible?</li>
<li>Is the system safe from excessive sunlight, wind, dust, water, or extreme  hot/cold temperatures?</li>
<li>Is this system located in a monitored, isolated area that sees little human  traffic?</li>
<li>Is the room/building in which the system is located secured by lock and  alarm system to which only a few trusted personnel have access? Are these  locks and alarms locked and armed during off-hours?</li>
<li>Is the terminal of the system secured to prevent someone from casually walking up to the system and using it (even if just for a few seconds)? Are all users logged out from the terminal?</li>
<li>Are the power and reset switches protected or disabled?</li>
<li>Are any input devices to the system secured/turned off: are all removable  disk drives locked/secured? Are the parallel/serial/infared/USB/SCSI ports  secured or removed? Are any attached hard drives physically locked down to  the system?</li>
</ul>
<h2><a id="network" name="network"></a>2. Network Security</h2>
<p>Network security is the SECOND MOST important  part of maintaining a system security. While good physical security can go a  long way, if you operate your system in a networked/multi-user environment, the system is many times more susceptible to outside attacks than a standalone system. Network security is also harder to evaluate because it requires a thorough  understanding of the various components and layers of your system and all the external services that interact with your system.</p>
<ul>
<li>Physical network: is the network connection a secure &#8220;pipe&#8221; with  no danger of unauthorized rewiring? Do only authorized personnel have physical  access to the physical network to which the system is attached? Do you know  and trust all of the various points where your physical network connection  is managed/administered by another person or entity?</li>
<li>Are the other systems on the same network physically and electronically  secure? If your system is reasonably secure but another system on the network  is not, your system&#8217;s vulnerability is increased greatly.</li>
<li>Approved Network Traffic
<ul>
<li>Do you know the names, functionality, vendor, and nature of the software  on your system that participates in any network activity? Have you checked  all the vendors for security patches, and do you regularly receive security  updates about patches/vulnerabilities to the software you use in a networked  environment?</li>
<li>Have you thoroughly tested any and all services that interact with the  network to insure that they do not, by default, provide any unauthorized  users with useful security information that could be used to attack the  system?</li>
<li>Do you effectively limit your users` abilities to make sensitive information  about the system available over the network?</li>
<li>Do you only allow trusted users shell/command  line access to your system?</li>
<li>Are you aware of any security holes created by certain software packages  interacting with each other?</li>
<li>Do you keep sufficient logs of all approved network activity?</li>
<li>Are you aware of all the software that should be interacting with the  network, the port numbers they use, the size and location of their binaries,  etc.?</li>
<li>Do user accounts that are accessible over the network regularly have  their passwords changed?</li>
<li>Do you encrypt sensitive data  that is transferred over the network?</li>
</ul>
</li>
<li>Unapproved Network Traffic
<ul>
<li>Do you regularly check for repeated unauthorized attempts to connect  to your system over a network? Do you keep sufficient logs of all network  activity related to your system?</li>
<li>Do you regularly check for unauthorized programs running on your system  that could potentially allow a user to connect over the network?</li>
<li>Do you monitor for excessive or unusual network activity that comes  to your system?</li>
</ul>
</li>
</ul>
<h2><a id="services" name="services"></a>3. Protocols / Services</h2>
<p>Once you are past the physical and network layers of your system, the next  category of evaluation is perhaps one of the largest; computers are made to  compute, and depending the purpose of your system, it will be running many different  kinds of software and programs at any point in time. It is likely in most cases  that, because all of the software was written by different people with different  understandings of security (and because there are always people who know <strong>more</strong> about security), at least one of those programs has some sort of security hole  that could be exploited.</p>
<ul>
<li>While it is generally safe to assume that software that comes pre-installed  on a new system is reasonably secure, you should always check with software  vendors for security patches, release notes, and other relevant information  to your particular configuration.</li>
<li>For any software that you install onto a new system, make sure you are fully  aware of the credentials of the vendor, any security patches, existing exploits,  and release notes that exist. You should make it a habit to check in with  vendors every month or so for new releases that may have security fixes. It&#8217;s  also a good idea to subscribe to mailing lists for your software, or general  mailing lists, that would announce security holes early.</li>
<li>Misconfiguration is probably the most common cause of someone exploiting  a security hole. Most software is written to be reasonably secure, but even  the most secure software can be used for unintended purposes if it is poorly  configured. Always follow the vendor&#8217;s instructions for installing software,  and always take notes on any problems you encounter in the configuration process.  If a piece of software requires special privileges to be installed or run  (e.g. running <em>setuid</em> on a UNIX system), make sure you understand the  full implications of having it do so, and any side-effects created in the  process. Test your configuration of the software thoroughly; try to break  it, try to hack into it, and see if others can do the same.</li>
<li>If a program accesses sensitive data, make sure that it can only be executed  by authorized users, and make sure that any logs or temporary information  is stored in a safe place and promptly disposed of; people can do amazing  things with the simple information found in a system log file.</li>
<li>If a piece of software runs as a <em>daemon</em> (i.e. it is constantly running and responds to requests from users locally or over the network), make sure it properly handles buffer overflows, denial of service attacks,  and general heavy system load. It&#8217;s generally a good idea to have as few services  as possible running as daemons, as they allow continuous and typically unmonitored  access to your system.</li>
<li>Be aware of all the services that are supposed to be running on your system,  the typical amount of resources (e.g. CPU time, memory, disk space) that they  take up. Check for unidentifiable daemons or software, or programs that are  unusual in their resource consumption. Remember that most security breaches  occur using the existing configuration of a system rather than installing  a new one; unless you&#8217;re careful, an intruder can manipulate the system to  their liking and you won&#8217;t notice anything out of the ordinary.</li>
<li>Run process accounting to keep track of typical software usage patterns  of your users.</li>
</ul>
<h2><a id="user" name="user"></a>4. User security</h2>
<p>The particulars of user security varies widely with the nature of the system  you&#8217;re running. In some cases, a system will be an isolated machine performing  mostly server functions with very few users who actually log in to the system  and use it directly, most of the users thusly being people interacting with  the server functions. In other cases, a system might have hundreds of users  directly accessing the system simultaneously. Obviously, the degree to which  user security is a concern depends largely on the character of your users, but  be aware that one user who attempts to breach security, or who has poor security  practices, can affect and possibly endanger an entire system.</p>
<ul>
<li>Develop a standard method for creating and maintaining user accounts. Develop  clear and concise acceptable use policies, and publish them well to your users.  Don&#8217;t create user accounts for people or organizations whom you have not previously  interacted with in some form, or who have been known to have security problems  on other systems.</li>
<li>You should set limits on the amount of resources a user can consume, from  number of logins to amount of disk space; make sure that the user cannot cause  a security breach or take down the system out of pure stupidity (e.g. a recursive  script that creates a 10 M file each time)</li>
<li>In some cases, you may want to limit the manner in which a user can connect to the system; if you&#8217;re providing a terminal login, make sure the terminal itself is secure and reasonably maintained. If you provide direct access via protocols such as telnet, consider running services such as tcp_wrappers  or identd that verify the user is connecting from the system they claim to  be connecting from.</li>
<li>Keep accurate logs of user activity; specifically, connection time, connection  duration, and the place where they logged in/connected from. In some cases  you may want to log more detail with process accounting, user command history,  and activity monitoring.</li>
<li>You should regularly check for irregular user activity; there are many programs  available that constantly &#8220;patrol&#8221; for failed attempts on the part of users to gain administrator privileges,  access files that they shouldn&#8217;t, or perform other unauthorized tasks.</li>
</ul>
<h2><a id="storage" name="storage"></a>5. Data storage security</h2>
<p>Data and file storage, at first, does not seem to present itself as a security  risk; either people have access to files or they don&#8217;t! In reality, it turns  out that there are many and complicated ways to access the same data on a given  system, and a good system administrator should be aware of these schemes.</p>
<ul>
<li>Know the file ownership scheme that your system implements; is it group based, user based, role based, or some  combination of these? Know the different levels of protection you can apply  to files and directories, and be aware of who has access to make changes to  these protections.</li>
<li>Know the general structure of your filesystems, how much is stored where,  and who typically accesses what parts of them. Keep logs of disk activity  (e.g. significant changes in disk space used) and of any disk problems.</li>
<li>Make sure that users are only able to access the parts of the system relevant  to their use of it; your protection scheme should clearly and easily include  a logical and conceptual separation of user and data files from system files.</li>
<li>Make sure that the file ownership schemes are consistent for various directories  (i.e. that the owner of a directory owns all the files in that directory,  etc.)</li>
<li>Insure that users cannot have access to more disk resources than you intend;  often user disk quotes are the best solution to this.</li>
<li>If your filesystems are available via any sort of network or sharing protocol.,  carefully examine the security of these protocols (see the protocols/services  section above). Always check your configuration of these services to make  sure that only authorized users and hosts are allowed to access shared data;  many configurations by default allow for unauthorized access.</li>
<li>Always maintain secure backups of a system; the most standard conventional  method is to backup files to a tape disk and then to remove that tape from  the site to guard against data loss from fire, flooding, etc. In the case  of operating systems, it&#8217;s a good idea to maintain a known good copy of your  operating system&#8217;s configuration on a read-only media such as a CD-ROM.</li>
<li>If you maintain any databases, make sure that the database is accessible  only to authorized users, both on the client side (via a data querying tool  such as SQLnet) and on the server side (i.e. the actual database files stored  on the disk drive of your system). As with other services, make sure any network  and sharing of databases is done securely.</li>
</ul>
<h2><a id="passwords" name="passwords"></a>6. Passwords</h2>
<p>Passwords are the central components in most security schemes; user accounts,  sensitive websites, system services are all protected by them. If you know the  right passwords, you can gain administrative privileges on a system where you  may not even be a user or infiltrate an environment you&#8217;ve never even worked  with before. They are conventionally accepted as a good way to implement security  because they can be incorporated easily into most operating systems and sensitive  software, and yet can be made complex enough to be difficult to &#8220;crack&#8221;,  while still being remembered by a user. Their downfall as a security scheme  are in their power; one password is all you need to have complete access to  an entire system, and passwords CAN be cracked. The best you can do is try to  make these two events very unlikely.</p>
<ul>
<li>Require unique, complex passwords for all user accounts on your system;  it&#8217;s not acceptable to have &#8220;guest&#8221; accounts or other accounts that  don&#8217;t require any sort of authentication. If an account is not ever used for  connection (i.e. that account will never be accessed), remove its ability  to login altogether.</li>
<li>Passwords should contain at least 6 characters and have a combination of  letters and numbers, uppercase and lowercase. Passwords should not resemble  any word, name, idea, or concept that might appear in any dictionary anywhere  in the world. A good example: <strong>jY2EHxqy</strong></li>
<li>Enforce password rotation and expiration; users should never be able to  keep a password for more than a few months at a time, as someone could easily  (but unnoticeably) brute force hack a password over a long period of time.  You should also advise users against using the same password in other places.</li>
<li>The password file or similar mechanism for storing the passwords should be encrypted, and should not be available to the average user if possible (e.g. via shadowing). If a user can  obtain the password file, they can use another system to try to crack the  passwords without you noticing.</li>
<li>Never write passwords down or store them in anything but human memory.</li>
<li>System passwords should be changed at least once a month, and should not  be shared with more people than is necessary.</li>
</ul>
<h2><a id="sysadmin" name="sysadmin"></a>7. System Administration</h2>
<p>Quality system administration techniques can make all the difference in security prevention. There&#8217;s not a lot required for most modern systems; many do self-checks and keep the system administrator automatically  informed of any suspicious changes. But there are still a few general tips to  follow:</p>
<ul>
<li>Regularly browse through your system, looking at the contents of system  directories, logs, and other files. Note file locations, file sizes. Observe  the usage patterns of your machine and your users.</li>
<li>Run cracking tools (such as &#8220;CRACK&#8221; and &#8220;Satan&#8221; in the Unix environment) regularly to check for vulnerabilities in your system configuration</li>
<li>Manually try to break into your system through different means.</li>
<li>Be aware of persons or groups who may have intentions of breaking into your  system.</li>
<li>Keep your users advised of your techniques and what you expect of them to  maintain security.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishardie.com/2003/04/computer-security-audit-checklist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

