<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>LINICKX.com</title><link>https://www.linickx.com/</link><description></description><lastBuildDate>Wed, 23 Dec 2015 12:13:00 +0000</lastBuildDate><item><title>CentOS7 - syslog-ng: Error setting capabilities, capability management disabled; error=Operation not permitted</title><link>https://www.linickx.com/centos7--syslog-ng-error-setting-capabilities-capability-management-disabled-erroroperation-not-permitted</link><description>&lt;p&gt;I've just installed &lt;a href="https://www.balabit.com/network-security/syslog-ng"&gt;syslog-ng&lt;/a&gt; from &lt;a href="https://fedoraproject.org/wiki/EPEL"&gt;epel&lt;/a&gt; onto a test CentOS7 box and found that the service wouldn't start, a quick verify of my &lt;code&gt;syslog-ng.conf&lt;/code&gt;, with &lt;code&gt;syslog-ng -s&lt;/code&gt; came back like so...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;syslog-ng: Error setting capabilities, capability management disabled; error='Operation not permitted'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;a href="http://serverfault.com/questions/524518/error-setting-capabilities-capability-management-disabled"&gt;debain fix&lt;/a&gt; suggests something like: &lt;code&gt;syslog-ng -no-caps -s&lt;/code&gt;, which seems to work. What is odd is that &lt;code&gt;/usr/lib/systemd/system/syslog-ng.service&lt;/code&gt; doesn't have it, but the service still seems to work once you've fixed and syntax errors!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Wed, 23 Dec 2015 12:13:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2015-12-23:centos7--syslog-ng-error-setting-capabilities-capability-management-disabled-erroroperation-not-permitted</guid><category>CentOS</category><category>Linux</category><category>Syslog-NG</category></item><item><title>Cisco NTP Authentication to Linux Server</title><link>https://www.linickx.com/cisco-ntp-authentication-to-linux-server</link><description>&lt;div style="float:right"&gt;
&lt;a href="/files/2015/05/ntp.png"&gt;&lt;img src="/files/2015/05/ntp-150x150.png" /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;NTP Authentication is a recommended best security practice; there are a lot of documents out there on how to setup NTP authentication between two Cisco IOS devices but anything between Cisco and LINUX is few and far between.&lt;/p&gt;
&lt;p&gt;I have setup a LINUX Server (&lt;em&gt;Redhat/CentOS&lt;/em&gt;) box, that will act as an upstream proxy to &lt;a href="http://pool.ntp.org"&gt;pool.ntp.org&lt;/a&gt;. NTP authentication will be enabled on the LINUX box so that the downstream Cisco IOS box (&lt;em&gt;router/switch&lt;/em&gt;) can be configured with authentication.&lt;/p&gt;
&lt;h2&gt;CentOS Server config&lt;/h2&gt;
&lt;p&gt;Start with installing and starting NTP.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo yum install ntpd
sudo systemctl start  ntpd.service
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;... don't forget to open the firewall...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo firewall-cmd --permanent --zone=public --add-port=123/udp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, add a key to &lt;code&gt;/etc/ntp/keys&lt;/code&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# For more information about this file, see the man page ntp_auth(5).
#
# id    type    key
1 M Cisco123
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What I've done here is, add a key with id &lt;code&gt;1&lt;/code&gt; that is type &lt;code&gt;MD5&lt;/code&gt; (&lt;em&gt;authentication&lt;/em&gt;), the key is &lt;code&gt;Cisco123&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now, setup &lt;code&gt;/etc/ntp.conf&lt;/code&gt;, below is an example of a minimal config (&lt;em&gt;with comments removed, backup your original&lt;/em&gt;).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1

restrict 1.1.1.0 mask 255.255.255.252 nomodify notrap
restrict 2.2.2.0 mask 255.255.255.252 nomodify notrap

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

keys /etc/ntp/keys
trustedkey 1

