-
Notifications
You must be signed in to change notification settings - Fork 2
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
PVA over TLS #2
PVA over TLS #2
Conversation
Testing recipes: Run
and then one of:
|
An item on the TODO list From what I can tell, Java and OpenSSL have somewhat different interpretations of the PKCS#12 spec. One difference between the two being that Java Another (potential) difference is in how the end point certificate is distinguished from intermediate/root CAs. This may cause complications with a .p12 files containing only a root CA. A keychain file with only a root CA seems a desirably as a common client configuration. Also, I am not sure what to do about the possibility of multiple root CAs... edit: not as different as I initially though. see |
Updated with changes to:
|
As for interoperability of the PKCS12 files, the Here's an example of creating a similar 'ioc' and 'ca' using keytool.
It starts out as a "self-signed certificate" with matching owner and issuer.
Import the signed certificate into the ioc keystore. Since
A client will trust any IOC certificate signed by 'myca' once it's aware of the 'myca' certificate,
So now an IOC can use |
The tcp vs tls behavior is a little sticky on the server side.
..So once the server replied with "tls", it keeps doing that, no matter what the seach supports... |
For a test, I changed the |
These should be resolved. fyi. the second actually caused |
So keytool forces a password. What is a non-interactive daemon supposed to do other than store that password right alongside the pkcs12 file? Ah, the joys of CYA security! I am tempted to invent some syntax like |
A keytool generated file can be reprocessed with openssl w/o a password. This losses the attributes which openssl doesn't understand. friendlyName (aka
|
That's reasonable. We do need a password, even |
You indeed fixed the sticky tls behavior and the "null parameter, SSL_CCTX_use_certificate". I can now read from softIocPVA with both pvxget and java client, |
Updated to add syntax for TLS in name servers. |
The new A minor quirk is that |
Another update. I am confident enough now in my understand of PKCS#12 file interoperability that I have removed I have also added an "authority" member to Certificate expiration date is now printed from I have also made failure to read/parse/setup TLS keychain a non-fatal error. I could be persuaded to change this for the CLI tool, but I think it better that IOCs continue to start since this error can be corrected at runtime (with
Should be fixed. |
I am also thinking about if/how to configure a "client cert. required" mode, which would make an public facing PVA gateway a less than totally insane proposition. |
Good question. On one hand, an option to require a client certificate sounds the proper thing to do. |
Is system account name actually actual? Group accounts are still to be found at *NLs... Or whatever string a client is made to send. With this PR, identity as viewed by pvxs would be a triple: method, authority, and account. eg. I see authorization as (mostly) out of scope for this PR. The in-scope parts are the question of backwards compatibility in how credentials are presented, where existing clients could see these two "mdavidsaver" as identical. Also how to decide to use "ca" vs. "x509". I am not sure what, if anything, to do about these. Also, it occurs to me that we could support allowing a peer to provide more than one identity. eg. both "ca" and "x509". I can't think of a reason not to do this, but am also not sure if it is worth the effort. Since it would mean a more involved API change, my default position is "no". |
I also hesitate to have too many configuration options. eg. I don't want to end up with dozens of |
It's now different. What I expected for EPICS_PVA_NAME_SERVERS:
Those are still fine. But these..
now result in From the plain TCP 5075 search I will get a "tls" reply so the data is then via TLS, but I can no longer start with TLS for the search. |
Agree that how to handle authorization is beyond this. Within this is supporting "ca" and "x509", and some way to select that on the client side (no certificate vs. client certificate with name) --> Done! On the server side, not sure we need a "client cert required" option. That could be handled in the authorization, implemented later, based on the available information. "anonymous": No access --> Server side is also done since we know if we get anon, ca or x509? |
Sorry, this was a late change. I guess I put it in the wrong place. This error in meant to prevent URIs in contexts with a UDP port. |
My motivation to think about a special switch is twofold. One technical, and one usability. "client cert required" exists as a TLS protocol option ( Also, I think of this flag as analogous to the global read-only flags in the CA and PVA gateways. Entirely redundant to a more fully featured ACL mechanism, but simpler to understand. Hopefully also harder to misconfigure. |
You're correct that requiring the client cert offers a fail-early option. Yes, like the global read-only. |
This should be resolved. Setting At some point I should remove this duplicate parsing... |
..NAME_SERVERS now indeed handles "pvas://.." and that changes the default TCP port from 5075 to 5076, all good. |
rename generated CONFIG_SITE to TOOLCHAIN
Development moved to main repository with epics-base/pvxs#53 . |
Preliminary work on applying OpenSSL to PVXS.
Client search requests include two "protocol" names:
tcp
andtls
. Server listens on a second TCP port for TLS connections, prefers to respond withtls
when both present.Adds
x509
AUTHZ method. Client advertisesx509
when configured with a client cert. Server prefersx509
toca
. If selected, uses client certcommonName
as account name. eg.CN=foo
appears to ACF logic asfoo
. (note, this really needs an extension to the ACF logic to account for different source of accounts)TLS features/restrictions
pva/1
. (mandatory?)New Configuration:
$EPICS_PVAS_TLS_KEYCHAIN
$EPICS_PVA_TLS_KEYCHAIN
name of a PKCS12 file containing some combination of key, server/client certificate, and/or CA certificates. The file path may optionally be followed by;
and a password. eg.EPICS_PVAS_TLS_KEYCHAIN=/path/to/some.p12;secret
.$EPICS_PVAS_TLS_PORT
$EPICS_PVA_TLS_PORT
default port to listen for TLS connections$OPENSSL_CONF
Location of OpenSSL config file. Defaults to/usr/lib/ssl/openssl.cnf
on Linux. Application namepvxs
is used.$SSLKEYLOGFILE
If set, TLS session keys will be written here. eg. for use by wireshark. cf. Decode PVA in TLS via ALPN cashark#14Building:
libevent
must be built with optional openssl support (bundled build will detect).openssl
is expected to be installed in the default search path. I have no plans to bundled openssl.Currently, python3-pyopenssl is also required. This is planned to be temporary during development.
TODO:
$EPICS_PVA_NAME_SERVERS
w/ URI-ishpvas://1.2.3.4:5678
.keytool
(OpenSSL parser for PKCS12 is... limited)openssl pkcs12
orkeytool
. (although Java can't current work with openssl created files)x509
AUTHZ method designauthority
alongsidemethod
andaccount
@george-mcintyre @kasemir @gregoryraymondwhite fyi. Something to discuss. May be ready for early testing. Definitely not ready for wider testing (no documentation, config. inputs may change).