annotate contrib/unicode2nginx/unicode-to-nginx.pl @ 7360:8f25a44d9add

SSL: logging level of "no suitable key share". The "no suitable key share" errors are reported by OpenSSL 1.1.1 when using TLSv1.3 if there are no shared groups (that is, elliptic curves). In particular, it is easy enough to trigger by using only a single curve in ssl_ecdh_curve: ssl_ecdh_curve secp384r1; and using a different curve in the client: openssl s_client -connect 127.0.0.1:443 -curves prime256v1 On the client side it is seen as "sslv3 alert handshake failure", "SSL alert number 40": 0:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:ssl/record/rec_layer_s3.c:1528:SSL alert number 40 It can be also triggered with default ssl_ecdh_curve by using a curve which is not in the default list (X25519, prime256v1, X448, secp521r1, secp384r1): openssl s_client -connect 127.0.0.1:8443 -curves brainpoolP512r1 Given that many clients hardcode prime256v1, these errors might become a common problem with TLSv1.3 if ssl_ecdh_curve is redefined. Previously this resulted in not using ECDH with such clients, but with TLSv1.3 it is no longer possible and will result in a handshake failure. The SSL_R_NO_SHARED_GROUP error is what BoringSSL returns in the same situation. Seen at: https://serverfault.com/questions/932102/nginx-ssl-handshake-error-no-suitable-key-share
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 25 Sep 2018 13:59:53 +0300
parents 8752257e883f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
667
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1 #!/usr/bin/perl -w
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3 # Convert unicode mappings to nginx configuration file format.
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 # You may find useful mappings in various places, including
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 # unicode.org official site:
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 #
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 # http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 # http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 # Needs perl 5.6 or later.
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
6665
8752257e883f Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 667
diff changeset
13 # Written by Maxim Dounin, mdounin@mdounin.ru
667
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 ###############################################################################
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 require 5.006;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 while (<>) {
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20 # Skip comments and empty lines
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 next if /^#/;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 next if /^\s*$/;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 chomp;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26 # Convert mappings
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 if (/^\s*0x(..)\s*0x(....)\s*(#.*)/) {
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 # Mapping <from-code> <unicode-code> "#" <unicode-name>
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30 my $cs_code = $1;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 my $un_code = $2;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
32 my $un_name = $3;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
33
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
34 # Produce UTF-8 sequence from character code;
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35
6665
8752257e883f Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 667
diff changeset
36 my $un_utf8 = join('',
8752257e883f Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 667
diff changeset
37 map { sprintf("%02X", $_) }
8752257e883f Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 667
diff changeset
38 unpack("U0C*", pack("U", hex($un_code)))
8752257e883f Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 667
diff changeset
39 );
667
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41 print " $cs_code $un_utf8 ; $un_name\n";
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 } else {
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
44 warn "Unrecognized line: '$_'";
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45 }
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
46 }
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
47
63a820b0bc6c nginx-0.3.55-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
48 ###############################################################################