disable monitor
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Take note of two things.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;trustedkey 1&lt;/code&gt; must match the ID in &lt;code&gt;/etc/ntp/keys&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;restrict 1.1.1.0 mask 255.255.255.252 nomodify notrap&lt;/code&gt; this says that any client (&lt;em&gt;i.e IOS router&lt;/em&gt;) in the 1.1.1.0/30 network can &lt;strong&gt;query&lt;/strong&gt; out CentOS time server&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Restart NTP to make the changes effective.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo systemctl restart  ntpd.service
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;ntpq&lt;/code&gt; to check its working...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[nick@CentOS7 ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp1.as34288.ne 85.158.25.72     2 u   31   64  377   56.363  -52.207  15.576
+ntp.coreless.ne 77.40.226.114    2 u   30   64  377   64.117  -45.444  10.966
-fra94-1-78-193- 212.83.158.83    3 u   23   64  377   42.197  -44.928  10.275
+dn3t.de         129.69.1.153     2 u   98   64  376   44.418  -42.061   7.436
[nick@CentOS7 ~]$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Don't move onto the IOS box until &lt;code&gt;ntpq&lt;/code&gt; shows a &lt;code&gt;*&lt;/code&gt; next to one of the upstream servers. You need clocks sync'd on the linux box before the IOS one will work. It should take at least 5 minutes to sync up; if you are having issues, manually set the linux clock to within a minute and restart the NTP service.&lt;/p&gt;
&lt;h2&gt;Cisco IOS Config&lt;/h2&gt;
&lt;p&gt;My Cisco router is 1.1.1.1, my linux server is 1.1.1.2, make sure both boxes can ping each other ;-)&lt;/p&gt;
&lt;p&gt;The router config is...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ntp authentication-key 1 md5 Cisco123
ntp trusted-key 1
ntp server 1.1.1.2 key 1
ntp authenticate
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Take note of the order! I wasted loads of time troubleshooting the debug error &lt;code&gt;NTP Core(INFO): 1.1.1.2 C01C 8C bad_auth no key&lt;/code&gt; because the command order is &lt;strong&gt;fussy&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can check it's working with the &lt;code&gt;show ntp association&lt;/code&gt; commands... notice on the detailed version is says &lt;code&gt;authenticated&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;R1#show ntp as

  address         ref clock       st   when   poll reach  delay  offset   disp
*~1.1.1.2         81.94.123.17     3     41     64     7 16.017  -4.263  1.893
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
R1#show ntp as detail
1.1.1.2 configured, ipv4, authenticated, our_master, sane, valid, stratum 3
ref ID 81.94.123.17   , time D9104931.F7121393 (13:46:25.965 UTC Wed May 27 2015)
our mode client, peer mode server, our poll intvl 64, peer poll intvl 64
root delay 56.70 msec, root disp 63.87, reach 7, sync dist 6302.70
delay 16.01 msec, offset -4.2633 msec, dispersion 1.89, jitter 6199.94 msec
precision 2**24, version 4
assoc id 42451, assoc name 1.1.1.2
assoc in packets 40, assoc out packets 42, assoc error packets 0
org time 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
rec time D91049C8.3C62C714 (13:48:56.235 UTC Wed May 27 2015)
xmt time D91049C8.3C62C714 (13:48:56.235 UTC Wed May 27 2015)
filtdelay =   107.76   51.78   16.01   19.97   23.99   19.84   32.00   43.89
filtoffset = 16398.9   76.43   -4.26   -1.38   22.31   27.85   22.48    8.67
filterror =     0.00    0.99    1.87    1.90    1.93    1.96    1.99    2.02
minpoll = 6, maxpoll = 10

R1#
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Footnote&lt;/h3&gt;
&lt;p&gt;NTP authentication is one way, the client authenticates the response from the server, so authentication is optional.&lt;/p&gt;
&lt;p&gt;I also have another router (&lt;em&gt;2.2.2.2&lt;/em&gt;) talking to the CentOS linux server (&lt;em&gt;1.1.1.2&lt;/em&gt;) with a default config....&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ntp server 1.1.1.2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And it works just fine...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;R2#show ntp as

  address         ref clock       st   when   poll reach  delay  offset   disp
