<?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>REDIS &#8211; Hostry Help Center</title>
	<atom:link href="https://help.hostry.com/article-tags/redis/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.hostry.com</link>
	<description>Full information on how to use HOSTRY, provided by 24/7 community based support</description>
	<lastBuildDate>Tue, 06 Aug 2019 06:58:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.13</generator>

<image>
	<url>https://help.hostry.com/wp-content/uploads/cache/2021/01/cropped-apple-icon-180x180-1/836712163.png</url>
	<title>REDIS &#8211; Hostry Help Center</title>
	<link>https://help.hostry.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Install Redis And Configure Security Settings on Linux</title>
		<link>https://help.hostry.com/knowledge-base/how-to-install-redis/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-install-redis/#comments</comments>
		
		<dc:creator><![CDATA[Paul Harris]]></dc:creator>
		<pubDate>Fri, 26 Jul 2019 12:42:40 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=418</guid>

					<description><![CDATA[For Debian-based systems, run the following commands: user@localhost: ~ sudo apt update Optional: user@localhost: ~ sudo apt upgrade user@localhost: ~ sudo apt install redis-server For RedHat-based systems, you can connect a remi repository, and run the following commands: user@localhost: ~ sudo yum install epel-release yum-utils user@localhost: ~ sudo yum install [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>For Debian-based systems, run the following commands:</p>



<p><code>user@localhost: ~ sudo apt update</code></p>



<p><strong>Optional:</strong></p>



<p><code>user@localhost: ~ sudo apt upgrade</code></p>



<p><code>user@localhost: ~ sudo apt install redis-server</code></p>



<p>For RedHat-based systems, you can connect a remi repository, and run the following commands:</p>



<p><code>user@localhost: ~ sudo yum install epel-release yum-utils</code></p>



<p><code>user@localhost: ~ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm</code></p>



<p><code>user@localhost: ~ sudo yum-config-manager --enable remi</code></p>



<p><code>user@localhost: ~ sudo yum install redis</code></p>



<p><code>user@localhost: ~ sudo systemctl start redis</code></p>



<p><code>user@localhost: ~ sudo systemctl enable redis</code></p>



<p><strong>Check</strong></p>



<p>netstat
-plant | grep -i redis</p>



<p>tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1035/redis-server 1</p>



<p>If all goes well, Redis is listening on port 6379.</p>



<h2 id="security-setting" >Security setting</h2>



<p>Run redis-server only on localhost</p>



<p>In
some Linux distributions, redis accepts requests on all interfaces
after installation, which is not allowed for security reasons because
redis access is not password protected by default.</p>



<p>Therefore, check the file /etc/redis/redis.conf contains the following line</p>



<p><code>bind 127.0.0.1</code></p>



<p>If
it is not, enter it there.</p>



<p>Next,
if prescribed, then restart Redis:</p>



<p><code>user@localhost: ~ sudo systemctl restart redis-server</code></p>



<p>&#8211; Put a password to access redis-server:</p>



<p>by
default, anyone can connect to redis without a password, for example:</p>



<p><code>redis-cli info | grep redis_versio</code></p>



<p>Therefore,
create a password of 32 characters:</p>



<p><code>user@localhost: ~ openssl rand -base64 32</code></p>



<p>get in the console something type <strong><code>Iouwokmsduhxvqj9fvz1tex9+VX0B1OG9r7sjAeuJY=</code></strong></p>



<p>And in /etc/redis/redis.conf write on:</p>



<p><strong><code>requirepass Iouwokmsduhxvqj9fvz1tex9+VX0B1OG9r7sjAeuJY=</code></strong></p>



<p>Next, if prescribed, then restart Redis:</p>



<p><code><strong>user@localhost: ~ sudo systemctl restart redis-server</strong></code></p>



<p>Now when you try to do:</p>



<p><code>user@localhost: ~ redis-cli info | grep redis_version</code></p>



<p>if everything is configured correctly, anonymous access is denied and we will not see any information</p>



<h2 id="connect-need-now-so" >Connect need now so</h2>



<p><code>redis-cli</code></p>



<p><code>127.0.0.1:6379&gt; info</code></p>



<p><code>NOAUTH Authentication required.</code></p>



<p><code>127.0.0.1:6379&gt; AUTH IoUwOKmsDuHXvqj9FVVz1TEx9+VX0B1OG9r7sjAeuJY=</code></p>



<p><code>OK</code></p>



<p><code>127.0.0.1:6379&gt; info</code></p>



<p><code># Server</code></p>



<p><code>redis_version:2.8.17</code></p>



<p><code>redis_git_sha1:00000000</code></p>



<p><code>redis_git_dirty:0</code></p>



<p><code>redis_build_id:4c1d5710660b9479</code></p>



<p><code>redis_mode:standalone</code></p>



<p><code>os:Linux 3.16.0-4-amd64 x86_64</code></p>



<p><code>....</code></p>



<p><code>127.0.0.1:6379&gt; quit</code></p>



<p>ATTENTION! By running redis-cli and entering commands in it, including AUTH with a password, the history of these commands is saved in the ~/file.rediscli_history. If an attacker gains access to it, they will be able to learn the password.</p>



<p><span style="text-decoration: underline;">Certainly./~ rediscli_history </span>is only available to the current user, such as root, and no one else will read it, but it&#8217;s better to know. The password is also stored in the /etc/redis/redis file.conf and by default this file is read by all users of the server, which is completely wrong and we will fix it further.</p>



<p><strong>&#8211; Rename and disable important commands</strong></p>



<p>Here&#8217;s a dangerous command Redis FLUSHDB, FLUSHALL, KEYS, PEXPIRE, DEL, CONFIG, SHUTDOWN, BGREWRITEAOF, BGSAVE, SAVE, SPOP, SREM, RENAME and DEBUG</p>



<p>To
do this, use the /etc/redis/redis file.conf write on:</p>



<ul><li>rename-command FLUSHDB &#8220;&#8221;</li><li>rename-command FLUSHALL &#8220;&#8221;</li><li>rename-command DEBUG &#8220;&#8221;</li><li>rename-command SHUTDOWN SHUTDOWN_SECRETCMD</li><li>rename-command CONFIG CONFIG_SECRETCMD</li></ul>



<p>Next, if prescribed, then restart Redis:</p>



<p><code>user@localhost: ~ sudo systemctl restart redis-server</code></p>



<p><strong>&#8211; Change the rights to the directory with the database and configuration file</strong></p>



<p>Look
at the default rights to the directory with the database:</p>



<p><code>ls -ld /var/lib/redis</code></p>



<p><code>drwxr-xr-x 2 redis redis 4096 Sep 9 10:14 redis</code></p>



<p>Change</p>



<p><code>chmod 700 /var/lib/redis</code></p>



<p>Look
right in the default configuration file</p>



<p><code>ls -l /etc/redis/redis.conf</code></p>



<p><code>-rw-r--r-- 1 root root 33004 Sep 9 10:15 /etc/redis/redis.conf</code></p>



<p>Change</p>



<p><code>chown redis:root /etc/redis/redis.conf</code></p>



<p><code>chmod 600 /etc/redis/redis.conf</code></p>



<p>Next,
if all done, then restart Redis:</p>



<p><code>user@localhost: ~ sudo systemctl restart redis-server</code></p>



<p>This completes the basic redis setup</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-install-redis/feed/</wfw:commentRss>
			<slash:comments>462</slash:comments>
		
		
			</item>
	</channel>
</rss>
