<?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>System Administration &#8211; Scott Mcintyre</title>
	<atom:link href="https://scott.cm/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>https://scott.cm</link>
	<description>Web Operations Engineer,  Linux Systems Administrator,  mySQL DBA,  MongoDB DBA,  Python+PHP Developer,  Performance Engineer</description>
	<lastBuildDate>Tue, 18 Jul 2017 08:58:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.2.2</generator>
	<item>
		<title>Install libmcrypt el6</title>
		<link>https://scott.cm/install-libmcrypt-el6/</link>
				<comments>https://scott.cm/install-libmcrypt-el6/#respond</comments>
				<pubDate>Wed, 29 May 2013 23:35:27 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[epel libmcrypt]]></category>
		<category><![CDATA[install libmcrypt]]></category>
		<category><![CDATA[install libmcrypt centos]]></category>
		<category><![CDATA[install libmcrypt el6]]></category>
		<category><![CDATA[install php libmcrypt]]></category>
		<category><![CDATA[php mcrypt]]></category>
		<category><![CDATA[php mcrypt centos 6]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=244</guid>
				<description><![CDATA[When trying to compile PHP I noticed the libmcrypt package is no longer provided with EL6 / CentOS 6, checking whether to enable multibyte string support&#8230; no checking whether to enable multibyte regex support&#8230; yes checking whether to check multibyte regex backtrack&#8230; yes checking for external libmbfl&#8230; no checking for]]></description>
								<content:encoded><![CDATA[<p>When trying to compile PHP I noticed the libmcrypt package is no longer provided with EL6 / CentOS 6,</p>
<blockquote><p>
checking whether to enable multibyte string support&#8230; no<br />
checking whether to enable multibyte regex support&#8230; yes<br />
checking whether to check multibyte regex backtrack&#8230; yes<br />
checking for external libmbfl&#8230; no<br />
checking for mcrypt support&#8230; yes<br />
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
</p></blockquote>
<p>Checking if the package exists in the default repos shows it doesn&#8217;t,</p>
<blockquote><p>
# <strong>yum search libmcrypt</strong><br />
Loaded plugins: fastestmirror, security<br />
Loading mirror speeds from cached hostfile<br />
 * base: mirrors.versaweb.com<br />
 * extras: mirrors.usc.edu<br />
 * updates: mirrors.easynews.com<br />
Warning: No matches found for: libmcrypt<br />
No Matches found
</p></blockquote>
<p>You need to obtain this from the epel repos now at http://dl.fedoraproject.org/pub/epel/6/x86_64/ ,  at the time of writing the version is 2.5.8-9 so you can install this with,</p>
<blockquote><p>
mcryptver=2.5.8-9<br />
arch=x86_64<br />
rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-$mcryptver.el6.$arch.rpm<br />
rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-devel-$mcryptver.el6.$arch.rpm
</p></blockquote>
<p>An example,</p>
<blockquote><p>
# <strong>mcryptver=2.5.8-9</strong><br />
# <strong>arch=x86_64</strong><br />
# <strong>rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-$mcryptver.el6.$arch.rpm</strong><br />
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm<br />
warning: /var/tmp/rpm-tmp.BoLykl: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY<br />
Preparing&#8230;                ########################################### [100%]<br />
   1:libmcrypt              ########################################### [100%]<br />
# <strong>rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-devel-$mcryptver.el6.$arch.rpm</strong><br />
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm<br />
warning: /var/tmp/rpm-tmp.6SW2Vh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY<br />
Preparing&#8230;                ########################################### [100%]<br />
   1:libmcrypt-devel        ########################################### [100%]
</p></blockquote>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/install-libmcrypt-el6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>nginx rewrite PHP with no extension</title>
		<link>https://scott.cm/nginx-rewrite-php-with-no-extension/</link>
				<comments>https://scott.cm/nginx-rewrite-php-with-no-extension/#respond</comments>
				<pubDate>Thu, 17 Jan 2013 06:14:26 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[nginx access denied]]></category>
		<category><![CDATA[nginx rewrite no extension]]></category>
		<category><![CDATA[php no extension]]></category>
		<category><![CDATA[php-fpm limit_extensions]]></category>
		<category><![CDATA[php-fpm no extension]]></category>
		<category><![CDATA[security.limit_extensions]]></category>
		<category><![CDATA[security.limit_extensions = false]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=214</guid>
				<description><![CDATA[I recently had to troubleshoot an issue while migrating from cherokee to nginx. This was a PHP application which had a shared set of common scripts , these where accessed by domain/common/file which in turn was translated into /vhosts/shared/common and this then included the necessary files. After doing the rewrite]]></description>
								<content:encoded><![CDATA[<p>I recently had to troubleshoot an issue while migrating from cherokee to nginx.    This was a PHP application which had a shared set of common scripts ,  these where accessed by domain/common/file which in turn was translated into /vhosts/shared/common and this then included the necessary files.</p>
<p>After doing the rewrite for nginx,</p>
<blockquote><p>
                location ^~ /common/ {<br />
                fastcgi_split_path_info ^(/common)(/?.+)$;<br />
                fastcgi_param SCRIPT_FILENAME /vhosts/shared/common$fastcgi_script_name;<br />
                fastcgi_param PATH_INFO $fastcgi_path_info;<br />
                fastcgi_pass   127.0.0.1:9000;<br />
                include        fastcgi_params;<br />
        }
</p></blockquote>
<p>nginx was simply returning access denied.</p>
<blockquote><p>
# curl http://localhost/common/file<br />
Access denied.
</p></blockquote>
<p>Which is because the new file has no extension and PHP-FPM now defaults to only allow .php.  This can be altered by editing security.limit_extensions in the php-fpm.conf (in this case /etc/php-fpm.d/daemon.conf) to allow the extensions you need.  In this case we needed it to support files without extensions so setting security.limit_extensions to FALSE done the job,</p>
<blockquote><p>
security.limit_extensions = FALSE
</p></blockquote>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/nginx-rewrite-php-with-no-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Max processes 1024 limits.conf</title>
		<link>https://scott.cm/max-processes-1024-limits-conf/</link>
				<comments>https://scott.cm/max-processes-1024-limits-conf/#comments</comments>
				<pubDate>Thu, 22 Nov 2012 06:44:24 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[centos ulimit]]></category>
		<category><![CDATA[linux max user processes]]></category>
		<category><![CDATA[mongodb replica sets]]></category>
		<category><![CDATA[mongodb soft limit]]></category>
		<category><![CDATA[mongodb ulimit]]></category>
		<category><![CDATA[red hat ulimit]]></category>
		<category><![CDATA[ulimit -u soft limit]]></category>
		<category><![CDATA[ulimit /etc/security/limits.d/90-nproc.conf]]></category>
		<category><![CDATA[ulimit 1024]]></category>
		<category><![CDATA[ulimit max processes]]></category>
		<category><![CDATA[ulimit max user processes]]></category>
		<category><![CDATA[ulimit pam]]></category>
		<category><![CDATA[ulimit soft limit]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=186</guid>
				<description><![CDATA[We where having an issue with replica sets on our MongoDB databases changing primaries. The logs shows it was hitting resource limits creating new processes. [initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable [initandlisten] can&#8217;t create new thread, closing connection There is a bug fix in the init.d available per https://jira.mongodb.org/browse/SERVER-6443]]></description>
								<content:encoded><![CDATA[<p>We where having an issue with replica sets on our MongoDB databases changing primaries.  The logs shows it was hitting resource limits creating new processes.</p>
<blockquote><p>
[initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable<br />
[initandlisten] can&#8217;t create new thread, closing connection
</p></blockquote>
<p>There is a bug fix in the init.d available per https://jira.mongodb.org/browse/SERVER-6443 to increase the ulimit -u however while working through increasing the available max processes on RHEL I was noting the soft limit would not increase past 1024 when checking /proc/pid/limits even when being increased in the startup script.</p>
<blockquote><p>
Limit                     Soft Limit           Hard Limit           Units<br />
Max cpu time              unlimited            unlimited            seconds<br />
Max file size             unlimited            unlimited            bytes<br />
Max data size             unlimited            unlimited            bytes<br />
Max stack size            10485760             unlimited            bytes<br />
Max core file size        0                    unlimited            bytes<br />
Max resident set          unlimited            unlimited            bytes<br />
Max processes             <strong>1024</strong>                 256662               processes<br />
Max open files            8192                 8192                 files<br />
Max locked memory         65536                65536                bytes<br />
Max address space         unlimited            unlimited            bytes<br />
Max file locks            unlimited            unlimited            locks<br />
Max pending signals       256662               256662               signals<br />
Max msgqueue size         819200               819200               bytes<br />
Max nice priority         0                    0<br />
Max realtime priority     0                    0<br />
Max realtime timeout      unlimited            unlimited            us
</p></blockquote>
<p>It turns out the pam package provides a file /etc/security/limits.d/90-nproc.conf which explicitly overrides the settings in security.conf for the number of processes,</p>
<blockquote><p>
# Default limit for number of user&#8217;s processes to prevent<br />
# accidental fork bombs.<br />
# See rhbz #432903 for reasoning.</p>
<p>*          soft    nproc     1024
</p></blockquote>
<p>Changing this allowed the number of processes to be increased.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/max-processes-1024-limits-conf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
							</item>
		<item>
		<title>Varnish Nagios Check</title>
		<link>https://scott.cm/varnish-nagios-check/</link>
				<comments>https://scott.cm/varnish-nagios-check/#comments</comments>
				<pubDate>Thu, 19 Apr 2012 20:34:35 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[icinga]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=157</guid>
				<description><![CDATA[**Update: 2 July 2014. Updated to new version 1.1 I have written a check for nagios/icinga to check the varnish backend health. You can get the latest version from github . The version at the time of posting at the bottom of this message. The defaults are RHEL defaults and]]></description>
								<content:encoded><![CDATA[<p><strong>**Update: 2 July 2014.  Updated to new version 1.1</strong></p>
<p>I have written a check for nagios/icinga to check the varnish backend health.  You can get the latest version from <a href="https://github.com/admingeekz/nagios-varnish" title="Check Varnish Backends" target="_blank">github </a>.  The version at the time of posting at the bottom of this message.</p>
<p>The defaults are RHEL defaults and ./check_varnishbackends.py should work without any options unless you want to override them.   Here is the Nagios/Icinga Setup,</p>
<p>Register the service</p><pre class="crayon-plain-tag">define service {
	register			0
	name				check_varnishbackends
	service_description		Varnish Backends
	use				generic-service
}</pre><p></p>
<p>Assign to host &#8220;server&#8221;</p><pre class="crayon-plain-tag">define service {
	service_description		Varnish Backend
	host_name			server
	use				check_varnishbackends
	check_command			remote_nrpe!check_varnishbackends -a &quot;127.0.0.1&quot; &quot;6082&quot; &quot;/etc/varnish/secret&quot; &quot;/usr/bin/varnishadm&quot;
}</pre><p></p>
<p>Setup NRPE (Make sure user has permission to varnish secret file or use sudo)</p><pre class="crayon-plain-tag">command[check_varnishbackends]=/usr/local/nagios/libexec/check_varnishbackends.py --host $ARG1$ --port $ARG2$ --secret $ARG3$ --path $ARG4$</pre><p></p>
<p>Version at time of posting,</p>
<p></p><pre class="crayon-plain-tag">#!/usr/bin/env python
# Nagios Varnish Backend Check
# v1.1
# URL: www.admingeekz.com
# Contact: sales@admingeekz.com
#
#
# Copyright (c) 2013, AdminGeekZ Ltd
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

import sys
import optparse
import subprocess

def runcommand(command, exit_on_fail=True):
    try:
      process = subprocess.Popen(command.split(&quot; &quot;), stdout=subprocess.PIPE)
      output, unused_err = process.communicate()
      retcode = process.poll()
      return output

    except OSError, e:
      print &quot;Error: Executing command failed,  does it exist?&quot;
      sys.exit(2)


def main(argv):
  o = optparse.OptionParser(conflict_handler=&quot;resolve&quot;, description=&quot;Nagios plugin to check varnish backend health.&quot;)
  o.add_option('-H', '--host', action='store', type='string', dest='host', default='127.0.0.1', help='The ip varnishadm is listening on')
  o.add_option('-P', '--port', action='store', type='int', dest='port', default=6082, help='The port varnishadm is listening on')
  o.add_option('-s', '--secret', action='store', type='string', dest='secret', default='/etc/varnish/secret', help='The path to the secret file')
  o.add_option('-p', '--path', action='store', type='string', dest='path', default='/usr/bin/varnishadm', help='The path to the varnishadm binary')

  options=o.parse_args()[0]
  command = runcommand(&quot;%(path)s -S %(secret)s -T %(host)s:%(port)s debug.health&quot; % options.__dict__)
  backends = command.split(&quot;\n&quot;)
  backends_healthy, backends_sick = [], []
  for line in backends:
    if line.startswith(&quot;Backend&quot;) and line.find(&quot;test&quot;)==-1:
      if line.endswith(&quot;Healthy&quot;):
        backends_healthy.append(line.split(&quot; &quot;)[1])
      else:
        backends_sick.append(line.split(&quot; &quot;)[1])
 
  if backends_sick:
    print &quot;%s backends are down.  %s&quot; % (len(backends_sick), &quot;&quot;.join(backends_sick))
    sys.exit(2)

  if not backends_sick and not backends_healthy:
    print &quot;No backends detected.  If this is an error, see readme.txt&quot;
    sys.exit(1)

  print &quot;All %s backends are healthy&quot; % (len(backends_healthy))
  sys.exit(0)


if __name__ == &quot;__main__&quot;:
    main(sys.argv[1:])</pre><p></p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/varnish-nagios-check/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
							</item>
		<item>
		<title>ERROR: Module backupdriver is in use</title>
		<link>https://scott.cm/error-module-backupdriver-is-in-use/</link>
				<comments>https://scott.cm/error-module-backupdriver-is-in-use/#respond</comments>
				<pubDate>Sat, 14 Apr 2012 15:13:09 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[R1soft]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[backupdriver is in use]]></category>
		<category><![CDATA[buagent]]></category>
		<category><![CDATA[Module backupdriver is in use]]></category>
		<category><![CDATA[r1soft cdp3]]></category>
		<category><![CDATA[r1soft error]]></category>
		<category><![CDATA[r1soft install]]></category>
		<category><![CDATA[r1soft uninstall]]></category>
		<category><![CDATA[removing buagent]]></category>
		<category><![CDATA[rmmod backupdriver]]></category>
		<category><![CDATA[unloading backupdriver]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=86</guid>
				<description><![CDATA[While updating several of our remaining systems from r1soft CDP 2 to CDP 3 we&#8217;ve been getting the following error, ERROR: Module backupdriver is in use r1soft-uninstall-buagent -R This uninstaller will remove the following.. File /etc/init.d/buagent File /usr/bin/buagent File /var/lock/buagent.lock File /var/run/buagent.pid File /usr/bin/r1key File /usr/bin/r1soft-cki File /usr/bin/r1soft-report.sh File /usr/bin/r1soft-uninstall-buagent]]></description>
								<content:encoded><![CDATA[<p>While updating several of our remaining systems from r1soft CDP 2 to CDP 3 we&#8217;ve been getting the following error,</p>
<p>ERROR: Module backupdriver is in use</p>
<p><code>r1soft-uninstall-buagent -R<br />
This uninstaller will remove the following..</code></p>
<p>File /etc/init.d/buagent<br />
File /usr/bin/buagent<br />
File /var/lock/buagent.lock<br />
File /var/run/buagent.pid<br />
File /usr/bin/r1key<br />
File /usr/bin/r1soft-cki<br />
File /usr/bin/r1soft-report.sh<br />
File /usr/bin/r1soft-uninstall-buagent<br />
File /usr/share/man/man3/buagent.3.gz<br />
File /usr/share/man/man3/r1key.3.gz<br />
File /usr/share/man/man3/r1soft-uninstall-buagent.3.gz<br />
Directory /etc/buagent<br />
Directory /usr/lib/buagent<br />
Directory /lib/modules/buagent<br />
Directory /var/cache/buagent<br />
Directory /var/db/buagent<br />
User buagent<br />
Group buagent</p>
<p>Would you like to continue? (yes/no):yes<br />
stopping buagent.<br />
removing buagent from services.<br />
removing File /etc/init.d/buagent<br />
removing File /usr/bin/buagent<br />
removing File /var/lock/buagent.lock<br />
removing File /var/run/buagent.pid<br />
removing File /usr/bin/r1key<br />
removing File /usr/bin/r1soft-cki<br />
removing File /usr/bin/r1soft-report.sh<br />
removing File /usr/bin/r1soft-uninstall-buagent<br />
removing File /usr/share/man/man3/buagent.3.gz<br />
removing File /usr/share/man/man3/r1key.3.gz<br />
removing File /usr/share/man/man3/r1soft-uninstall-buagent.3.gz<br />
removing Directory /etc/buagent<br />
removing Directory /usr/lib/buagent<br />
removing Directory /lib/modules/buagent<br />
removing Directory /var/cache/buagent<br />
removing Directory /var/db/buagent<br />
removing buagent user…<br />
unloading backupdriver kernel module…<br />
ERROR: Module backupdriver is in use<br />
done.</p>
<p>Trying to simply rmmod the driver fails because it&#8217;s in use but without having forced support there is no way to unload it using this method.</p>
<p><code><br />
# rmmod backupdriver<br />
ERROR: Module backupdriver is in use<br />
</code></p>
<p>The solution is to reinstall the latest CDP 2 agent and run <strong>buagent -u</strong> to unload it first then proceed to uninstalling the CDP2 agent and installing CDP3 agent.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/error-module-backupdriver-is-in-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Mounting ext2/ext3 partitions on windows</title>
		<link>https://scott.cm/mounting-ext2ext3-partitions-on-windows/</link>
				<comments>https://scott.cm/mounting-ext2ext3-partitions-on-windows/#respond</comments>
				<pubDate>Mon, 28 Nov 2011 15:57:05 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[ext2 windows]]></category>
		<category><![CDATA[ext2/3 partiton windows]]></category>
		<category><![CDATA[ext2/ext3 partition windows]]></category>
		<category><![CDATA[ext3 windows]]></category>
		<category><![CDATA[ext3 windows 7]]></category>
		<category><![CDATA[mount ext2 partition on windows]]></category>
		<category><![CDATA[mount ext2/3 partition on windows]]></category>
		<category><![CDATA[mount ext2/3 windows]]></category>
		<category><![CDATA[mount ext2/ext3 windows]]></category>
		<category><![CDATA[mount ext3 in windows]]></category>
		<category><![CDATA[mount ext3 on windows]]></category>
		<category><![CDATA[mount ext3 partition on windows]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=84</guid>
				<description><![CDATA[Today I needed to mount one of my USB sticks on windows to copy some files over. To get windows to recognise it I altered/etc/mke2fs.conf and done the following. Removed ext_addr from &#8220;base_features&#8221; and commented out the inode_size line. Here is a diff from the default ubuntu e2fsprogs /etc/mke2fs.conf with]]></description>
								<content:encoded><![CDATA[<p>Today I needed to mount one of my USB sticks on windows to copy some files over. To get windows to recognise it I altered/etc/mke2fs.conf and done the following.</p>
<p>Removed <em>ext_addr</em> from &#8220;base_features&#8221; and commented out the <em>inode_size</em> line. Here is a diff from the default ubuntu e2fsprogs /etc/mke2fs.conf with the necessary changes,</p>
<p>&nbsp;</p>
<p>&#8212; /etc/mke2fs.orig.conf 2011-11-28 15:20:07.365231775 +0000<br />
+++ /etc/mke2fs.conf 2011-11-28 15:20:48.165231803 +0000<br />
@@ -1,7 +1,7 @@<br />
[defaults]<br />
&#8211; base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr<br />
+ base_features = sparse_super,filetype,resize_inode,dir_index<br />
blocksize = 4096<br />
&#8211; inode_size = 256<br />
+ #inode_size = 256<br />
inode_ratio = 16384</p>
<p>[fs_types]</p>
<p>Then format the partition and this will allow it to be mounted on windows.</p>
<p>I used DiskInternals Linux Reader on windows to mount the drive and copy the files which can be downloaded for free at</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/mounting-ext2ext3-partitions-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>WordPress Auto Wrapping Code</title>
		<link>https://scott.cm/wordpress-auto-wrapping-code/</link>
				<comments>https://scott.cm/wordpress-auto-wrapping-code/#respond</comments>
				<pubDate>Thu, 24 Nov 2011 12:35:51 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[auto wrap wordpress]]></category>
		<category><![CDATA[long code wordpress]]></category>
		<category><![CDATA[wrap text]]></category>
		<category><![CDATA[wrap text wordpress]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=80</guid>
				<description><![CDATA[When posting code it wasn&#8217;t wrapping text properly on my blog due to how narrow it is. Luckily there&#8217;s some easy code that already exists to solve this so reposting it. height: 120px; overflow: auto; font-family: “Consolas”,monospace; font-size: 9pt; text-align:left; background-color: #FCF7EC; overflow-x: auto; /* Use horizontal scroller if needed;]]></description>
								<content:encoded><![CDATA[<p>When posting code it wasn&#8217;t wrapping text properly on my blog due to how narrow it is. Luckily there&#8217;s some easy code that already exists to solve this so reposting it.</p>
<p><code><br />
height: 120px;<br />
overflow: auto;<br />
font-family: “Consolas”,monospace;<br />
font-size: 9pt;<br />
text-align:left;<br />
background-color: #FCF7EC;<br />
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not<br />
white-space: pre-wrap; /* css-3 */<br />
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */<br />
word-wrap: break-word; /* Internet Explorer 5.5+ */<br />
margin: 0px 0px 0px 0px;<br />
padding:5px 5px 3px 5px;<br />
white-space : normal; /* crucial for IE 6, maybe 7? */<br />
</code></p>
<p>Hopefully others find this useful.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/wordpress-auto-wrapping-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Setup mySQL replicated slave using r1soft</title>
		<link>https://scott.cm/setup-mysql-replicated-slave-using-r1soft/</link>
				<comments>https://scott.cm/setup-mysql-replicated-slave-using-r1soft/#comments</comments>
				<pubDate>Thu, 27 Jan 2011 03:22:08 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[R1soft]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=63</guid>
				<description><![CDATA[Using r1soft mySQL addon to setup mySQL replication slaves requiring read locks in seconds rather than hours for non transactional tables.]]></description>
								<content:encoded><![CDATA[<p>I have been using r1soft <a href="http://www.r1soft.com/linux-cdp/">Continuous Data Protection</a> for many years now with the <a href="http://www.r1soft.com/linux-cdp/cdp-30-enterprise-edition/mysql/">mySQL Addon</a> and wanted to share a trick I have used several times.</p>
<p>For those of us that don&#8217;t have the luxury of using all transactional based tables such as InnoDB and the the ability to use the likes of <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_single-transaction">&#8211;single-transaction</a> with <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_master-data">&#8211;master-data</a> we do have an option of using r1soft to avoid lengthy downtimes in the event we have to setup/resetup a slave. You can turn a potential several hour outage in a 30-60 second <em>READ LOCK</em> and perform the rest in the background.</p>
<p>Firstly a quick explanation of the r1soft mySQL addon, the mySQL addon works by issuing a global lock and then flushes changes from memory to disk to ensure consistent snapshots. As it works with the r1soft device driver the process usually takes less than a second making this the perfect method to take backups and have the master position at the time the backup was taken. At the time of writing r1soft does not support the ability to store the master/slave status data although hopefully in the future it will store and display it to avoid having to use the following trick.</p>
<p>We can however work around this by monitoring the r1soft server-log.txt to determine when it has flushed and unlocked the mySQL instance. As it happens very early on in the process we can manually issue a global read lock, get the current position, monitor the server-log.txt until r1soft has performed the snapshot of mySQL and then release the global lock manually.</p>
<p>I have performed an example of this for this article. I started by logging into the CDP interface, browsing to the system in question and getting to the start backup process, having this all filled in and ready to submit speeds the process up. Once this was ready I logged into the database system and issued a global read lock then obtained the current master position,</p>
<p><code>mysql&gt; <strong>flush tables with read lock;</strong><br />
Query OK, 0 rows affected (0.10 sec)</code></p>
<p>mysql&gt; <strong>show master status;</strong><br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| mysql-bin.024272 | 120146094 | | |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>I then clicked ok under the schedule backup window and started a tail on server-log.txt (usually found in /usr/r1soft/buserver/log) and waited until it reached the mySQL lock, flush and unlock.</p>
<p><code><br />
2011-01-27 02:44:27,743 INFO: (tid:976019) Starting task 'Backup' for host (xx.xx.xx.xx) with host id (xxxxxxxx)<br />
2011-01-27 02:44:27,771 INFO: (tid:976019) Starting Backup Task.<br />
2011-01-27 02:44:27,772 INFO: (tid:976019) Backing up partition tables.<br />
2011-01-27 02:44:27,773 INFO: (tid:976020) Starting task 'Partition Table Backup' for host (xx.xx.xx.xx) with host id (xxxxxxxx)<br />
2011-01-27 02:44:27,790 INFO: (tid:976020) Starting partition table backup for host (xx.xx.xx.xx) device (/dev/sda) Disk Safe (0) recovery point (6025).<br />
2011-01-27 02:44:27,892 INFO: (tid:976020) AGENT: (Righteous Backup Linux Agent) 1.62.0 build 6386<br />
2011-01-27 02:44:28,019 WARN: (tid:976020) AGENT: allowing control from backup server (xx.xx.xx.xx) with valid RSA key<br />
2011-01-27 02:44:28,059 WARN: (tid:976020) AGENT: sending auth challenge for allowed host at (xx.xx.xx.xx) port (41758)<br />
2011-01-27 02:44:28,108 INFO: (tid:976020) AGENT: host (xx.xx.xx.xx) port (41758) authentication successful<br />
2011-01-27 02:44:28,193 INFO: Agent (xx.xx.xx.xx) authenticated successfully<br />
2011-01-27 02:44:28,267 INFO: (tid:976020) AGENT: Partition Backup request accepted. Starting backup.<br />
2011-01-27 02:44:28,269 INFO: (tid:976020) AGENT: Found 4 partition(s), 1 extended partition(s) and 124 extra sector(s)<br />
2011-01-27 02:44:28,270 INFO: (tid:976020) AGENT: Need to back up 126 sectors<br />
2011-01-27 02:44:28,270 INFO: (tid:976020) Sector size (512) bytes.<br />
2011-01-27 02:44:28,271 INFO: (tid:976020) Number of sectors (126).<br />
--SNIP--<br />
2011-01-27 02:44:32,083 INFO: Sending (1) MySQL instances to agent.<br />
2011-01-27 02:44:32,083 INFO: Sending next MySQL instance to agent.<br />
2011-01-27 02:44:32,117 INFO: (tid:976019) AGENT: Backup request accepted. Starting backup.<br />
2011-01-27 02:44:39,340 INFO: (tid:976019) AGENT: Flushed 1 MySQL instances.<br />
2011-01-27 02:44:39,353 INFO: (tid:976019) AGENT: Flushed 1 MySQL instances.<br />
2011-01-27 02:44:39,354 INFO: (tid:976019) AGENT: Flushed 1 MySQL instances.<br />
2011-01-27 02:44:39,355 INFO: (tid:976019) AGENT: Locked 1 MySQL instances.<br />
2011-01-27 02:44:39,355 INFO: (tid:976019) AGENT: Unlocked 1 MySQL instances.<br />
2011-01-27 02:44:39,356 INFO: (tid:976019) AGENT: Snapshot completed in 0.059 seconds.<br />
<strong>2011-01-27 02:44:39,357 INFO: (tid:976019) AGENT: Acquired MySQL lock in 0.025 seconds and held lock for 0.085 seconds on 1 instance.</strong><br />
2011-01-27 02:44:39,357 INFO: (tid:976019) Backup pipeline size (256) blocks.<br />
2011-01-27 02:44:39,358 INFO: (tid:976019) Block size (4096).<br />
2011-01-27 02:44:39,358 INFO: (tid:976019) Partition size (34529701) blocks.<br />
2011-01-27 02:44:39,359 INFO: (tid:976019) Mount Point (/).<br />
2011-01-27 02:44:39,803 INFO: (tid:976019) Network Queue Size: 1280 blocks</code></p>
<p>Once it has completed the stage in bold I simply released the read lock,</p>
<p><code>mysql&gt; <strong>unlock tables;</strong><br />
Query OK, 0 rows affected (0.00 sec)</code></p>
<p>I now had a backup in r1soft and had the master position of the time it was taken. Once the backup completed I simply restored the tables I needed to the slave using the restore to an alternate host and started replication using this data.</p>
<p><code><br />
INFO 01/27/2011 <strong>02:44:27 GMT</strong> (tid:976019) Starting task 'Backup' for host (xx.xx.xx.xx) with host id (xxxxxxxx)<br />
INFO 01/27/2011<strong> 02:51:10 GMT</strong> (tid:976019) Backup Task finished.</code></p>
<p>I restored the backup to the mysql datadir, as you are backing up the master you can skip all the binlogs. After this was restored I started mySQL, changed the master to the details we got from the master status earlier and started the slave.</p>
<p><code><br />
mysql&gt; CHANGE MASTER to MASTER_HOST='192.168.1.3', MASTER_USER='slave', MASTER_PASSWORD='xxxxxx', MASTER_LOG_FILE='mysql-bin.024272', MASTER_LOG_POS=120146094;<br />
Query OK, 0 rows affected (0.01 sec)</code></p>
<p>mysql&gt; start slave;<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql&gt; show slave status \G;<br />
<strong>Seconds_Behind_Master: 0</strong></p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/setup-mysql-replicated-slave-using-r1soft/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
							</item>
		<item>
		<title>2010 Recap</title>
		<link>https://scott.cm/2010-recap/</link>
				<comments>https://scott.cm/2010-recap/#respond</comments>
				<pubDate>Thu, 30 Dec 2010 11:56:26 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=59</guid>
				<description><![CDATA[So another year has passed and I have made 0 entries to the blog. This shall be the 8th post in 6 years. I thought it would be only fitting that I atleast end the year with a blog post and a commitment to blog more in 2011. This blog]]></description>
								<content:encoded><![CDATA[<p>So another year has passed and I have made 0 entries to the blog.   This shall be the 8th post in 6 years.  I thought it would be only fitting that I atleast end the year with a blog post and a commitment to blog more in 2011.</p>
<p>This blog post will be about what I have learned in 2010 and some plans for 2011.</p>
<p>So what have I learned,  enjoyed and hated in 2010?</p>
<p>&#8211; I love puppet</p>
<p>&#8211; Adobe flash is the bane of my life.  Flash on 64bit linux is nothing short of a pain,  it causes the most problems,  the most crashes and should rot in hell.</p>
<p>&#8211; I am starting to like chrome but have not made the full switch from firefox yet. </p>
<p>&#8211; I am quite a lazy programmer,  more worrying I actually don&#8217;t care.</p>
<p>&#8211; I love MongoDB and expect big things from it.</p>
<p>&#8211; I am unsure weather to love or hate r1soft.  On one hand I like what it brings on the other hand it&#8217;s very buggy and I don&#8217;t think the release of 3.0 is going to address many of these.   This should be an entire blog post in itself later.</p>
<p>&#8211; Started using ksplice uptrack,  already have this running on a few hundred systems and no problems to date.  Only time will tell.</p>
<p>I am looking forward to 2011,  I am hoping to continue on with getting large portions of the &#8220;todo list&#8221; completed.  Some of the ones off the top of my head are,</p>
<p>&#8211; Make the switch from cacti to collectd+MongoDB.  Been working on this on and off for awhile.  Primary goals is to make it more flexible,  more automated and easier to maintain.   Since we maintain so many different environments it has to fit some very specific needs.  Hoping to replace the primary cacti install and also some of the other secondary customer-specific ones (such as munin).</p>
<p>&#8211; Upgrade to nagios 3.x.  We still are running nagios 2.x so an upgrade is needed.  At the same time need to rebuild and rewrite the automation systems,  templates,  hosts and groups.    Especially to tie better into collectd,  the existing nagios+cacti setup is pretty &#8220;hacky&#8221;.</p>
<p>&#8211; Rebuild the client database,  notes and task list systems.    This work is already under-way so should be completed in Q1 2011.   Better encryption,  more functionality,  more flexibility,  easier to manage.</p>
<p>&#8211; Build a new ticket system and drop Kayako.   I don&#8217;t particularly like the direction Kayako has taken in their latest release so it&#8217;s time to stop using it (Very hacked up anyway).</p>
<p>&#8211; Better documentation.   I, along with many others, really fail in this area and I would love to improve on it.   Still toying with the idea of internal wiki&#8217;s combined with the existing notes systems and to make better use of them.</p>
<p>&#8211; Improve the existing yum repo,  make more use of mocks,  include some newer RPM&#8217;s and update all systems to use this.   Replace all custom builds to an RPM from the repo (nginx, memcached, etc).</p>
<p>&#8211; Make more use of the nessus systems and plugin feeds.   At the moment this is mostly semi-manual ,  need to work on making it fully automated and easy to maintain.</p>
<p>&#8211; Post more blog entries?   Goal of atleast 20 more blog posts (Less than 2 per month).  </p>
<p>&#8211; Rewrite the nagios r1soft/buagent check and release it.</p>
<p>&#8211; Make the vbulletin static cache into a plugin.   This is just a simple patch we provide to customers who don&#8217;t have enough capacity and are receiving a sudden burst of traffic (IE a thread slashdotted/etc). It simply stores the threads for guests in memory for 2 minutes and then displays the cache for guests (supports online counters, multiple themes,  browsers, mobile, etc).</p>
<p>That&#8217;s my list for the time being.   Lets hope I can stick to it.   Do you have your list ready?  Feel free to share.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/2010-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Outbound DoS</title>
		<link>https://scott.cm/outbound-dos/</link>
				<comments>https://scott.cm/outbound-dos/#respond</comments>
				<pubDate>Sun, 18 Oct 2009 23:14:50 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[apache status]]></category>
		<category><![CDATA[bandwidth graph]]></category>
		<category><![CDATA[bandwidth network monitor]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[cacti graphs]]></category>
		<category><![CDATA[cacti monitoring]]></category>
		<category><![CDATA[mrtg graphs]]></category>
		<category><![CDATA[outbound dos]]></category>
		<category><![CDATA[outbound firewall]]></category>
		<category><![CDATA[php ddos]]></category>
		<category><![CDATA[php dos]]></category>
		<category><![CDATA[posix acl]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[traffic graph]]></category>
		<category><![CDATA[udp.pl]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=33</guid>
				<description><![CDATA[Last Sunday I had a new customer sign up to our Linux Server Management company and one of the issues they were receiving was bandwidth overages for continual outbound DoS attacks their system was performing but they were unable to track. So in effort to find the initial cause of]]></description>
								<content:encoded><![CDATA[<p>Last Sunday I had a new customer sign up to our <a href="http://www.admingeekz.com">Linux Server Management</a> company and one of the issues they were receiving was bandwidth overages for continual outbound DoS attacks their system was performing but they were unable to track.</p>
<p>So in effort to find the initial cause of this with no real data to work from I had a search around the system for the usual suspects but couldn&#8217;t find any particular culprit. Manually inspecting nearly 2 million files was not an option so opted to carry on with the usual setup and enforced posix ACL&#8217;s against the apache user and setup some more explicit bandwidth monitoring to obtain data when an attack was occurring.</p>
<p>A few hours later an alert came in that the outbound bandwidth exceeded the threshold so I promptly begin investigating, The process list doesn&#8217;t seem to show any obvious usual culprits. After spending a few minutes with iftop and tcpdump I identified the targeted IP and that the traffic was being directed to a DNS server (port 53). I filtered traffic to this IP while investigating the source, as there was no unusual processes I decided to have alook at the apache status and found the GET request containing the destination IP and port (xxx.php?target=xx.xx.xx.xx&amp;port=53).</p>
<p>I got the vhosts path from the httpd.conf and reviewed the file and it looks like a simple php script to perform a UDP flood to the target,</p>
<p><code>$sock=socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);</code></p>
<p>if(!$sock) die(&#8220;Cant Create Socket!!!&#8221;);</p>
<p>$data=&#8221;;<br />
for($i=0;$i&lt;1400;$i++)<br />
{<br />
$data.=chr(rand(0,255));<br />
}</p>
<p>while(true)<br />
{<br />
if(!socket_sendto($sock,$data,strlen($data),0,$target,$port)) die(&#8220;Error SendTo!!!&#8221;);<br />
}</p>
<p>That is a snippet of it. It is very unusual to see these PHP based which is the reason for this blog entry and a definite new addition to the <em>search list</em>.</p>
<p>For those of you interested the customer already had MRTG installed and below is the last week which shows the attack saturating the uplink (100Mbit) when it was occurring but has since been stopped.</p>
<p><a href="https://scott.cm/wp-content/uploads/2009/10/index-week.png" title="Outbound DoS Attack"><img src="https://scott.cm/wp-content/uploads/2009/10/index-week-300x81.png" alt="Outbound DoS Attack" /></a></p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/outbound-dos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
	</channel>
</rss>