*~1.1.1.2         81.94.123.17     3     18     64     1 39.632  -1.911 187.61
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
R2#
R2#
R2#show ntp as det
1.1.1.2 configured, ipv4, our_master, sane, valid, stratum 3
ref ID 81.94.123.17   , time D9104B06.F4F12334 (13:54:14.956 UTC Wed May 27 2015)
our mode client, peer mode server, our poll intvl 64, peer poll intvl 64
root delay 47.43 msec, root disp 55.89, reach 1, sync dist 322.40
delay 39.63 msec, offset -1.9110 msec, dispersion 187.61, jitter 34.98 msec
precision 2**24, version 4
assoc id 48023, assoc name 1.1.1.2
assoc in packets 8, assoc out packets 8, assoc error packets 0
org time 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
rec time D9104B96.A0AFE3F2 (13:56:38.627 UTC Wed May 27 2015)
xmt time D9104B96.A0AFE3F2 (13:56:38.627 UTC Wed May 27 2015)
filtdelay =    76.05   48.05   39.83   56.03   39.85   39.63    0.00    0.00
filtoffset =   64.31   33.05    5.55   17.13  -11.56   -1.91    0.00    0.00
filterror =     0.00    0.03    0.06    0.09    0.12    0.15 16000.0 16000.0
minpoll = 6, maxpoll = 10

