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

OpenVPN: ca certificate shall include ancestors if not self-singed #1487

Closed
8191 opened this issue Mar 19, 2017 · 26 comments
Closed

OpenVPN: ca certificate shall include ancestors if not self-singed #1487

8191 opened this issue Mar 19, 2017 · 26 comments
Assignees
Labels
bug Production bug
Milestone

Comments

@8191
Copy link
Member

8191 commented Mar 19, 2017

It seems that OpenVPN refuses to verify user certificates if it does not know all its ancestors. I.e. if the CA configured as "Peer Certificate Authority" in the OpenVPN Server UI is not self-signed, OpenVPN refuses to verify user certificates (even if signed directly by the Peer Certificate Authority) with the error VERIFY ERROR: depth=1, error=unable to get issuer certificate: Peer Certificate Authority.

A solution to this would be to add all ancestors of Peer Certificate Authority to the ca file (/var/etc/openvpn/serverx.ca) if the CA is a sub-ca (i.e. not self-signed).

See also: https://forum.opnsense.org/index.php?topic=4830.0

@AdSchellevis
Copy link
Member

timeout due to inactivity

@8191
Copy link
Member Author

8191 commented Jan 2, 2018

Actually still an issue. Did anyone ever try to use OpenVPN with TLS-Auth using a non-self-sigened root CA?

@wschlich
Copy link

wschlich commented Feb 13, 2019

Yes, it's still an issue with 19.1 (see https://forum.opnsense.org/index.php?topic=11601.0).

@wschlich
Copy link

@AdSchellevis can you please reopen the issue?

@AdSchellevis
Copy link
Member

@wschlich are you planning to work on it?

@wschlich
Copy link

@AdSchellevis At least from a user perspective, yes :-)

@AdSchellevis AdSchellevis reopened this Feb 13, 2019
@AdSchellevis
Copy link
Member

Not a lot of people seem to be using this construction, hence the time out last time. I'll reopen this for now, but without people digging into the use case and related code, it's likely this will be closed again.

@wschlich
Copy link

wschlich commented Feb 13, 2019

From what I've seen, @8191 was absolutely right regarding his findings. I've written mine down at https://forum.opnsense.org/index.php?topic=11601.0 -- basically OPNsense does not add the full CA certificate chain to /var/etc/openvpn/serverX.ca when the Peer Certificate Authority is not a self-signed, but an intermediate CA (signed by a Root CA which is managed by OPNsense as well).
I guess there's already code in OPNsense to do a full resolution of a chain of CA certificates? If yes, the fix should be easy.

@wschlich
Copy link

wschlich commented Feb 13, 2019

The bug is in /usr/local/etc/inc/plugins.inc.d/openvpn.inc in lines 895+896 (on 19.1.1):
$ca = lookup_ca($settings['caref']);
openvpn_add_keyfile($ca['crt'], $conf, $mode_id, "ca");
Simply no full CA chain resolution code there.

$ca = lookup_ca($settings['caref']);

@AdSchellevis
Copy link
Member

but that would suggest it doesn't work for self-signed certificates either, let me take a quick peek.

@wschlich
Copy link

@AdSchellevis nope, works fine for self-signed Root CA certificates because the CA chain is completed already by adding just the Root CA certificate.

@AdSchellevis
Copy link
Member

does OPNsense know the path for your intermediate CA?

@wschlich
Copy link

wschlich commented Feb 13, 2019

@AdSchellevis yes, it does, as it consists solely of CA certificates that are managed by the OPNsense CA manager :-)
There's currently simply no code in place to actually try a CA chain resolution. The chosen Peer Certificate Authority is simply copied 1:1 :(

@AdSchellevis
Copy link
Member

ok, one moment.

@AdSchellevis
Copy link
Member

@wschlich can you try 67f4948 ?

From your console, you should be able to install using:

opnsense-patch 67f4948

@AdSchellevis AdSchellevis self-assigned this Feb 13, 2019
@wschlich
Copy link

@wschlich can you try 67f4948 ?

works flawlessly now (removed the workaround before having the openvpn instance config regenerated using the web UI), awesome! thank you :-) 👍

@fichtner fichtner added the bug Production bug label Feb 13, 2019
@fichtner fichtner added this to the 19.7 milestone Feb 13, 2019
@AdSchellevis
Copy link
Member

Thank you!

@fichtner
Copy link
Member

@AdSchellevis for 19.1.2?

@AdSchellevis
Copy link
Member

@fichtner yes please :)

fichtner pushed a commit that referenced this issue Feb 13, 2019
(cherry picked from commit 67f4948)
@wschlich
Copy link

@AdSchellevis , @fichtner you guys rock! 🥇

@wschlich
Copy link

@AdSchellevis My OPNsense firewall reported an issue in /usr/local/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php, line 205 (function accountsActivation). Is it maybe related to your patch? That function is working with 'caref' as well...

@AdSchellevis
Copy link
Member

@wschlich it can't be related, new style mvc code has no relation with the legacy code base.

Can you open a new issue with the the full error?

@wschlich
Copy link

@wschlich it can't be related, new style mvc code has no relation with the legacy code base.

I see :-)

Can you open a new issue with the the full error?

Hmm, I submitted the issue via the web GUI crash reporting function. Did that already open up an issue somewhere?

@AdSchellevis
Copy link
Member

sorry, we don't read those on a very regular bases, better to open a ticket describing steps to reproduce and data here.

@wschlich
Copy link

I see... :/ actually I have no idea how this error occurred. If it happens again, I'll open a github issue then.

@AdSchellevis
Copy link
Member

ok, thanks

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

No branches or pull requests

4 participants