
<?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> &#187; Linux</title>
	<atom:link href="https://www.nikeshshk.com.np/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nikeshshk.com.np</link>
	<description></description>
	<lastBuildDate>Tue, 04 Nov 2025 10:25:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.4</generator>
	<item>
		<title>How to Install Iptables on CentOS 7</title>
		<link>https://www.nikeshshk.com.np/news/how-to-install-iptables-on-centos-7/</link>
		<comments>https://www.nikeshshk.com.np/news/how-to-install-iptables-on-centos-7/#comments</comments>
		<pubDate>Thu, 04 Jun 2020 05:16:52 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=855</guid>
		<description><![CDATA[Prerequisites Before starting with the tutorial, make sure you are logged in as a user with sudo privileges. Disable FirewallD To disable firewalld on your system follow these steps: Type the following command to stop the FirewallD service:sudo systemctl stop firewalld Disable the FirewallD service to start automatically on system boot:sudo systemctl disable firewalld Mask the FirewallD service to prevent it from being started by another services:sudo systemctl mask --now firewalld Install and Enable Iptables Perform the following steps to install Iptables on a CentOS 7 system: Run the following command to install the&#160;iptables-service&#160;package from the CentOS repositories:sudo yum install iptables-services Once the package is installed start the Iptables service:sudo systemctl start iptablessudo systemctl start ip6tables Enable the Iptables service to start automatically on system boot:sudo systemctl enable iptablessudo systemctl enable ip6tables Check the iptables service status with:sudo systemctl status iptablessudo systemctl status ip6tables To check the current iptables rules use the following commands:sudo iptables -nvLsudo ip6tables -nvLBy default only&#160;<a href="https://www.nikeshshk.com.np/news/how-to-install-iptables-on-centos-7/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p><!-- wp:heading --></p>
<h2 id="prerequisites">Prerequisites</h2>
<p><!-- /wp:heading --></p>
<p><!-- wp:paragraph --></p>
<p>Before starting with the tutorial, make sure you are logged in as a user with sudo privileges.</p>
<p><!-- /wp:paragraph --></p>
<p><!-- wp:heading --></p>
<h2 id="disable-firewalld">Disable FirewallD</h2>
<p><!-- /wp:heading --></p>
<p><!-- wp:paragraph --></p>
<p>To disable firewalld on your system follow these steps:</p>
<p><!-- /wp:paragraph --></p>
<p><!-- wp:list {"ordered":true} --></p>
<ol>
<li>Type the following command to stop the FirewallD service:<code>sudo systemctl stop firewalld</code></li>
<li>Disable the FirewallD service to start automatically on system boot:<code>sudo systemctl disable firewalld</code></li>
<li>Mask the FirewallD service to prevent it from being started by another services:<code>sudo systemctl mask --now firewalld</code></li>
</ol>
<p><!-- /wp:list --></p>
<p><!-- wp:heading --></p>
<h2 id="install-and-enable-iptables">Install and Enable Iptables</h2>
<p><!-- /wp:heading --></p>
<p><!-- wp:paragraph --></p>
<p>Perform the following steps to install Iptables on a CentOS 7 system:</p>
<p><!-- /wp:paragraph --></p>
<p><!-- wp:list {"ordered":true} --></p>
<ol>
<li>Run the following command to install the&nbsp;<code>iptables-service</code>&nbsp;package from the CentOS repositories:<code>sudo yum install iptables-services</code></li>
<li>Once the package is installed start the Iptables service:<code>sudo systemctl start iptables</code><code>sudo systemctl start ip6tables</code></li>
<li>Enable the Iptables service to start automatically on system boot:<code>sudo systemctl enable iptables</code><code>sudo systemctl enable ip6tables</code></li>
<li>Check the iptables service status with:<code>sudo systemctl status iptables</code><code>sudo systemctl status ip6tables</code></li>
<li>To check the current iptables rules use the following commands:<code>sudo iptables -nvL</code><code>sudo ip6tables -nvL</code>By default only the SSH port 22 is open. The output should look something like this:<code>Chain INPUT (policy ACCEPT 0 packets, 0 bytes)<br />
 pkts bytes target     prot opt in     out     source               destination<br />
 5400 6736K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED<br />
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0<br />
    2   148 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0<br />
    3   180 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22<br />
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited</p>
<p>Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)<br />
 pkts bytes target     prot opt in     out     source               destination<br />
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited</p>
<p>Chain OUTPUT (policy ACCEPT 4298 packets, 295K bytes)<br />
 pkts bytes target     prot opt in     out     source               destination     </code></li>
</ol>
<p><!-- /wp:list --></p>
<p><!-- wp:paragraph --></p>
<p>At this point, you have successfully enabled the iptables service and you can start building your firewall. The changes will persist after a reboot.</p>
<p><!-- /wp:paragraph --></p>
<p><!-- wp:heading --></p>
<h2 id="conclusion">Conclusion</h2>
<p><!-- /wp:heading --></p>
<p><!-- wp:paragraph --></p>
<p>In this tutorial, you learned how to disable the FirewallD service and install iptables.</p>
<p><!-- /wp:paragraph --></p>
<p><!-- wp:paragraph --></p>
<p>If you have any questions or remarks, please leave a comment below.</p>
<p><!-- /wp:paragraph --></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/how-to-install-iptables-on-centos-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scanning for malware with Linux Malware Detect (LMD)</title>
		<link>https://www.nikeshshk.com.np/news/scanning-for-malware-with-linux-malware-detect-lmd/</link>
		<comments>https://www.nikeshshk.com.np/news/scanning-for-malware-with-linux-malware-detect-lmd/#comments</comments>
		<pubDate>Sat, 25 Jul 2015 09:39:11 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[malware remove]]></category>
		<category><![CDATA[malware scan linux]]></category>
		<category><![CDATA[virus remove]]></category>
		<category><![CDATA[virus scan]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=841</guid>
		<description><![CDATA[Linux Malware Detect (LMD), also known as Maldet, is a malware scanner for Linux released under the GNU GPLv2 license. It is particularly effective for the detection of php backdoors, darkmailers and many other malicious files that can be uploaded on a compromised website. It will help you do detect infected websites and clean the infection, however securing the compromised user or website is still necessary to avoid re-infection. If the server has cPanel , we recommend you install ClamAV first, as maldet will use the ClamAV scan engine. ClamAV installation instructions are available here. You will need to be logged in as root to the server over SSH. 1 &#8211; Install maldet cd /usr/local/src/ &#38;&#38; wget http://www.rfxn.com/downloads/maldetect-current.tar.gz &#38;&#38; tar -xzvf maldetect-current.tar.gz &#38;&#38; cd maldetect-* &#38;&#38; sh install.sh This will automatically install a cronjob inside /etc/cron.daily/maldet so a daily scan will be run for local cPanel or Plesk accounts. 2 &#8211; Make sure to update to the latest version and virus signatures:&#160;<a href="https://www.nikeshshk.com.np/news/scanning-for-malware-with-linux-malware-detect-lmd/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>Linux Malware Detect (LMD), also known as Maldet, is a malware scanner for Linux released under the GNU GPLv2 license. It is particularly effective for the detection of php backdoors, darkmailers and many other malicious files that can be uploaded on a compromised website. It will help you do detect infected websites and clean the infection, however securing the compromised user or website is still necessary to avoid re-infection.</p>
<p>If the server has cPanel , we recommend you install ClamAV first, as maldet will use the ClamAV scan engine. ClamAV installation instructions are <a href="http://kb.iweb.com/entries/21073403-Installing-and-configuring-ClamAV-for-cPanel?locale=1" target="_blank">available here.</a></p>
<p>You will need to be logged in as root to the server over SSH.</p>
<p>1 &#8211; Install maldet</p>
<blockquote><p>cd /usr/local/src/ &amp;&amp; wget <a href="http://www.rfxn.com/downloads/maldetect-current.tar.gz">http://www.rfxn.com/downloads/maldetect-current.tar.gz</a> &amp;&amp; tar -xzvf maldetect-current.tar.gz &amp;&amp; cd maldetect-* &amp;&amp; sh install.sh</p></blockquote>
<p>This will automatically install a cronjob inside /etc/cron.daily/maldet so a daily scan will be run for local cPanel or Plesk accounts.<br />
2 &#8211; Make sure to update to the latest version and virus signatures:</p>
<blockquote><p>maldet -d &amp;&amp; maldet -u</p></blockquote>
<p>3 &#8211; Run the first scan manually</p>
<p>To scan a specific user&#8217;s home directory, run the following command:</p>
<blockquote><p>maldet -a /home/user</p></blockquote>
<p>To launch a background scan for all user&#8217;s public_html and public_ftp in all home directories, run the following command:</p>
<blockquote><p>maldet -b &#8211;scan-all /home?/?/public_?</p></blockquote>
<p>(We also recommend you to scan /tmp and /dev/shm/)</p>
<p>4 &#8211; Verify the scan report</p>
<p>We recommend you to always read the scan reports before doing a quarantine. You will also be able to identify infected websites for further actions.</p>
<p>List all scan reports time and SCANID:</p>
<blockquote><p>maldet &#8211;report list</p></blockquote>
<p>Show a specific report details :</p>
<blockquote><p>maldet &#8211;report SCANID</p></blockquote>
<p>&nbsp;</p>
<p>Show all scan details from log file:</p>
<blockquote><p>grep &#8220;{scan}&#8221; /usr/local/maldetect/event_log</p></blockquote>
<p>&nbsp;</p>
<p>5 &#8211; Clean the malicious files</p>
<p>By default the quarantine is disabled. You will have to launch it manually.</p>
<blockquote><p>maldet -q SCANID</p></blockquote>
<p>6 &#8211; (optional) Automatically quarantine detected malware</p>
<p>Please review these configuration variables in /usr/local/maldetect/conf.maldet<br />
variable     value     description<br />
quar_hits     number     if the number is different than 0, enables automatic quarantine</p>
<p>7- (optional) Configure scan reports e-mail alerts</p>
<p>Maldet can send you and email alert each time it detects malware. Please review these configuration variables in /usr/local/maldetect/conf.maldet<br />
variable     value     description<br />
email_alert     1 or 0     enable or disable e-mail alerts<br />
email_addr      e-mail address      target e-mail for notifications, should be put in quotes like: &#8220;<a href="mailto:myuser@mydomain.com">myuser@mydomain.com</a>&#8221;</p>
<p>More information is available: /usr/local/maldetect/conf.maldet or <a href="https://www.rfxn.com/projects/linux-malware-detect/" target="_blank">https://www.rfxn.com/projects/linux-malware-detect/</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/scanning-for-malware-with-linux-malware-detect-lmd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change the current timezone in CentOS</title>
		<link>https://www.nikeshshk.com.np/news/change-the-current-timezone-in-centos/</link>
		<comments>https://www.nikeshshk.com.np/news/change-the-current-timezone-in-centos/#comments</comments>
		<pubDate>Thu, 23 Jul 2015 10:33:05 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[change timezone linux]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=837</guid>
		<description><![CDATA[Type the following commands as root: cp /etc/localtime /root/old.timezone rm /etc/localtime ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime Verify new settings by typing the following two commands: date ls -l /etc/localtime Thats it]]></description>
				<content:encoded><![CDATA[<p>Type the following commands as root:</p>
<p>cp /etc/localtime /root/old.timezone<br />
rm /etc/localtime<br />
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime</p>
<p>Verify new settings by typing the following two commands:</p>
<p>date<br />
ls -l /etc/localtime</p>
<p>Thats it <img src="https://www.nikeshshk.com.np/wp-includes/images/smilies/simple-smile.png" alt=":)" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/change-the-current-timezone-in-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find and replace text within a file using commands on Linux</title>
		<link>https://www.nikeshshk.com.np/news/find-and-replace-text-within-a-file-using-commands-on-linux/</link>
		<comments>https://www.nikeshshk.com.np/news/find-and-replace-text-within-a-file-using-commands-on-linux/#comments</comments>
		<pubDate>Thu, 23 Jul 2015 05:15:56 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[find and replace]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=834</guid>
		<description><![CDATA[How can I find and replace specific words in a text file using command line? cd /path/to/your/folder/nikeshshakya sed -i &#8216;s/original/new/g&#8217; file.txt Explanation: sed = Stream EDitor -i = in-place (i.e. save back to the original file) The command string: s = the substitute command original = a regular expression describing the word to replace (or just the word itself) new = the text to replace it with g = global (i.e. replace all and not just the first occurrence) file.txt = the file name Or to make replace on all files on folder cd /path/to/your/folder/nikeshshakya sed -i &#8216;s/foo/bar/g&#8217; *]]></description>
				<content:encoded><![CDATA[<p>How can I find and replace specific words in a text file using command line?</p>
<p>cd /path/to/your/folder/nikeshshakya<br />
sed -i &#8216;s/original/new/g&#8217; file.txt<br />
<code>Explanation:</p>
<p>sed = Stream EDitor<br />
-i = in-place (i.e. save back to the original file)<br />
The command string:</p>
<p>s = the substitute command<br />
original = a regular expression describing the word to replace (or just the word itself)<br />
new = the text to replace it with<br />
g = global (i.e. replace all and not just the first occurrence)<br />
file.txt = the file name</code></p>
<p>Or to make replace on all files on folder<br />
cd /path/to/your/folder/nikeshshakya<br />
sed -i &#8216;s/foo/bar/g&#8217; *</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/find-and-replace-text-within-a-file-using-commands-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Create a New User and Grant Permissions in MySQL</title>
		<link>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/</link>
		<comments>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/#comments</comments>
		<pubDate>Sat, 13 Jun 2015 04:43:01 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[create mysql user with permission]]></category>
		<category><![CDATA[grant permission mysql]]></category>
		<category><![CDATA[mysql user]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=824</guid>
		<description><![CDATA[In the cases where more restrictions may be required, there are ways to create users with custom permissions. Let’s start by making a new user within the MySQL shell: CREATE USER 'nikesh'@'localhost' IDENTIFIED BY 'password'; Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell. Therefore, the first thing to do is to create new database and provide the user with access to that database. create database nikeshdb; GRANT ALL PRIVILEGES ON nikeshdb.* TO 'nikeshshk'@'localhost'; The asterisks in this command refer to table that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables. Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges. FLUSH PRIVILEGES; Your&#160;<a href="https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>In the cases where more restrictions may be required, there are ways to create users with custom permissions.<br />
Let’s start by making a new user within the MySQL shell:</p>
<p><code>CREATE USER 'nikesh'@'localhost' IDENTIFIED BY 'password';</code></p>
<p>Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.</p>
<p>Therefore, the first thing to do is to create new database and  provide the user with access to that database.</p>
<p><code>create database nikeshdb;</p>
<p>GRANT ALL PRIVILEGES ON nikeshdb.* TO 'nikeshshk'@'localhost';</code></p>
<p>The asterisks in this command refer to table that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.<br />
Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.</p>
<p><code>FLUSH PRIVILEGES;</code></p>
<p>Your changes will now be in effect.</p>
<p>How To Grant Different User Permissions<br />
Here is a short list of other common possible permissions that users can enjoy.</p>
<p>ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)<br />
<code>CREATE- allows them to create new tables or databases<br />
DROP- allows them to them to delete tables or databases<br />
DELETE- allows them to delete rows from tables<br />
INSERT- allows them to insert rows into tables<br />
SELECT- allows them to use the Select command to read through databases<br />
UPDATE- allow them to update table rows<br />
GRANT OPTION- allows them to grant or remove other users' privileges</code><br />
To provide a specific user with a permission, you can use this framework:</p>
<p> <code>GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;</code><br />
If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.</p>
<p>Each time you update or change a permission be sure to use the Flush Privileges command.</p>
<p>If you need to revoke a permission, the structure is almost identical to granting it:</p>
<p><code> REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;</code><br />
Just as you can delete databases with DROP, you can use DROP to delete a user altogether:</p>
<p><code> DROP USER ‘demo’@‘localhost’;</code><br />
To test out your new user, log out by typing</p>
<p><code> quit </code><br />
and log back in with this command in terminal:</p>
<p><code>mysql -u [username]-p</code></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu – ownCloud Secure Access with SSL</title>
		<link>https://www.nikeshshk.com.np/news/ubuntu-owncloud-secure-access-with-ssl/</link>
		<comments>https://www.nikeshshk.com.np/news/ubuntu-owncloud-secure-access-with-ssl/#comments</comments>
		<pubDate>Tue, 02 Jun 2015 11:50:25 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=820</guid>
		<description><![CDATA[Enable ssl sudo a2enmod ssl Create new directory for the self signed certificate sudo mkdir /etc/apache2/ssl Create the self signed certificate and the server key that protects it, and placing both of them into the new directory sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/owncloud.key -out /etc/apache2/ssl/owncloud.crt Now we setup the certificate sudo nano /etc/apache2/sites-available/default-ssl.conf The lines that need changing are the following ServerName 192.168.1.11:443 SSLEngine on SSLCertificateFile /etc/apache2/ssl/owncloud.crt SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key Activate the new vhost sudo a2ensite default-ssl Restart apache sudo service apache2 restart]]></description>
				<content:encoded><![CDATA[<p>Enable ssl</p>
<p>sudo a2enmod ssl</p>
<p>Create new directory for the self signed certificate</p>
<p>sudo mkdir /etc/apache2/ssl</p>
<p>Create the self signed certificate and the server key that protects it, and placing both of them into the new directory</p>
<p>sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/owncloud.key -out /etc/apache2/ssl/owncloud.crt</p>
<p>Now we setup the certificate</p>
<p>sudo nano /etc/apache2/sites-available/default-ssl.conf</p>
<p>The lines that need changing are the following</p>
<p>ServerName 192.168.1.11:443<br />
SSLEngine on<br />
SSLCertificateFile /etc/apache2/ssl/owncloud.crt<br />
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key</p>
<p>Activate the new vhost</p>
<p>sudo a2ensite default-ssl</p>
<p>Restart apache</p>
<p>sudo service apache2 restart</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/ubuntu-owncloud-secure-access-with-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hardening your Apache and PHP on Ubuntu 9.04 Server</title>
		<link>https://www.nikeshshk.com.np/news/hardening-your-apache-and-php-on-ubuntu-9-04-server/</link>
		<comments>https://www.nikeshshk.com.np/news/hardening-your-apache-and-php-on-ubuntu-9-04-server/#comments</comments>
		<pubDate>Tue, 02 Jun 2015 11:13:02 +0000</pubDate>
		<dc:creator><![CDATA[Nikesh Shakya]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=818</guid>
		<description><![CDATA[You have installed LAMP and OpenSSH on your Ubuntu 9.04 Server. The first thing to do is to harden it in order to avoid some kind of attacks. You can do the following steps in front of your Ubuntu 9.04 Server or remote access it via OpenSSH. For OpenSSH, your Ubuntu 9.04 Server is at 192.168.0.10 : ssh 192.168.0.10 -l nikesh Step 1 : The avoid someone to list your files on your Apache directory, you should do the following step. sudo nano /etc/apache2/sites-available/default Add a minus &#8220;-&#8221; in the front of &#8220;Indexes&#8221; and it will looking like this :     Options -Indexes FollowSymLinks MultiViews     AllowOverride None     Order allow,deny     allow from all Step 2 : To enable the rewrite module of Apache. sudo a2enmod rewrite To avoid Cross-Site-Tracing attack. Add the following lines within &#8221; &#8221; :     RewriteEngine On     RewriteCond %{REQUEST_METHOD} ^(TRACE&#124;TRACK)     RewriteRule .* &#8211; [F] Step 3 : To avoid HTTP DoS, DDoS or Brute Force attack, you should install&#160;<a href="https://www.nikeshshk.com.np/news/hardening-your-apache-and-php-on-ubuntu-9-04-server/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>You have installed LAMP and OpenSSH on your Ubuntu 9.04 Server. The first thing to do is to harden it in order to avoid some kind of attacks.</p>
<p>You can do the following steps in front of your Ubuntu 9.04 Server or remote access it via OpenSSH.</p>
<p>For OpenSSH, your Ubuntu 9.04 Server is at 192.168.0.10 :</p>
<p>ssh 192.168.0.10 -l nikesh</p>
<p>Step 1 :</p>
<p>The avoid someone to list your files on your Apache directory, you should do the following step.</p>
<p>sudo nano /etc/apache2/sites-available/default</p>
<p>Add a minus &#8220;-&#8221; in the front of &#8220;Indexes&#8221; and it will looking like this :</p>
<p><Directory /var/www/><br />
    Options -Indexes FollowSymLinks MultiViews<br />
    AllowOverride None<br />
    Order allow,deny<br />
    allow from all<br />
</Directory></p>
<p>Step 2 :</p>
<p>To enable the rewrite module of Apache.</p>
<p>sudo a2enmod rewrite</p>
<p>To avoid Cross-Site-Tracing attack. Add the following lines within &#8221; <VirtualHost *:80>&#8221; :</p>
<p><IfModule mod_rewrite.c><br />
    RewriteEngine On<br />
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)<br />
    RewriteRule .* &#8211; [F]
</IfModule></p>
<p>Step 3 :</p>
<p>To avoid HTTP DoS, DDoS or Brute Force attack, you should install this module.</p>
<p>sudo apt-get install libapache2-mod-evasive</p>
<p>Step 4 :</p>
<p>To screen out bad URL requests, such as /etc/shadow or MySQL injection and etc. You should install mod_security module. If you installed a amd64 (64-bit) version of Ubuntu Server, please replaced i386 with amd64 for the following commands.</p>
<p>wget http://etc.inittab.org/~agi/debian/libapache-mod-security2/libapache-mod-security_2.5.9-1_i386.deb</p>
<p>wget http://etc.inittab.org/~agi/debian/libapache-mod-security2/mod-security-common_2.5.9-1_all.deb</p>
<p>sudo dpkg -i libapache-mod-security_2.5.9-1_i386.deb mod-security-common_2.5.9-1_all.deb</p>
<p>Step 5 :</p>
<p>Do not allow any Apache and Ubuntu Server information to be print on the error pages.</p>
<p>sudo nano /etc/apache2/conf.d/security</p>
<p>Change the following lines as the following :</p>
<p>ServerToken Prod<br />
ServerSignature Off</p>
<p>Step 6 :</p>
<p>Now, it is time to harden the PHP.</p>
<p>sudo nano /etc/php5/apache2/php.ini</p>
<p>Change the following lines as the following :</p>
<p>display_errors = Off<br />
log_errors = On<br />
allow_url_fopen = Off<br />
safe_mode = On<br />
expose_php = Off<br />
enable_dl = Off<br />
disable_functions = system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd</p>
<p>Step 7 :</p>
<p>Final step is to restart Apache server.</p>
<p>sudo /etc/init.d/apache2 restart</p>
<p>Step 8 :</p>
<p>sudo nano /etc/sysctl.conf<br />
Uncomment the following line and make it look like this.</p>
<p>#Enable TCP SYN Cookie Protection<br />
net.ipv4.tcp_syncookies = 1</p>
<p>Make the change active.</p>
<p>sudo /sbin/sysctl -p</p>
<p>That&#8217;s all. See you!</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/hardening-your-apache-and-php-on-ubuntu-9-04-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Protect your Server Against the Shellshock Bash Vulnerability</title>
		<link>https://www.nikeshshk.com.np/news/how-to-protect-your-server-against-the-shellshock-bash-vulnerability/</link>
		<comments>https://www.nikeshshk.com.np/news/how-to-protect-your-server-against-the-shellshock-bash-vulnerability/#comments</comments>
		<pubDate>Sat, 27 Sep 2014 15:49:53 +0000</pubDate>
		<dc:creator><![CDATA[Nikesh Shakya]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Shellshock Bash Vulnerability]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=783</guid>
		<description><![CDATA[On September 24, 2014, a GNU Bash vulnerability, referred to as Shellshock or the &#8220;Bash Bug&#8221;, was disclosed. In short, the vulnerability allows remote attackers to execute arbitrary code given certain conditions, by passing strings of code following environment variable assignments. Because of Bash&#8217;s ubiquitous status amongst Linux, BSD, and Mac OS X distributions, many computers are vulnerable to Shellshock; all unpatched Bash versions between 1.14 through 4.3 (i.e. all releases until now) are at risk. The Shellshock vulnerability can be exploited on systems that are running Services or applications that allow unauthorized remote users to assign Bash environment variables. Examples of exploitable systems include the following: Apache HTTP Servers that use CGI scripts (via mod_cgi and mod_cgid) that are written in Bash or launch to Bash subshells Certain DHCP clients OpenSSH servers that use the ForceCommand capability Various network-exposed services that use Bash A detailed description of the bug can be found at CVE-2014-6271 and CVE-2014-7169. Because the Shellshock vulnerability is very widespread&#8211;even more so than the&#160;<a href="https://www.nikeshshk.com.np/news/how-to-protect-your-server-against-the-shellshock-bash-vulnerability/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>On September 24, 2014, a GNU Bash vulnerability, referred to as Shellshock or the &#8220;Bash Bug&#8221;, was disclosed. In short, the vulnerability allows remote attackers to execute arbitrary code given certain conditions, by passing strings of code following environment variable assignments. Because of Bash&#8217;s ubiquitous status amongst Linux, BSD, and Mac OS X distributions, many computers are vulnerable to Shellshock; all unpatched Bash versions between 1.14 through 4.3 (i.e. all releases until now) are at risk.</p>
<p>The Shellshock vulnerability can be exploited on systems that are running Services or applications that allow unauthorized remote users to assign Bash environment variables. Examples of exploitable systems include the following:</p>
<ul>
<li>Apache HTTP Servers that use CGI scripts (via <code>mod_cgi</code> and <code>mod_cgid</code>) that are written in Bash or launch to Bash subshells</li>
<li>Certain DHCP clients</li>
<li>OpenSSH servers that use the <code>ForceCommand</code> capability</li>
<li>Various network-exposed services that use Bash</li>
</ul>
<p>A detailed description of the bug can be found at <a href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6271">CVE-2014-6271</a> and <a href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-7169">CVE-2014-7169</a>.</p>
<p>Because the Shellshock vulnerability is very widespread&#8211;even more so than the OpenSSL Heartbleed bug&#8211;and particularly easy to exploit, it is highly recommended that affected systems are properly updated to fix or mitigate the vulnerability as soon as possible. We will show you how to test if your machines are vulnerable and, if they are, how to update Bash to remove the vulnerability.</p>
<p>Note: <em>(Sept. 25, 2014 &#8211; 6:00pm EST)</em> At the time of writing, only an &#8220;incomplete fix&#8221; for the vulnerability has been released. As such, it is recommended to update your machines that run Bash immediately, and check back for updates and a complete fix.</p>
<div data-unique="check-system-vulnerability"></div>
<h2>Check System Vulnerability</h2>
<p>On each of your systems that run Bash, you may check for Shellshock vulnerability by running the following command at the <code>bash</code> prompt:</p>
<pre><code>env VAR='() { :;}; echo Bash is vulnerable!' bash -c "echo Bash Test"
</code></pre>
<p>The highlighted <code>echo Bash is vulnerable!</code> portion of the command represents where a remote attacker could inject malicious code; arbitrary code following a function definition within an environment variable assignment. Therefore, if you see the following output, your version of Bash is vulnerable and should be updated:</p>
<pre><code>Bash is vulnerable!
Bash Test
</code></pre>
<p>Otherwise, if your output does not include the simulated attacker&#8217;s payload, i.e. &#8220;Bash is vulnerable&#8221; is not printed as output, your version of bash is not vulnerable. It may look something like this:</p>
<pre><code>bash: warning: VAR: ignoring function definition attempt
bash: error importing function definition for `VAR'
Bash Test
</code></pre>
<p>If your version of Bash is vulnerable, read on to learn how to update Bash and fix the vulnerability.</p>
<h3>Test Remote Sites</h3>
<p>If you simply want to test if websites or specific CGI scripts are vulnerable, use this link:<a href="http://shellshock.brandonpotter.com/">&#8216;ShellShock&#8217; Bash Vulnerability CVE-2014-6271 Test Tool</a>.</p>
<p>Simply enter the URL of the website or CGI script you want to test in the appropriate form and submit.</p>
<div data-unique="fix-vulnerability-update-bash"></div>
<h2>Fix Vulnerability: Update Bash</h2>
<p>The easiest way to fix the vulnerability is to use your default package manager to update the version of Bash. The following subsections cover updating Bash on various Linux distributions, including Ubuntu, Debian, CentOS, Red Hat, and Fedora.</p>
<p>Note: <em>(Sept. 25, 2014 &#8211; 6:00pm EST)</em> At the time of writing, only an &#8220;incomplete fix&#8221; for the vulnerability has been released. As such, it is recommended to update your machines that run Bash immediately, and check back for updates and a complete fix.</p>
<h3>APT-GET: Ubuntu / Debian</h3>
<p>Update Bash to the latest version available via <code>apt-get</code>:</p>
<pre><code>sudo apt-get update &amp;&amp; sudo apt-get install --only-upgrade bash
</code></pre>
<p>Now check your system vulnerability again by running the command in the previous section (<a href="https://www.digitalocean.com/community/tutorials/how-to-protect-your-server-against-the-shellshock-bash-vulnerability#check-system-vulnerability">Check System Vulnerability</a>).</p>
<h3>YUM: CentOS / Red Hat / Fedora</h3>
<p>Update Bash to the latest version available via the <code>yum</code>:</p>
<pre><code>sudo yum update bash
</code></pre>
<p>Now check your system vulnerability again by running the command in the previous section (<a href="https://www.digitalocean.com/community/tutorials/how-to-protect-your-server-against-the-shellshock-bash-vulnerability#check-system-vulnerability">Check System Vulnerability</a>).</p>
<div data-unique="conclusion"></div>
<h2>Conclusion</h2>
<p>Be sure to update all of your affected servers to the latest version of Bash!</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/how-to-protect-your-server-against-the-shellshock-bash-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting WAV files</title>
		<link>https://www.nikeshshk.com.np/news/converting-wav-files/</link>
		<comments>https://www.nikeshshk.com.np/news/converting-wav-files/#comments</comments>
		<pubDate>Tue, 09 Sep 2014 11:28:40 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[convert wav files]]></category>
		<category><![CDATA[gsm]]></category>
		<category><![CDATA[sox]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=778</guid>
		<description><![CDATA[Converting WAV files If you have a wav file (in what format?) you can convert it using the sox program. &#8211; Raw linear, signed 16 bit, mono, 8000 Hz (.slin) sox file.wav -t raw -r 8000 -c 1 -w -s file.slin &#8211; Raw mu-law, mono, 8000 Hz (.mulaw or .u) sox file.wav -t raw -r 8000 -c 1 -b 8 -U file.mulaw &#8211; Raw A-law, mono, 8000 Hz (.alaw or .A) sox file.wav -t raw -r 8000 -c 1 -b 8 -A file.alaw &#8211; Raw GSM, mono, 8000 Hz (.gsm) sox file.wav -t raw -r 8000 -c 1 -b 8 -g file.gsm (not all versions of sox support this conversion) &#8211; SUN/SGI audio/basic file, mono 8000 Hz (.au) containing: - Signed linear sox file.wav -r 8000 -c 1 -w -s file.au - alaw sox file.wav -r 8000 -c 1 -b 8 -A file.au - mulaw sox file.wav -r 8000 -c 1 -b 8 -U file.au In addition basic format &#8220;conversion&#8221;&#160;<a href="https://www.nikeshshk.com.np/news/converting-wav-files/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<h3>Converting WAV files</h3>
<p>If you have a wav file (in what format?) you can convert it using the sox program.</p>
<p>&#8211; Raw linear, signed 16 bit, mono, 8000 Hz (.slin)</p>
<pre>    sox file.wav -t raw -r 8000 -c 1 -w -s file.slin</pre>
<p>&#8211; Raw mu-law, mono, 8000 Hz (.mulaw or .u)</p>
<pre>    sox file.wav -t raw -r 8000 -c 1 -b 8 -U file.mulaw</pre>
<p>&#8211; Raw A-law, mono, 8000 Hz (.alaw or .A)</p>
<pre>    sox file.wav -t raw -r 8000 -c 1 -b 8 -A file.alaw</pre>
<p>&#8211; Raw GSM, mono, 8000 Hz (.gsm)</p>
<pre>    sox file.wav -t raw -r 8000 -c 1 -b 8 -g file.gsm
    (not all versions of sox support this conversion)</pre>
<p>&#8211; SUN/SGI audio/basic file, mono 8000 Hz (.au) containing:</p>
<pre>    - Signed linear
        sox file.wav -r 8000 -c 1 -w -s file.au
    - alaw
        sox file.wav -r 8000 -c 1 -b 8 -A file.au
    - mulaw
        sox file.wav -r 8000 -c 1 -b 8 -U file.au</pre>
<p>In addition basic format &#8220;conversion&#8221; if needed:</p>
<p>&#8211; WAV into RAW (tested with an A-law, mono, 8000 Hz riff wavefile)</p>
<pre>    sox file.wav file.raw</pre>
<p>The SUN/SGI formats have the advantage of being easily playable in a Web browser and it also preserves the format information.</p>
<p><strong>The output format should always be mono, 8 kHz as that is required for telephony.</strong></p>
<h3>Converting into WAV files</h3>
<p>If you have a mono 8kHz raw data file you can convert it into wave file by using sox</p>
<p>&#8211; Raw A-law, mono, 8000 Hz (.alaw or .A)</p>
<pre>    sox -t raw -r 8000 -A -b 8 -c 1 file.alaw file.wav
</pre>
<p>&#8211; mulaw, mono 8000 Hz (.mulaw)</p>
<pre>    sox -t raw -r 8000 -U -b 8 -c 1 file.mulaw test.wav</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/converting-wav-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VPN Installer for CentOS 6 Installation</title>
		<link>https://www.nikeshshk.com.np/news/vpn-installer-for-centos-6-installation/</link>
		<comments>https://www.nikeshshk.com.np/news/vpn-installer-for-centos-6-installation/#comments</comments>
		<pubDate>Wed, 03 Sep 2014 15:49:56 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[vanilla vpn]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=775</guid>
		<description><![CDATA[To get started with your own secure VPN, simply execute the following commands at your servers command-line: yum install -y git cd /opt &#38;&#38; git clone git://github.com/drewsymo/VPN.git cd VPN &#38;&#38; bash vpn-setup-vanilla.sh If you’re on Linode, you can simply rebuild your instance with the PPTP VPN Installer StackScript. Note: OpenVZ users, currently one of the iptables rules used in this script is not virtualised in OpenVZ (masquerade). This means you will need to run this line of code once you have finished installing the CentOS PPTP VPN script for it to work: iptables -t nat -A POSTROUTING -j SNAT --to-source x.x.x.x Where x.x.x.x is your venet0 IP address In addition to this, you will also need OpenVZ kernel 2.6.32 How do I connect to my VPN? You can now connect to your VPN using your servers IP as the hostname (this depends on your VPN client) The default username and password for your VPN server is: Username: myuser Password: mypass&#160;<a href="https://www.nikeshshk.com.np/news/vpn-installer-for-centos-6-installation/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>To get started with your own secure VPN, simply execute the following commands at your servers command-line:<br />
<code><br />
yum install -y git<br />
cd /opt &amp;&amp; git clone git://github.com/drewsymo/VPN.git<br />
cd VPN &amp;&amp; bash vpn-setup-vanilla.sh</code></p>
<p>If you’re on Linode, you can simply rebuild your instance with the PPTP VPN Installer StackScript.</p>
<p>Note: OpenVZ users, currently one of the iptables rules used in this script is not virtualised in OpenVZ (masquerade). This means you will need to run this line of code once you have finished installing the CentOS PPTP VPN script for it to work:<br />
<code><br />
iptables -t nat -A POSTROUTING -j SNAT --to-source x.x.x.x</code></p>
<p>Where x.x.x.x is your venet0 IP address</p>
<p>In addition to this, you will also need OpenVZ kernel 2.6.32</p>
<p>How do I connect to my VPN?<br />
You can now connect to your VPN using your servers IP as the hostname (this depends on your VPN client)</p>
<p>The default username and password for your VPN server is:</p>
<p>Username: myuser<br />
Password: mypass</p>
<p><strong>What’s the Code?</strong><br />
See below for the code in all its glory; keep in mind that you might need to adjust a few of the parameters (localip, remoteip) to suit your requirements:</p>
<p>&nbsp;</p>
<p>#!/bin/bash -x</p>
<p>#<br />
# drewsymo/VPN<br />
#<br />
# Installs a PPTP VPN-only system for CentOS<br />
#<br />
# @package VPN 2.0<br />
# @since VPN 1.0<br />
# @author Drew Morris<br />
#</p>
<p>(</p>
<p>VPN_IP=`curl ipv4.icanhazip.com&gt;/dev/null 2&gt;&amp;1`</p>
<p>VPN_USER=&#8221;myuser&#8221;<br />
VPN_PASS=&#8221;mypass&#8221;</p>
<p>VPN_LOCAL=&#8221;192.168.0.150&#8243;<br />
VPN_REMOTE=&#8221;192.168.0.151-200&#8243;</p>
<p>yum -y groupinstall &#8220;Development Tools&#8221;<br />
rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm<br />
yum -y install policycoreutils policycoreutils<br />
yum -y install ppp pptpd<br />
yum -y update</p>
<p>echo &#8220;1&#8221; &gt; /proc/sys/net/ipv4/ip_forward<br />
sed -i &#8216;s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g&#8217; /etc/sysctl.conf</p>
<p>sysctl -p /etc/sysctl.conf</p>
<p>echo &#8220;localip $VPN_LOCAL&#8221; &gt;&gt; /etc/pptpd.conf # Local IP address of your VPN server<br />
echo &#8220;remoteip $VPN_REMOTE&#8221; &gt;&gt; /etc/pptpd.conf # Scope for your home network</p>
<p>echo &#8220;ms-dns 8.8.8.8&#8243; &gt;&gt; /etc/ppp/options.pptpd # Google DNS Primary<br />
echo &#8220;ms-dns 209.244.0.3&#8243; &gt;&gt; /etc/ppp/options.pptpd # Level3 Primary<br />
echo &#8220;ms-dns 208.67.222.222&#8243; &gt;&gt; /etc/ppp/options.pptpd # OpenDNS Primary</p>
<p>echo &#8220;$VPN_USER pptpd $VPN_PASS *&#8221; &gt;&gt; /etc/ppp/chap-secrets</p>
<p>service iptables start<br />
echo &#8220;iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&#8221; &gt;&gt; /etc/rc.local<br />
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<br />
service iptables save<br />
service iptables restart</p>
<p>service pptpd restart<br />
chkconfig pptpd on</p>
<p>echo -e &#8216;\E[37;44m'&#8221;\033[1m Installation Log: /var/log/vpn-installer.log \033[0m&#8221;<br />
echo -e &#8216;\E[37;44m'&#8221;\033[1m You can now connect to your VPN via your external IP ($VPN_IP)\033[0m&#8221;</p>
<p>echo -e &#8216;\E[37;44m'&#8221;\033[1m Username: $VPN_USER\033[0m&#8221;<br />
echo -e &#8216;\E[37;44m'&#8221;\033[1m Password: $VPN_PASS\033[0m&#8221;</p>
<p>) 2&gt;&amp;1 | tee /var/log/vpn-installer.log</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/vpn-installer-for-centos-6-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
