<?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>Analysis and Review &#187; Unix</title>
	<atom:link href="http://analysisandreview.com/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://analysisandreview.com</link>
	<description>Brain Dumps For All</description>
	<lastBuildDate>Fri, 13 Apr 2012 12:51:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Ubuntu 10 LAMP Optimization Guide</title>
		<link>http://analysisandreview.com/unix/ubuntu-10-lamp-optimization-guide/</link>
		<comments>http://analysisandreview.com/unix/ubuntu-10-lamp-optimization-guide/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 20:52:31 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=944</guid>
		<description><![CDATA[Ubuntu 10 Linux / Apache2 / MySQL / PHP Guide is all about optimizing Apache, MYSQL and PHP to work faster together to serve up webpages created by the WordPress content management system. The setting you use for any server depend heavily upon the amount of available RAM / CPU etc as well as the ]]></description>
			<content:encoded><![CDATA[<p>Ubuntu 10 Linux / Apache2 / MySQL / PHP Guide is all about optimizing Apache, MYSQL and PHP to work faster together to serve up webpages created by the WordPress content management system.<span id="more-944"></span></p>
<p>The setting you use for any server depend heavily upon the amount of available RAM / CPU etc as well as the consumption of these resources by other application and or services running in your environment.</p>
<p>In general you want to modify several configuration files to obtain optimal performance. The files you need to modify are:</p>
<ul>
<li>/etc/apache2/apache2.conf</li>
<li>/etc/mysql/my.cnf</li>
<li>/etc/php5/apache2/php.ini</li>
</ul>
<p><strong>Let&#8217;s start with apache2.conf</strong></p>
<p>Apache2.conf is the main Apache server configuration file. It contains the configuration directives that give the server its instructions. See <a href="http://httpd.apache.org/docs/2.2/" target="_blank">http://httpd.apache.org/docs/2.2/</a> for detailed information about the directives.</p>
<p>I want to focus on:</p>
<ul>
<li>Timeout 300</li>
<li>KeepAlive On</li>
<li>MaxKeepAliveRequests 100</li>
<li>KeepAliveTimeout 1</li>
</ul>
<p>These keep alive and timeout setting stop external request from eating up apache processes. The above setting will work for just about any setup.</p>
<p>Next let&#8217;s talk about the prefork module in apache2.conf, you want to start with</p>
<p><code><br />
<IfModule mpm_prefork_module><br />
    StartServers          4<br />
    MinSpareServers       4<br />
    MaxSpareServers      10<br />
    MaxClients           40<br />
    ServerLimit          30<br />
    MaxRequestsPerChild  2000<br />
</IfModule><br />
</code></p>
<p>This tells apache how many workers to start with max amount of allowed connects. These numbers play a role in CPU and adjusting them and monitoring the changes overtime will help you optimize apache.</p>
<p>Now restart apache to load the new configuration.</p>
<p><code>/etc/init.d/apache2 restart</code></p>
<p><strong>Now let&#8217;s move on to my.cnf </strong></p>
<p>located in /etc/mysql/my.cnf this controls, among other things, the resource mysql will consume, most importantly RAM. </p>
<p><code><br />
[mysqld]<br />
key_buffer = 512M<br />
sort_buffer_size = 8M<br />
read_buffer_size = 8M<br />
read_rnd_buffer_size = 8M<br />
myisam_sort_buffer_size = 40M<br />
query_cache_size = 64M<br />
skip-innodb<br />
table_cache            =  128<br />
max_allowed_packet      = 6M<br />
thread_stack            = 192K<br />
thread_cache_size       = 8<br />
query_cache_limit       = 1M<br />
query_cache_size        = 16M<br />
[mysqldump]<br />
quick<br />
quote-names<br />
max_allowed_packet      = 16M<br />
[isamchk]<br />
key_buffer              = 16M<br />
</code></p>
<p>The above is a good mysql optimization starting part. Only use skip-innodb if your using wordpress without innodb enabled, which is default for wordpress. </p>
<p><strong><br />
Now we move to PHP optimization.</strong></p>
<p>You&#8217;re going to optimize the php.ini file located /etc/php5/apache2/php.ini</p>
<p><code><br />
max_execution_time = 30<br />
memory_limit = 64M<br />
mysql.cache_size = 2000<br />
session.gc_maxlifetime = 1440<br />
mysqli.cache_size = 2000<br />
</code></p>
<p>The above is a good starting point for optimization on a standard size ubuntu server with average resources for a small to medium size server. PHP isn&#8217;t to bad of a memory hog but if your pages are dynamic created with PHP you&#8217;ll see CPU spikes on page loads if your server isn&#8217;t configured optimally or your resources are just extended to far due to server load.</p>
<p><strong>Some other points of interest.</strong></p>
<p>Are you using any type of caching with WordPress (such as WP-SuperCache)?  You may be able to squeeze a bit more performance out of your Ubuntu server by implementing some caching for the websites themselves.</p>
<p>If this does not handle the caching efficiently enough there are more advanced solutions available including using Memcached and Varnish.  Memcached is used to cache SQL queries, and Varnish is used to cache dynamic content websites to allow you to serve the content faster.</p>
<p>Along with that you may want to consider scaling your services horizontally.  This would be to separate your web server and your SQL server to separate hardware.  This would allow your web server and SQL database to operate on different hardware, therefore they would not need to contend with each other for system resources.</p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/ubuntu-10-lamp-optimization-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tips for Webmasters, redirects, find, reload</title>
		<link>http://analysisandreview.com/unix/quick-tips-for-webmaster/</link>
		<comments>http://analysisandreview.com/unix/quick-tips-for-webmaster/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 05:04:26 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=790</guid>
		<description><![CDATA[Reload Apache2 /etc/init.d/apache2 reload a2ensite domainname.com display query status on page &#60;!&#8211; &#60;?php print $query;//print_r($results); ?&#62; &#8211;&#62; Redirects Redirect 301 /somedomain /forwardtohere Redirect 301 http://oldodmain.oldpage.html http://google.com This one will 301 redirect the entire directory to a certain file (location) or homepage. RedirectMatch 301 ^/community(.*) http://fantasyknuckleheads.com mysql replace for wordpress multisite UPDATE wp_9_posts SET post_content = ]]></description>
			<content:encoded><![CDATA[<p>Reload Apache2<br />
/etc/init.d/apache2 reload</p>
<pre>a2ensite domainname.com</pre>
<p><span id="more-790"></span></p>
<p>display query status on page &lt;!&#8211; &lt;?php print $query;//print_r($results); ?&gt; &#8211;&gt;</p>
<p>Redirects<br />
Redirect 301 /somedomain /forwardtohere<br />
Redirect 301 http://oldodmain.oldpage.html http://google.com<br />
<em>This one will 301 redirect the entire directory to a certain file (location) or homepage.</em><br />
RedirectMatch 301 ^/community(.*) http://fantasyknuckleheads.com</p>
<p>mysql replace for wordpress multisite<br />
UPDATE wp_9_posts SET post_content = REPLACE(post_content, &#8216;/wp-content/uploads/&#8217;, &#8216;/wp-content/blogs.dir/9/files/uploads/&#8217;);</p>
<p>Find files with ubuntu linux<br />
find / -iname &#8216;*.ogg&#8217;<br />
find / -name domfile.txt</p>
<p>grep -iR &#8220;Player not found into database&#8221; /var/www/html/wp-content/plugins/simple-tags/inc/</p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/quick-tips-for-webmaster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mass Insert Data into a mySQL Table</title>
		<link>http://analysisandreview.com/unix/mass-insert-data-into-a-mysql-table/</link>
		<comments>http://analysisandreview.com/unix/mass-insert-data-into-a-mysql-table/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 13:29:42 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=783</guid>
		<description><![CDATA[How to mass insert data into a table via mySQL. INSERT INTO table_name_goes_here( group_id, parent_id, type, name) VALUES( '1', '2', 'option', 'Aaron Rodgers' ), ( '1', '2', 'option', ' ) Or just add one item INSERT INTO NFL2010_ProjectedStats(`player`,`pos`,`team`,`p-yds`,`p-td`,`int`,`ru-yds`,`ru-td`,`rec`,`re-yds`,`re-td`,`bonus`)VALUES('Kareem Huggins','RB','TB','0','0','0','500','2','35','350','1','0')]]></description>
			<content:encoded><![CDATA[<p>How to mass insert data into a table via mySQL. <span id="more-783"></span></p>
<p><code>INSERT INTO table_name_goes_here(<br />
group_id,<br />
parent_id,<br />
   type,<br />
   name)<br />
VALUES(<br />
        '1',<br />
	'2',<br />
        'option',<br />
        'Aaron Rodgers'<br />
     ),<br />
(<br />
        '1',<br />
	'2',<br />
        'option',<br />
        '<br />
)</p>
<p>Or just add one item</p>
<p>INSERT INTO NFL2010_ProjectedStats(`player`,`pos`,`team`,`p-yds`,`p-td`,`int`,`ru-yds`,`ru-td`,`rec`,`re-yds`,`re-td`,`bonus`)VALUES('Kareem Huggins','RB','TB','0','0','0','500','2','35','350','1','0')</p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/mass-insert-data-into-a-mysql-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to capture packets with tcpdump and output to pcap for wireshark</title>
		<link>http://analysisandreview.com/unix/how-to-capture-packets-with-tcpdump-and-output-to-pcap-for-wireshark/</link>
		<comments>http://analysisandreview.com/unix/how-to-capture-packets-with-tcpdump-and-output-to-pcap-for-wireshark/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 21:25:48 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[tcpdump]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=754</guid>
		<description><![CDATA[how to capture packets with tcpdump and output to pcap for wireshark -s 0 tell tcpdump to get the entire packet -w filename.pcap is going to be your output file name not port 1024 tells tcpdummp to ignore port 1024 you can also say port 1024 to capture packets on that port with tcpdump tcpdump ]]></description>
			<content:encoded><![CDATA[<p>how to capture packets with tcpdump and output to pcap for wireshark<span id="more-754"></span></p>
<p>-s 0 tell tcpdump to get the entire packet<br />
-w filename.pcap is going to be your output file name<br />
not port 1024 tells tcpdummp to ignore port 1024<br />
you can also say port 1024 to capture packets on that port with tcpdump</p>
<p>tcpdump -s 0 -w filename.pcap not port 1024 and not port 80</p>
<p>You can optionally <a href="http://analysisandreview.com/cisco/how-to-configure-a-packet-capture-in-the-cisco-asa/">capture the packets with your firewall </a></p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/how-to-capture-packets-with-tcpdump-and-output-to-pcap-for-wireshark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Sendmail with FreeBSD</title>
		<link>http://analysisandreview.com/unix/how-to-use-sendmail-with-freebsd/</link>
		<comments>http://analysisandreview.com/unix/how-to-use-sendmail-with-freebsd/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 17:07:36 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[send mail]]></category>
		<category><![CDATA[Sendmail]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=750</guid>
		<description><![CDATA[Using sendmail with freebsd is easy. Here we will cover how to start and stop sendmail how to send mail with sendmail how to send mail from the terminal, cli, command prompt how to make sendmail start at boot time How to start and stop send mail: How to send mail with sendmail from the ]]></description>
			<content:encoded><![CDATA[<p>Using sendmail with freebsd is easy. Here we will cover<span id="more-750"></span></p>
<ul>
<li>how to start and stop sendmail</li>
<li>how to send mail with sendmail</li>
<li>how to send mail from the terminal, cli, command prompt</li>
<li>how to make sendmail start at boot time</li>
</ul>
<p>How to start and stop send mail:</p>
<ol>
<li>
<pre class="brush: php; title: ; notranslate">/etc/rc.d/sendmail  stop&lt;/li&gt;
	&lt;li&gt;/etc/rc.d/sendmail  start&lt;/li&gt;
	&lt;li&gt;/etc/rc.d/sendmail restart</pre>
</li>
</ol>
<p>How to send mail with sendmail from the terminal aka cli or command prompt or root</p>
<pre class="brush: php; title: ; notranslate">mail someuser@somedomain.com
Subject: For Testing Only
This email is for testing the mail delivery system only.
* then press ctrl+D</pre>
<p>How to make sendmail start at boot time:</p>
<ol>
<li>edit /etc/rc.conf</li>
<li>add &#8211; sendmail_enable=&#8221;YES&#8221;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/how-to-use-sendmail-with-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to delete all but one file in linux directory</title>
		<link>http://analysisandreview.com/unix/how-to-delete-all-but-one-file-in-linux-directory/</link>
		<comments>http://analysisandreview.com/unix/how-to-delete-all-but-one-file-in-linux-directory/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:23:06 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=738</guid>
		<description><![CDATA[ls *&#124; grep -v FileName &#124; xargs rm -rf Using this command you can delete all files except the one listed]]></description>
			<content:encoded><![CDATA[<p>ls *| grep -v FileName | xargs rm -rf</p>
<p>Using this command you can delete all files except the one listed.</p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/how-to-delete-all-but-one-file-in-linux-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable FTP FreeBSD and Allow Only Localhost</title>
		<link>http://analysisandreview.com/unix/enable-ftp-freebsd-and-allow-only-localhost/</link>
		<comments>http://analysisandreview.com/unix/enable-ftp-freebsd-and-allow-only-localhost/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 03:35:43 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[FTPD]]></category>
		<category><![CDATA[Localhost]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=693</guid>
		<description><![CDATA[Enable FTP on your FreeBSD server and allow only your localhost (local machine) access to the ftpd server. The inetd server should be run at boot time by /etc/rc. It then listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corresponds ]]></description>
			<content:encoded><![CDATA[<p>Enable FTP on your FreeBSD server and allow only your localhost (local machine) access to the ftpd server.<span id="more-693"></span></p>
<p>The inetd server should be run at boot time by /etc/rc. It then listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corresponds to, and invokes a program to service the request. The server program is invoked with the service socket as its standard input, output and error descriptors. After the program is finished, inetd continues to listen on the socket.</p>
<p>To enable FTPD Open /etc/inetd.conf file and remove the hash from:</p>
<pre class="brush: php; title: ; notranslate">ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l</pre>
<p>Then restart inetd.conf</p>
<pre class="brush: php; title: ; notranslate">/etc/rc.d/inetd restart
or
/etc/rc.d/inetd onerestart</pre>
<p>Or allow only 127.0.0.1 (localhost) to connect to your ftp server:</p>
<pre class="brush: php; title: ; notranslate">ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l -D -a 127.0.0.1</pre>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/enable-ftp-freebsd-and-allow-only-localhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best freeBSD Firewall for a Web Server, PF Configuration and Testing</title>
		<link>http://analysisandreview.com/unix/best-freebsd-firewall-for-a-web-server-pf-configuration-and-testing/</link>
		<comments>http://analysisandreview.com/unix/best-freebsd-firewall-for-a-web-server-pf-configuration-and-testing/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 04:03:01 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[best freebsd firewall]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[pf]]></category>
		<category><![CDATA[pf configuration]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=687</guid>
		<description><![CDATA[You&#8217;ll see many articles discussing various firewalls for BSD. freeBSD comes with three firewalls but I&#8217;ll lay out what I believe is the best freebsd firewall for a web server, pf. I need firewall that will help negate DDoS attacks, spoofing and fingerprinting. Allows port 80 and 443 as well as ssh and is simple ]]></description>
			<content:encoded><![CDATA[<div id="attachment_688" class="wp-caption alignright" style="width: 266px"><a href="http://analysisandreview.com/wp-content/blogs.dir/5/files/uploads/2010/02/freebsd-firewall.png"><img class="size-full wp-image-688" src="http://analysisandreview.com/wp-content/blogs.dir/5/files/uploads/2010/02/freebsd-firewall.png" alt="freeBSD 8 firewall for web server" width="256" height="256" /></a><p class="wp-caption-text">freeBSD 8 firewall for web server</p></div>
<p>You&#8217;ll see many articles discussing various firewalls for BSD. freeBSD comes with three firewalls but I&#8217;ll lay out what I believe is the best freebsd firewall for a web server, pf.<span id="more-687"></span></p>
<p>I need firewall that will help negate DDoS attacks, spoofing and fingerprinting. Allows port 80 and 443 as well as ssh and is simple to test and configure.</p>
<p>Well PF handles all that and comes built into the freeBSD kernel so it&#8217;s pretty easy and quick to set up and test.</p>
<p>do a ifconfig to figure out what your interface is named</p>
<pre class="brush: bash; title: ; notranslate">#ifconfig
bigkill# ifconfig
 re0:  flags=8843 metric 0 IC&amp;gt;
        ether 00:2c:c1:f9:5s:d3
        inet 224.210.155.13 netmask 0xfffffff8 broadcast 224.210.155.253
        media: Ethernet autoselect (100baseTX )
        status: active
lo0: flags=8049 metric 0
        inet 127.0.0.1 netmask 0xff000000
</pre>
<p>As you can see here the interface name is  re0</p>
<p> so just replace re0 in the below configuration and apply it to /etc/pf.conf</p>
<pre class="brush: bash; title: ; notranslate"> ### macro name for external interface.
ext_if = &quot;re0&quot;

### all incoming traffic on external interface is normalized and fragmented
### packets are reassembled.
scrub in on $ext_if all fragment reassemble

### set a default deny everything policy.
block all

### exercise antispoofing on the external interface, but add the local
### loopback interface as an exception, to prevent services utilizing the
### local loop from being blocked accidentally.
set skip on lo0
antispoof for $ext_if inet

### block anything coming from sources that we have no back routes for.
block in from no-route to any

### block packets that fail a reverse path check. we look up the routing
### table, check to make sure that the outbound is the same as the source
### it came in on. if not, it is probably source address spoofed.
block in from urpf-failed to any

### drop broadcast requests quietly.
block in quick on $ext_if from any to 255.255.255.255

### block packets claiming to come from reserved internal address blocks, as
### they are obviously forged and cannot be contacted from the outside world.
block in log quick on $ext_if from { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 255.255.255.255/32 } to any

### block probes that can possibly determine our operating system by disallowing
### certain combinations that are commonly used by nmap, queso and xprobe2, who
### are attempting to fingerprint the server.
### * F : FIN  - Finish; end of session
### * S : SYN  - Synchronize; indicates request to start session
### * R : RST  - Reset; drop a connection
### * P : PUSH - Push; packet is sent immediately
### * A : ACK  - Acknowledgement
### * U : URG  - Urgent
### * E : ECE  - Explicit Congestion Notification Echo
### * W : CWR  - Congestion Window Reduced
block in quick on $ext_if proto tcp flags FUP/WEUAPRSF
block in quick on $ext_if proto tcp flags WEUAPRSF/WEUAPRSF
block in quick on $ext_if proto tcp flags SRAFU/WEUAPRSF
block in quick on $ext_if proto tcp flags /WEUAPRSF
block in quick on $ext_if proto tcp flags SR/SR
block in quick on $ext_if proto tcp flags SF/SF

### keep state on any outbound tcp, udp or icmp traffic. modulate the isn of
### outgoing packets. (initial sequence number) broken operating systems
### sometimes don't randomize this number, making it guessable.
pass out on $ext_if proto { tcp, udp, icmp } from any to any modulate state

### normally, a client connects to the server and we handshake with them, then
### proceed to exchange data. by telling pf to handshake proxy between the client
### and our server, tcp syn flood attacts from ddos become uneffective because
### a spoofed client cannot complete a handshake.

### set a rule that allows inbound ssh traffic with synproxy handshaking. yes I changed the ssh port
pass in on $ext_if proto tcp from any to any port 1229 flags S/SA synproxy state
### set a rule that allows inbound www traffic with synproxy handshaking.
pass in on $ext_if proto tcp from any to any port 80 flags S/SA synproxy state
pass in on $ext_if proto tcp from any to any port 443 flags S/SA synproxy state
 </pre>
<p> If you want to allow any other port simple copy the last line and replace the port number.</p>
<p> Now issue a reboot command to restart the system in 5 minutes to test your pf configuration.</p>
<pre class="brush: bash; title: ; notranslate"> shutdown -r +5
 </pre>
<p> Okay not start PF and test it</p>
<pre class="brush: bash; title: ; notranslate"> /etc/rc.d/pf onestart
 </pre>
<p> Now &#8220;test&#8221; the current configuration to see what you got</p>
<pre class="brush: bash; title: ; notranslate"> pfctl -s all&quot; ### list all the current rules that are in effect and shows current connections
 </pre>
<p> If you&#8217;re happy with your PF firewall configuration for freebsd 8 you&#8217;ll need to apply it at boot time by adding the following to your /etc/rc.conf</p>
<pre class="brush: bash; title: ; notranslate"> pf_enable=&quot;YES&quot;
pf_rules=&quot;/etc/pf.conf&quot;
 </pre>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/best-freebsd-firewall-for-a-web-server-pf-configuration-and-testing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to shutdown freebsd 8 and stop shutdown</title>
		<link>http://analysisandreview.com/unix/how-to-shutdown-freebsd-8-and-stop-shutdown/</link>
		<comments>http://analysisandreview.com/unix/how-to-shutdown-freebsd-8-and-stop-shutdown/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 03:45:08 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[schedule]]></category>
		<category><![CDATA[shutdown]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=685</guid>
		<description><![CDATA[Shutdown freebsd now Shutdown freeBSD at a scheduled time or within a set time. In the sample below we have shutdown taking place in 5 minutes. This is useful when you want to set a configuration and you&#8217;re worried about the system locking you out. Set the shutdown time for five minutes from now and ]]></description>
			<content:encoded><![CDATA[<p>Shutdown freebsd now</p>
<pre class="brush: php; title: ; notranslate">shutdown -r now
</pre>
<p><span id="more-685"></span><br />
Shutdown freeBSD at a scheduled time or within a set time. In the sample below we have shutdown taking place in 5 minutes. This is useful when you want to set a configuration and you&#8217;re worried about the system locking you out. Set the shutdown time for five minutes from now and if you get locked out you just have to wait for he reboot to take place.</p>
<pre class="brush: php; title: ; notranslate">shutdown -r +5
</pre>
<p>And if you want to stop the shutdown process from taking place simple issue a kill.</p>
<pre class="brush: php; title: ; notranslate">pkill shutdown
</pre>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/how-to-shutdown-freebsd-8-and-stop-shutdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD 8 LAMP Install for WordPress</title>
		<link>http://analysisandreview.com/unix/freebsd-8-lamp-install-for-wordpress/</link>
		<comments>http://analysisandreview.com/unix/freebsd-8-lamp-install-for-wordpress/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:48:15 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[BAMP]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[FAMP]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[Rollback]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://analysisandreview.com/?p=658</guid>
		<description><![CDATA[How to install FreeBSD 8 for WordPress. It&#8217;s a basic LAMP install but since we&#8217;re not using linux it should be called BAMP or maybe FAMP? Who cares.. here are the steps to install FreeBSD 8 with apache, mySQL, PHP then install wordpress. I&#8217;ll be using ports of course for this entire install. I&#8217;m assuming ]]></description>
			<content:encoded><![CDATA[<p><a href="http://analysisandreview.com/wp-content/blogs.dir/5/files/uploads/2010/02/beastie.png"><img class="alignright size-full wp-image-683" src="http://analysisandreview.com/wp-content/blogs.dir/5/files/uploads/2010/02/beastie.png" alt="" width="178" height="196" /></a>How to install FreeBSD 8 for WordPress. It&#8217;s a basic LAMP install but since we&#8217;re not using linux it should be called BAMP or maybe FAMP? Who cares.. here are the steps to install FreeBSD 8 with apache, mySQL, PHP then install wordpress.</p>
<p>I&#8217;ll be using ports of course for this entire install. I&#8217;m assuming that you have the proper hardware for this type installation.</p>
<p>Start with a minimal installation of freeBSD 8</p>
<p><span id="more-658"></span></p>
<p>Bypass the headache and host on vps or dedicated servers with <a rel="nofollow" href="http://www.dpbolvw.net/click-2907135-10751178" target="_blank">pre-installed LAMP here</a>.</p>
<p>Update the server ports &#8211; <a rel="nofollow" href="http://www.freebsd.org/doc/handbook/ports-using.html" target="_blank">freebsd guide on ports</a></p>
<p>First update your port tree</p>
<pre class="brush: bash; title: ; notranslate">portsnap fetch update *if this is the first time do a portsnap fetch extract</pre>
<p>List available update</p>
<pre class="brush: bash; title: ; notranslate">pkg_version -vIL=</pre>
<p>Once you have updated your Ports Collection, before attempting a port upgrade, you should check /usr/ports/UPDATING. This file describes various issues and additional steps users may encounter and need to perform when updating a port, including such things as file format changes, changes in locations of configuration files, or other such incompatibilities with previous versions.</p>
<p>Upgrade your ports with</p>
<pre class="brush: bash; title: ; notranslate">portupgrade -rR</pre>
<p>Okay now that your freeBSD server ports are updates lets do Binary updates <a rel="nofollow" href="http://www.freebsd.org/doc/en/books/handbook/updating-freebsdupdate.html" target="_blank">freebsd-update</a>.</p>
<pre class="brush: bash; title: ; notranslate">freebsd-update fetch</pre>
<pre class="brush: bash; title: ; notranslate">freebsd-update install</pre>
<p>Then reboot</p>
<pre class="brush: bash; title: ; notranslate">shutdown -r now</pre>
<p>Verify update took place</p>
<pre class="brush: bash; title: ; notranslate">uname -a</pre>
<p>Rollback if necessary</p>
<pre class="brush: bash; title: ; notranslate">freebsd-update rollback</pre>
<p><strong>Now lets install Apache, PHP, mysql and phpMyAdmin on your freeBSD 8 web server.</strong></p>
<p>First install the latest <strong>apache </strong>from ports.</p>
<pre class="brush: bash; title: ; notranslate">cd /usr/ports/www/apache22/
make config install clean
echo 'apache22_enable=&quot;YES&quot;' &lt;&lt; /etc/rc.conf
echo 'apache22ssl_enable=&quot;YES&quot;' &lt;&lt; /etc/rc.conf
echo 'accf_http_ready=&quot;YES&quot;' &lt;&lt; /etc/rc.conf &amp;amp;&amp;amp; kldload accf_http</pre>
<p>Now install <strong>PHP</strong></p>
<pre class="brush: bash; title: ; notranslate">cd /usr/ports/lang/php5
make config install clean
cd /usr/ports/lang/php5-extensions  ** enable &lt;strong&gt;mysql &lt;/strong&gt;extensions **
make config install clean</pre>
<p>Now modify your httpd.conf &#8211; Add the following entries to /usr/local/etc/apache22/httpd.conf directly after all the LoadModule lines</p>
<pre class="brush: bash; title: ; notranslate">AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps</pre>
<p>now locate IfModule mod_dir.c and add index.php</p>
<pre class="brush: bash; title: ; notranslate">DirectoryIndex index.php index.html index.htm</pre>
<p>Last but not least get a good php.ini file setup</p>
<pre class="brush: bash; title: ; notranslate">cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini</pre>
<p>Restart apache and</p>
<pre class="brush: bash; title: ; notranslate">/usr/local/etc/rc.d/apache22 start</pre>
<p>Now its time for <strong>mySQL </strong>installation, configuration and setup</p>
<pre class="brush: bash; title: ; notranslate">cd /usr/ports/databases/mysql50-server
make install WITH_OPENSSL=yes
make distclean
echo 'mysql_enable=&quot;YES&quot;' &lt;&lt; /etc/rc.conf</pre>
<p>Start mysql server and change root password</p>
<pre class="brush: bash; title: ; notranslate">/usr/local/etc/rc.d/mysql-server start
mysqladmin -u root password sumcrazypaswrd
mysql -u root -p    *make sure you can log in*
rm /root/.history  *remove history so password isn't exposed*</pre>
<p>Create a configuration file for mysql in /etc/my.cnf</p>
<pre class="brush: bash; title: ; notranslate">[client]
port=29912
[mysqld]
port=29912
bind-address=127.0.0.1</pre>
<p>Now lets install configure and setup <strong>phpMyAdmin</strong></p>
<pre class="brush: bash; title: ; notranslate">cd /usr/ports/databases/phpmyadmin
make config install clean
cd /usr/local/www/phpMyAdmin &amp;amp;&amp;amp; cp config.sample.inc.php
config.inc.php
vi config.inc.php
$cfg['blowfish_secret'] = 'sdf934sdfgHijh98Y';</pre>
<p>open httpd.conf and Alias</p>
<pre class="brush: bash; title: ; notranslate">Alias /phpmyadmin /usr/local/www/phpMyAdmin</pre>
<p>Now allow who you want to access it</p>
<pre class="brush: bash; title: ; notranslate">        &lt;Directory &quot;/usr/local/www/phpmyadmin'&lt;
Order allow,deny
        Allow from all   *or allow from 222.114.123.0/12*
&lt;/Directory&lt;</pre>
<p>you&#8217;ll want https when you connect to phpmyadmin so lets enable https and make some httpd.conf changes</p>
<p><strong>Create your certificate</strong></p>
<p>In order to access phpmyadmin of ssl you need to get https going on apache. You can buy an SSL certificate generated by a trusted CA such as Thwate or Verisign, or you can generate one yourself using OpenSSL. I borrowed a ton of infor from <a href="http://www.freebsdmadeeasy.com/tutorials/freebsd/create-a-ca-with-openssl.php">freebsdmadeeasy.com</a></p>
<p>lets get the openssl.cnf file ready</p>
<pre class="brush: bash; title: ; notranslate">vi /etc/ssl/openssl.cnf
dir = /root/sslCA
default_days = 3650</pre>
<p>Now set up the directories</p>
<pre class="brush: bash; title: ; notranslate">cd ~root/
mkdir sslCA
chmod 700 sslCA
chmod 700 sslCA
mkdir certs private newcerts
echo 1000 &lt; serial
touch index.txt
cd ~root/sslCA
openssl req -new -x509 -days 3650 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -config /etc/ssl/openssl.cnf</pre>
<p>The CA should now be all set.. test with more;</p>
<pre class="brush: bash; title: ; notranslate">more ~root/sslCA/cacert.pem
more ~root/sslCA/private/cakey.pem</pre>
<p>Now lets generate an SSL certificate for apache</p>
<pre class="brush: bash; title: ; notranslate">cd ~root/sslCA
openssl req -new -nodes -out yourhostname-req.pem -keyout private/yourhostname-key.pem -config /etc/ssl/openssl.cnf
openssl ca -config /etc/ssl/openssl.cnf -out yourhostname-cert.pem -infiles yourhostname-req.pem</pre>
<p>Lets put everything where it needs to be.</p>
<pre class="brush: bash; title: ; notranslate">mkdir /etc/ssl/crt
mkdir /etc/ssl/key
cp ~root/sslCA/yourhostname-cert.pem /etc/ssl/crt
cp ~root/sslCA/private/yourhostname-key.pem /etc/ssl/key</pre>
<p>And finally add the SSL virtual host</p>
<p>Find the below line in your httpd.conf and take the comment hash out.</p>
<pre class="brush: bash; title: ; notranslate"># Secure (SSL/TLS) connections
Include etc/apache22/extra/httpd-ssl.conf</pre>
<p>Now modify your httpd-ssl.conf</p>
<pre class="brush: bash; title: ; notranslate">ServerName ssl.yourhostname.com
SSLCertificateFile /etc/ssl/crt/yourhostname-cert.pem
SSLCertificateKeyFile /etc/ssl/key/yourhostname-key.pem
DocumentRoot &quot;/etc/www/apache22/data&quot;      ** whatever your location is**
ErrorLog &quot;/var/log/httpd-error.log&quot;
TransferLog &quot;/var/log/httpd-access.log&quot;</pre>
<p>In /usr/local/etc/apache22/extra/httpd-default.conf, disable ServerSignature to prevent the server from showing more information than it has to. Make sure the server-status and the server-info sections in /usr/local/etc/apache22/extra/httpd-info.conf are commented out.</p>
<p>Finally restart apache</p>
<pre class="brush: bash; title: ; notranslate">/usr/local/etc/rc.d/apache22 restart</pre>
<p>Now install <strong>wordpress</strong></p>
<pre class="brush: bash; title: ; notranslate">cd /usr/ports/wordpress
make install clean</pre>
<p>do a locate wordpress and move file to web root</p>
<pre class="brush: bash; title: ; notranslate">locate wordpress
cp /usr/local/www/data/wordpress/* /usr/local/whatever web root is</pre>
<p>go into web root and copy wp-config-sample.php to wp-config.php</p>
<p>navigate to https://hostname/phpmyadmin and create wordpress db &#8211; add that name to wp-config.php</p>
]]></content:encoded>
			<wfw:commentRss>http://analysisandreview.com/unix/freebsd-8-lamp-install-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

