1

I have added the nuget package Microsoft.AspNet.SignalR.Redis to my project to allow me to scale out my signalR application using the redis cache backplane following instructions at:

http://www.asp.net/signalr/overview/performance/scaleout-with-redis

I have setup a redis cache server on Azure and everything is working perfectly using a non-secure connection to port 6379.

I now want to enable SSL for added security but there doesn't seem to be any support for SSL connections using the nuget plugin:

If I try using the secure port 6380, the nuget package doesn't seem to support SSL connections.

Example:

GlobalHost.DependencyResolver.UseRedis("redis-server.cloudapp.net", 6380,
"Password/Key", "ChatApp")

These is no switch to enable SSL

Here is the full code to connect:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {

        // Configuration for scale out using Redis:
        var redisEnabled = Convert.ToBoolean(WebConfigurationManager.AppSettings["RedisScaleOut_Enable"]);
        if (redisEnabled)
        {
            var redisHost = WebConfigurationManager.AppSettings["RedisScaleOut_Host"];
            var redisPort = Convert.ToInt16(WebConfigurationManager.AppSettings["RedisScaleOut_Port"]);
            var redisPassword = WebConfigurationManager.AppSettings["RedisScaleOut_Password"];
            var redisAppName = WebConfigurationManager.AppSettings["RedisScaleOut_AppName"];

            GlobalHost.DependencyResolver.UseRedis(redisHost, redisPort, redisPassword, redisAppName);
        }

        // Branch the pipeline here for requests that start with "/signalr"
        app.Map("/signalr", map =>
        {
            // Setup the CORS middleware to run before SignalR.
            // By default this will allow all origins. You can 
            // configure the set of origins and/or http verbs by
            // providing a cors options with a different policy.
            map.UseCors(CorsOptions.AllowAll);

            var hubConfiguration = new HubConfiguration
            {
                // You can enable JSONP by uncommenting line below.
                // JSONP requests are insecure but some older browsers (and some
                // versions of IE) require JSONP to work cross domain
                EnableJSONP = true
            };

            // Run the SignalR pipeline. We're not using MapSignalR
            // since this branch already runs under the "/signalr"
            // path.
            map.RunSignalR(hubConfiguration);
        });

    }
}
George Filippakos
  • 16,359
  • 15
  • 81
  • 92

2 Answers2

3

The latest version of SignalR (currently 2.2.1) allows for SSL like so:

var connectionString = "myredis.redis.cache.windows.net:6380,password=myPassword,ssl=True,abortConnect=False";

GlobalHost.DependencyResolver.UseRedis(new RedisScaleoutConfiguration(connectionString, "YourServer"));

Thanks to Michael Parshin for his answer here: https://stackoverflow.com/a/29591328/648738

Community
  • 1
  • 1
Jazaret
  • 3,655
  • 3
  • 17
  • 15
1

SignalR Redis backplane is currently using Booksleeve and from what I can see here they are connecting to Redis using bare sockets. I don't know Redis but I assume the communication is not HTTP based but just TCP so you cannot use SSL directly.

Pawel
  • 31,342
  • 4
  • 73
  • 104
  • **Data encryption support** Redis does not support encryption. In order to implement setups where trusted parties can access a Redis instance over the internet or other untrusted networks, an additional layer of protection should be implemented, such as an SSL proxy. [Redis Security](http://redis.io/topics/security) – felickz Jan 06 '15 at 18:28
  • Both the StackExchange.Redis cache client and the Microsoft.RedisSessionStateProvider support SSL. They must have implemented their own proxies or communicate using https. – George Filippakos Jan 07 '15 at 06:53
  • 1
    SignalR 2.2.0 will use StackExchange.Redis instead of Booksleeve. – Pawel Jan 07 '15 at 15:36
  • And to clarify StackExchange.Redis (as of now 1.0.481) does have support for SSL. – Crypth Aug 29 '15 at 13:07