<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarai.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Redis TLS Configuration in Sugar 25.1.x?</title><link>https://sugarclub.sugarai.com/dev-club/f/questions-answers/8310/redis-tls-configuration-in-sugar-25-1-x</link><description>We currently have the following Redis configuration: 
 
 Can the Redis host be updated to use tls:// (or rediss://) and the port changed to 6380? We are looking for the exact steps required to enable and validate TLS for this configuration. The environment</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Redis TLS Configuration in Sugar 25.1.x?</title><link>https://sugarclub.sugarai.com/thread/33681?ContentTypeID=1</link><pubDate>Mon, 02 Feb 2026 16:57:06 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:fb2c6e03-b4a5-48f4-a826-18ba011eedae</guid><dc:creator>Rafael Fernandes</dc:creator><description>&lt;p&gt;hi &lt;a href="/members/szykulat"&gt;Tomasz Szykuła&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;Sugar does not offer &lt;code&gt;password&lt;/code&gt; as config for override, however we do use &lt;a href="https://symfony.com/doc/current/components/cache/adapters/redis_adapter.html"&gt;RedisTrait from symphony&lt;/a&gt; which I believe you can workaround it in passing in the URL, like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;use Symfony\Component\Cache\Adapter\RedisAdapter;

// host &amp;quot;my.server.com&amp;quot; and port &amp;quot;6379&amp;quot;
RedisAdapter::createConnection(&amp;#39;redis://my.server.com:6379&amp;#39;);

// host &amp;quot;my.server.com&amp;quot; and port &amp;quot;6379&amp;quot; and database index &amp;quot;20&amp;quot;
RedisAdapter::createConnection(&amp;#39;redis://my.server.com:6379/20&amp;#39;);

// host &amp;quot;localhost&amp;quot;, auth &amp;quot;abcdef&amp;quot; and timeout 5 seconds
RedisAdapter::createConnection(&amp;#39;redis://abcdef@localhost?timeout=5&amp;#39;);

// socket &amp;quot;/var/run/redis.sock&amp;quot; and auth &amp;quot;bad-pass&amp;quot;
RedisAdapter::createConnection(&amp;#39;redis://bad-pass@/var/run/redis.sock&amp;#39;);

// host &amp;quot;redis1&amp;quot; (docker container) with alternate DSN syntax and selecting database index &amp;quot;3&amp;quot;
RedisAdapter::createConnection(&amp;#39;redis:?host[redis1:6379]&amp;amp;dbindex=3&amp;#39;);

// providing credentials with alternate DSN syntax
RedisAdapter::createConnection(&amp;#39;redis:default:verysecurepassword@?host[redis1:6379]&amp;amp;dbindex=3&amp;#39;);

// a single DSN can also define multiple servers
RedisAdapter::createConnection(
    &amp;#39;redis:?host[localhost]&amp;amp;host[localhost:6379]&amp;amp;host[/var/run/redis.sock:]&amp;amp;auth=my-password&amp;amp;redis_cluster=1&amp;#39;
);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Give it a try and let us know the results..&lt;/p&gt;
&lt;p&gt;rafa&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Redis TLS Configuration in Sugar 25.1.x?</title><link>https://sugarclub.sugarai.com/thread/33679?ContentTypeID=1</link><pubDate>Mon, 02 Feb 2026 13:47:44 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:241f64db-4154-416d-9e1f-165a82a09002</guid><dc:creator>Tomasz Szykuła</dc:creator><description>&lt;p&gt;Rafael i see that your code is not using password and Jeff&amp;#39;s config has &amp;#39;password&amp;#39; key in configuration. Does Sugar out of box support authentication to Redis used as backend cache ? I don see it in SugarCRM code but I would like to get confirmation? If i&amp;#39;m wrong please point me to file and line of code in SugarCRM codebase.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Redis TLS Configuration in Sugar 25.1.x?</title><link>https://sugarclub.sugarai.com/thread/33618?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2026 16:44:20 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d2fc387f-75d8-4d57-8321-88b84fbdbb5c</guid><dc:creator>Rafael Fernandes</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/jeffbickart21808"&gt;Jeff Bickart&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;TLS is not supported out of the box. That said, there are a few alternative options available. Although we haven&amp;rsquo;t tested them ourselves, the guidance below should be helpful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Alternative&amp;nbsp;1: Override Redis Service via after_entry_point Logic Hook&lt;/strong&gt;&lt;br /&gt;Approach: Use the after_entry_point application hook to override the Redis::class service definition in the container before cache is used.&lt;br /&gt;Files to create:&lt;/p&gt;
&lt;div class="c-message_kit__blocks c-message_kit__blocks--rich_text"&gt;
&lt;div class="c-message__message_blocks c-message__message_blocks--rich_text" data-qa="message-text"&gt;
&lt;div class="p-block_kit_renderer" data-qa="block-kit-renderer"&gt;
&lt;div class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first"&gt;
&lt;div class="p-rich_text_block" dir="auto"&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;custom/Extension/application/Ext/LogicHooks/RedisTlsHook.php&lt;/code&gt;&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;custom/include/RedisTlsOverride.php&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;pre class="ui-code" data-mode="php"&gt;// custom/Extension/application/Ext/LogicHooks/RedisTlsHook.php
&amp;lt;?php
$hook_array[&amp;#39;after_entry_point&amp;#39;][] = [
    0, // Priority - run first
    &amp;#39;Redis TLS Override&amp;#39;,
    &amp;#39;custom/include/RedisTlsOverride.php&amp;#39;,
    &amp;#39;RedisTlsOverride&amp;#39;,
    &amp;#39;overrideRedisService&amp;#39;,
];

// custom/include/RedisTlsOverride.php
&amp;lt;?php

use Sugarcrm\Sugarcrm\DependencyInjection\Container;
use Sugarcrm\Sugarcrm\Cache\Exception as SugarCacheException;
use Psr\Container\ContainerInterface;

class RedisTlsOverride
{
    public function overrideRedisService()
    {
        $container = Container::getInstance();

        // Override the Redis service with TLS support
        $container-&amp;gt;set(\Redis::class, function (ContainerInterface $container): \Redis {
            if (!extension_loaded(&amp;#39;redis&amp;#39;)) {
                throw new SugarCacheException(&amp;#39;Redis extension is not loaded&amp;#39;);
            }

            $client = new \Redis();
            $config = $container-&amp;gt;get(\SugarConfig::class)-&amp;gt;get(&amp;#39;external_cache.redis&amp;#39;);
            $persistentId = $container-&amp;gt;get(\SugarConfig::class)-&amp;gt;get(&amp;#39;unique_key&amp;#39;);

            $host = $config[&amp;#39;host&amp;#39;] ?? &amp;#39;127.0.0.1&amp;#39;;
            $port = $config[&amp;#39;port&amp;#39;] ?? 6379;
            $timeout = $config[&amp;#39;timeout&amp;#39;] ?? 0;
            $persistent = $config[&amp;#39;persistent&amp;#39;] ?? false;
            $retryInterval = $config[&amp;#39;retry_interval&amp;#39;] ?? 0;
            $readTimeout = $config[&amp;#39;read_timeout&amp;#39;] ?? 0;

            // Build context array for TLS/SSL stream options
            $context = [];
            if (isset($config[&amp;#39;stream&amp;#39;])) {
                $context[&amp;#39;stream&amp;#39;] = $config[&amp;#39;stream&amp;#39;];
            }

            try {
                if ($persistent) {
                    $client-&amp;gt;pconnect(
                        $host,
                        $port,
                        $timeout,
                        $persistentId ?? &amp;#39;&amp;#39;,
                        $retryInterval,
                        $readTimeout,
                        $context
                    );
                } else {
                    $client-&amp;gt;connect(
                        $host,
                        $port,
                        $timeout,
                        &amp;#39;&amp;#39;,
                        $retryInterval,
                        $readTimeout,
                        $context
                    );
                }
            } catch (\RedisException $e) {
                throw new SugarCacheException($e-&amp;gt;getMessage(), 0, $e);
            }

            return $client;
        });
    }
}&lt;/pre&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Config in&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;config_override.php&lt;/code&gt;:&lt;/div&gt;
&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;pre class="ui-code" data-mode="php"&gt;$sugar_config[&amp;#39;external_cache&amp;#39;][&amp;#39;redis&amp;#39;] = [
    &amp;#39;host&amp;#39; =&amp;gt; &amp;#39;tls://redis.example.com&amp;#39;,
    &amp;#39;port&amp;#39; =&amp;gt; 6380,
    &amp;#39;timeout&amp;#39; =&amp;gt; 2.5,
    &amp;#39;stream&amp;#39; =&amp;gt; [
        &amp;#39;verify_peer&amp;#39; =&amp;gt; true,
        &amp;#39;verify_peer_name&amp;#39; =&amp;gt; true,
        &amp;#39;cafile&amp;#39; =&amp;gt; &amp;#39;/path/to/ca-bundle.crt&amp;#39;,
    ],
];&lt;/pre&gt;&lt;/div&gt;
&lt;div class="p-rich_text_block--no-overflow"&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Uses standard SugarCRM extension framework&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;No core file modifications&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Survives upgrades&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;after_entry_point runs after some initialization - cache may already be accessed&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Container service may already be instantiated&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Alternative&amp;nbsp;2: Custom Container Configuration File&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Approach&lt;/strong&gt;: Create a custom container configuration file that loads after the core container and overrides the Redis service.&lt;br /&gt;Files to create:&lt;/div&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;custom/etc/container.php&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(custom container definitions)&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;custom/include/SugarContainerLoader.php&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(loader class)&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;custom/Extension/application/Ext/LogicHooks/ContainerLoader.php&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Implementation&lt;/strong&gt;:&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;pre class="ui-code" data-mode="php"&gt;// custom/etc/container.php
&amp;lt;?php

use Sugarcrm\Sugarcrm\Cache\Exception as SugarCacheException;
use Psr\Container\ContainerInterface;

return [
    \Redis::class =&amp;gt; function (ContainerInterface $container): \Redis {
        if (!extension_loaded(&amp;#39;redis&amp;#39;)) {
            throw new SugarCacheException(&amp;#39;Redis extension is not loaded&amp;#39;);
        }

        $client = new \Redis();
        $config = $container-&amp;gt;get(\SugarConfig::class)-&amp;gt;get(&amp;#39;external_cache.redis&amp;#39;);
        $persistentId = $container-&amp;gt;get(\SugarConfig::class)-&amp;gt;get(&amp;#39;unique_key&amp;#39;);

        $host = $config[&amp;#39;host&amp;#39;] ?? &amp;#39;127.0.0.1&amp;#39;;
        $port = $config[&amp;#39;port&amp;#39;] ?? 6379;
        $timeout = $config[&amp;#39;timeout&amp;#39;] ?? 0;
        $persistent = $config[&amp;#39;persistent&amp;#39;] ?? false;
        $retryInterval = $config[&amp;#39;retry_interval&amp;#39;] ?? 0;
        $readTimeout = $config[&amp;#39;read_timeout&amp;#39;] ?? 0;

        // Build context for TLS
        $context = [];
        if (isset($config[&amp;#39;stream&amp;#39;])) {
            $context[&amp;#39;stream&amp;#39;] = $config[&amp;#39;stream&amp;#39;];
        }

        try {
            if ($persistent) {
                $client-&amp;gt;pconnect(
                    $host, $port, $timeout,
                    $persistentId ?? &amp;#39;&amp;#39;, $retryInterval, $readTimeout, $context
                );
            } else {
                $client-&amp;gt;connect(
                    $host, $port, $timeout,
                    &amp;#39;&amp;#39;, $retryInterval, $readTimeout, $context
                );
            }
        } catch (\RedisException $e) {
            throw new SugarCacheException($e-&amp;gt;getMessage(), 0, $e);
        }

        return $client;
    },
];
// custom/include/SugarContainerLoader.php
&amp;lt;?php

class SugarContainerLoader
{
    public function loadCustomContainer()
    {
        $customContainerPath = &amp;#39;custom/etc/container.php&amp;#39;;
        if (file_exists($customContainerPath)) {
            $container = \Sugarcrm\Sugarcrm\DependencyInjection\Container::getInstance();
            $container-&amp;gt;configureFromFile($customContainerPath);
        }
    }
}
// custom/Extension/application/Ext/LogicHooks/ContainerLoader.php
&amp;lt;?php
$hook_array[&amp;#39;after_entry_point&amp;#39;][] = [
    0,
    &amp;#39;Load Custom Container&amp;#39;,
    &amp;#39;custom/include/SugarContainerLoader.php&amp;#39;,
    &amp;#39;SugarContainerLoader&amp;#39;,
    &amp;#39;loadCustomContainer&amp;#39;,
];&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="p-rich_text_block--no-overflow"&gt;&lt;/div&gt;
&lt;div class="p-rich_text_block--no-overflow"&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Clean separation of custom container definitions&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Uses UltraLite Container&amp;#39;s built-in configureFromFile() method&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Easy to manage multiple service overrides&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p-rich_text_section"&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class="p-rich_text_list p-rich_text_list__bullet p-rich_text_list--nested" data-stringify-type="unordered-list" data-list-tree="true" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Still uses after_entry_point hook (timing issue)&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Custom container file needs maintenance across upgrades&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>