R2#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So make sure your clients have authentication enabled.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Wed, 27 May 2015 14:10:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2015-05-27:cisco-ntp-authentication-to-linux-server</guid><category>Cisco</category><category>Linux</category><category>NTP</category><category>CentOS</category><category>Security</category></item><item><title>RPM SPECS for Python CiscoConfParse</title><link>https://www.linickx.com/rpm-specs-for-python-ciscoconfparse</link><description>&lt;p&gt;Recently I have been using &lt;a href="http://www.pennington.net/py/ciscoconfparse/"&gt;ciscoconfparse&lt;/a&gt; to loop through Cisco configs, installing on my local laptop is straightforward with &lt;code&gt;pip&lt;/code&gt; however getting it onto a &lt;em&gt;customers&lt;/em&gt; linux jump server can be a bit more tricky (proxies, build deps and the like).&lt;/p&gt;
&lt;p&gt;For Redhat/Centos (6) boxes I found an out of date &lt;a href="http://anorien.csc.warwick.ac.uk/mirrors/OBS/warwick.ac.uk:/CSC:/Public/CentOS_6/src/python-ciscoconfparse-1.2.15-1.1.csc.src.rpm"&gt;.src.rpm&lt;/a&gt;  therefore I have updated the &lt;a href="http://www.rpm.org/max-rpm/ch-rpm-inside.html"&gt;SPEC&lt;/a&gt; file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/files/2015/03/python-ciscoconfparse.spec"&gt;python-ciscoconfparse.spec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have made two changes, I updated to the ciscoconfparse 1.2.16 and added the python-ipaddr dependency.&lt;/p&gt;
&lt;p&gt;To build your own yo will also need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/files/2015/03/python-setuptools_hg.spec"&gt;python-setuptools_hg.spec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The only change I have made there is to add the correct download URL to the &lt;code&gt;Source&lt;/code&gt; so that it build without the human having to put the package in the right directory.... other than that all other build deps should be in the standard &lt;code&gt;base&lt;/code&gt; repositories.&lt;/p&gt;
&lt;p&gt;Building them is straight forward with &lt;code&gt;rebuild -ba&lt;/code&gt;, I have &lt;a href="https://www.linickx.com/rebuilding-rpms-getting-started-guide"&gt;an old post here&lt;/a&gt;... fedora have a much &lt;a href="https://fedoraproject.org/wiki/How_to_create_an_RPM_package"&gt;more comprehensive one here&lt;/a&gt;... I haven't uploaded pre-built RPMs &lt;a href="/files/rpm/"&gt;to my repo&lt;/a&gt; as I haven't found the need to for years, maybe this is a good excuse to resurrect it!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Mon, 30 Mar 2015 15:59:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2015-03-30:rpm-specs-for-python-ciscoconfparse</guid><category>Linux</category><category>Python</category><category>CentOS</category><category>Redhat</category><category>Cisco</category></item><item><title>bash-completion</title><link>https://www.linickx.com/bash-completion</link><description>&lt;p&gt;If like me you can be a little slow at times you need this in your life.&lt;/p&gt;
&lt;p&gt;Centos/Fedora Linux:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
$sudo yum install bash-completion
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;OSX: &lt;a href="https://trac.macports.org/wiki/howto/bash-completion"&gt;https://trac.macports.org/wiki/howto/bash-completion&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Fri, 06 Jul 2012 19:47:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2012-07-06:bash-completion</guid><category>centos</category><category>Fedora</category><category>Linux</category><category>mac</category><category>osx</category></item><item><title>apc.php for rhel / centos</title><link>https://www.linickx.com/apc-php-for-rhel-centos</link><description>&lt;p&gt;Note to self: The apc.php (&lt;em&gt;script for monitroing apc performance&lt;/em&gt;) is
stored in - &lt;code&gt;/usr/share/doc/php-pecl-apc-3.1.3p1&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Wed, 16 May 2012 14:39:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2012-05-16:apc-php-for-rhel-centos</guid><category>centos</category><category>Enterprise Linux</category><category>Linux</category><category>PHP</category></item><item><title>Bookmarks: Clustered Filesystems for CentOS</title><link>https://www.linickx.com/bookmarks-clustered-filesystems-for-centos</link><description>&lt;p&gt;Excellent resources....&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wiki.virtastic.com/display/howto/Clustered+Filesystem+with+DRBD+and+GFS2+on+CentOS+5.4"&gt;Clustered Filesystem with DRBD and GFS2 on CentOS
5.4&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;...a short walk-through of how to set up a filesystem, which
replicates across two web nodes, and allows concurrent access from
both nodes. This scenario is particularly useful, when you intend to
load-balance or automatically fail-over two web nodes...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://wiki.virtastic.com/display/howto/Clustered+Filesystem+with+DRBD+and+OCFS2+on+CentOS+5.5"&gt;Clustered Filesystem with DRBD and OCFS2 on CentOS
5.5&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;...OCFS2 works very similar to GFS2, except that it doesn't use
RedHat's Cluster Manager, but instead ships with O2CB, Oracle's own
cluster manager. As far as the filesystem is concerned, it does the
same thing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I've been playing with both solutions in VirtualBox with a plan to roll
out to ec2 and solve &lt;a href="https://www.linickx.com/archives/3165/slammed-by-spam"&gt;my cpu
issues&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;GFS won't be happening in EC2 as that requires multicast, I've played
with
&lt;a href="https://www.linickx.com/archives/3195/centosredhat-ipsec-and-ec2"&gt;IPSEC&lt;/a&gt;
and
&lt;a href="https://www.linickx.com/archives/3185/gre-example-for-centosrhel"&gt;GRE&lt;/a&gt;
and the redhat clustering stuff just won't bind to the tunnel
interfaces.&lt;/p&gt;
&lt;p&gt;OCFS2 looks like it will work, I'll be testing on a micro-instance later
but doesn't support SELINUX so I'll need to review my security config.&lt;/p&gt;
&lt;p&gt;More posts no doubt as testing continues!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Mon, 07 Feb 2011 22:50:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-02-07:bookmarks-clustered-filesystems-for-centos</guid><category>aws</category><category>centos</category><category>DRBD</category><category>ec2</category><category>GFS</category><category>OCFS2</category></item><item><title>CentOS/Redhat IPSEC and EC2</title><link>https://www.linickx.com/centosredhat-ipsec-and-ec2</link><description>&lt;p&gt;So it turns out my &lt;a href="https://www.linickx.com/archives/3181/5-minute-centosrhel-vpn"&gt;5 minute
vpn&lt;/a&gt;
doesn't work in EC2 because the ESP/AH protocols (50 and 51) are blocked
on the AWS network.&lt;/p&gt;
&lt;p&gt;This is no big deal tho, as &lt;a href="http://en.wikipedia.org/wiki/NAT-T"&gt;NAT-T&lt;/a&gt;
allows one to tunnel IPSEC over UDP... however getting it to work on
CentOS required a bit of a hack.&lt;/p&gt;
&lt;p&gt;If you have already tried setting up an IPSEC vpn, shut it down with
&lt;code&gt;ifdown ipsec1&lt;/code&gt; and remove your /etc/racoon/192.168.56.101.conf (&lt;em&gt;or
whatever IP yours is&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;To start the hack on BOTH boxes, you need to edit
/etc/sysconfig/network-scripts/ifup-ipsec. Around line 215 you need to
insert &lt;code&gt;nat_traversal force;&lt;/code&gt;... like this....&lt;/p&gt;
&lt;p&gt;BEFORE:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
        case "$IKE_METHOD" in
           PSK)
              cat &amp;gt;&amp;gt; /etc/racoon/$DST.conf &amp;lt;&amp;lt; EOF
        my_identifier address;
        proposal {
                encryption_algorithm $IKE_ENC;
                hash_algorithm $IKE_AUTH;
                authentication_method pre_shared_key;
                dh_group $IKE_DHGROUP;
        }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;AFTER:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
        case "$IKE_METHOD" in
           PSK)
              cat &amp;gt;&amp;gt; /etc/racoon/$DST.conf &amp;lt;&amp;lt; EOF
        my_identifier address;
        nat_traversal force;
        proposal {
                encryption_algorithm $IKE_ENC;
                hash_algorithm $IKE_AUTH;
                authentication_method pre_shared_key;
                dh_group $IKE_DHGROUP;
        }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Again, on both boxes update your
