<?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>ServerAdminBlog</title>
	<atom:link href="http://www.serveradminblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serveradminblog.com</link>
	<description>Short Circuit...</description>
	<lastBuildDate>Fri, 27 Apr 2012 06:48:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CentOS server &#8211; Vsftpd Howto</title>
		<link>http://www.serveradminblog.com/2012/04/centos-server-vsftpd-howto/</link>
		<comments>http://www.serveradminblog.com/2012/04/centos-server-vsftpd-howto/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 06:47:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Server project]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=446</guid>
		<description><![CDATA[To set up your CentOS as a secure FTP server, follow the next couple steps Install VSFTPD with yum install vsftpd Turn on vsftpd auto start with chkconfig --level 235 vsftpd on Open vsftpd.conf nano /etc/vsftpd/vsftpd.conf and edit the next: 1. Change anonymous_enable=YES to anonymous_enable=NO 2. Uncomment chroot_local_user=YES line (In CentOS 5.x you will need to add this [...]]]></description>
			<content:encoded><![CDATA[<p>To set up your CentOS as a secure FTP server, follow the next couple steps</p>
<p>Install VSFTPD with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">yum install vsftpd</pre></div></div>

<p>Turn on vsftpd auto start with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">chkconfig --level 235 vsftpd on</pre></div></div>

<p>Open vsftpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">nano /etc/vsftpd/vsftpd.conf</pre></div></div>

<p>and edit the next:</p>
<p>1. Change <strong>anonymous_enable=YES</strong> to <strong>anonymous_enable=NO</strong></p>
<p>2. Uncomment <strong>chroot_local_user=YES</strong> line (In CentOS 5.x you will need to add this line)</p>
<p>3. Change the default port number from 21 to XXXXX (where XXXXX is above 1024) with <strong>listen_port=XXXXX</strong></p>
<p>It this line doesn&#8217;t exist, paste it to the end of the file. Be sure that port XXXXX is accessible.</p>
<p>Restart vsftpd with service vsftpd restart. Please keep in mind that changing default port number doesn&#8217;t mean that your server is 100% secured. It will help you to avoid random dictionary attacks and your log files will be much smaller. Good password is a MUST.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/04/centos-server-vsftpd-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS server &#8211; Webmin howto</title>
		<link>http://www.serveradminblog.com/2012/04/centos-server-webmin-howto/</link>
		<comments>http://www.serveradminblog.com/2012/04/centos-server-webmin-howto/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 06:37:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server project]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=451</guid>
		<description><![CDATA[Webmin is a web-based app for system administration for Unix/Linux. With Webmin, you can setup user accounts, web server, mail server  and much more. In this post, I&#8217;ll show how to install Webmin on RedHat based distros. Download webmin with wget http://www.webmin.com/download/rpm/webmin-current.rpm Install webmin with with rpm -Uvh webmin* After installation, start Webmin with &#8220;service webmin [...]]]></description>
			<content:encoded><![CDATA[<p>Webmin is a web-based app for system administration for Unix/Linux. With Webmin, you can setup user accounts, web server, mail server  and much more.</p>
<p>In this post, I&#8217;ll show how to install Webmin on RedHat based distros.</p>
<p>Download webmin with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">wget http://www.webmin.com/download/rpm/webmin-current.rpm</pre></div></div>

<p>Install webmin with with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rpm -Uvh webmin*</pre></div></div>

<p>After installation, start Webmin with &#8220;service webmin start&#8221;. You can access Webmin via web browser (localhost:10000)</p>
<p>It is good idea to change the default port. To do this, open miniserv.conf (usually /etc/webmin/miniserv.conf) with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">nano /etc/webmin/miniserv.conf</pre></div></div>

<p>and change the default port number from 10000 to something more secure (port=23345 for example). Save the file and restart Webmin (service webmin restart).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/04/centos-server-webmin-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Average monthly traffic report (freeRadius)</title>
		<link>http://www.serveradminblog.com/2012/03/average-monthly-traffic-report-freeradius/</link>
		<comments>http://www.serveradminblog.com/2012/03/average-monthly-traffic-report-freeradius/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 18:28:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeRadius]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=442</guid>
		<description><![CDATA[The average monthly traffic per user in MB. Note The stats were collected between Dec. 2007 and the Feb 2012. Average speed per user is 768k (5GHz wireless connection)]]></description>
			<content:encoded><![CDATA[<p>The average monthly traffic per user in MB.</p>
<p><img class="size-full wp-image-443 aligncenter" title="prosjecan-promet-en-550" src="http://www.serveradminblog.com/wp-content/uploads/2012/03/prosjecan-promet-en-550.png" alt="" width="550" height="348" /></p>
<p>Note<br />
The stats were collected between Dec. 2007 and the Feb 2012. Average speed per user is 768k (5GHz wireless connection)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/03/average-monthly-traffic-report-freeradius/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Three years since the first blog post</title>
		<link>http://www.serveradminblog.com/2012/03/three-years-since-the-first-blog-post/</link>
		<comments>http://www.serveradminblog.com/2012/03/three-years-since-the-first-blog-post/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 01:05:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=439</guid>
		<description><![CDATA[Three years ago, I wrote the first blog post here. Since then, I posted near 80 blog posts and many of them are still very popular. I&#8217;m glad I was able to help. Please send me your comments and questions and thank you for reading this.]]></description>
			<content:encoded><![CDATA[<p>Three years ago, I wrote the first blog post here. Since then, I posted near 80 blog posts and many of them are still very popular.</p>
<p>I&#8217;m glad I was able to help. </p>
<p>Please send me your comments and questions and thank you for reading this. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/03/three-years-since-the-first-blog-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Fatal error: Class ‘DOMDocument’ not found in &#8230;</title>
		<link>http://www.serveradminblog.com/2012/03/php-fatal-error-class-domdocument-not-found-in/</link>
		<comments>http://www.serveradminblog.com/2012/03/php-fatal-error-class-domdocument-not-found-in/#comments</comments>
		<pubDate>Sat, 10 Mar 2012 10:32:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=437</guid>
		<description><![CDATA[This morning I found the next errors inside the web server log. PHP Warning: include(DOMDocument.php) [&#60;a href=&#34;function.include&#34;&#62;function.include&#60;/a&#62;]: failed to open stream: No such file or directory in ...... PHP Warning: include() [&#60;a href=&#34;function.include&#34;&#62;function.include&#60;/a&#62;]: Failed opening 'DOMDocument.php' for inclusion (include_path='..... PHP Fatal error: Class 'DOMDocument' not found in ..... The solution for this problem is to [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I found the next errors inside the web server log.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PHP Warning: include(DOMDocument.php) [&lt;a href=&quot;function.include&quot;&gt;function.include&lt;/a&gt;]: failed to open stream: No such file or directory in ......
PHP Warning: include() [&lt;a href=&quot;function.include&quot;&gt;function.include&lt;/a&gt;]: Failed opening 'DOMDocument.php' for inclusion (include_path='.....
PHP Fatal error: Class 'DOMDocument' not found in .....</pre></div></div>

<p>The solution for this problem is to install the missing php-xml rpm.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">yum install php-xml</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/03/php-fatal-error-class-domdocument-not-found-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install phpshield loaders</title>
		<link>http://www.serveradminblog.com/2012/02/how-to-install-phpshield-loaders/</link>
		<comments>http://www.serveradminblog.com/2012/02/how-to-install-phpshield-loaders/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 23:35:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=431</guid>
		<description><![CDATA[PHPShield is an PHP encoder application that is used to protect the PHP code which is an excellent option for encoding your PHP files if you don&#8217;t require any time limiting, IP/Domain locking or other licensing features which are available in phpSHIED older brother SourceGuardian. This post will cover installing phpSHIELD on a Linux server [...]]]></description>
			<content:encoded><![CDATA[<p>PHPShield is an PHP encoder application that is used to protect the PHP code which is an excellent option for encoding your PHP files if you don&#8217;t require any time limiting, IP/Domain locking or other licensing features which are available in phpSHIED older brother SourceGuardian.</p>
<p>This post will cover installing phpSHIELD on a Linux server (RH based distros). You must have root access to your server which means if you have shared hosting account, you won&#8217;t be able to install phpSHIELD. In this case, you&#8217;ll need to contact your hosting provider and to ask them about phpshield loades.</p>
<p>The first step is to find out which PHP version do you have with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># php -v</pre></div></div>

<p>and you will get something like</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PHP 5.1.6 (cli) (built: Feb  2 2012 18:25:25)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies</pre></div></div>

<p>Then download loaders from this <a href="http://phpshield.com/loaders/index.php" target="_blank">link</a> (according to your platform) and unpack them on your local drive. </p>
<p>The next step is to upload encoded files and visit app link. You should get something like</p>
<blockquote><p>PHP script /var/www/html/myApp/index.php is protected by phpSHIELD and requires the phpSHIELD loader phpshield.5.1.lin. The phpSHIELD loader has not been installed, or is not installed correctly. Please visit the phpSHIELD php encoder site to download required loader.</p></blockquote>
<p>Note: <strong>The files in my case were encoded by older PHPShield (3.1). The new version (8.x) will probably have the same message where phpshield.5.1.lin will be replaced with ixed.5.1.lin</strong></p>
<p>I suppose that your server is a 64bit which means that PHP will load modules from /usr/lib64/php/modules dir. </p>
<p>Copy downloaded ixed.5.1.lin file inside /usr/lib64/php/modules dir.</p>
<p>Then open /etc/php.ini and add the next line at the end of the file</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">extension=ixed.5.1.lin</pre></div></div>

<p>Save the changes and restart apache (service httpd restart)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/02/how-to-install-phpshield-loaders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeRadius install howto (5) – Mikrotik settings</title>
		<link>http://www.serveradminblog.com/2012/01/freeradius-install-howto-5-mikrotik-settings/</link>
		<comments>http://www.serveradminblog.com/2012/01/freeradius-install-howto-5-mikrotik-settings/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 23:18:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeRadius]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=414</guid>
		<description><![CDATA[&#160; I&#8217;m receiving so many questions about FreeRadius and I&#8217;m sorry to tell this but I can&#8217;t and I won&#8217;t give you tech support 4 free. I can and I will answer on one or two questions but do not bother me every single day via email and IM clients when I already wrote on [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>I&#8217;m receiving so many questions about FreeRadius and I&#8217;m sorry to tell this but <strong>I can&#8217;t and I won&#8217;t give you tech support 4 free</strong>. I can and I will answer on one or two questions but do not bother me every single day via email and IM clients when I already wrote on this blog all you need to know.</p>
<p>I understand that RADIUS protocol is marginalized but there are more than enough articles which just laying around and waiting for you. All you need is Google and the right search term.</p>
<p><span id="more-414"></span></p>
<p>Before you continue to this read this article, please:<br />
turn on your brain<br />
find out what exactly do you want from your RADIUS server<br />
read the four articles I posted on this blog<br />
be sure that you Mikrotik can reach the Internet (has properly configured IP addresses, DNS, default route, etc)</p>
<p>In this post, I will explain how to set up a Mikrotik router to act as a NAS (but only the part related to RADIUS).</p>
<p>The first step you need to do is to be sure that Mikrotik and RADIUS server “can talk” which means you can ping RADIUS server from Mikrotik and vice verse. Of course, the connection must be reliable and without packet loss.</p>
<p>In the last example, our RADIUS server had an IP address 192.168.0.10 and if you remember we added IP 192.168.0.15 inside the nas table with mysecret as a RADIUS secret. This means that only NAS from IP address 192.168.0.15 would be able to talk with RADIUS server but only if the secret is correct.</p>
<p>So, lets define the RADIUS server inside Mikrotik.</p>
<p>Connect to Mikrotik via Winbox utility. Click on RADIUS and click on the + to add a new RADIUS server.</p>
<p><img class="size-full wp-image-420 aligncenter" title="1" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/1.png" alt="" width="336" height="449" /></p>
<p>&nbsp;</p>
<p>Enter RADIUS server IP address (in this case 192.168.0.10), enter secret and select ppp.</p>
<p>The next step is to enable Incoming requests so you will be able to disconnect users via PoD (Packet of Disconnect). Click on the Incoming button (RADIUS -&gt; Incoming) and enable Accept checkbox.</p>
<p><img class="size-full wp-image-415 aligncenter" title="2" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/2.png" alt="" width="261" height="200" /></p>
<p>Add new PPPoE server (PPP &#8211; PPPoE Servers and click Add).</p>
<p><img class="aligncenter" title="3" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/3.png" alt="" width="336" height="347" /></p>
<p>The most important thing here is to choose the right interface. I your LAN interface is connected to the network where are the users, select LAN. My recommendation is to leave only pap and chap inside Auth. section.</p>
<p>The next step is to define a IP pool which will be used for address allocation.</p>
<p><img class="size-full wp-image-417 aligncenter" title="4" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/4.png" alt="" width="275" height="186" /></p>
<p>Be sure that pool name is the same like you defined in the database because radius server will return the pool name to Mikrotik and if the pool with that name doesn&#8217;t exists, the users won&#8217;t get an IP address.</p>
<p>The next step is to properly configure the default profile for PPPoE users.</p>
<p><img class="size-full wp-image-418 aligncenter" title="5" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/5.png" alt="" width="341" height="551" /></p>
<p>Enter local IP address (your public IP address), select remote address pool (the IP pool which we defined above) and add DNS servers which will be returned to the users.You can use the same Mikrotik as a DNS server but you need to turn on Allow remote requests inside DNS settings.</p>
<p>The last step is to turn on RADIUS for accounting inside PPP &#8211; Secret menu. Interim update is the time and I do not recommend the values less than 5 minutes.</p>
<p><img class="size-full wp-image-419 aligncenter" title="6" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/6.png" alt="" width="324" height="132" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/01/freeradius-install-howto-5-mikrotik-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dia &#8211; diagram creation program</title>
		<link>http://www.serveradminblog.com/2012/01/dia-diagram-creation-program/</link>
		<comments>http://www.serveradminblog.com/2012/01/dia-diagram-creation-program/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 13:01:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Networks]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=405</guid>
		<description><![CDATA[In case you need to draw a diagram from time to time, you should think about Dia. Dia is a GTK+ based diagram creation program for GNU/Linux, MacOS X, Unix, and Windows, and is released under the GPL license. It is a very nice replacement for Visio which is commercial product. It can be used [...]]]></description>
			<content:encoded><![CDATA[<p>In case you need to draw a diagram from time to time, you should think about Dia. Dia is a GTK+ based diagram creation program for GNU/Linux, MacOS X, Unix, and Windows, and is released under the GPL license.</p>
<p>It is a very nice replacement for Visio which is commercial product. It can be used to draw many different kinds of diagrams. It currently has special objects to help draw entity relationship diagrams, UML diagrams, flowcharts, network diagrams, and many other diagrams. It is also possible to add support for new shapes by writing simple XML files, using a subset of SVG to draw the shape.</p>
<p>It can load and save diagrams to a custom XML format (gzipped by default, to save space), can export diagrams to a number of formats, including EPS, SVG, XFIG, WMF and PNG, and can print diagrams (including ones that span multiple pages).</p>
<p>I almost bought LanFlow for 99$ but then I found Dia <img src='http://www.serveradminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The next step is donation to this project <img src='http://www.serveradminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img class="size-full wp-image-408 aligncenter" title="dia" src="http://www.serveradminblog.com/wp-content/uploads/2012/01/dia.png" alt="" width="500" height="313" /></p>
<p>Here is the link <a href="http://live.gnome.org/Dia">http://live.gnome.org/Dia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2012/01/dia-diagram-creation-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook you’re doing it wrong</title>
		<link>http://www.serveradminblog.com/2011/12/facebook-youre-doing-it-wrong/</link>
		<comments>http://www.serveradminblog.com/2011/12/facebook-youre-doing-it-wrong/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 21:26:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=401</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-402 aligncenter" title="facebook-you-doing-it-wrong" src="http://www.serveradminblog.com/wp-content/uploads/2011/12/facebook-you-doing-it-wrong.png" alt="" width="324" height="271" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/12/facebook-youre-doing-it-wrong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeRadius install howto (4) &#8211; populating tables</title>
		<link>http://www.serveradminblog.com/2011/12/freeradius-install-howto-4-populating-tables/</link>
		<comments>http://www.serveradminblog.com/2011/12/freeradius-install-howto-4-populating-tables/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 23:45:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Networks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=315</guid>
		<description><![CDATA[In the last article about FreeRadius (Here), I wrote about basic settings and now I&#8217;ll write something about inserting users into database (MySQL). The FreeRadius database schema contains several tables: nas This table contains data about NASes (radius clients) and it is a &#8220;replacement&#8221; for clients.conf file. It is much easier to maintain the clients [...]]]></description>
			<content:encoded><![CDATA[<p>In the last article about FreeRadius (<a href="http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/">Here</a>), I wrote about basic settings and now I&#8217;ll write something about inserting users into database (MySQL).</p>
<p>The FreeRadius database schema contains several tables:</p>
<p><strong>nas</strong></p>
<p>This table contains data about NASes (radius clients) and it is a &#8220;replacement&#8221; for clients.conf file. It is much easier to maintain the clients in the database than inside config file. If you want to use database for NAS list, skip the step in the last howto (the part about clients.conf). Also, in case you want to keep your NASes in the nas table, you&#8217;ll need to uncomment the <strong>readclients = yes</strong> inside sql.conf.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">        # Set to 'yes' to read radius clients from the database ('nas' table)
        # Clients will ONLY be read on server startup.  For performance
        # and security reasons, finding clients via SQL queries CANNOT
        # be done &quot;live&quot; while the server is running.
        #
        readclients = yes</pre></div></div>

<p>As you can see from the comment, you will need to restart radiusd process to allow/disallow specific NAS.</p>
<p>nas table schema is located inside raddb/sql/mysql/nas.sql</p>
<p>To add IP 192.168.0.15 inside nas table, exec next query:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span>  nas <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'192.168.0.15'</span><span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'myNAS'</span><span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'other'</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'mysecret'</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'RADIUS Client'</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>and you will have</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mysql&gt; select * from nas;
+----+--------------+-----------+-------+-------+----------+--------+-----------+---------------+
| id | nasname      | shortname | type  | ports | secret   | server | community | description   |
+----+--------------+-----------+-------+-------+----------+--------+-----------+---------------+
|  1 | 192.168.0.15 | myNAS     | other |  NULL | mysecret | NULL   | NULL      | RADIUS Client |
+----+--------------+-----------+-------+-------+----------+--------+-----------+---------------+
1 row in set (0.00 sec)</pre></div></div>

<p><strong>radacct</strong></p>
<p>This table is used for accounting data. In case you want to collect traffic stats, you will need to uncomment <strong>sql</strong> inside accounting {} section in <strong>/usr/local/etc/raddb/sites-available/default.</strong> The same table can be used for simultaneous use checking which is faster than radutmp. All you need to do is to uncomment <strong>sql</strong> inside session {} section inside <strong>/usr/local/etc/raddb/sites-available/default </strong>and uncomment <strong>simul_count_query</strong> inside <strong>/usr/local/etc/raddb/sql/mysql/dialup.conf</strong></p>
<p><strong>radcheck</strong></p>
<p>This table keeps the check attributes for users (User-Password, Cleartext-Password, Expiration, Simultaneous-Use, Auth-Type, &#8230;)</p>
<p><strong>radreply</strong></p>
<p>Is used for reply attributes for specific user. For example Framed-IP-Address, upload and download speed, etc&#8230;</p>
<p><strong>radgroupcheck</strong></p>
<p>This table keeps the check attributes for groups (which means, all users inside specific group will be checked against this attributes).</p>
<p><strong>radgroupreply</strong></p>
<p>The same like radreply but for groups. (all users in specific group will get the same speed, etc). Also, Framed-Pool attribute goes here.</p>
<p><strong>radpostauth</strong></p>
<p>This table is used for logging failed login attempts. To use this, you&#8217;ll need to uncomment sql inside postauth section (<strong>/usr/local/etc/raddb/sites-available/default.</strong>). Think twice before you enable this option because it can overload your server with constant inserts. Your customers will probably spend their money on wireless or wired routers so the logging attempts will come over and over.</p>
<p><strong>radusergroup</strong></p>
<p>This table keeps relation between username and specific group and group priority. In Freeradius 1.x this table was named &#8220;<strong>usergroup</strong>&#8221; so in case you have your own billing which is made for old schema, rename this table to <strong>usergroup</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">        # Table to keep group info
        usergroup_table = &quot;radusergroup&quot;</pre></div></div>

<p>Examples</p>
<p>We will create a sample service with the next attributes:<br />
- 512kbps download speed<br />
- 128kbps upload speed<br />
- we will use PPPoE – Point to Point Protocol Over Ethernet<br />
- we will assign dynamic IP addresses to our clients from &#8220;internet&#8221; IP pool</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radgroupreply`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`groupname`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testservice'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Ascend-Xmit-Rate'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'524288'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testservice'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Ascend-Data-Rate'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'131072'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testservice'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Framed-Pool'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'internet'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>As you can see the speed is converted to bps.</p>
<p><img src="http://www.serveradminblog.com/wp-content/uploads/2011/12/kreiranje-paketa.png" alt="" title="service" width="296" height="101" class="alignnone size-full wp-image-392" /></p>
<p>After you created the service, lets create a sample user (assigned with created service).</p>
<p>As I noticed above, check attributes should be placed inside radcheck table.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radcheck`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`username`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'User-Password'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testpassword'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Simultaneous-Use'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In this sample, the password is in plain text format which is not reccommended. Insted User-Password (which is alternative to Cleartext-Password for Mikrotik) better option is to use MD5-Password but keep in mind that you won&#8217;t be able to use CHAP.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radcheck`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`username`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'MD5-Password'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> MD5<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'testpassword'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Simultaneous-Use'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><img src="http://www.serveradminblog.com/wp-content/uploads/2011/12/kreiranje-korisnika.png" alt="" title="kreiranje-korisnika" width="461" height="79" class="alignnone size-full wp-image-394" /></p>
<p>Then we need to assign this user with created service (group)</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radusergroup`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`username`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`groupname`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`priority`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testservice'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><img src="http://www.serveradminblog.com/wp-content/uploads/2011/12/uparivanje-korisnika.png" alt="" title="uparivanje-korisnika" width="215" height="48" class="alignnone size-full wp-image-396" /></p>
<p>After those inserts, lets test</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ns2 raddb]# radtest testuser testpassword 127.0.0.1 0 testing123
Sending Access-Request of id 228 to 127.0.0.1 port 1812
        User-Name = &quot;testuser&quot;
        User-Password = &quot;testpassword&quot;
        NAS-IP-Address = 192.168.0.10
        NAS-Port = 0
        Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=228, length=54
        Ascend-Xmit-Rate = 524288
        Ascend-Data-Rate = 131072
        Framed-Pool = &quot;internet&quot;
[root@ns2 raddb]#</pre></div></div>

<p>As you can see, the username/password combination is valid and RADIUS server returned all attributes assigned with user&#8217;s group. </p>
<p>To suspend user&#8217;s account you can insert Auth-Type := Reject for user.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radcheck`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`username`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testuser'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Auth-Type'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Reject'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>and we have</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ns2 raddb]# radtest testuser testpassword 127.0.0.1 0 testing123
.....
rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=145, length=20</pre></div></div>

<p>Another option for disabling users is assigning with specific group which has Auth-Type := Reject inside radgroupcheck</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radgroupcheck`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`groupname`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'suspended'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Auth-Type'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Reject'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Assigning with suspended group can be done with</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`radusergroup`</span> 
<span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`groupname`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'suspended'</span> 
<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #ff0000;">`username`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'testuser'</span> 
<span style="color: #993333; font-weight: bold;">AND</span> <span style="color: #ff0000;">`priority`</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>

<p><img src="http://www.serveradminblog.com/wp-content/uploads/2011/12/reject-grupe.png" alt="" title="reject-grupe" width="249" height="51" class="alignnone size-full wp-image-397" /></p>
<p>and we have</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=198, length=20</pre></div></div>

<p>Also, keep in mind that routers will try to connect again and again so you will have a big problems in case you have thousands of users. Another option is to assign users with specific group which doesn&#8217;t have Auth-Type attribute. Instead rejecting you can assign internal IPs and redirect them to suspended page.</p>
<p>Many questions on FreeRadius mailing list are about Simultaneus-Use. Solution to this problem is very simple and it is very rude to ask this question again and again&#8230; </p>
<p>All you need to do is to insert Simultaneous-Use := 1 for specific user (radcheck table) or inside radgroupcheck if you want to limit all users inside specific group.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`radgroupcheck`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`groupname`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`attribute`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`op`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`value`</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'testservice'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Simultaneous-Use'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">':='</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In case you want to set Expiration attribute you can insert the date and the time inside radcheck table.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">INSERT INTO `radcheck` (`id` ,`username` ,`attribute` ,`op` ,`value` )
VALUES (NULL , 'testuser', 'Expiration', '==', 'November 30 2011 00:00:00');</pre></div></div>

<p>then we have</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ns2 raddb]# radtest testuser testpassword 127.0.0.1 0 testing123
Sending Access-Request of id 28 to 127.0.0.1 port 1812
        User-Name = &quot;testuser&quot;
        User-Password = &quot;testpassword&quot;
        NAS-IP-Address = 192.168.0.10
        NAS-Port = 0
        Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=28, length=60
        Ascend-Xmit-Rate = 524288
        Ascend-Data-Rate = 131072
        Framed-Pool = &quot;internet&quot;
        Session-Timeout = 670889</pre></div></div>

<p>You can note Session-Timeout attribute which contains the time in seconds between this moment and the date inside Expiration field. According to this value, the NAS will auto disconnect user when this time expire (in our case 670889 seconds). In case you set the time which already passed (for example yesterdays date) the user will be rejected. </p>
<p><strong>Please keep in mind that this date format works for Mikrotik. I didn&#8217;t have chance to test it with other NASes.</strong> </p>
<p>If you want to reconnect users at regular intervals (for example every 24 hours &#8211; 86400 seconds) you can insert Session-Timeout inside radreply table (because it isn&#8217;t check attribute).<br />
To recconect every user inside specific group, add this attribute inside radgroupreply table. </p>
<p>To assign a static IP for specific user insert Framed-IP-Address attribute inside radreply table where Value will be that IP address. Operator should be :=. </p>
<p>Please keep in mind that all inserts inside those tables are visible to radius server right after insert. Only inserts inside nas table won&#8217;t be until the restart (service radiusd restart)</p>
<p>I hope this post will help you to set up your own RADIUS server. Also, keep in mind that this is just an example and all this can done in many other ways. </p>
<p>In case you find a spelling errors please contact me so I can fix them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/12/freeradius-install-howto-4-populating-tables/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>

