<?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>Hack Admin</title>
	<atom:link href="http://www.hackadmin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Implement htaccess with MySQL</title>
		<link>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/</link>
		<comments>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 21:31:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=275</guid>
		<description><![CDATA[Article by Aashish
# yum install httpd* mysql* -y
*** Install Module Needed for Authentication from MySQL databases. ***
# yum install mod_auth_mysql -y
*** Create a database which contains a table holding the username and passwd ***
#mysql -u root -p
password:
mysql> create database httpd;
mysql> use httpd;
mysql> create user &#8216;apache&#8217;@'localhost&#8217; identified by &#8216;apache&#8217;;
mysql> create table users( user_name char(30) NOT NULL, [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p># yum install httpd* mysql* -y</p>
<p>*** Install Module Needed for Authentication from MySQL databases. ***</p>
<p># yum install mod_auth_mysql -y</p>
<p>*** Create a database which contains a table holding the username and passwd ***</p>
<p>#mysql -u root -p<br />
password:</p>
<p>mysql> create database httpd;<br />
mysql> use httpd;<br />
mysql> create user &#8216;apache&#8217;@'localhost&#8217; identified by &#8216;apache&#8217;;<br />
mysql> create table users( user_name char(30) NOT NULL, user_passwd char(30), user_group char(30)<br />
NOT NULL, PRIMARY KEY(user_name));<br />
mysql> grant all privileges on *.* to &#8216;apache&#8217;@'localhost&#8217; with GRANT option;<br />
mysql> INSERT INTO users VALUES (&#8217;testuser&#8217;, ENCRYPT(&#8217;testpass&#8217;), &#8216;user&#8217;);<br />
mysql> INSERT INTO users VALUES (&#8217;admin&#8217;, ENCRYPT(&#8217;testpass&#8217;), &#8216;group&#8217;);<br />
mysql> quit</p>
<p># service mysqld restart</p>
<p># vim /etc/httpd/conf/httpd.conf</p>
<p><Directory /var/www/html><br />
AuthName &#8220;MySQL group authenticated zone&#8221;<br />
AuthType Basic<br />
AuthMYSQLEnable on<br />
AuthMySQLUser apache<br />
AuthMySQLPassword apache<br />
AuthMySQLDB httpd<br />
AuthMySQLUserTable users<br />
AuthMySQLNameField user_name<br />
AuthMySQLPasswordField user_passwd<br />
AuthMySQLGroupField user_group<br />
require group admin /or/ require valid-user<br />
</Directory></p>
<p># service httpd restart</p>
<p>enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/feed/</wfw:commentRss>
		<slash:comments>64</slash:comments>
		</item>
		<item>
		<title>LDAP Authentication In Linux</title>
		<link>http://www.hackadmin.com/2010/03/05/ldap-authentication-in-linux/</link>
		<comments>http://www.hackadmin.com/2010/03/05/ldap-authentication-in-linux/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 17:41:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=270</guid>
		<description><![CDATA[This howto will show you howto store your users in LDAP and authenticate some of the services against it. I will not show howto install particular packages, as it is distribution/system dependant. I will focus on "pure" configuration of all componenets needed to have LDAP authentication/storage of users.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;">This howto will show you howto store your users in LDAP and authenticate some of the services against it. I will not show howto install particular packages, as it is distribution/system dependant. I will focus on &#8220;pure&#8221; configuration of all componenets needed to have LDAP authentication/storage of users. The howto assumes somehow, that you are migrating from a regular passwd/shadow authentication, but it is also suitable for people who do it from scratch.</span></p>
<p><span id="more-270"></span></p>
<h2>Requirements</h2>
<p>OpenLDAP<br />
pam_ldap<br />
nss_ldap<br />
PADL migrationtools</p>
<h2><span style="font-size: medium;">Introducion</span></h2>
<p>The thing we want to achieve is to have our users stored in LDAP, authenticated against LDAP ( direct or pam ) and have some tool to manage this in a human understandable way.</p>
<p>This way we can use all software, which has ldap support or fallback to PAM ldap module, which will act as a PAM-&gt;LDAP gateway.</p>
<h2><span style="font-size: medium;">Configuring OpenLDAP</span></h2>
<p>OpenLDAP consists of slapd and slurpd daemon. This howto covers one LDAP server without a replication, so we will focus only on slapd. I also assume you installed and initialized your openldap installation (depends on system/disribution). If so, let&#8217;s go to configuration part.</p>
<p>On my system (Gentoo), openldap&#8217;s configuration is stored in<span> </span><span>/etc/openldap</span>, we are interested in<span>/etc/openldap/slapd.conf</span><span> </span>file. But first we have to generate a password for LDAP administrator, to put it into the config file:</p>
<p># slappasswd -h {md5}</p>
<p>The config looks like this:<span> </span></p>
<p># vim /etc/openldap/slapd.conf</p>
<pre style="white-space: pre-wrap;">include         /etc/openldap/schema/core.schema

include         /etc/openldap/schema/cosine.schema

include         /etc/openldap/schema/inetorgperson.schema

include         /etc/openldap/schema/nis.schema

allow bind_v2

pidfile         /var/run/openldap/slapd.pid

argsfile        /var/run/openldap/slapd.args

modulepath      /usr/lib/openldap/openldap

access to attrs=userPassword

        by dn="uid=root,ou=People,dc=hackadmin,dc=com" write

        by dn="cn=Manager,dc=hackadmin,dc=com" write

        by anonymous auth

        by self write

        by * none

access to dn.base="" by * read

access to *

         by dn="cn=Manager,dc=hackadmin,dc=com" write

         by * read

database        bdb

suffix          "dc=hackadmin,dc=com"

rootdn          "cn=Manager,dc=hackadmin,dc=com"
rootpw          {MD5}Tk1sMytv5ipjr+Vhcf03JQ==

directory       /var/lib/openldap-data

index   objectClass     eq</pre>
<p>Remember to change suffix and paths to your needs.</p>
<p>These are basic options with some basic ACLs needed to change passwrods by user. If you want more functionality, please read the manual about openLDAP. Now when we have a proper config for slapd, we can start the daemon :<span> </span></p>
<p># /etc/init.d/ldap start</p>
<p># chkconfig ldap on</p>
<p>Now we can test if openldap is running and working properly. We do not have any data yet in the directory, but we can try to bind as cn=Manager,dc=domain,dc=com. When you are asked for password, you should use the one you generated (of course the plain text version of it <img src='http://www.hackadmin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> :</p>
<p># ldapsearch -D &#8220;cn=Manager,dc=hackadmin,dc=com&#8221; -W</p>
<h2><span style="font-size: medium;">Migrate/Add data to the directory</span></h2>
<p>Now when we have a running LDAP server, we have to fill it with data, either create or migrate entries. I will show you howto migrate existing entries from regular<span> </span><span>/etc/passwd, /etc/shadow , /etc/groups</span></p>
<p>The first step is to configure mogrationtools to your needs. The configuration file on gentoo is located in<span>/usr/share/migrationtools/<a style="color: #005488;" href="http://migrate_common.ph/" target="_blank">migrate_common.ph</a></span>.</p>
<p>Generally you need to change only these:</p>
<pre style="white-space: pre-wrap;">$DEFAULT_BASE = "dc=hackadmin,dc=com";

$EXTENDED_SCHEMA = 1;</pre>
<p>Now you are ready to migrate the data (actually it works even without the export command):</p>
<p>export ETC_SHADOW=/etc/shadow</p>
<p># ./<a style="color: #005488;" href="http://migrate_base.pl/" target="_blank">migrate_base.pl</a><span> </span>&gt; /tmp/base.ldif<br />
# ./<a style="color: #005488;" href="http://migrate_group.pl/" target="_blank">migrate_group.pl</a><span> </span>/etc/group /tmp/group.ldif<br />
# ./<a style="color: #005488;" href="http://migrate_hosts.pl/" target="_blank">migrate_hosts.pl</a><span> </span>/etc/hosts /tmp/hosts.ldif<br />
# ./<a style="color: #005488;" href="http://migrate_passwd.pl/" target="_blank">migrate_passwd.pl</a><span> </span>/etc/passwd /tmp/passwd.ldif</p>
<p>Now we have the data in the format understood by LDAP server. Please open one the files with text editor to get used to the syntax. After that we can add the data from ldifs.</p>
<p># ldapadd -D &#8220;cn=Manager,dc=domain,dc=com&#8221; -W -f /tmp/base.ldif</p>
<p># ldapadd -D &#8220;cn=Manager,dc=domain,dc=com&#8221; -W -f /tmp/group.ldif</p>
<p># ldapadd -D &#8220;cn=Manager,dc=domain,dc=com&#8221; -W -f /tmp/passwd.ldif</p>
<p># ldapadd -D &#8220;cn=Manager,dc=domain,dc=com&#8221; -W -f /tmp/hosts.ldif</p>
<p>You can try searching for some data:</p>
<p># ldapsearch uid=foouser</p>
<h2>Client configuration</h2>
<p>By client I mean the machine, which connects to LDAP server to get users and authorize. It can be also the machine, the ldap server runs on. In both cases we have to edit three files :<span> </span><span>/etc/ldap.conf, /etc/nsswitch.conf and /etc/pam.d/system-auth</span></p>
<p>Let&#8217;s start woth ldap.conf, the ldap&#8217;s client:</p>
<pre style="white-space: pre-wrap;">BASE    dc=hackadmin, dc=com

scope sub

suffix          "dc=hackadmin,dc=com"

## when you want to change user's password by root 

rootbinddn cn=Manager,dc=hackadmin,dc=com

## there are needed when your ldap dies

timelimit 5

bind_timelimit 5

uri ldap://<a style="color: #005488;" href="http://ldap.hackadmin.com/" target="_blank">ldap.hackadmin.com/</a>

pam_password exop

ldap_version 3

pam_filter objectclass=posixAccount

pam_login_attribute uid

pam_member_attribute memberuid

nss_base_passwd ou=Computers,dc=cognifide,dc=pl

nss_base_passwd ou=People,dc=cognifide,dc=pl

nss_base_shadow ou=People,dc=cognifide,dc=pl

nss_base_group  ou=Group,dc=cognifide,dc=pl

nss_base_hosts  ou=Hosts,dc=cognifide,dc=pl</pre>
<p>Now it is time for nsswitch.conf and pam</p>
<p>Add these to nsswitch.conf:</p>
<pre style="white-space: pre-wrap;">passwd: files ldap

shadow: files ldap

group:  files ldap</pre>
<p>And change the system-auth (or hatever you have like login, sshd etc) to :</p>
<pre style="white-space: pre-wrap;">auth       required     pam_env.so

auth       sufficient   pam_unix.so likeauth nullok

auth       sufficient   pam_ldap.so use_first_pass

auth       required     pam_deny.so

account    sufficient   pam_unix.so

account    sufficient   pam_ldap.so

account    required     pam_ldap.so

password   required     pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3

password   sufficient   pam_unix.so nullok md5 shadow use_authtok

password   sufficient   pam_ldap.so use_first_pass

password   required     pam_deny.so

session    required     pam_limits.so

session    required     pam_unix.so

session    optional     pam_ldap.so</pre>
<p>Time to test it. The best tool for it is a good old getent. Pick a user from your system and issue:</p>
<p># getent passwd | grep foouser</p>
<p>You should get the result twice, if so the nss_ldap works fine. The pam part can be tested by deleting a user from the /etc/passwd and trying to log in through ssh.</p>
<h2><span style="font-size: medium;">Apache mod_auth_ldap</span></h2>
<p>To have LDAP authorization in apache, you have to load mod_auth_ldap module</p>
<pre style="white-space: pre-wrap;">LoadModule mm_auth_ldap_module modules/mod_auth_ldap.so</pre>
<p>Now it is enought to make .htaccess like that:</p>
<pre style="white-space: pre-wrap;">AuthName "Restricted"

AuthType Basic

AuthLDAPURL ldap://<a style="color: #005488;" href="http://ldap.hackadmin.com:389/ou=People,dc=hackadmin,dc=com?uid" target="_blank">ldap.hackadmin.com:389/ou=People,dc=hackadmin,dc=com?uid</a>

AuthLDAPBindDN "cn=Manager,dc=hackadmin,dc=com"

AuthLDAPBindPassword "your_secret_secret_password_to_ldap_admin"

require valid-user</pre>
<p>Note that this method can be also used for webdav subversion authorization</p>
<h2><span style="font-size: medium;">Administration tools for ldap</span></h2>
<p>There are few tool I recommend using to administrate OpenLDAP server</p>
<p><a style="color: #005488;" href="http://phpldapadmin.sourceforge.net/" target="_blank">phpldapadmin</a><span> </span>- web based tool<br />
<a style="color: #005488;" href="http://directory.fsf.org/database/applications/ldapvi.html" target="_blank">ldapvi</a><span> </span>- vim browsing<br />
<a style="color: #005488;" href="http://www.padl.com/OSS/MigrationTools.html" target="_blank">PADL migrationtools</a><span> </span>- migrationtools<br />
<a style="color: #005488;" href="http://sourceforge.net/projects/smbldap-tools/" target="_blank">IDEALX sambaldap tools</a><span> </span>- samba ldap tools</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/03/05/ldap-authentication-in-linux/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>MySQL Server Replication with ssl</title>
		<link>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/</link>
		<comments>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:14:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bushan]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=262</guid>
		<description><![CDATA[TYPES OF MYSQL REPLICATION

    *

      Statement-based Replication
    *

      Row-based Replication
    *

      Mixed

      To change the type of Replication modify my.cnf configuration file and change]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --><span>via </span><a href="http://www.hackadmin.com/bashan/"><span>Bhushan</span></a></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">TYPES OF MYSQL REPLICATION</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">Statement-based Replication</p>
</li>
<li>
<p style="margin-bottom: 0in;">Row-based Replication</p>
</li>
<li>
<p style="margin-bottom: 0in;">Mixed</p>
<p style="margin-bottom: 0in;">To change the type of Replication 	modify my.cnf configuration file and change</p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format=<span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">mixed</span> | row | statement</span></span></span></p>
</li>
</ul>
<p><span id="more-262"></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW VARIABLES LIKE &#8216;binlog_format&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| binlog_format | MIXED </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<ul>
<p style="margin-bottom: 0in;">
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Processes/Threads inside MySQL that are responsible for replication</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">MASTER	-	Binlog Dump Thread</p>
</li>
<li>
<p style="margin-bottom: 0in;">SLAVE	-	I/O Thread</p>
<ul>
<li>
<ul>
<li>
<ul>
<li>
<ul>
<li>
<ul>
<p style="margin-bottom: 0in;">SQL Thread</p>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;"> Statements useful to check the status of these threads as replication goes:</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW PROCESSLIST\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW MASTER STATUS\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW SLAVE STATUS\G</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Directories and File Locations</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">Datadir &#8211; /var/lib/mysql</p>
</li>
<li>
<p style="margin-bottom: 0in;">General Log dir. 	-	/var/log</p>
</li>
<li>
<p style="margin-bottom: 0in;">Bin Log dir.		-	/var/log/mysql</p>
</li>
<li>
<p style="margin-bottom: 0in;">Configuration 	file	-	/etc/mysql/my.cnf</p>
</li>
<li>
<p style="margin-bottom: 0in;">SSL Certificates		-	/etc/mysql/ssl</p>
</li>
<li>
<p style="margin-bottom: 0in;">Relay Log 	file		-	/var/lib/mysql/slavehost-relay-bin.NNNNNN</p>
</li>
<li>
<p style="margin-bottom: 0in;">Status Files			-	master.info, 	relay-log.info</p>
</li>
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Note:</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	All <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">modification/updates to data should be done on Master only, and not on any Slave. Slave should be used for queries</span>.</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;" align="center"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: medium;">setup replication</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">MySQL MASTER = 192.168.1.100:3306</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">MySQL SLAVE  = 192.168.1.111:3306</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">MASTER host</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mkdir /etc/mysql/ssl</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> cd /etc/mysql/ssl/</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> rm -rf *</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create CA certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl genrsa 2048 &gt; ca-key.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -new -x509 -nodes -days 1000 -key ca-key.pem &gt; ca-cert.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create server certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem &gt; server-req.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 &gt; server-cert.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Copy ca-cert file to MySQL clients &amp; slaves</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> scp ca-cert.pem <a href="mailto:root@192.168.1.111">root@</a>slave-host-IP:/etc/mysql/ssl/</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Modify configuration file</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> vi /etc/mysql/my.cnf</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Enable Binary logging in Mixed  format. And specify a Unique Server ID of Master</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[mysqld]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">log-bin			=	/var/log/mysql/mysql-bin </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format	=	mixed </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">server-id      	= 	1</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-key			=	/etc/mysql/ssl/server-key.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-cert		=	/etc/mysql/ssl/server-cert.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-ca			=	/etc/mysql/ssl/ca-cert.pem</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Test SSL connectivity using MySQL-Client</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"> /etc/init.d/mysql restart</span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"> mysql --ssl-ca=/etc/mysql/ssl/ca-cert.pem -u root -p</span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW VARIABLES LIKE &#8216;%ssl%&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value                          | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| have_openssl  | <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">YES</span> | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| have_ssl      | <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">YES </span> | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_ca        | /etc/mysql/ssl/ca-cert.pem     | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_capath    |                                | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_cert      | /etc/mysql/ssl/server-cert.pem | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_cipher    |                                | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_key       | /etc/mysql/ssl/server-key.pem  | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW STATUS LIKE &#8216;Ssl_cipher&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value              | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Ssl_cipher    | DHE-RSA-AES256-SHA | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">confirms that SSL is supported &amp; enabled on MASTER</span></span></code></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create mysql user on master that has the privileges to do replication.</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql -u root -p</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO replssl@&#8217;<span style="font-family: Courier New,monospace;"><span style="font-size: small;">%&#8217; IDENTIFIED BY &#8216;replipass&#8217;</span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"> </span></span></code><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE SSL</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">;</span></span></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">If user already exists</span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">mysql&gt; </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">GRANT USAGE ON *.* </span></span></span></code><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">TO 'repl'@'%' REQUIRE SSL;</span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; FLUSH PRIVILEGES;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW GRANTS FOR repl;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Find the location where Master is writing now</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; show master status; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| File         | Position |Binlog_Do_DB |Binlog_Ignore_DB </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>|mysql-bin.000004|   7705 |             | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">They are:   mysql-bin.000004,    7705</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Take snapshot of Mysql data on Master and then scp it to slave.</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; FLUSH TABLES WITH <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">READ LOCK</span>;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> tar czvf ~/mysql-snapshot.tar.gz /var/lib/mysql</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; UNLOCK TABLES;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Copy snapshot to the slave</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> scp mysql-snapshot.tar/gz user@slave-IP:~</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">SLAVE side</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">To configure this host as a replication slave, you can choose between </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">two methods : </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	Use the CHANGE MASTER TO command </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"> <span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>CHANGE MASTER TO MASTER_HOST=&lt;host&gt;, MASTER_PORT=&lt;port&gt;, </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"> <span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>MASTER_USER=&lt;user&gt;, MASTER_PASSWORD=&lt;password&gt; &#8230;&#8230;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">OR </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	Set the variables in /etc/mysql/my.cnf.</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create client certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -newkey rsa:2048 -days 1000</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">-nodes -keyout client-key.pem &gt; client-req.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl x509 -req -in client-req.pem -days 1000</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">-CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 &gt; client-cert.pem</span></span></span></code></strong></span></span></span></p>
<ol>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> vi /etc/mysql/my.cnf</strong></span></span></span></p>
</ol>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[mysqld]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">server-id       = 	2 </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-host     =   192.168.1.100</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-user     =   repl</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-password =   replipass</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-port     =  	3306</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">log-bin			=	/var/log/mysql/mysql-bin </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format	=	mixed </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">tmpdir         	= 	/tmp/</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[client]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-ca=/etc/mysql/ssl/ca-cert.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">#ssl-key=/etc/mysql/ssl/client-key.pem </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">#ssl-cert=/etc/mysql/ssl/client-cert.pem </span> </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p><span style="color: #6b4794;">“<span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>If the account has no special SSL requirements or was created using a </em></span></span></span><code><a href="http://dev.mysql.com/doc/refman/5.0/en/grant.html"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>GRANT</em></span></span></span></a></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> statement that includes the </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE SSL</span></em></span></span></span></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option, a client can connect securely by using just the </em></span></span></span><code><a href="http://dev.mysql.com/doc/refman/5.0/en/ssl-options.html#option_general_ssl-ca"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-ca</em></span></span></span></a></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option: </em></span></span></span></p>
<pre style="margin-bottom: 0.2in;"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>shell&gt; </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>mysql --ssl-ca=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>cacert.pem</em></span></span></span></em></pre>
<p><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>To require that a client certificate also be specified, create the account using the </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE X509</span></em></span></span></span></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option. Then the client must also specify the proper client key and certificate files or the server will reject the connection: </em></span></span></span></p>
<pre><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>shell&gt; </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>mysql --ssl-ca=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>cacert.pem</em></span></span></span></em><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> \</em></span></span></span></code>
<span style="color: #6b4794;">       </span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-cert=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>client-cert.pem</em></span></span></span></em><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> \</em></span></span></span></code>
<span style="color: #6b4794;">       </span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-key=client-key.pem</em></span></span></span></code></pre>
<p><span style="font-family: Century Schoolbook L,serif;"><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;">In other words, the options are similar to those used for the server. </span></span></span><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">Note that the Certificate Authority certificate has to be the same. “ </span></span></span></span><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></em></span></p>
<p>Ref:     <a href="http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html">http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html</a></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> /etc/init.d/mysql 	restart</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Test connectivity to Master from Slave</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mysql &#8211;ssl-ca=/etc/mysql/ssl/ca-cert.pem -u root -p -h 192.168.1.100</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mysql -u root -p</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SLAVE STOP;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	mysql&gt; CHANGE MASTER TO MASTER_HOST=&#8217;192.168.1.100&#8242;, MASTER_PORT=3306, MASTER_USER=&#8217;replssl&#8217;, MASTER_PASSWORD=&#8217;1&#8242;,MASTER_LOG_FILE=&#8217;mysql-bin.000004&#8242;, MASTER_LOG_POS=7705, MASTER_SSL=1, MASTER_SSL_CA=&#8217;/etc/mysql/ssl/ca-cert.pem&#8217;;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	START SLAVE;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SHOW SLAVE STATUS\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SHOW PROCESSLIST\G</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Note : If we have given only GRANT &#8230; REQUIRE SSL to replication user then  <strong>MASTER_SSL=1, MASTER_SSL_CA are to be specidfied. ITo require that a client certificate also be specified, create the account using the </strong><code><strong>REQUIRE X509</strong></code><strong> option.</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>IP Failover For Web Cluster</title>
		<link>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/</link>
		<comments>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:38:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=258</guid>
		<description><![CDATA[keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?</p>
<p><span id="more-258"></span><br />
If your are using a LVS director to loadbalance a server pool in a production environment, you may want to have a robust solution for healthcheck &amp; failover. This will also work with reverse proxy server such as nginx.</p>
<p>lb0 &#8211; Linux box directly connected to the Internet via eth1. This is master load balancer.<br />
lb1 &#8211; Linux box directly connected to the Internet via eth1. This is backup load balancer. This will become active if master networking failed.</p>
<p>202.54.1.1 &#8211; This ip moves between lb0 and lb1 server. It is called virtual IP address and it is managed by keepalived.<br />
eth0 is connected to LAN and all other backend software such as Apache, MySQL and so on.</p>
<p><strong>You need to install the following softwares on both lb0 and lb1:<br />
</strong><br />
keepalived for IP failover.<br />
iptables to filter traffic<br />
nginx or lighttpd revers proxy server.</p>
<p><strong>DNS settings should be as follows:</strong></p>
<p><a href="http://hackadmin.in/" target="_blank">hackadmin.in</a> &#8211; Our sample domain name.<br />
<a href="http://lb0.hackadmin.in/" target="_blank">lb0.hackadmin.in</a> &#8211; 202.54.1.11 (real ip assigned to eth1)<br />
<a href="http://lb1.hackadmin.in/" target="_blank">lb1.hackadmin.in</a> &#8211; 202.54.1.12 (real ip assigned to eth1)<br />
<a href="../" target="_blank">www.hackadmin.com</a> &#8211; 202.54.1.1 (VIP for web server) do not assign this IP to any interface.</p>
<p><strong>Install Keepalived</strong></p>
<p>Visit <a href="http://keepalived.org/" target="_blank">keepalived.org</a> to grab latest source code. You can use the wget command to download the same (you need to install keepalived on both lb0 and lb1):</p>
<p># cd /opt</p>
<p># wget <a href="http://www.keepalived.org/software/keepalived-1.1.19.tar.gz" target="_blank">http://www.keepalived.org/software/keepalived-1.1.19.tar.gz</a></p>
<p>#  tar -zxvf keepalived-1.1.19.tar.gz</p>
<p># cd keepalived-1.1.19</p>
<p><strong>Install Kernel Headers</strong></p>
<p>You need to install the following packages:</p>
<p>Kernel-headers &#8211; includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package.<br />
kernel-devel &#8211; this package provides kernel headers and makefiles sufficient to build modules against the kernel package.</p>
<p>Make sure kernel-headers and kernel-devel packages are installed. If not type the following install the same:<br />
<strong><br />
Compile keepalived</strong></p>
<p><strong>Type the following command:</strong><br />
# ./configure &#8211;with-kernel-dir=/lib/</p>
<div id=":1j0">modules/$(uname -r)/build</p>
<p>Sample outputs:</p>
<p>checking for gcc&#8230; gcc<br />
checking for C compiler default output file name&#8230; a.out<br />
checking whether the C compiler works&#8230; yes<br />
checking whether we are cross compiling&#8230; no<br />
checking for suffix of executables&#8230;<br />
checking for suffix of object files&#8230; o<br />
&#8230;<br />
&#8230;..<br />
..<br />
config.status: creating keepalived/check/Makefile<br />
config.status: creating keepalived/libipvs-2.6/Makefile</p>
<p><strong>Keepalived configuration</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Keepalived version       : 1.1.19<br />
Compiler                 : gcc<br />
Compiler flags           : -g -O2<br />
Extra Lib                : -lpopt -lssl -lcrypto<br />
Use IPVS Framework       : Yes<br />
IPVS sync daemon support : Yes<br />
Use VRRP Framework       : Yes<br />
Use Debug flags          : No</p>
<p><strong>Compile and install the same:</strong><br />
# make &amp;&amp; make install</p>
<p><strong>Create Required Softlinks</strong></p>
<p>Type the following commands to create service and run it at RHEL / CentOS run level #3 :<br />
# cd /etc/sysconfig<br />
# ln -s /usr/local/etc/sysconfig/keepalived .<br />
# cd /etc/rc3.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived S100keepalived<br />
# cd /etc/init.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived .<br />
<strong><br />
Configuration</strong></p>
<p>Your main configuration directory is located at /usr/local/etc/keepalived and configuration file name is keepalived.conf. First, make backup of existing configuration:<br />
# cd /usr/local/etc/keepalived<br />
# cp keepalived.conf keepalived.conf.bak<br />
Edit keepalived.conf as follows on lb0:</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 101<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Edit keepalived.conf as follows on lb1 (note priority set to 100 i.e. backup load balancer):</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 100<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Save and close the file. Finally start keepalived on both lb0 and lb1 as follows:<br />
# /etc/init.d/keepalived start</p>
<p>Verify: Keepalived Working Or Not</p>
<p>/var/log/messages will keep track of VIP:<br />
# tail -f /var/log/messages<br />
Sample outputs:</p>
<p>Feb 21 04:06:15 lb0 Keepalived_vrrp: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:06:20 lb0 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p>
<p>Verify that VIP assigned to eth1:<br />
# ip addr show eth1<br />
<strong>Sample outputs:</strong></p>
<p>3: eth1:  mtu 1500 qdisc pfifo_fast qlen 10000<br />
link/ether 00:30:48:30:30:a3 brd ff:ff:ff:ff:ff:ff<br />
inet <a href="http://202.54.1.11/29" target="_blank">202.54.1.11/29</a> brd 202.54.1.254 scope global eth1<br />
inet <a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> scope global secondary eth1</p>
<p><strong>ping failover test</strong></p>
<p>Open UNIX / Linux / OS X desktop terminal and type the following command to ping to VIP:<br />
# ping 202.54.1.1<br />
Login to lb0 and halt the server or take down networking:<br />
# halt<br />
Within seconds VIP should move from lb0 to lb1 and you should not see any drops in ping. On lb1 you should get the following in /var/log/messages:</p>
<p>Feb 21 04:10:07 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) forcing a new MASTER election<br />
Feb 21 04:10:08 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs.<br />
Feb 21 04:10:09 lb1 Keepalived_healthcheckers: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>How to Recover a Lost MySQL Password</title>
		<link>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/</link>
		<comments>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:23:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=256</guid>
		<description><![CDATA[This article explains the process that will allow you to recover a lost MySQL password:

Stop the MySQL server process]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>This article explains the process that will allow you to recover a lost MySQL password:</p>
<p>Stop the MySQL server process</p>
<p>Start the MySQL (mysqld) server/daemon process with the<br />
&#8211;skip-grant-tables option so that it will not prompt for password.</p>
<p><span id="more-256"></span></p>
<p>Connect to mysql server as the root user.</p>
<p>Setup new mysql root account password.</p>
<p>Exit and restart the MySQL server.</p>
<p><strong>Example:</strong></p>
<p># service mysqld stop</p>
<p><strong>Output:</strong></p>
<p>Stopping MySQL database server: mysqld.</p>
<p>Then start MySql in safe mode</p>
<p># mysqld_safe &#8211;skip-grant-tables</p>
<p><strong>Output</strong></p>
<p>[1] 5988<br />
Starting mysqld daemon with databases from /var/lib/mysql</p>
<p>Then connect the mysql without any password</p>
<p># mysql -u root</p>
<p>( Then setup password )</p>
<p>mysql&gt; use mysql;</p>
<p>mysql&gt; update user set password=PASSWORD(&#8221;NEW-ROOT-PASSWORD&#8221;) where User=&#8217;root&#8217;;</p>
<div id=":1it">
<p>mysql&gt; flush privileges;</p>
<p>mysql&gt; quit</p>
<p>Then stop mysql</p>
<p># service mysql stop</p>
<p># service mysql start</p>
<p>Then Try your new password :</p>
<p># mysql -u root -p</p>
<p>Good Luck!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Port Redirection through the iptables</title>
		<link>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 03:44:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=254</guid>
		<description><![CDATA[How do I redirect 80 port to 8123 using iptables?

You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong> </strong>How do I redirect 80 port to 8123 using iptables?</p>
<p>You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.</p>
<p><span id="more-254"></span><br />
<strong>Syntax<br />
</strong><br />
The syntax is as follows to redirect tcp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumbe</p>
<p>The syntax is as follows to redirect udp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p udp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumber</p>
<p>Replace eth0 with your actual interface name. The following syntax match for source and destination ips:</p>
<p>iptables -t nat -I PREROUTING &#8211;src $SRC_IP_MASK &#8211;dst $DST_IP -p tcp &#8211;dport $portNumber -j REDIRECT &#8211;to-ports $rediectPort</p>
<p><strong>Examples:</strong></p>
<p>In The following example redirects TCP port 25 to port 2525:</p>
<p># iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport 25 -j REDIRECT &#8211;to-port 2525</p>
<p>this example all incoming traffic on port 80 redirect to port 8123</p>
<p># iptables -t nat -I PREROUTING &#8211;src 0/0 &#8211;dst 192.168.1.5 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-ports 8123</p>
<p><strong>How Do I View NAT Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables -t nat -L -n -v</p>
<p><strong>How Do I Save NAT Redirect Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables-save</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Apache Modules and Their Functions</title>
		<link>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/</link>
		<comments>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:04:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=249</guid>
		<description><![CDATA[Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user's requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong style="color: #333333;"><span style="font-size: medium;">Apache Performance Modules</span></strong><br style="color: #333333;" /><br style="color: #333333;" /><span style="color: #333333;">Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user&#8217;s requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.</span><br style="color: #333333;" /><br style="color: #333333;" /></p>
<p><span id="more-249"></span><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<h2 style="color: #333333;">List of Standard Modules</h2>
<p style="color: #333333;">This appendix (alphabetically) lists of all of the standard modules that are part of the current (version 1.3.x) Apache distribution. Table 1 the modules that are compiled-in by default and Table 2 lists the ones which are not.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Host based access control</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_actions</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Filetype/method-based script execution</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_alias</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Aliases and redirects</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_asis</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The .asis file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using text files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_autoindex</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatic directory listings</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Invoking CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_dir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic directory handling</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_env</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Passing of environments to CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_imap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The imagemap file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-parsed documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_isapi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Windows ISAPI extension support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_config</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User-configurable logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using file extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_negotiation</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Content negotiation</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_setenvif</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Set environment variables based on client information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_status</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server status display</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_userdir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User home directories</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_unique_id</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Generate unique request identifier for every request</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_usertrack</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User tracking using Cookies</td>
</tr>
</tbody>
</table>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<p style="color: #333333;">Table 1. Apache Standard Modules Compiled-In by Default.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_anon</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Anonymous user authentication, FTP-style</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_db</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using Berkeley DB files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_dbm</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using DBM files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cern_meta</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Support for HTTP header metafiles</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_digest</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">MD5 authentication</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_example</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Demonstrates Apache API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_expires</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apply Expires: headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_headers</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Add arbitrary HTTP headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_info</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server configuration information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_agent</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of user agents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_referer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of document references</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime_magic</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using &#8220;magic numbers&#8221;</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mmap_static</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Mapping files into memory for faster serving</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_proxy</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Caching proxy abilities</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_rewrite</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Powerful URI-to-filename mapping using regular expressions</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_so</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Experimental support for loading modules (DLLs on Windows) at runtime (not compiled-in the UNIX distribution)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_speling</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatically correct minor typos in URLs</td>
</tr>
</tbody>
</table>
<p style="color: #333333;">Table 2. Apache Standard Modules Not Compiled-In by Default.</p>
<h2 style="color: #333333;"><a style="color: #005488;" name="126daf85273bb1e9_126dacf4e92051a1_app2"></a>Appendix II : List of Nonstandard Modules</h2>
<p style="color: #333333;">This appendix is a list of some nonstandard Apache modules. The selection is biased towards modules for programming language support and Web site administration. See Table 3.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">apache_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">SSL extensions for Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_bandwidth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Limit bandwidth based on number of connections</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cint</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded C/C++ interpreter module for apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Chili!ASP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Active Server Pages module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">ColdFusion Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Interface to the ColdFusion application server (Windows NT only)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Cookie Authentication</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Fake Basic authentication using Cookies</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">dir_log_module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Implements per-directory logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Distributed Permanence Control Apache Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Module designed to work with RCS and CVS to encourage the permanence of document version/editions on the Web</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">FastCGI</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Keeps CGI processes alive to avoid per-hit forks</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">GIF Counter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic GIF counter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired Mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired extensions to mod_include</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Indexer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Configurable directory listing module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java Wrapper Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Enables execution of Java applications as CGI directly</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_allowdev</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Restricts access to filespace more efficiently</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_ldap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apache LDAP authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_mysql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mySQL authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_udp</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">External authentication using UDP</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgisock</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Socket implementation of the CGI</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_format</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Formats C, C++, and Java source code using HTML</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_gunzip</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">On-the-fly decompression of HTML documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_hosts_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Allows you to use the hosts.allow and hosts.deny files to configure access to Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_javascript</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">JavaScript module (ECMA-262)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_jserv</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java servlet interface</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_neoinclude</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">NeoWebScript &#8211; Tcl scripting extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_perl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embeds Perl language interpreter and provides a Perl interface to the server API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Free Apache interface to SSLeay</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_weborb</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Directly invokes CORBA-objects to handle CGI requests</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_msql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic authentication with the mSQL database</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">parselog</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Perl script to parse and store logs by server and date</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">PHP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-side scripting language with extensive database support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_pyapache</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded Python language interpreter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">TalentSoft WebPlus (Web+)</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Web+ (WebPlus) application development tool/database middleware. Supports Linux, Apache API, mySQL, miniSQL, PostgreSQL, etc.</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif; color: #000000;" valign="top">WebCounter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Page counter</td>
</tr>
</tbody>
</table>
<p><br style="color: #333333;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>How to Create Connection Limits with Iptables</title>
		<link>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:21:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=243</guid>
		<description><![CDATA[How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?

You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><span style="font-size: medium;"><strong></strong></span></span></p>
<p>How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?</p>
<p>You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.</p>
<p><span id="more-243"></span><br />
<strong>Syntax</strong><br />
The syntax is as follows:</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport $port -m connlimit &#8211;connlimit-above N -j REJECT &#8211;reject-with tcp-reset</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit SSH Connections Per IP / Host</p>
<p>Only allow 3 ssh connections per client host:</p>
<p># /sbin/iptables  -A INPUT -p tcp &#8211;syn &#8211;dport 22 -m connlimit &#8211;connlimit-above 3 -j REJECT</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit HTTP Connections Per IP / Host</p>
<p>Only allow 20 http connections per IP (MaxClients is set to 60 in httpd.conf):</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -m connlimit &#8211;connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset<br />
save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Skip proxy server IP 1.2.3.4 from this kind of limitations:</strong></p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -d ! 1.2.3.4 -m connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset</p>
<p>Enjoy it&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>OpenVPN Tutorial</title>
		<link>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/</link>
		<comments>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 00:42:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=236</guid>
		<description><![CDATA[Openvpn is an open source software, allows us to create a Virtual Private Network.

1. Istalling openvpn

	install these packages openvpn openssh-server openssl:

	laptop:~$ sudo apt-get install openvpn openssh-server openssl
]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>Openvpn is an open source software, allows us to create a Virtual Private Network.</p>
<p><span id="more-236"></span><br />
1. Installing openvpn</p>
<p>	install these packages openvpn openssh-server openssl:</p>
<p>	laptop:~$ sudo apt-get install openvpn openssh-server openssl</p>
<p>	Now the ssh server is installed we can control it and access to it from anywhere on the web using the IP and port 22.</p>
<p>	In reality 22 is for SSH The best port for OpenVPN (http://www.iana.org/assignments/port-numbers) is 1194.</p>
<p>	There is special web interfaces to can interact and configure openVPN through a browser like webmin, </p>
<p>	so we should install apache, php and mysql with this command:</p>
<p>	laptop:~$ sudo apt-get install apache2 mysql-server-5.0 libapache2-mod-php5 php5 php5-common php5-mysql</p>
<p>	To install webmin:</p>
<p>	laptop:~$ sudo apt-get install webmin</p>
<p>2. VPN configuration:</p>
<p>	The openvpn use Private Key Infrastructure (PKI):</p>
<p>		1. One Public key for server and Private keys for each client.</p>
<p>		2. It uses Certification for more security each Certification is valid for one couple (Server, Client)</p>
<p>	The authentication With OpenVPN is a bidirectional, means the sever identify the client before trusting on and client identify the server too.</p>
<p>	Key Generation:</p>
<p>	To generate a Key we can use scripts provided by OpenVPN</p>
<p>	We create openvpn/ in /home to manipulate and create keys there:</p>
<p>	laptop:~$ sudo cp /usr/share/doc/openvpn/examples/easy-rsa /home/openvpn/ -R</p>
<p>	All commands are in /home/openvpn/2.0/ file</p>
<p>	laptop:~$ cd /home/openvpn/2.0</p>
<p>	Edit vars file:	</p>
<p>	laptop:~$ sudo nano vars    &#8212;&#8212;&#8212;&#8212;&#8211;// (nano is a text editor you can use others: gedit, &#8230;)</p>
<p>		Setup these variables KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL</p>
<p>		EX:</p>
<p>			export KEY_COUNTRY=DZ</p>
<p>			export KEY_PROVINCE=ALGER</p>
<p>			export KEY_CITY=alger</p>
<p>			export KEY_ORG=alger</p>
<p>			export KEY_EMAIL=xxxxxxxxx@xxx.dz</p>
<p>		* We can find other variables like:</p>
<p>			 * KEY_SIZE by default set to 1024 in some countries there is limit that you</p>
<p>			     should respect for this KEY_SIZE you can&#8217;t go over the limitation.</p>
<p>			* CA_EXPIRE : In how many days your certification will expire?</p>
<p>	Save and close (in nano ctrl+x)</p>
<p>	To set these variables we run this:</p>
<p>	laptop:~$ . ./vars  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;     //first dot isn&#8217;t a mistake</p>
<p>	We should clean all existing certification we have to not have conflits (run this command):</p>
<p>	laptop:~$ sudo ./clean-all &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-// will delete /home/openvpn/2.0/keys</p>
<p>	If you do&#8217;nt have certification set before nothing will be done.</p>
<p>	Now we create our Certification and key with CA (master Certification Authority) with this command:</p>
<p>	laptop:~$ sudo ./build-ca</p>
<p>	The certification now are created in keys directory: ca.crt ca.key</p>
<p>	Generate a certification and key to the SERVER:</p>
<p>	laptop:~$ sudo ./build-key-server SERVER &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-  //we suppose that server&#8217;s named SERVER</p>
<p>	When common name is required type the name OS the server (here SERVER)</p>
<p>	Generate certification and key for client:</p>
<p>	laptop:~$ sudo ./build-key client1</p>
<p>	when common name is required type the name of the client (client1)</p>
<p>	this common name MUST be different if you have many clients.</p>
<p>	To protect your key with a password use ./build-key-pass instead of ./build-key</p>
<p>	NB: We were able to generate the client key on its own end to avoid transfer through the network</p>
<p>	Diffie Hellman parameters should be generated for the openvpn server: </p>
<p>	laptop:~$ sudo ./build-dh</p>
<p>	these parameters are copied in keys directory dh1024.pem</p>
<p>	So now all Certifications and keys are in /home/openvpn/2.0/keys directory:</p>
<p>		name 	 	Utile for					Role					Secret</p>
<p>		ca.crt 		servers and all clients 		root Certification CA 		no</p>
<p>		ca.key 		key signing the machine (both) 	root key CA 			yes</p>
<p>		dh1024.pem 	server	 				Diffie Hellman parameters	no</p>
<p>		SERVER.crt 	server					server certification 		no</p>
<p>		SERVER.key 	server		 			server key 			yes</p>
<p>		client1.crt 	Client1					Client1 certification 		no</p>
<p>		client1.key 	Client1					Client1 key 			yes</p>
<p>	We copy files to the client machines using a secured tunel</p>
<p>3. Creation of the file configuration for clients and server</p>
<p>	There is samples of this configuration in /usr/share/doc/openvpn/examples/sample-config-files/   client.conf and server.conf.gz</p>
<p>	1. Server configuration:</p>
<p>		We should gunzip the server.conf.gz</p>
<p>		laptop:~$ sudo gunzip server.conf.gz</p>
<p>		and then copy this file to /home/openvpn using:</p>
<p>		laptop:~$ sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf /etc/openvpn/</p>
<p>		Edit server.conf:</p>
<p>		laptop:~$ sudo nano /home/openvpn/server.conf</p>
<p>		this would create a VPN with virtual interface and listen to the connections in 1194 port and distribute</p>
<p>		virtual addresses to clients that connect through 10.8.0.0/24</p>
<p>		By default this server.conf is useful but we can set more parameters(directives) like (IP, PORT, KEY_SIZE etc&#8230;)</p>
<p>		Client configuration and server one must be coherent.</p>
<p>	1. Client configuration:</p>
<p>		Edit the client.conf:</p>
<p>		laptop:~$ sudo nano /home/openvpn/client.conf</p>
<p>		Verify the name of certification and key of each client:</p>
<p>		ca ca.crt</p>
<p>		cert client.crt</p>
<p>		key client.key </p>
<p>		Go to the remote parameter and set up the server IP</p>
<p>		remote my-server-1 1194</p>
<p>		save the file</p>
<p>		Now we verify if client parameters if they correspond to the server one:</p>
<p>		dev (tun ou tap)</p>
<p>		proto (udp ou tcp)</p>
<p>		comp-lzo</p>
<p>		fragment</p>
<p>4. Starting the VPN:</p>
<p>	4.1. Before we start we should copy all file in keys directory and .conf to /etc/openvpn:</p>
<p>		4.1.1 SERVER:</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/SERVER.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/SERVER.key /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/dh1024.pem /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/server.conf /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/ca.crt /etc/openvpn</p>
<p>		4.1.2 Client:</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/client1.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/client1.key /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/ca.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/client1.conf /etc/openvpn</p>
<p>	4.2 Start the server:</p>
<p>		laptop:~$ cd /etc/openvpn</p>
<p>		laptop:/etc/openvpn$ sudo openvpn server.conf</p>
<p>	4.3 Start the client1:</p>
<p>		aptop:~$ cd /etc/openvpn</p>
<p>		laptop:/etc/openvpn$ sudo openvpn client1.conf</p>
<p>	4.4 Test the VPN:</p>
<p>		From the client terminal try to ping the server which has the 10.8.0.1 by default:</p>
<p>		ping 10.8.0.1</p>
<p>To can communicate with other client through the network with the VPN you have to uncomment the client-to-client parameter in server.conf<br />
 and then you would be able to ping the other clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>ISCSI Target ( Server )</title>
		<link>http://www.hackadmin.com/2010/02/16/iscsi-target-server/</link>
		<comments>http://www.hackadmin.com/2010/02/16/iscsi-target-server/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:12:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[iscsi]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=231</guid>
		<description><![CDATA[Article by Aashish
 


Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.

iSCSI initiator (client)

An initiator functions as an iSCSI client. An initiator typically serves the same purpose [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<div style="text-align: center;"><strong><span style="font-size: medium;"><br />
</span></strong></div>
<p>Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.</p>
<p><span id="more-231"></span><br />
<strong>iSCSI initiator (client)<br />
</strong><br />
An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network.</p>
<p><strong>Debian / Ubuntu Linux Install tgt<br />
</strong><br />
Type the following command to install Linux target framework user-space tools:</p>
<p>$ sudo apt-get install tgt</p>
<p>CentOS / RHEL / Red Hat Linux Install tgt</p>
<p>RHEL 5.2 and older version do not have tgt tools. However, RHEL 5.3 (preview version) comes with tgt tools.</p>
<p>tgtadm &#8211; Linux SCSI Target Administration Utility</p>
<p>tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc. This tool allows a system to serve block-level SCSI storage to other systems that have a SCSI initiator. This capability is being initially deployed as a Linux iSCSI target, serving storage over a network to any iSCSI initiator.</p>
<p>Start tgtd</p>
<p>To start the tgtd, enter:</p>
<p># /usr/sbin/tgtd</p>
<p>Under RHEL 5.3 to start the tgtd service, enter:</p>
<p># /etc/init.d/tgtd start</p>
<p><strong>Define an iscsi target name<br />
</strong><br />
The following example creates a target with id 1 (the iqn is 19 iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz) and adds a 20 logical unit (backed by /dev/hdc1)with lun 1.</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode target &#8211;tid 1 -T iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz<br />
To view the current configuration, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target<br />
<strong><br />
Sample output:</strong></p>
<p>Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Add a logical unit to the target (/dev/sdb1):</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /dev/sdb1</p>
<p><strong>Note:-</strong><span> </span>about home computer / test system</p>
<p>Most production boxes will only use iSCSI root with real iSCSI devices, but for testing purposes it can be quite useful to set up an iSCSI target on your image server. This is useful for testing and learning iSCSI target and iSCSI initiator at home, simply use filesystem for testing purpose. Use dd command to create diskbased filesystem:</p>
<p># dd if=/dev/zero of=/fs.iscsi.disk bs=1M count=512</p>
<p>Add /fs.iscsi.disk as a logical unit to the target:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /fs.iscsi.disk</p>
<p>Now, you should able to view details:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target</p>
<p><strong>Sample output:<br />
</strong><br />
Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>LUN: 1</p>
<p>Type: disk</p>
<p>SCSI ID: deadbeaf1:1</p>
<p>SCSI SN: beaf11</p>
<p>Size: 512M</p>
<p>Online: Yes</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: /fs.iscsi.disk</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Accept iSCSI Target</p>
<p>To enable the target to accept any initiators, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op bind &#8211;mode target &#8211;tid 1 -I ALL</p>
<p>This should open network port # 3260:</p>
<p># netstat -tulpn | grep 3260</p>
<p><strong>Sample output:<br />
</strong><br />
tcp 0 0<span> </span><a style="color: #005488;" href="http://0.0.0.0:3260/" target="_blank">0.0.0.0:3260</a><span> </span>0.0.0.0:* LISTEN 27328/tgtd<br />
tcp6 0 0 :::3260 :::* LISTEN 27328/tgtd</p>
<p>And you are done. Your system is configured as iSCSI Target. Remote client computer can access this computers hard disk over network. Your can use cluster aware filesystem to setup real shared storage for small business. Open TCP port 3260 in your firewall, if required.</p>
<p><strong>For Client<br />
</strong>Install Required Package</p>
<p>iscsi-initiator-utils RPM package &#8211; The iscsi package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks. This package is available under Redhat Enterprise Linux / CentOS / Fedora Linux and can be installed using yum command:</p>
<p># yum install iscsi-initiator-utils</p>
<p>A note about Debian / Ubuntu Linux</p>
<p>If you are using Debian / Ubuntu Linux install open-iscsi package, enter:</p>
<p>$ sudo apt-get install open-iscsi</p>
<p>iSCSI Configuration</p>
<p>There are three steps needed to set up a system to use iSCSI storage:</p>
<p>1. iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI</p>
<p>via /etc/iscsi/iscsid.conf file</p>
<p>2. Discover targets.</p>
<p>3. Automate target logins for future system reboots.</p>
<p>4. You also need to obtain iSCSI username, password and storage server IP address (target host)</p>
<p><strong>Step # 1: Configure iSCSI</strong></p>
<p>Open /etc/iscsi/iscsid.conf with vi text editor:</p>
<p># vi /etc/iscsi/iscsid.conf</p>
<p>Setup username and password:</p>
<p>node.session.auth.username = My_ISCSI_USR_NAME</p>
<p>node.session.auth.password = MyPassword</p>
<p>discovery.sendtargets.auth.username = My_ISCSI_USR_NAME</p>
<p>discovery.sendtargets.auth.password = MyPassword</p>
<p>Where,</p>
<p>* node.session.* is used to set a CHAP username and password for initiator authentication by the target(s).<br />
* discovery.sendtargets.* is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)</p>
<p>You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:</p>
<p># /etc/init.d/iscsi start</p>
<p><strong>Step # 2: Discover targets</strong><br />
Now use iscsiadm command, which is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:</p>
<p># iscsiadm -m discovery -t sendtargets -p 192.168.1.5</p>
<p># /etc/init.d/iscsi restart</p>
<p>Now there should be a block device under /dev directory. To obtain new device name, type:</p>
<p># fdisk -l</p>
<p>or</p>
<p># tail -f /var/log/messages</p>
<p><strong>Output:<br />
</strong>Oct 10 12:42:20 ora9is2 kernel: Vendor: EQLOGIC Model: 100E-00 Rev: 3.2<br />
Oct 10 12:42:20 ora9is2 kernel: Type: Direct-Access ANSI SCSI revision: 05<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: unknown partition table<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0<br />
Oct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.<br />
Oct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now<br />
/dev/sdd is my new block device.</p>
<p><strong>Step # 3: Format and Mount iSCSI Volume<br />
</strong><br />
You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:</p>
<p># fdisk /dev/sdd</p>
<p># mke2fs -j -m 0 -O dir_index /dev/sdd1</p>
<p><strong>OR<br />
</strong><br />
# mkfs.ext3 /dev/sdd1</p>
<p>Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:</p>
<p># nohup mkfs.ext3 /dev/sdd1 &amp;</p>
<p>Mount new partition:</p>
<p># mkdir /mnt/iscsi</p>
<p># mount /dev/sdd1 /mnt/iscsi</p>
<p><strong>Step #4: Mount iSCSI drive automatically at boot time<br />
</strong><br />
First make sure iscsi service turned on at boot time:</p>
<p># chkconfig iscsi on</p>
<p>Open /etc/fstab file and append config directive:</p>
<p>/dev/sdd1 /mnt/iscsi ext3 _netdev 0 0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/16/iscsi-target-server/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
