Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certificate subject doesn't match with ipv6 address #3465

Closed
juhaszviktor opened this issue Oct 26, 2020 · 2 comments · Fixed by #3466
Closed

Certificate subject doesn't match with ipv6 address #3465

juhaszviktor opened this issue Oct 26, 2020 · 2 comments · Fixed by #3466
Labels

Comments

@juhaszviktor
Copy link
Collaborator

syslog-ng

Version of syslog-ng

3.20.1

Platform

Linux

Steps to reproduce

on client side configure syslog-ng using TLS and IPv6 destination.
on server side configure a syslog-ng using TLS and IPv6 source.

the servers' certificate contains the ipv6 address in the "X509v3 Subject Alternative Name"
like:
X509v3 Subject Alternative Name:
IP Address:9994:0:0:0:0:0:0:2, IP Address:10.138.44.71

Preanalysis

During the mutual cert validation, the client reads the alternates of the server's certificate.
In the function tls_verify_certificate_name the type of the alternate name will be GEN_IPADD.
In that case the address is handled as an IPv4 address, seemingly the code doesn't care about IPv6 addresses.

I think the problematic code is in lib/tlscontext.c:

else if (gen_name->type == GEN_IPADD)
                {
                  char *dotted_ip = inet_ntoa(*(struct in_addr *) gen_name->d.iPAddress->data);

                  g_strlcpy(pattern_buf, dotted_ip, sizeof(pattern_buf));
                  found = TRUE;
                  result = strcasecmp(host_name, pattern_buf) == 0;
                }
@lbudai
Copy link
Collaborator

lbudai commented Oct 26, 2020

Hi @juhaszviktor !

could you check PR #3466 ?

@lbudai lbudai added this to the syslog-ng-3.30 milestone Oct 26, 2020
lbudai added a commit to lbudai/syslog-ng that referenced this issue Oct 26, 2020
Fixes: syslog-ng#3465

Signed-off-by: Laszlo Budai <laszlo.budai@outlook.com>
@juhaszviktor
Copy link
Collaborator Author

Hi @lbudai,

It works fine!
Thanks for the quick response :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants