<?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/"
	>

<channel>
	<title>jon zobrist (dot) com &#187; admin</title>
	<atom:link href="http://www.jonzobrist.com/tag/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonzobrist.com</link>
	<description>Unix, Linux, IT, Cloud, Meat</description>
	<lastBuildDate>Fri, 06 Jan 2012 18:59:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Quick remote SMTP page script in Python</title>
		<link>http://www.jonzobrist.com/2011/05/29/quick-remote-smtp-page-script-in-python/</link>
		<comments>http://www.jonzobrist.com/2011/05/29/quick-remote-smtp-page-script-in-python/#comments</comments>
		<pubDate>Sun, 29 May 2011 17:58:07 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[Alert]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=280</guid>
		<description><![CDATA[
Related posts:<ol>
<li><a href='http://www.jonzobrist.com/2011/05/29/lcod-5-29-2011-2-quick-tcp-port-check-scripts-in-python/' rel='bookmark' title='LCOD 5.29.2011 &#8211; 2 quick TCP port check scripts in Python'>LCOD 5.29.2011 &#8211; 2 quick TCP port check scripts in Python</a> <small>...</small></li>
<li><a href='http://www.jonzobrist.com/2011/05/04/my-ec2-ebs-raid-0-creation-script/' rel='bookmark' title='My EC2 EBS RAID-0 creation script'>My EC2 EBS RAID-0 creation script</a> <small>...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F05%2F29%2Fquick-remote-smtp-page-script-in-python%2F' data-shr_title='Quick+remote+SMTP+page+script+in+Python'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F05%2F29%2Fquick-remote-smtp-page-script-in-python%2F' data-shr_title='Quick+remote+SMTP+page+script+in+Python'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Disclaimer : You own what you do with this script, and are responsible for it. This script could cause problems with SMTP / mail server administrators, and you should be sure to get any use approved. I make no claims about the scripts fitness for any specific use.</p>
<p>I have several servers that are not allowed to communicate with the outside world. Often times this helps a lot, but it can be a pain when trying to send e-mail alerts. Combine that sometimes I&#8217;m not root on these boxes so I can&#8217;t simply change the postfix/exim/qmail/sendmail default relay server to something.</p>
<p>The work around is this script, which uses a hard coded SMTP server, so you&#8217;ll need to edit the script to change the from, to, and the smtp servers IP.</p>
<p>I haven&#8217;t set it to take arguments, as I rarely re-use it for different things. Let me know if you&#8217;d benefit from that and I&#8217;ll throw them in.</p>
<p><a title="Page.py script" href="http://jonzobrist.com/files/page.py.gz">Here is the script in gzipped format</a></p>
<p>Here is the code of the script :</p>
<p>#!/usr/bin/python<br />
#Author : jon@jonzobrist.com<br />
#License : BSD/public/freeware</p>
<p>import smtplib<br />
import sys</p>
<p>def prompt(prompt):<br />
return raw_input(prompt).strip()</p>
<p>fromaddr = &#8220;noreply@example.com&#8221;<br />
#toaddrs = ['userA@example.com','userB@example.com','Phone1@txt.att.net','Phone2@txt.att.net','userC@example.com']<br />
toaddrs = ['userA@example.com']<br />
subject = &#8220;[ALERT] Alert from localhost&#8221;</p>
<p>msg = (&#8220;From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n&#8221;<br />
% (fromaddr,toaddrs,subject))<br />
msg = msg + sys.argv[1]<br />
server = smtplib.SMTP(&#8216;server.ip.or.hostname&#8217;)<br />
#server.set_debuglevel(1)<br />
server.sendmail(fromaddr, toaddrs, msg)<br />
server.quit()</p>
<p>&nbsp;</p>
<p>Enjoy!</p>
<div class="shr-publisher-280"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F05%2F29%2Fquick-remote-smtp-page-script-in-python%2F' data-shr_title='Quick+remote+SMTP+page+script+in+Python'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F05%2F29%2Fquick-remote-smtp-page-script-in-python%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F05%2F29%2Fquick-remote-smtp-page-script-in-python%2F' data-shr_title='Quick+remote+SMTP+page+script+in+Python'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>Related posts:<ol>
<li><a href='http://www.jonzobrist.com/2011/05/29/lcod-5-29-2011-2-quick-tcp-port-check-scripts-in-python/' rel='bookmark' title='LCOD 5.29.2011 &#8211; 2 quick TCP port check scripts in Python'>LCOD 5.29.2011 &#8211; 2 quick TCP port check scripts in Python</a> <small>Disclaimer : These scripts could be considered malicious and should...</small></li>
<li><a href='http://www.jonzobrist.com/2011/05/04/my-ec2-ebs-raid-0-creation-script/' rel='bookmark' title='My EC2 EBS RAID-0 creation script'>My EC2 EBS RAID-0 creation script</a> <small>I want to write up a full howto/tutorial, but have...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2011/05/29/quick-remote-smtp-page-script-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Chef.</title>
		<link>http://www.jonzobrist.com/2011/04/21/getting-started-with-chef/</link>
		<comments>http://www.jonzobrist.com/2011/04/21/getting-started-with-chef/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 17:08:48 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[Chef]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Support - Servers]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[chef]]></category>
		<category><![CDATA[knife]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=249</guid>
		<description><![CDATA[I write a lot of scripts, configure a lot of systems, and do a lot of snapshot related backup/restore/sync stuff on servers in house, and in the cloud. Chef is a Ruby-based configuration management engine. There is a good intro here. I set up a Chef Server. There&#8217;s a good overview here. I followed the [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F04%2F21%2Fgetting-started-with-chef%2F' data-shr_title='Getting+started+with+Chef.'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F04%2F21%2Fgetting-started-with-chef%2F' data-shr_title='Getting+started+with+Chef.'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I write a lot of scripts, configure a lot of systems, and do a lot of snapshot related backup/restore/sync stuff on servers in house, and in the cloud.<br />
Chef is a Ruby-based configuration management engine. There is a good intro <a title="Chef information" href="http://www.rubyinside.com/chef-tasty-server-configuraiton-2162.html">here</a>.</p>
<p>I set up a Chef Server. There&#8217;s a good overview <a title="Chef Server Setup" href="http://vagrantup.com/docs/provisioners/chef_server.html">here.</a></p>
<p>I followed the instructions to setup a Chef server from this <a title="Setup Chef with RubyGems" href="http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation">Wiki on Opscode.</a></p>
<p>I also referred to the information from Grig Gheorghiu&#8217;s blog <a title="Chef installation and minimal configuration" href="http://agiletesting.blogspot.com/2010/07/chef-installation-and-minimal.html">here</a>.</p>
<p>Now that my server is up, I&#8217;m hoping to port my server configurations to Chef, with heavy reliance on <a title="Amazon EC2 AWS" href="http://aws.amazon.com/ec2/">EC2</a> and hopefully <a title="Ubuntu Enterprise Cloud UEC" href="http://www.ubuntu.com/business/cloud/overview">UEC</a>.</p>
<div class="shr-publisher-249"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F04%2F21%2Fgetting-started-with-chef%2F' data-shr_title='Getting+started+with+Chef.'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F04%2F21%2Fgetting-started-with-chef%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2011%2F04%2F21%2Fgetting-started-with-chef%2F' data-shr_title='Getting+started+with+Chef.'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2011/04/21/getting-started-with-chef/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup</title>
		<link>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/</link>
		<comments>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 00:31:57 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[MySQL Server Support]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=118</guid>
		<description><![CDATA[This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at hackmysql.com
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at <a title="MySQL Report" href="http://hackmysql.com/mysqlreport">hackmysql.com</a></p>
<p>As the user you want to set this up on, run the following commands.</p>
<p>(Note that I touch and then chmod og-rwx the .my.cnf file, since you&#8217;re putting your users mysql password in it, creating it and making it unreadable before editing is always a good idea.)</p>
<pre>wget http://hackmysql.com/scripts/mysqlreport
chmod uog+x mysqlreport
mkdir bin logs
mv mysqlreport bin/
touch ~/.my.cnf
chmod og-rwx ~/.my.cnf
vi ~/.my.cnf
</pre>
<p>Now, put in a client section like this in, you can find your sock file with grep sock /etc/my.cnf, or grep sock /etc/mysql/my.cnf</p>
<pre>[client]</pre>
<pre>user="root"</pre>
<pre>password="password"</pre>
<pre>socket=/var/run/mysqld/mysqld.sock</pre>
<p>Now, install perl&#8217;s DBD::MySQL</p>
<p>Debian/Ubuntu:</p>
<pre>sudo su</pre>
<pre>apt-get install libdbd-mysql-perl</pre>
<p>via CPAN/Other Linux/Generic BSD:</p>
<pre>perl -MCPAN -e shell</pre>
<p>Optional, update CPAN:</p>
<pre>install Bundle::CPAN</pre>
<pre>reload cpan</pre>
<p>(If there are errors on following some dependencies exit, and restart your CPAN shell, then start with install Bundle::CPAN)<br />
Install perl DBI</p>
<pre>install DBD::mysql
exit
</pre>
<p>Now, run it to test, you should see a bunch of text output</p>
<pre>~/bin/mysqlreport
</pre>
<p>Now, set it up to run from cron</p>
<pre>
crontab -e
</pre>
<p>Add a line like this (this will email to test@example.com a full report nightly at midnight, and put the last nights report in /home/USERNAME/logs/mysqlreport)</p>
<pre>
0 0 * * * /home/USERNAME/bin/mysqlreport --email test@example.com &gt; /home/USERNAME/logs/mysqlreport.log 2&gt;&amp;1
</pre>
<div class="shr-publisher-118"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F04%2F12%2Flcod-%25e2%2580%2593-4-12-10-%25e2%2580%2593-quick-mysqlreport-to-e-mail-setup%2F' data-shr_title='LCOD+%E2%80%93+4.12.10+%E2%80%93+Quick+Mysqlreport+to+e-mail+setup'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/04/12/lcod-%e2%80%93-4-12-10-%e2%80%93-quick-mysqlreport-to-e-mail-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 11.17.09 &#8211; Simple page/alert email script</title>
		<link>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/</link>
		<comments>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 05:52:37 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=100</guid>
		<description><![CDATA[Here&#8217;s a quick page script for *nix boxes with mail. I grabbed the mail / file redirect from http://theos.in/shell-scripting/send-mail-bash-script/ #!/bin/bash #Author : dougnaka@gmail.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it #Description : Quick alert/page script, edit EMAIL="" to include a comma separated list of emails to send [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Here&#8217;s a quick page script for *nix boxes with mail.<br />
I grabbed the mail / file redirect from</p>
<p>http://theos.in/shell-scripting/send-mail-bash-script/</p>
<p><code><br />
#!/bin/bash<br />
#Author : dougnaka@gmail.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it<br />
#Description : Quick alert/page script, edit EMAIL="" to include a comma separated list of emails to send to<br />
#Usage : page.sh "Short or long message"<br />
if [ "${1}" ]<br />
 then<br />
  SUBJECT="[ALERT] ${1}"<br />
  EMAIL=" someone@example.com"<br />
  EMAILMESSAGE="/tmp/`date +%s`-message"<br />
  echo "ALERT: at `date`" > ${EMAILMESSAGE}<br />
  echo "${1}" >> ${EMAILMESSAGE}<br />
  echo "From `hostname`" >> ${EMAILMESSAGE}<br />
  mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}<br />
  /bin/rm ${EMAILMESSAGE}<br />
else<br />
 echo "Usage: ${0} MESSAGE"<br />
 exit 1<br />
fi<br />
</code></p>
<div class="shr-publisher-100"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2009%2F11%2F17%2Flcod-11-17-09-simple-pagealert-email-script%2F' data-shr_title='+LCOD+-+11.17.09+-+Simple+page%2Falert+email+script+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2009/11/17/lcod-11-17-09-simple-pagealert-email-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 8.3.08 Get around annoying reboot during fdisk</title>
		<link>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/</link>
		<comments>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 05:47:18 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[fdisk]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=92</guid>
		<description><![CDATA[Do you ever try to reformat / repartition disks and Linux complains the kernel is still using the old table and you have to REBOOT (a sin on any *NIX) to fix this? The error is &#8220;WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Do you ever try to reformat / repartition disks and Linux complains the kernel is still using the old table and you have to REBOOT (a sin on any *NIX) to fix this?<br />
The error is &#8220;WARNING: Re-reading the partition table failed with error 16: Device or resource busy.<br />
The kernel still uses the old table.<br />
The new table will be used at the next reboot.&#8221;</p>
<p>This annoys me, what was happening on my Ubuntu 7.10 computer was I had a disk that used to be Linux and I put it into a USB / Firewire enclosure and fdisk&#8217;d it and then formatted it, but the automounter sees the partition exists as soon as the kernel rereads the partition table and mounts it. This isn&#8217;t safe or a good idea really, so, if you&#8217;re going to nuke a disk you should zero out any previous partitions by nuking the master partition table.</p>
<p>THIS IS A POTENTIALLY DANGEROUS OPERATION, YOU PROCEED AT YOUR OWN RISK, I WILL NOT ASSUME LIABILITY FOR LOST DATA OR ANY DAMAGES.</p>
<p>Ok, so make 100% absolutely sure you know the drive letter you&#8217;re getting with something like</p>
<p>dmesg | tail</p>
<p>and you&#8217;ll see something like</p>
<p> sd 18:0:0:0: [sdf] 488397168 512-byte hardware sectors (250059 MB)<br />
[3010413.606563] sd 18:0:0:0: [sdf] Test WP failed, assume Write Enabled<br />
[3010413.606568] sd 18:0:0:0: [sdf] Assuming drive cache: write through<br />
[3010413.607559] sd 18:0:0:0: [sdf] 488397168 512-byte hardware sectors (250059 MB)<br />
[3010413.608807] sd 18:0:0:0: [sdf] Test WP failed, assume Write Enabled<br />
[3010413.608811] sd 18:0:0:0: [sdf] Assuming drive cache: write through<br />
[3010413.608815]  sdf: sdf1 sdf2 < sdf5 ><br />
[3010413.651837] sd 18:0:0:0: [sdf] Attached SCSI disk<br />
[3010413.651880] sd 18:0:0:0: Attached scsi generic sg5 type 0<br />
[3010415.111787] kjournald starting.  Commit interval 5 seconds</p>
<p>Now run this (as root), substitude sdf for the device you found. BE WARNED that if Linux didn&#8217;t see your disk when you just plugged it in, you may be seeing the detection of an actual file system disk. The best way to tell is to run tail -f /var/log/kern.log (or /var/log/messages or something where the kernel logs, depending on your distribution of Linux)</p>
<p>fdisk -l /dev/sdf</p>
<p>This showed me</p>
<p>Disk /dev/sdf: 250.0 GB, 250059350016 bytes</p>
<p>255 heads, 63 sectors/track, 30401 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Disk identifier: 0x000969e0</p>
<p>   Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdf1   *           1       30024   241167748+  83  Linux<br />
/dev/sdf2           30025       30401     3028252+   5  Extended<br />
/dev/sdf5           30025       30401     3028221   82  Linux swap / Solaris</p>
<p>Now I check df -h and see that Ubunu already mounted /dev/sdf1 on /media/disk<br />
So I (as root) unmount it with<br />
umount /dev/sdf1</p>
<p>Now I zero the partition table, THIS CAN TOTALLY MESS UP YOUR DISK IN AN UNRECOVERABLE FASHION, SO BE REALLY REALLY REALLY SURE YOU HAVE THE  CORRECT DISK DEVICE NODE. IF YOU ARE UNSURE DO NOT PROCEED.<br />
(More info about the master boot record on the wikipedia article here. )</p>
<p>dd if=/dev/zero of=/dev/sdf bs=512 count=1</p>
<p>Now, proceed with creating the partition(s) and formatting<br />
fdisk /dev/sdf<br />
select n,p,enter,enter,w<br />
mkfs.ext3 /dev/sdf1</p>
<div class="shr-publisher-92"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F08%2F03%2Flcod-8-3-08-get-around-annoying-reboot-during-fdisk%2F' data-shr_title='LCOD+-+8.3.08+Get+around+annoying+reboot+during+fdisk+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2008/08/03/lcod-8-3-08-get-around-annoying-reboot-during-fdisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 5.17.08 &#8211; Locking down ssh access</title>
		<link>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/</link>
		<comments>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/#comments</comments>
		<pubDate>Sun, 18 May 2008 05:46:10 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=90</guid>
		<description><![CDATA[In light of an increase in ssh attacks , vulnerabilities and scans I am writing this guide to help you keep unwanted people from connecting to your server via SSH. If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In light of an increase in ssh attacks , vulnerabilities  and scans  I am writing this guide to help you keep unwanted people from connecting to your server via SSH.</p>
<p>If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could login to your box if they know the name of one of your users that you allow in via ssh within 30 minutes!<br />
See here for more info: http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<p>This applies to any PAM enabled Linux (or other PAM-enabled *nix like OS)</p>
<p>This guide will walk you through configuring your OpenSSH server to only allow public key authentication and limit that to specific users and groups. Errors in this guide or mistakes or differences in system configurations could lock you out of your own systems, be very careful and do not proceed unless you understand and assume the risk you are taking.</p>
<p>I assume no responsibility for YOUR actions. This guide was tested on Ubuntu 7.10 and fairly recent Gentoo system.</p>
<p>1. Limit SSH access to public/private keys only, deny X11 and TCP forwarding, and deny root ssh access<br />
Step 1 Discussion:<br />
Public/Private keys are not necessarily more secure than passwords, but it&#8217;s harder to  guess a private key, and if your users put passwords on their keys then an attacker must have or guess 2 things, the key and its password.</p>
<p>The root user is GOD on almost every Linux/*nix system out there, and nobody should be able to login directly as root remotely. In addition it&#8217;s a very common user, on almost every Linux/*nix system.</p>
<p>TCP and X11 forwarding is one of the coolest features of an ssh server. Unless you want people to be able to use your ssh server like a full access vpn to your local network, or any other network (bounce their attacks through your server), then you want this disabled. And X11 forwarding is great, but I never run an X11 server on something that is a &#8220;production&#8221; environment. If something requires an X11 server, like Oracle, then I run vncserver and allow ssh port forwarding so people can connect via ssh. I make sure to have full deny by default firewalls on all machines like this, limiting outbound access.</p>
<p>Step 1 HOWTO<br />
Edit /etc/ssh/sshd_config<br />
Make sure the following lines are not commented out, and don&#8217;t say something different</p>
<p>Protocol 2<br />
PermitRootLogin no<br />
UsePAM yes<br />
PasswordAuthentication no<br />
PubkeyAuthentication yes<br />
RSAAuthentication yes<br />
PermitEmptyPasswords no<br />
ChallengeResponseAuthentication no<br />
AllowTcpForwarding no<br />
X11Forwarding no</p>
<p>2. Create an ssh remote users group and add users to it who need remote ssh access<br />
Step 2 Discussion:<br />
The main reason I want to limit who has remote ssh access is because there are frequently system accounts or other automatically created accounts that I don&#8217;t want to have to monitor to make sure the installer didn&#8217;t just make a new user with a simple password or key. I want to have the default be nobody can ssh, and then I&#8217;ll add ssh permissions to users who need it.</p>
<p>Step 2 HOWTO:<br />
Let&#8217;s call our remote ssh users list rsshusers, we create it with the command<br />
groupadd rsshusers<br />
Now let&#8217;s say we have a user named mikey already setup, let&#8217;s add him to our new rsshusers group, with the command<br />
usermod -a -G rsshusers mikey<br />
Do this for every user you want to have ssh in remotely. Note that if you&#8217;re used to logging in remotely as root and are going to stop doing that, make sure you user can su to root with the command su.<br />
Login as the user, run<br />
su<br />
Put in your root password, if it accepts it and you are root (run whoami to verify) then you&#8217;re good to go. If it fails to let you su and you&#8217;re sure you have the password right you may need to be in the wheel group to us (default on FreeBSD and Gentoo).<br />
Back as root run the following command to add your user (again, mikey in this example) to your wheel group.<br />
usermod -a -G wheel mikey</p>
<p>Now we&#8217;re going to edit 2 files to limit remote ssh users to the group we made called rsshusers.<br />
First, edit /etc/pam.d/sshd (this was ssh on my Debian/Ubuntu systems)<br />
Add the line<br />
account    required     pam_access.so</p>
<p>This enables access accounting based on the /etc/security/access.conf file, which is the next one we are going to edit.<br />
On both my Gentoo and Debian system this file had every line commented out.<br />
At the end I added the following lines.</p>
<p>-:ALL EXCEPT root mikey:LOCAL<br />
+ : (rsshusers) : ALL<br />
- : ALL : ALL</p>
<p>Initially I tried to use a group like @rsshusers, however this didn&#8217;t seem to work, but () designates explicitly a group.</p>
<p>Restart sshd<br />
Gentoo:<br />
/etc/init.d/sshd restart<br />
Debian/Ubuntu:<br />
/etc/init.d/ssh restart</p>
<p>Now, without closing your root terminal, open a new one and make sure you can ssh in as mikey, and su to root.</p>
<p>Assuming everything went well you could try ssh&#8217;ing in as another user whose public key is correctly in place, but who isn&#8217;t in the rsshusers group.</p>
<p>Related links:</p>
<p>PAM:</p>
<p>http://devmanual.gentoo.org/tasks-reference/pam/index.html</p>
<p>http://linuxdocs.org/HOWTOs/User-Authentication-HOWTO/x101.html</p>
<p>http://tldp.org/HOWTO/User-Authentication-HOWTO/</p>
<p>http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html</p>
<p>OpenSSH:</p>
<p>http://www.openssh.com/</p>
<p>http://thinkhole.org/wp/2006/10/30/five-steps-to-a-more-secure-ssh/</p>
<p>http://www.cyberciti.biz/tips/rhel-centos-linux-install-configure-rssh-shell.html</p>
<p>http://geekzine.org/2007/09/28/easy-sftp-and-chroot-sftp-with-scponly/</p>
<p>Misc:<br />
Securing RedHat</p>
<p>http://help.unc.edu/?id=1859</p>
<p>Debian SSLkeys</p>
<p>http://wiki.debian.org/SSLkeys</p>
<p>Links in post:</p>
<p>http://www.securityfocus.com/news/11518</p>
<p>http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<div class="shr-publisher-90"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 6.6.07 &#8211; Simple SSH remote command execution</title>
		<link>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/</link>
		<comments>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 05:37:27 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=77</guid>
		<description><![CDATA[ssh -X -C -f HOSTNAME PROGRAM Of course you need to be running an X server (Linux/*BSD Desktop) on your client, and you need to have ForwardX11 yes or ForwardX11Trusted yes in your CLIENT&#8217;s /etc/ssh/ssh_config file and X11Forwarding yes in /etc/ssh/sshd_config on the SERVER. No related posts. Related posts brought to you by Yet Another [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>ssh -X -C -f HOSTNAME PROGRAM</p>
<p>Of course you need to be running an X server (Linux/*BSD Desktop) on your client, and you need to have<br />
 ForwardX11 yes<br />
or<br />
 ForwardX11Trusted yes</p>
<p>in your CLIENT&#8217;s /etc/ssh/ssh_config file<br />
and<br />
X11Forwarding yes<br />
in /etc/ssh/sshd_config<br />
on the SERVER.</p>
<div class="shr-publisher-77"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

