加密 Sidekiq 与 Redis 的连接

Encrypt Sidekiq's connection to Redis

我们目前使用 Azure Redis 缓存设置了 Sidekiq,并希望加密它们之间的连接。经过一些谷歌搜索后,我发现 a recently merged pull request 为 Redis 添加了本机加密,但这尚未发布。我看到有人建议使用 Stunnel,但我想知道这种方法是否有任何替代方法?

如果您使用 rediss:// 方案提供连接 URL,Sidekiq 将使用 redis gem which has SSL/TLS support(第二个 's' 不是拼写错误)。

# https://github.com/redis/redis-rb/blob/1317ecb518c2d0d0263f1cfc49f104cea3ea24b3/lib/redis/cluster/option.rb#L29
class Redis
  class Cluster
    class Option
      DEFAULT_SCHEME = 'redis'
      SECURE_SCHEME = 'rediss'

      # ...

      def secure?
        @node_uris.any? { |uri| uri.scheme == SECURE_SCHEME } || @options[:ssl_params] || false
      end
    end
  end
end

我将其与支持 in-transit encryption. The Azure docs suggest Azure Cache has similar SSL capability 的 AWS ElastiCache 一起使用。