/etc/sysconfig/network-scripts/ifcfg-ipsec1 files so that AH is
disabled... because AH doesn't like NAT... like this....&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash

[root@CentOS2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ipsec1 
DST=192.168.56.101
TYPE=IPSEC
ONBOOT=yes
IKE_METHOD=PSK
AH_PROTO=none
[root@CentOS2 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On your iptables policy make sure that UDP 500 and UDP 4500 are
permitted and volia.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# tcpdump -n -i eth1 port not 22
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
20:26:49.257590 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xa), length 116
20:26:49.261076 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xa), length 116
20:26:50.260942 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xb), length 116
20:26:50.262939 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xb), length 116
20:26:51.261298 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xc), length 116
20:26:51.264974 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xc), length 116
20:26:52.262289 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xd), length 116
20:26:52.265488 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xd), length 116
20:26:53.264008 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xe), length 116
20:26:53.267003 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xe), length 116
20:26:54.265655 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0xf), length 116
20:26:54.267264 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0xf), length 116
20:26:55.267459 IP 192.168.56.101.ipsec-nat-t &amp;gt; 192.168.56.102.ipsec-nat-t: UDP-encap: ESP(spi=0x08de7c32,seq=0x10), length 116
20:26:55.269678 IP 192.168.56.102.ipsec-nat-t &amp;gt; 192.168.56.101.ipsec-nat-t: UDP-encap: ESP(spi=0x03787bd0,seq=0x10), length 116
14 packets captured
14 packets received by filter
0 packets dropped by kernel
#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;IPSEC VPN Tunnelling over UDP.... done!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Thu, 27 Jan 2011 20:17:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-01-27:centosredhat-ipsec-and-ec2</guid><category>aws</category><category>centos</category><category>ec2</category><category>IPSEC</category><category>Linux</category><category>redhat</category><category>vpn</category></item><item><title>RedHat Cluster - How to Disable Fencing</title><link>https://www.linickx.com/redhat-cluster-how-to-disable-fencing</link><description>&lt;p&gt;I've spent far too long googling how to disable fencing.... I can only
guess that because you shouldn't really disable fencing no-one wants to
post a how to... so for the hard of hearing.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Do NOT disable fencing on your RedHat Cluster unless you really know
what you're doing! Fencing is designed to protect your data from
corruption, if you disable fencing your data is at RISK, you have been
warned!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I however am working on building a GFS DRBD cluster, as far as I can
gather DRBD doesn't need fencing, and the bottom line is my data is
personal data not mission critical and if my website goes down due to my
disabling fencing then it's no big deal.&lt;/p&gt;
&lt;p&gt;Rant over, here we go..... To disable fencing, create a custom fence
agent.&lt;/p&gt;
&lt;p&gt;Fence agents are simply scripts in /sbin, I've created /sbin/myfence and
here are the contents.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin.bash
echo "success: myfence $2"
exit 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, change your cluster.conf...&lt;/p&gt;
&lt;p&gt;If you're running SELINUX don't forget to update that! ... start with
&lt;code&gt;restorecon /sbin/myfence&lt;/code&gt; then update your policy.&lt;/p&gt;
&lt;p&gt;This is the policy I've created...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module fenced 1.0;

require {
        type fenced_t;
        type shell_exec_t;
        class file { read execute };
}

