<?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 &#187; Linux</title>
	<atom:link href="http://www.hackadmin.com/category/linux/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>60</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>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>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>48</slash:comments>
		</item>
		<item>
		<title>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server</title>
		<link>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/</link>
		<comments>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:29:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[rsnapshot]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=224</guid>
		<description><![CDATA[Article by Aashish
How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server

Q. I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server<br />
</strong><br />
<strong>Q.</strong> I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly format. How do I configure my Red Hat / CentOS Linux server as remote backup or snapshot server? </p>
<p><span id="more-224"></span><br />
<strong>A.</strong> rsnapshot is easy, reliable and a good disaster recovery backup solution. It is a remote backup program that uses rsync to take backup snapshots of your filesystems. It uses hard links to save space on disk and offers following features:</p>
<p><strong>• Filesystem snapshot</strong> &#8211; for local or remote systems.</p>
<p><strong>• Database backup</strong> &#8211; MySQL backup</p>
<p><strong>• Secure</strong> &#8211; Traffic between remote backup server is always encrypted using openssh</p>
<p><strong>• Full backup</strong> &#8211; plus incremental</p>
<p><strong>• Easy to restore</strong> &#8211; Files can restored by the users who own them, without the root user getting involved.</p>
<p><strong>• Automated backup</strong> &#8211; Runs in background via cron.</p>
<p><strong>• Bandwidth friendly</strong> &#8211; rsync used to save bandwidth </p>
<p><strong>Sample setup</strong></p>
<p>• snapshot.example.com &#8211; HP box with RAID 6 configured with Red Hat / CentOS Linux ac as backup server for other clients.</p>
<p>• DNS ns1.example.com &#8211; Red Hat server act as primary name server.</p>
<p>• DNS ns2.example.com &#8211; Red Hat server act as secondary name server.</p>
<p>• www.example.com &#8211; Red Hat running Apache web server.</p>
<p>• mysql.example.com &#8211; Red Hat mysql server.</p>
<p><strong>Install rsnapshot</strong></p>
<p>Login to snapshot.example.com. Download rsnapshot rpm file, enter: WARNING! These examples only works on Red hat / CentOS / Suse / RHEL / Fedora Linux. See Debian / Ubuntu Linux backup server instructions here.</p>
<p># cd /tmp</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p>Verify rpm file for integrity, enter</p>
<p># md5sum -c rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p><strong>Sample output:</strong><br />
rsnapshot-1.3.0-1.noarch.rpm: OK<br />
Install rsnapshot, enter:</p>
<p># rpm -ivh rsnapshot-1.3.0-1.noarch.rpm<br />
Sample output:<br />
Preparing&#8230; ########################################### [100%]<br />
1:rsnapshot ########################################### [100%]</p>
<p><strong>Configure rsnapshot</strong></p>
<p>You need to perform following steps</p>
<p>Step # 1: Configure passwordless login</p>
<p>To perform remote backup you need to setup passwordless login using openssh. Create ssh rsa key and upload them to all servers using scp (note you are overwriting ~/ssh/authorized_keys2 files).You need to type following commands on snapshot.example.com server:</p>
<p># ssh-keygen -t rsa</p>
<p># scp .ssh/id_rsa.pub root@ns1.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@ns2.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@www.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@mysql.example.com:.ssh/authorized_keys2</p>
<p>Step # 2: Configure rsnapshot</p>
<p>The default configuration file is located at /etc/rsnapshot.conf. Open configuration file using a text editor, enter:</p>
<p># vi /etc/rsnapshot.conf</p>
<p><strong>Configuration rules</strong></p>
<p>You must follow two configuration rules:</p>
<p>• rsnapshot config file requires tabs between elements.</p>
<p>• All directories require a trailing slash. For example, /home/ is correct way to specify directory, but /home is wrong.</p>
<p>First, specify root directory to store all snapshots such as /snapshots/ or /dynvol/snapshot/ as per your RAID setup, enter:</p>
<p>snapshot_root /raiddisk/snapshots/</p>
<p>You must separate snapshot_root and /raiddisk/snapshots/ by a [tab] key i.e. type snapshot_root hit [tab] key once and type /raiddisk/snapshots/.</p>
<p><strong>Define snapshot intervals</strong></p>
<p>You need to specify backup intervals i.e. specify hourly, daily, weekly and monthly intervals:</p>
<p>interval hourly 6</p>
<p>interval daily 7</p>
<p>interval weekly 4</p>
<p>interval monthly 3</p>
<p>The line &#8220;interval hourly 6&#8243; means 6 hourly backups a day. Feel free to adapt configuration as per your backup requirements and snapshot frequency.</p>
<p><strong>Remote backup directories</strong></p>
<p>To backup /var/named/ and /etc/ directory from ns1.example.com and ns2.example.com, enter:</p>
<p>backup root@ns1.example.com:/etc/ ns1.example.com/</p>
<p>backup root@ns1.example.com:/var/named/ ns1.example.com/</p>
<p>backup root@ns2.example.com:/etc/ ns2.example.com/</p>
<p>backup root@ns2.example.com:/var/named/ ns2.example.com/</p>
<p>To backup /var/www/, /var/log/httpd/ and /etc/ directory from www.example.com, enter</p>
<p>backup root@www.example.com:/var/www/ www.example.com/</p>
<p>backup root@www.example.com:/etc/ www.example.com/</p>
<p>backup root@www.example.com:/var/log/httpd/ www.example.com/</p>
<p>To backup mysql database files stored at /var/lib/mysql/, enter:</p>
<p>backup root@mysql.example.com:/var/lib/mysql/ mysql.example.com/dbdump/Save and close the file. To test your configuration, enter:</p>
<p># rsnapshot configtest</p>
<p>Sample output:</p>
<p>Syntax OK</p>
<p><strong>Schedule cron job</strong></p>
<p>Create /etc/cron.d/rsnapshot cron file. Following values used correspond to the examples in<br />
#vim /etc/rsnapshot.conf.</p>
<p>0 */4 * * * /usr/bin/rsnapshot hourly</p>
<p>50 23 * * * /usr/bin/rsnapshot daily</p>
<p>40 23 * * 6 /usr/bin/rsnapshot weekly</p>
<p>30 23 1 * * /usr/bin/rsnapshot monthly</p>
<p>Save and close the file. Now rsnapshot will work as follows to backup files from remote boxes:</p>
<p>1. 6 hourly backups a day (once every 4 hours, at 0,4,8,12,16,20)</p>
<p>2. 1 daily backup every day, at 11:50PM</p>
<p>3. 1 weekly backup every week, at 11:40PM, on Saturdays (6th day of week)</p>
<p>4. 1 monthly backup every month, at 11:30PM on the 1st day of the month<br />
<strong><br />
How do I see backups?</strong></p>
<p>To see backup change directory to</p>
<p># cd /raiddisk/snapshots/</p>
<p># ls -l</p>
<p>Sample output:<br />
drwxr-xr-x 4 root root 4096 2008-07-04 06:04 daily.0<br />
drwxr-xr-x 4 root root 4096 2008-07-03 06:04 daily.1<br />
drwxr-xr-x 4 root root 4096 2008-07-02 06:03 daily.2<br />
drwxr-xr-x 4 root root 4096 2008-07-01 06:02 daily.3<br />
drwxr-xr-x 4 root root 4096 2008-06-30 06:02 daily.4<br />
drwxr-xr-x 4 root root 4096 2008-06-29 06:05 daily.5<br />
drwxr-xr-x 4 root root 4096 2008-06-28 06:04 daily.6<br />
drwxr-xr-x 4 root root 4096 2008-07-05 18:05 hourly.0<br />
drwxr-xr-x 4 root root 4096 2008-07-05 15:06 hourly.1<br />
drwxr-xr-x 4 root root 4096 2008-07-05 12:06 hourly.2<br />
drwxr-xr-x 4 root root 4096 2008-07-05 09:05 hourly.3<br />
drwxr-xr-x 4 root root 4096 2008-07-05 06:04 hourly.4<br />
drwxr-xr-x 4 root root 4096 2008-07-05 03:04 hourly.5<br />
drwxr-xr-x 4 root root 4096 2008-07-05 00:05 hourly.6<br />
drwxr-xr-x 4 root root 4096 2008-07-04 21:05 hourly.7<br />
drwxr-xr-x 4 root root 4096 2008-06-22 06:04 weekly.0<br />
drwxr-xr-x 4 root root 4096 2008-06-15 09:05 weekly.1<br />
drwxr-xr-x 4 root root 4096 2008-06-08 06:04 weekly.2</p>
<p><strong>How do I restore backup?</strong></p>
<p>Let us say you would like to restore a backup for www.example.com. Type the command as follows (select day and date from ls -l output):</p>
<p># cd /raiddisk/snapshots/<br />
# ls -l</p>
<p># cd hourly.0/www.example.com/</p>
<p># scp -r var/www/ root@www.example.com:/var/www/</p>
<p># scp -r etc/httpd/ root@www.example.com:/etc/httpd/</p>
<p><strong>How do I exclude files from backup?</strong></p>
<p>To exclude files from backup, open rsnapshot.conf file and add following line:</p>
<p>exclude_file /etc/rsnapshot.exclude.www.example.com</p>
<p>Create /etc/rsnapshot.exclude.www.example.com as follows:</p>
<p>/var/www/tmp/</p>
<p>/var/www/*.cache</p>
<p>That&#8217;s It!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Identifying Slow MySQL queries</title>
		<link>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/</link>
		<comments>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 17:34:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[querry]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=213</guid>
		<description><![CDATA[MySQL can sometimes create big problems on a server when you have users abusing it.
This article will teach you how to correctly identify the queries that are creating a problem for your server.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>MySQL can sometimes create big problems on a server when you have users abusing it.<br />
This article will teach you how to correctly identify the queries that are creating a problem for your server.</p>
<p><span id="more-213"></span><br />
MySQL can log those queries that are taking longer then X seconds but this future is not turned on by default.<br />
Here’s how you turn it on:<br />
Login to your server as root<br />
Open my.cnf with your favorite editor. Example:<br />
vim /etc/my.cnf</p>
<p>Into the [mysqld] section add the fallowing lines<br />
log-slow-queries = /var/log/mysql-slow.log<br />
long_query_time = 3</p>
<p>This is just an example. You can use any file name that you want and you can modify the long_query_time to any value. In this example I will be logging to /var/log/mysql-slow.log any queries that are taking longer then 3 seconds.</p>
<p>Go ahead and save the configuration.<br />
For vim: CTRL+X and YES</p>
<p>Now we have to actually create the log file.<br />
touch /var/log/mysql-slow.log</p>
<p>Now we are changing the owner of the file so that mysql and actually write to it.<br />
chown mysql.root /var/log/mysql-slow.log</p>
<p>Now we restart mysql<br />
service mysql restart</p>
<p>It should restart successfully. If it doesn’t check that you didn’t brake my.cnf by examining the error file in your data directory.</p>
<p>Wait a few minutes and then examine the slow queries log<br />
A few examples on how to do it:</p>
<p>cat /var/log/mysql-slow.log<br />
tail /var/log/mysql-slow.log<br />
tail -50 /var/log/mysql-slow.log</p>
<p>After you have identified the offending query go ahead and optimize or remove it.<br />
Again test the results by looking at your server load and the mysql slow queries log.</p>
<p>After you fixed all the problems go ahead and comment the slow queries logging as it will slow your server a bit if you leave it on. my.cnf should now look similar to this:</p>
<p>#log-slow-queries = /var/log/mysql-slow.log<br />
#long_query_time = 3</p>
<p>And don’t forget to restart MySQL after this.</p>
<p>service mysql restart</p>
<p>Hope this helps ! </p>
<p>Install MySQL Performance Tuning Primer Script</p>
<p>Tuning the performance of MySQL can be a really hard job to do.<br />
There are many things to consider and no two servers are identical so there is no universal solution.<br />
Tuning Primer is a script that will help you tune your mysql installation by providing very healthy recommendations based on past mysql records.<br />
For the script to be efficient you must run the mysql server for at least 48 hours.<br />
Installation is extremely simple:</p>
<p>Download the script<br />
wget http://day32.com/MySQL/tuning-primer.sh</p>
<p>Change the permissions for the file<br />
chmod 755 tuning-primer.sh</p>
<p>Run it<br />
./tuning-primer.sh</p>
<p>Apply the sugesttions</p>
<p>                    Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Amazon S3 backup Tutorial -via Khaled</title>
		<link>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/</link>
		<comments>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 22:54:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=198</guid>
		<description><![CDATA[To interact with amazon S3, we have many languages we can use as well as python. I chose python because it's a scripting language.  That means we don't need to compile and we don't need a virtual machine to run it, only an interpreter is needed.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>To interact with amazon S3, we have many languages we can use as well as python.  I chose python because it&#8217;s a scripting language.  That means we don&#8217;t need to compile and we don&#8217;t need a virtual machine to run it, only an interpreter is needed.</p>
<p>	There is some ready tools to interact with amazon S3 I found S3cmd it&#8217;s made with python and there is many methods within.</p>
<p><span id="more-198"></span><br />
Installing S3cmd   (nb: commands are in red color)</p>
<p>Its better to be root to have all permissions   Laptop:~$ sudo -i</p>
<p>Take the zip file and copy it somewhere for example /home/Your_Directory/  </p>
<p>1.To copy  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;     Laptop:~# cp s3cmd-0.9.9.91 /home/Your_Directory</p>
<p>2. Decompress the file.	&#8212;&#8212;&#8212;&#8212;&#8212;-  Laptop:~# unzip s3cmd.zip</p>
<p>3. Move to s3cmd folder	.&#8212;&#8212;&#8212;&#8212;&#8212;	Laptop:~# cd s3cmd-0.9.9.91</p>
<p>4. Change setup.py mod to can execute it.    Laptop:~/s3cmd-0.9.9.91# chmod +x setup.py </p>
<p>5. Run the setup file with this command.      Laptop:~/s3cmd-0.9.9.91# ./setup.py                                  </p>
<p>6. During the installation enter your 	access key and secret one, and choose secured connection.</p>
<p>	Now s3cmd is installed and your connection with s3 account is set, so you can transfer files to and from s3 account there is many commands you can use to can use them you should be in s3cmd folder, I verified most of the code and it uses methods provided by amazon s3 developers.</p>
<p>	The command that allows you to transfer from your server (linux) to amazon s3 is :</p>
<p>s3cmd-0.9.9.91#./s3cmd put Local_File s3://BUCKET_Name/Other_Files_In_Bucket</p>
<p>But this command will transfer “Local_File” to the bucket so if we have another new file within and we use the same command, the whole “Local_File” would be transferred too, so we loose in data transfer.</p>
<p>	BUT if we use a sync command we can synchronize a local file with a remote one, it means that if we have a local folder and we add files in it step by step this command allows us to transfer only missing files to the remote file,  this is how we minimize data transfer, so for example everyday we have a new tar.gz file added to our local file and our backup would be done everyday, </p>
<p>The command is :<br />
3cmd-0.9.9.91# ./s3cmd sync /home/Your_Directory/local_file/  s3://BUCKET_Name/Remote_File</p>
<p>Every time we run this command it copies only missing files.</p>
<p>Automation of our transfer with sync command:</p>
<p>	In linux OS we can automate execution of commands by adding them to a special file which has a specific (easy) syntax.<br />
To access to this file we use this command  &#8212;&#8212;&#8212;   3cmd-0.9.9.91# crontab -e</p>
<p>Our file is open now, we can insert any command to be executed at any time or day or month.</p>
<p>A sample line is so &#8212;&#8212;&#8212;&#8212;&#8212;-   * * * * * Command_to_execute</p>
<p>if we want to run any linux command for example at 3:59 PM we edit our line as follow<br />
59 15 * * *  Command_to_run</p>
<p>	Suppose that we have our tar.gz files already in a Local_File and we want to transfer them to the Remote_File with sync command everyday at 3:00 am, the line would be:</p>
<p>0 3 * * * Path_Where_s3cmd_Folder_is/./s3cmd  sync  /home/Your-Directory/Local_File/ s3://BUCKET/Remote_File/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

