<?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>Technical Diary &#187; redhat</title>
	<atom:link href="http://andriigrytsenko.net/tag/redhat/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:02:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wireless internet AP based on RedHat linux</title>
		<link>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/</link>
		<comments>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 02:36:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=498</guid>
		<description><![CDATA[I will try to describe how to make own home wireless access point based on RedHat linux machine.

This post include 2 part. In first one I&#8217;ll describe step which should be taken on linux machine and in second one step for windows client.
Linux(server side)
We use this host to share internet connection between users over wireless [...]]]></description>
			<content:encoded><![CDATA[<p>I will try to describe how to make own home wireless access point based on RedHat linux machine.</p>
<p><span id="more-498"></span></p>
<p>This post include 2 part. In first one I&#8217;ll describe step which should be taken on linux machine and in second one step for windows client.</p>
<h2 style="text-align: center;">Linux(server side)</h2>
<p>We use this host to share internet connection between users over wireless network, so the machine has to have at least two connection:</p>
<ol>
<li>Internet ( regular ethernet connection)</li>
<li>Wireless connection( provided by wi-fi card)</li>
</ol>
<p>I will skip how to setup your Internet connection, therefore make sure its work properly.<br />
If you mounted your wi-fi card to pci slot use <em>lspci</em> to check it out:</p>
<pre>[root@localhost ~]# lspci  | grep -i wireless
02:01.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)</pre>
<p>For this card kernel module <em>ath5k</em> should be loaded into the kernel. Check it:</p>
<pre>lsmod | grep ath5k</pre>
<p>Use <em>modprobe</em> unless module is not loaded.</p>
<pre>modprobe ath5k</pre>
<p>If you done it without any problem I will able to set up the wi-fi card. Here is network configuration file for interface wlan0 with some comments:</p>
<pre>[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-wlan0# Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter
DEVICE=wlan0
ONBOOT=yes
IPADDR=192.168.0.1
NETMASK=255.255.255.0
HWADDR=00:17:9a:b7:d6:01
TYPE=Wireless
MODE=Ad-Hoc  # set this mode if want to make this card as access point
ESSID=homeee # the name of this connection which will be displayed for users
KEY=dffb9e2cc2 # secret key for connection</pre>
<p>To generate connection key run:</p>
<pre>dd if=/dev/random bs=1 count=5| xxd -ps</pre>
<p>Now restart the network service:</p>
<pre>service network restart</pre>
<p>and verify:</p>
<pre>iwconfig wlan0</pre>
<p>and</p>
<pre>ifconfig wlan0</pre>
<p>So 50% of linux part is done. Tune your kernel to make it forward ip traffic:</p>
<pre>vi /etc/sysctl.conf</pre>
<p>and set
<pre>net.ipv4.ip_forward</pre>
<p> to 1:<br />
<em>net.ipv4.ip_forward = <strong>1</strong></em><br />
Make changes affected:</p>
<pre>sysctl -p /etc/sysctl.conf</pre>
<p>Verify:</p>
<pre>sysctl -a | grep all.forwarding | grep ipv4</pre>
<p>And last but very important step. Its firewall and nat settings:<br />
!!! Be careful because this command flush all your rules in OUTPUT chain</p>
<pre>iptables -F OUTPUT</pre>
<p>turn masquerading on:</p>
<pre> iptables -t nat -I POSTROUTING -s 192.168.0.2/32 -o eth0 -j MASQUERADE</pre>
<p>where <em>eth0</em> your interface for share.<br />
save it all:</p>
<pre>service iptables save</pre>
<p>The linux router is ready on all 100%.</p>
<h2 style="text-align: center;">Windows(client side)</h2>
<p>I use windows Vista for this, but this steps can be used to Windows XP as well. Go to:<br />
<em>Start-&gt;Control Panel-&gt;Network and Internet-&gt; Network and Sharing center -&gt;  manage network connections </em><br />
Click right button on your <em>Wireless Network Connection</em> and choose <em>Properties</em>.<br />
Make double click on <em>Internet Protocol Version 4</em>.<br />
When new window is appear fill it up:<br />
<em>Ip address: 192.168.0.2<br />
Subnet mask: 255.255.255.0<br />
Default gateway: 192.168.0.1</em><br />
Also you need to specify you DNS server. Put the ip address of DNS server provided by your ISP.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/11/wireless-internet-ap-based-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Login restriction by time over pam.d</title>
		<link>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/</link>
		<comments>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 15:53:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[pam]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=423</guid>
		<description><![CDATA[If you I want to allow users log in in to system only at working hours use pam_time.so module. This example works on CentOS and I suspect that it will be work at RHEL as well.

We should edit to files for this:
/etc/pam.d/login
/etc/security/time.conf
Let&#8217;s begin from first one. Put next line into the file:
account    [...]]]></description>
			<content:encoded><![CDATA[<p>If you I want to allow users log in in to system only at working hours use pam_time.so module. This example works on CentOS and I suspect that it will be work at RHEL as well.</p>
<p><span id="more-423"></span></p>
<p>We should edit to files for this:<br />
<em>/etc/pam.d/login<br />
/etc/security/time.conf</em></p>
<p>Let&#8217;s begin from first one. Put next line into the file:</p>
<pre>account    required     pam_time.so</pre>
<p>after that go to the <em>/etc/security/time.conf</em>, and insert next:</p>
<pre>login;tty*;user1|user2|user3;Wk0009-1800 &amp; !Wd0000-2400</pre>
<p>where<br />
<em>login</em> &#8211; the type of pam service<br />
<em>tty*</em> &#8211; terminal name(in this case all terminal ttyXXX, you also specify defined terminal as well)<br />
<em>user1|user2|user3</em> &#8211; users or user name which should be restricted<br />
<em>Wk0009-1800 &amp; !Wd0000-2400</em> &#8211; time frame. Time where actions is allowed. To inverse it put &#8220;!&#8221; before.  There is 7 types of day:<br />
<em>Mo Tu We Th Fr Sa Su Wk Wd Al</em><br />
First seven is according to weeks day.<br />
<em>Wk</em> &#8211; means all work days(Mo-Fr)<br />
<em>Wd</em> &#8211; it&#8217;s week end(Sa,SU)<br />
<em>Al</em> &#8211; all days of week.</p>
<p>Now, you new rules was applied. And users user1, user2, user3 can&#8217;t log on system at no working time. No restart is required.</p>
<p>But we still have one problem. Users which logined at work time can be continuous use system without problem. To prevent this situation I have written little <a href="http://andriigrytsenko.net/files/time.txt">script</a>.</p>
<p>Rename it to <em>time.sh</em> and put anywhere at your system. After this new crontab entry should be added:</p>
<pre>crontab -e</pre>
<pre>55 17 * * 1-5    /path/to/time.sh</pre>
<p>Now all session will be destroyed at the end of working day and script notify user via user&#8217;s terminal 5 minutes before this. After that nobody from specified users willn&#8217;t be able to login on the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/08/login-restriction-by-time-over-pam-d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NIS and RedHat Linux Mini-HOWTO</title>
		<link>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/</link>
		<comments>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 10:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[nis]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=302</guid>
		<description><![CDATA[Here is describe how to configure NIS for the RedHat Linux.

The Network Information Service or NIS (originally called Yellow Pages or YP) consists of a client-server directory service protocol for distributing system configuration data such as user and host names between computers on a computer network.
Before we start  I would like to say couple [...]]]></description>
			<content:encoded><![CDATA[<p>Here is describe how to configure NIS for the RedHat Linux.</p>
<p><span id="more-302"></span></p>
<p>The Network Information Service or NIS (originally called Yellow Pages or YP) consists of a client-server directory service protocol for distributing system configuration data such as user and host names between computers on a computer network.</p>
<p>Before we start  I would like to say couple words about my environment:<br />
- I have to boxes (node2 has ip address 10.0.30.2 and node1 with ip 10.0.30.1)<br />
- node2 used as NIS server and node1 as NIS client<br />
- Both machines uses CentOS</p>
<p>I will divide post on two part. First part will be describe what have to done on the server side and second on the client side.</p>
<p>Let&#8217;s get nis software over yum:</p>
<pre>yum install ypbind
yum install ypserv
yum install yp-tools</pre>
<p>And configure ypserv configuration files:</p>
<pre>vi /etc/ypserv.conf</pre>
<p>The main line is :<br />
<em>Host : Domain : Map : Security </em> , it&#8217;s commented by default<br />
In our server we have next lines:</p>
<pre>10.0.30. : my-net : * : port </pre>
<p>It&#8217;s means that:<br />
- we allow access to our database all machines in subnet 10.0.30.0/24 .<br />
- the name of our nis domain is <em>&#8220;my-net&#8221;</em><br />
- we allow for replicate all files which described at /var/yp/Makefile<br />
- allow access if source port &lt; 1024. Otherwise deny access.</p>
<p>If you want to get more information concerning ypserv.conf, type:</p>
<pre>man ypserv.conf </pre>
<p>Do not forget set variable NISDOMAIN at file /etc/syconfig/network, because your service will not start at next boot:</p>
<pre>echo "NISDOMAIN=\"my_net\"" &gt;&gt; /etc/syconfig/network</pre>
<p>Start server services :</p>
<pre>/etc/init.d/ypserv start
/etc/init.d/yppasswdd start</pre>
<p>and add its to loading scripts :</p>
<pre>chkconfig --level 345 ypserv on
chkconfig --level 345 yppasswdd on</pre>
<p>Where ,<br />
ypserv &#8211; main server<br />
yppasswdd &#8211; password daemon, which allows users change their password in NIS database</p>
<p>Also you need to create <em>/var/yp/securenets</em> file restrict access to your NIS server. To allow acces for subnet 10.0.30.0/24, put next in file:</p>
<pre>255.255.255.0   10.0.30.0</pre>
<p>Use
<pre>man securenets</pre>
<p> to get more details.</p>
<p>Next, generate nis database :</p>
<pre>cd /usr/lib/yp/
./ypinit -m </pre>
<p>you will be prompted to input the name of client servers(they should be declared at <em>/etc/hosts</em>)</p>
<p>Make these steps every time after updating of maped files:</p>
<pre>cd /var/yp/
make </pre>
<p>That all for the first part. Now your server should be work.</p>
<p>Go to the client side.</p>
<p>Install nis client software:</p>
<pre>yum install ypbind</pre>
<p>and switch off SELinux rule which block ypbind running:</p>
<pre># setsebool -P allow_ypbind on</pre>
<p>Edit /etc/yp.conf file. Put into it next string:</p>
<pre>domain my_net server node2</pre>
<p>!!Please make sure that <em>node2</em> is declared at your <em>/etc/hosts</em> file.</p>
<p>Edit lines you want to effected in /etc/nsswitch.conf, like</p>
<pre>passwd: nis files
shadow: nis files</pre>
<p>if you want make common account database for all.</p>
<p>Also as in server side you need to set variable NISDOMAIN at file /etc/syconfig/network:</p>
<pre>echo "NISDOMAIN=\"my_net\"" &gt;&gt; /etc/syconfig/network</pre>
<p>Now, you are ready to run nis client :</p>
<pre>/etc/init.d/ypbind start</pre>
<p>If its started without errors put it in autoload:</p>
<pre>chkconfig --level 345 ypbind on</pre>
<p>Let&#8217;s check out if everything work fine. Go to the server and create new nis user <strong>nis_test_user</strong>:</p>
<pre>adduser nis_test_user
passwd nis_test_user
cd /var/yp
make</pre>
<p>Back to client box and type:</p>
<pre>ypmatch nis_test_user passwd </pre>
<p>and if its work you will get something like that:</p>
<pre>nis_test_user:$1$qMB3FqLy$XbzjESg3Uuse/.5PTRgPJ1:1000:1000::/home/nis_test_user:/bin/bash</pre>
<p>Also you will be able to login as <em>nis_test_user</em> at your box.</p>
<p>To change password for it use:</p>
<pre>yppasswd user</pre>
<p>!!To use this feature daemon yppasswdd on server side has to be running.</p>
<p>The end.</p>
<p>UPD:<br />
use
<pre>ypwhich -m </pre>
<p> to print all mapping files</p>
<pre>ypcat [mapping file]</pre>
<p> &#8211; to print file</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/nis-for-redhat-mini-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