#============= fenced_t ==============
allow fenced_t shell_exec_t:file { read execute };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you save the above as fenced.te, then run this to install it..&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;checkmodule -M -m -o fenced.mod fenced.te
semodule_package -o fenced.pp -m fenced.mod
semodule -i fenced.pp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should now be able to start cman, fencing will start but will return
success for any fencing issues without actually doing anything!&lt;/p&gt;
&lt;p&gt;Happy non-fencing!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Tue, 25 Jan 2011 19:37:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-01-25:redhat-cluster-how-to-disable-fencing</guid><category>centos</category><category>cluster</category><category>fencing</category><category>howto</category><category>redhat</category><category>selinux</category></item><item><title>GRE example for CentOS/RHEL</title><link>https://www.linickx.com/gre-example-for-centosrhel</link><description>&lt;p&gt;I'm not sure why GRE isn't in &lt;a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces-other.html"&gt;RedHat's
Documentation&lt;/a&gt;,
but setting up a GRE tunnel between two RedHat boxes is quite straight
forward...&lt;/p&gt;
&lt;p&gt;On Host1 (192.168.56.101)...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-tun0 
DEVICE=tun0
BOOTPROTO=none
ONBOOT=no
TYPE=GRE
PEER_OUTER_IPADDR=192.168.56.102
PEER_INNER_IPADDR=192.168.168.2
MY_INNER_IPADDR=192.168.168.1
[root@CentOS1 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On host2 (192.168.56.102) ....&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-tun0 
DEVICE=tun0
BOOTPROTO=none
ONBOOT=no
TYPE=GRE
PEER_OUTER_IPADDR=192.168.56.101
PEER_INNER_IPADDR=192.168.168.1
MY_INNER_IPADDR=192.168.168.2
[root@CentOS1 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bring the interfaces up....&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# ifup tun0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;.. on host2...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS2 ~]# ifup tun0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And we're done! ... see the proof in the pudding below....&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-05-08-80-3C-00-00-00-00-00-00-00-00  
          inet addr:192.168.168.1  P-t-P:192.168.168.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP  MTU:1476  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:168 (168.0 b)  TX bytes:756 (756.0 b)

[root@CentOS1 ~]# ping 192.168.168.2
PING 192.168.168.2 (192.168.168.2) 56(84) bytes of data.
64 bytes from 192.168.168.2: icmp_seq=1 ttl=64 time=1.51 ms
64 bytes from 192.168.168.2: icmp_seq=2 ttl=64 time=2.13 ms
64 bytes from 192.168.168.2: icmp_seq=3 ttl=64 time=2.12 ms

--- 192.168.168.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 1.511/1.921/2.132/0.289 ms
[root@CentOS1 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The other end...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS2 ~]# ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-05-08-80-4C-00-00-00-00-00-00-00-00  
          inet addr:192.168.168.2  P-t-P:192.168.168.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP  MTU:1476  Metric:1
          RX packets:42 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3528 (3.4 KiB)  TX bytes:4536 (4.4 KiB)

[root@CentOS2 ~]# ping 192.168.168.1
PING 192.168.168.1 (192.168.168.1) 56(84) bytes of data.
64 bytes from 192.168.168.1: icmp_seq=1 ttl=64 time=4.39 ms
64 bytes from 192.168.168.1: icmp_seq=2 ttl=64 time=1.41 ms
64 bytes from 192.168.168.1: icmp_seq=3 ttl=64 time=2.57 ms

--- 192.168.168.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 1.419/2.795/4.393/1.224 ms
[root@CentOS2 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we show the tunnelled packets...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# tcpdump -n -i eth1 proto 47
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
13:45:59.429315 IP 192.168.56.102 &amp;gt; 192.168.56.101: GREv0, length 88: IP 192.168.168.2 &amp;gt; 192.168.168.1: ICMP echo request, id 55053, seq 7, length 64
13:45:59.429315 IP 192.168.56.101 &amp;gt; 192.168.56.102: GREv0, length 88: IP 192.168.168.1 &amp;gt; 192.168.168.2: ICMP echo reply, id 55053, seq 7, length 64
13:46:00.530528 IP 192.168.56.102 &amp;gt; 192.168.56.101: GREv0, length 88: IP 192.168.168.2 &amp;gt; 192.168.168.1: ICMP echo request, id 55053, seq 8, length 64
13:46:00.530686 IP 192.168.56.101 &amp;gt; 192.168.56.102: GREv0, length 88: IP 192.168.168.1 &amp;gt; 192.168.168.2: ICMP echo reply, id 55053, seq 8, length 64
13:46:01.418447 IP 192.168.56.102 &amp;gt; 192.168.56.101: GREv0, length 88: IP 192.168.168.2 &amp;gt; 192.168.168.1: ICMP echo request, id 55053, seq 9, length 64
13:46:01.418526 IP 192.168.56.101 &amp;gt; 192.168.56.102: GREv0, length 88: IP 192.168.168.1 &amp;gt; 192.168.168.2: ICMP echo reply, id 55053, seq 9, length 64

6 packets captured
6 packets received by filter
0 packets dropped by kernel
[root@CentOS1 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since we can see the ICMP packets inside the GRE tunnel that show's us
that GRE is in clear text... to add some security &lt;a href="https://www.linickx.com/archives/3181/5-minute-centosrhel-vpn"&gt;setup a simple IPSEC
VPN&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;Reference:
&lt;a href="http://juliano.info/en/Blog:Memory_Leak/Bridges_and_tunnels_in_Fedora"&gt;http://juliano.info/en/Blog:Memory_Leak/Bridges_and_tunnels_in_Fedora&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Mon, 24 Jan 2011 18:02:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-01-24:gre-example-for-centosrhel</guid><category>centos</category><category>gre</category><category>redhat</category></item><item><title>5 Minute CentOS/RHEL VPN</title><link>https://www.linickx.com/5-minute-centosrhel-vpn</link><description>&lt;p&gt;I'm looking at running two servers on EC2; as we all know the most
important thing about running services in the cloud is &lt;strong&gt;encryption&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;Whilst googling on how to setup a host-to-host IPSEC VPN I was surprised
at how easy it is...&lt;/p&gt;
&lt;p&gt;On Host1 (192.168.56.101)...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ipsec1 
DST=192.168.56.102
TYPE=IPSEC
ONBOOT=no
IKE_METHOD=PSK
[root@CentOS1 ~]#
[root@CentOS1 ~]# cat /etc/sysconfig/network-scripts/keys-ipsec1 
IKE_PSK=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[root@CentOS1 ~]#
[root@CentOS1 ~]# ifup ipsec1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On host2 (192.168.56.102)...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ipsec1 
DST=192.168.56.101
TYPE=IPSEC
ONBOOT=no
IKE_METHOD=PSK
[root@CentOS2 ~]#
[root@CentOS2 ~]# cat /etc/sysconfig/network-scripts/keys-ipsec1 
IKE_PSK=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[root@CentOS2 ~]#
[root@CentOS2 ~]#ifup ipsec1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;... done!!!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
[root@CentOS1 ~]# tcpdump -n -i eth1 host 192.168.56.102
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
09:46:37.306292 IP 192.168.56.101 &amp;gt; 192.168.56.102: AH(spi=0x0aff2b10,seq=0x203): ESP(spi=0x00a0a3cc,seq=0x203), length 84
09:46:37.310197 IP 192.168.56.102 &amp;gt; 192.168.56.101: AH(spi=0x09f82154,seq=0x203): ESP(spi=0x098f0ff9,seq=0x203), length 68
09:46:38.175048 IP 192.168.56.101 &amp;gt; 192.168.56.102: AH(spi=0x0aff2b10,seq=0x204): ESP(spi=0x00a0a3cc,seq=0x204), length 84
09:46:38.179017 IP 192.168.56.102 &amp;gt; 192.168.56.101: AH(spi=0x09f82154,seq=0x204): ESP(spi=0x098f0ff9,seq=0x204), length 68
09:46:39.313583 IP 192.168.56.101 &amp;gt; 192.168.56.102: AH(spi=0x0aff2b10,seq=0x205): ESP(spi=0x00a0a3cc,seq=0x205), length 84
09:46:39.316427 IP 192.168.56.102 &amp;gt; 192.168.56.101: AH(spi=0x09f82154,seq=0x205): ESP(spi=0x098f0ff9,seq=0x205), length 68

6 packets captured
6 packets received by filter
0 packets dropped by kernel
[root@CentOS1 ~]#
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now this is a simple IKE pre-shared key vpn, you might want to google
for using certificates for stronger authentication, you can also edit
/etc/racoon/racoon.conf to change your IPSEC parameters.&lt;/p&gt;
&lt;p&gt;Reference:
&lt;a href="http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-vpn.htm"&gt;http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-vpn.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE: To make this work in EC2, &lt;a href="https://www.linickx.com/archives/3195/centosredhat-ipsec-and-ec2"&gt;you need to enable NAT-T see my
hack
here&lt;/a&gt;!&lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Sun, 23 Jan 2011 09:51:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-01-23:5-minute-centosrhel-vpn</guid><category>centos</category><category>Enterprise Linux</category><category>Security</category><category>vpn</category></item></channel></rss>