|
| 1 | +--- |
| 2 | +title: Remove use of TLS 1.0 and 1.1 with Azure Cache for Redis | Microsoft Docs |
| 3 | +description: Learn how to remove TLS 1.0 and 1.1 from your application when communicating with Azure Cache for Redis |
| 4 | +services: cache |
| 5 | +documentationcenter: '' |
| 6 | +author: yegu-ms |
| 7 | +manager: maiye |
| 8 | +editor: '' |
| 9 | + |
| 10 | +ms.assetid: |
| 11 | +ms.service: cache |
| 12 | +ms.workload: tbd |
| 13 | +ms.tgt_pltfrm: cache |
| 14 | +ms.devlang: na |
| 15 | +ms.topic: article |
| 16 | +ms.date: 10/22/2019 |
| 17 | +ms.author: yegu |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +# Remove use of TLS 1.0 and 1.1 with Azure Cache for Redis |
| 22 | + |
| 23 | +There is an industry-wide push towards using TLS 1.2 or higher exclusively. TLS Versions 1.0 and 1.1 are known to be susceptible to attacks such as BEAST and POODLE and have other Common Vulnerabilities and Exposures (CVE) weaknesses. They also do not support the modern encryption methods and cipher suites recommended by PCI compliance standards. This [TLS security blog](https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/) explains some of these vulnerabilities in more details. |
| 24 | + |
| 25 | +While none of these pose immediate problems, you should consider moving away from using TLS 1.0 and 1.1 as early as possible. Azure Cache for Redis will stop supporting these TLS versions starting on March 31, 2020. Your application will be required to use at least TLS 1.2 in order to communicate with your cache after this date. |
| 26 | + |
| 27 | +This article provides general guidance on how to detect and remove these dependencies from your application. |
| 28 | + |
| 29 | +## Check if your application is already compliant |
| 30 | + |
| 31 | +The easiest way to figure out if your application will work with TLS 1.2 is to set the Minimum TLS version on a test or staging cache it uses to TLS 1.2. You can find the Minimum TLS version setting in the [Advanced settings](cache-configure.md#advanced-settings) of your cache instance in the Azure portal. If the application continues to function as expected after this change, it is most likely to be compliant. Some Redis client libraries used by our application may need to be specifically configured to enable TLS 1.2 in order to connect to Azure Cache for Redis over that security protocol. |
| 32 | + |
| 33 | +## Configure your application to use TLS 1.2 |
| 34 | + |
| 35 | +Most applications utilize Redis client libraries to handle communication with their caches. Below are instructions on how to configure some of the popular client libraries in various programming languages and frameworks to use TLS 1.2. |
| 36 | + |
| 37 | +### .NET Framework |
| 38 | + |
| 39 | +Redis .NET clients use the lowest TLS version by default on .NET Framework 4.5.2 or below and the highest TLS version on 4.6 or above. If you're using an older version of .NET Framework, you can enable TLS 1.2 manually: |
| 40 | + |
| 41 | +* StackExchange.Redis: set `ssl=true` and `sslprotocls=tls12` in the connection string. |
| 42 | +* ServiceStack.Redis: follow [these instructions](https://github.com/ServiceStack/ServiceStack.Redis/pull/247). |
| 43 | + |
| 44 | +### .NET Core |
| 45 | + |
| 46 | +Redis .NET Core clients use the highest TLS version by default. |
| 47 | + |
| 48 | +### Java |
| 49 | + |
| 50 | +Redis Java clients use TLS 1.0 on Java version 6 or below. Jedis, Lettuce and Radisson won't be able to connect to Azure Cache for Redis if TLS 1.0 is disabled on the cache. There is no known workaround currently. |
| 51 | + |
| 52 | +On Java 7 or above, Redis clients don't use TLS 1.2 by default but may be configured for it. Lettuce and Radisson don't support this right now. They will break if the cache only accepts TLS 1.2 connections. Jedis allows you to specify the underlying TLS settings with the following code snippet: |
| 53 | + |
| 54 | +``` Java |
| 55 | +SSLSocketFactory sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); |
| 56 | +SSLParameters sslParameters = new SSLParameters(); |
| 57 | +sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); |
| 58 | +sslParameters.setProtocols(new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"}); |
| 59 | + |
| 60 | +URI uri = URI.create("rediss://host:port"); |
| 61 | +JedisShardInfo shardInfo = new JedisShardInfo(uri, sslSocketFactory, sslParameters, null); |
| 62 | + |
| 63 | +shardInfo.setPassword("cachePassword"); |
| 64 | + |
| 65 | +Jedis jedis = new Jedis(shardInfo); |
| 66 | +``` |
| 67 | + |
| 68 | +### Node.js |
| 69 | + |
| 70 | +Node Redis and IORedis use TLS 1.2 by default. |
| 71 | + |
| 72 | +### PHP |
| 73 | + |
| 74 | +Predis on PHP 7 won't work since the latter only supports TLS 1.0. On PHP 7.2.1 or below, Predis uses TLS 1.0 or 1.1 by default. You can specify TLS 1.2 when instantiating the client: |
| 75 | + |
| 76 | +``` PHP |
| 77 | +$redis=newPredis\Client([ |
| 78 | + 'scheme'=>'tls', |
| 79 | + 'host'=>'host', |
| 80 | + 'port'=>6380, |
| 81 | + 'password'=>'password', |
| 82 | + 'ssl'=>[ |
| 83 | + 'crypto_type'=>STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, |
| 84 | + ], |
| 85 | +]); |
| 86 | +``` |
| 87 | + |
| 88 | +On PHP 7.3 or above, Predis uses the latest TLS version. |
| 89 | + |
| 90 | +PhpRedis doesn't support TLS on any PHP version. |
| 91 | + |
| 92 | +### Python |
| 93 | + |
| 94 | +Redis-py uses TLS 1.2 by default. |
| 95 | + |
| 96 | +### GO |
| 97 | + |
| 98 | +Redigo uses TLS 1.2 by default. |
| 99 | + |
| 100 | +## Additional information |
| 101 | + |
| 102 | +- [How to configure Azure Cache for Redis](cache-configure.md) |
0 commit comments