Quantcast
Channel: EJBCA - Open Source Enterprise PKI
Viewing all 76 articles
Browse latest View live

The (updated) Definitive EJBCA Upgrade Guide

$
0
0
With the release of EJBCA 7.0 and subsequent drop of support for JDK7/JEE6, we've updated the upgrade guide that we published back in 2017 to reflect these changes. With no further ado, here it goes:

tl;dr:

The official steps for upgrading any EJBCA installation are:

If running EJBCA < 4.0.16 on JDK6 or earlier:
  1. Upgrade to EJBCA 4.0.16
  2. Run ant upgrade from the console
  3. Run ant post-upgrade from the console
  4. Continue below
If running EJBCA >= 4.0.16 but < 5.0.12 on JDK6 or earlier:
  1. Upgrade to EJBCA 6.3.2.6
  2. Run ant upgrade from the console
  3. Run ant post-upgrade from the console
  4. Upgrade to JDK8 
  5. Upgrade application server to a JEE7 supporting application server
  6. Deploy the latest version of EJBCA 
  7. Run ant upgrade from the console
  8. Run post-upgrade from the UI
    If running EJBCA >= 5.0.12 but < 6.4.0:
        1. Upgrade to JDK8 
        2. Upgrade application server to a JEE7 supporting application server 
        3. Upgrade to latest version of EJBCA 
        4. Run ant upgrade from the console
        5. Run post-upgrade from the UI
        If running EJBCA >= 6.4.0:
        1. Upgrade to latest version of EJBCA 
        2. Run post-upgrade from the UI

        Example:

        A typical upgrade path:

        1. EJBCA 4.0.16 (on JDK6, JBoss 5.1.0.GA) 
        2. EJBCA 6.3.2.6 (on JDK6, JBoss 5.1.0.GA) 
        3. EJBCA 6.3.2.6 (on JDK8, WildFly 12) 
        4. EJBCA 7.x

              Concepts

              The background to writing this guide both stems from the understandable confusion in regards to upgrading EJBCA and many of our users experiencing problems when upgrading decade old installations. Thus there are some concepts we'd like to go through and explain:

              The Intermediate Release: EJBCA 6.3.2.6

              During EJBCA 6.8.0 we refactored the roles and access rules massively, which lead to an upgrade break when upgrading from versions of EJBCA prior to 5.0 (though upgrading via EJBCA 5.0 was still possible). As we realized that solving this issue while preserving 100% uptime requirements (see below) was impossible, as well as due to the technology jump (see the next section) and bugs that we discovered while testing upgrading from ancient installations, we created EJBCA 6.3.2.6 in order to handle all the intermediate steps. As of today EJBCA 6.3.2.6 is published and available in the Community Edition on SourceForge, and in the download area for customers.  

              Technology Jump - JDK6 → JDK7

              When: EJBCA 6.4.0

              All good things must come to an end, as must support for legacy runtime versions. As much as we value not having to put our customers through unnecessary hoops by forcing them to upgrade underlying technology such as the JDK, at some point we have to drop support due for several reasons: being held back by not being able to use modern developments, because other dependent systems like Application Servers drop support as well and because the JDKs themselves come to the end of their service lives and will no longer receive support from the vendor. 

              Technology Jump - JEE5 → JEE6

              When: EJBCA 6.4.0

              In EJBCA 6.4.0 we decided to move on to JDK7, which means that it can no longer be deployed to application servers based on JDK6 such as JBoss versions 4 and 5. The latest version that can still run under JDK6 is EJBCA 6.3.2.6. For an upgrade path this means that you can continue running on your old JBoss 5.1.0.GA server (JEE5) up to, and including, the EJBCA 6.3.2.6 intermediate release. At this stage you must upgrade JDK and the application server to JDK8 and JBoss EAP 7 or WildFly 10.

              Technology Jump - JDK7 → JDK8

              When: EJBCA 7.0.0

              With the planned drop of official support from JDK7 from Oracle during 2019, we've decided to drop JDK7 support. Internally this allows us to upgrade now aging libraries which have long since ceased receiving security updates.

              Technology Jump - JEE6 → JEE7

              When: EJBCA 7.0.0

              The loss of JEE7 support means that we've taken the chance to upgrade persistence definition files and library schemas to JEE7 standards. This means that EJBCA will no longer render on JEE6 application servers, meaning that minimal supported AS's are JBoss EAP7/Wildfly 10. 

              100% Uptime during Upgrade

              When: EJBCA 4.0

              While this may be familiar to many of you, EJBCA has ever since version 4.0 supported full uptime during upgrades for clustered installations. What this means is that we pledge that a clustered installation can continue to sign certificates, issue CRLs and answer OCSP queries during the upgrade process with no noticeable downtime for the end user. 

              This is why the upgrade process you may be familiar with is split up into two steps: upgrade and post-upgrade. In short, upgrade performs whatever steps may be required for the first node to be upgraded to be able to function once it comes online again, while post-upgrade performs whatever steps that remain (such as clean up) that can only be performed once all nodes are running the latest code. 

              Automatic Upgrade

              When: EJBCA 6.4.0

              Stunningly, prior to EJBCA 6.4.0 we hadn't actually thought of tracking the database version internally, thus requiring our user to manually enter this value. From EJBCA 6.4.0 and later we do in fact track this, doing away with the need to run the upgrade command entirely. Instead, it'll be automatically run from the first node running the upgraded code. 

              post-upgrade from Console

              When: EJBCA 6.8.0


              In a similar vein, as more and more of our customers run EJBCA on the PrimeKey Appliance and thus don't have access to the command line. As of EJBCA 6.8.0 it's been possible to perform post-upgrades from the UI. When a post-upgrade is required, the System Upgrade option will appear in the menu:
              Choosing it will bring you to a screen used to perform the post-upgrade action:

              Conclusion

              With this blog post and our latest round of QA, we hope that we've solved all existing upgrade issues, and that we can make running the latest version of EJBCA as easy and manageable as possible.

              Cheers!
              Tomas Gustavsson
              CTO

              Mike Agrenius Kushner
              Product Owner EJBCA

              eIDAS and PSD2, what's new for PKI and what can you do?

              $
              0
              0

              What does PSD2 have to do with eIDAS?

              With the introduction of the Revised Payment Service Directive (PSD2) in EU there are many changes for Payment Service Providers, but there are also some changes for eIDAS (Trust Service Providers (TSPs). Payment service Providers (PSPs) will be required to use Qualified Certificates for electronic seals and website authentication. Specifically for PSPs there are new fields in the QC statement in certificates issued to for this purpose. With PSD2 the QC statement is an interesting mix of issuer specific field (static) and subject specific fields (dynamic). For general eIDAS QC statement information see our earlier blog post.

              PSD2 Specific Certificate Fields

              The PSD2 specific fields are specified in the recently released ETSI Technical Specification ETSI TS 119 495 in section 4.

              Lets look at the new fields and what they mean. There are four required fields in TS 119 495:
              • Authorization number
              • Roles of PSP
              • NCAName
              • NCAId
              The authorization number is a registration number of the payment service provider. This number must be included in the Subject DN of the certificate, in the organizationIdentifier DN attribute. This is a dynamic field, different for each certificate issued to different PSPs, but the same for multiple certificates issued to the same PSP. OrganizationIdentifier is supported in EJBCA Enterprise PKI from version 6.5.2. The other three elements are part of the QC statement.

              PSD2 Qualified Certificate Statement

              The PSD2 specific fields in the qualified certificate statement are specified in ETSI Technical Specification ETSI TS 119 495 in section 5.

              Every PSD2 Third Party Payment Service Provider can have one or more of four different roles (described in section 4.2 of TS 119 495). This means this must be a dynamic field to be set by the TSP when issuing the certificate to the PSP. The four roles are account servicing (PSP_AS), payment initiation (PSP_PI), account information (PSP_AI) and issuing of card-based payment instruments (PSP_IC).

              The NCAName and NCAId is the name and ID of the National Competent Authority (NCA). This is for example BaFin in Germany. These are specific to the country where the PSP is registered. Since TSPs can issue certificates within any country in EU, this also means that the NCAName and NCAId fields must be dynamic fields to be set by the TSP when issuing the certificate to the PSP.

              PSD2 QC Statements is supported out of the box in EJBCA Enterprise PKI from version 7.0.0. In earlier versions they can be created with custom extensions in order to produce test certificates.

              Creating PSD2 Certificates with EJBCA

              To issue PDS2 certificates with EJBCA Enterprise (7.0.0 and later):
              • Check the ETSI PSD2 QC Statement checkbox in the Certificate Profile
              • Include the PSD2 specific fields when issuing the certificate

              ./ejbcaClientToolBox.sh EjbcaWsRaCli edituser psd2 foo123 true "CN=PSD2 eSeal Certificate,organizationIdentifier=12345678-9876,O=PrimeKey,C=SE" NULL NULL ManagementCA 1 PEM NEW User Client NULL  NULL NULL "QCETSIPSD2ROLESOFPSP=0.4.0.19495.1.1;PSP_AS""QCETSIPSD2NCANAME=PrimeKey Solutions AB, Solna Access, Plan A8, Sundbybergsvägen 1, SE-17173 Solna""QCETSIPSD2NCAID=SE-PK"
              You can also set PSD2 specific fields in the web UI (EJBCA 7.0.1 and later), by specifying those to be used in the End Entity Profile:
              After that you will be able to enter PSD2 fields in the Admin UI and the RA UI:



              PSD2 Certificate Timeline

              Payment services must provide account information and payment services with adequate documentation of the technical interface and a corresponding test environment that works with PSD2 certificates from March 14th 2019. From September 14 2019, all service providers must be PSD2-compliant.

              EJBCA Enterprise

              We strive to support all relevant open PKI standards and it is important to keep EJBCA Enterprise up to date with new and emerging standards. Since EJBCA 6.5.2 eIDAS compliance should be easily achieved on the level of PKI, and the new PSD2 specific QC statement is fully supported in EJBCA 7.0.1.

              Cheers,
              Tomas Gustavsson
              CTO 

               EJBCA Enterprise PKI and PKI Appliance developed by PrimeKey.

              EJBCA is a registered trademark of PrimeKey Solutions AB in the EU, the United States, Japan and certain other countries.

              EJBCA 7.0.1 - PSD2 and SN Entropy

              $
              0
              0
              Hot on the heels of EJBCA 7.0, we'd like to present the release of EJBCA 7.0.1 - implementing a ton of neat functionality that didn't make the cut for the main release. On top of the list of most commonly requested features is PSD2 support, but please read on to find all the reasons to upgrade to EJBCA 7.0.1!

              Full PSD2 Support

              EJBCA 7.0.1 provides full support for the Payment Services Directive as defined by EU Directive 2015/2366. PSD2 allows eIDAS Trusted Certificate Providers to issue PSD2 QWAC certificates to third party FinTech companies, which in turn gives them access to financial APIs hosted by European banks. To enable PSD2 in your instance of EJBCA, scroll down to the QC Statements extension of your certificate profile and enable the PSD2 option. 
               This will enable PSD2 fields in the RA UI during enrollment.
              If you'd like to read more about PSD2, we've written blog post about it on PrimeKey's blog and right here on our own development blog.  

              Domain Blacklist Validator

              As a request from some of our CABF-customers, we've implemented a Domain Blacklist Validator. The new Validator takes a list of partial and complete domain names, and can be configured to either block them outright (if run during the data phase) or cause an approval action to be triggered in the final approval step (if approvals are activated). 
              All of the approving RA administrators in the final approval step will be shown the following warning before the approval passes:

              dnsName SAN can be Automatically Populated by the CN

              We've added a setting to End Entity Profiles to allow the dnsName Subject Alternative Name field in a certificate to be filled in by the Common Name (CN) value in the Subject DN.

              Configurable SN Entropy, Default Value Raised to 20 Octets

              CA/B Forum requires the use of 64 bit entropy when generating serial numbers (see CABF Ballot 164). Due to only positive values being valid serial numbers, 8 octets will only result in 63 bit entropy as the most-significant-bit will always be 0, hence we recommend larger sizes than 8 octets. Previously this was set using the property ca.serialnumberoctetsize in cesecore.properties, which has now been dropped and the value is instead set directly in the CA.
              Possible values may range between 4 and 20 octets, and the default for all new CAs is 20 while upgraded CA's will retain whatever value was set in ca.serialnumberoctetsize, or 8 if none was set. 

              Downloadable CSRs

              In EJBCA 7.0.1 we've started storing CSRs along with the associated certificate (instead of only the last submitted CSR as it was earlier), so you now have access to download and review all CSRs submitted and processed in the past.

              URL Metadata Type Added to Approvals

              Upon popular request, we've added a URL metadata type to the partitioned approval profiles. It allows the approving RA administrator to enter a URL while performing the approval, e.g pointing to a file upload at an external location.
              Upon later review of the approval, it will show up as a hyperlink:

              Experimental: Configuration Checker

              Lastly, we're trying out an experimental new feature in EJBCA 7.0.1, the Configuration Checker. It displays an (incomplete) list of common configuration issues on the front page. 
              If you'd like to try it out, it can be activated in its own tab under the System Configuration:

              Roadmap Update

              Common Criteria

              Our common criteria process is ongoing - the Security Target (ST) is now complete and has been sent for evaluation. Preliminary date for a certified version of EJBCA is still projected to be at the end of this summer. 

              Appliance Release

              EJBCA 7.0.1 will be available on Appliance 3.3.0, due at the end of March/beginning of April.

              Up Next

              The teams are rearing to go to work on EJBCA 7.1. Main features are going to be Partitioned CRLs, multi-value RDN support and a couple of surprises. See you then!

              Cheers,
              Mike Agrenius Kushner
              Product Owner, EJBCA

              EJBCA 7.1.0 - Partitioned CRLs!

              $
              0
              0
              Spring has finally arrived in Stockholm, following the traditional seasons of Winter, False Spring, Second Winter, the Spring of Deceit and the final cold snap of I-Just-Changed-My-Tires. The melting snows bring with them many gifts, besides the beer forgotten on the balcony last November, among them EJBCA 7.1

              Partitioned CRLs

              Long and enduringly requested, EJBCA 7.1 is now capable of producing partitioned CRLs. Activated under the CA configuration, the number of partitions per CRL is dynamically configurable, allowing new partitions to be added as the CRL grows, and assignment to older partitions to be suspended in order to allow for future growth. CDP partition assignment is random in order to allow for even distribution of certificates, and partition definition can be looked up in the CDP extension as defined in RFC5280.
              For those of you not wishing to use partitioned CRLs life will mostly move on as usual while for those of you applying partitioned CRLs to existing installations you will retain a legacy CRL for pre-existing certificates (as the CDP can't be changed retroactively) while newly issued certificates will be issued to partitions.

              Deprecation and Removal of Hard Token Support

              In an effort to relieve ourselves of maintaining little-used features we have chosen in this release to deprecate and remove support of hard tokens, after analyzing that it has little to no use among PrimeKey customers. Naturally this will have no impact on existing installations, but we have provided scripts for those of you wishing to remove the relevant tables from the database. See the upgrade notes for more details.

              VA and RA Specific Distributions

              As a response to market interest, we've enhanced our build process and modularization in order to produce VA and RA specific builds of EJBCA, each capable of acting in their specific roles but not as a CA. This allows PrimeKey to offer a more dynamic model for Appliance and Cloud users who would like to add RA and VA instances to their PKIs but find it prohibitive to pay for the full fee for the complete distribution. The standard CA distribution still retains the full VA and RA capabilities as before. If you're interested in finding out more, please contact sales@primekey.com

              EJBCA 6.15.2 CE Available on Docker Hub

              As some of you already know, as part of our ongoing containerization project we've added a docker container to Docker Hub, built on a sneak-peek of the coming release of EJBCA 6.15.2 Community Edition. 
              If you're interested in moving your PKI towards containerization, please go ahead and have a look, and feel free to give us any feedback! 

              Cheers,
              Mike Agrenius Kushner
              Product Owner, EJBCA

              A bit about us...

              $
              0
              0
              We seldom speak much about the team behind EJBCA or about PrimeKey Solutions on a whole on this blog, so for those interested I'd like to write a bit about us and our culture for those of you who might be interested.

              The Evolution of a Company

              PrimeKey Solutions was founded way back when in 2002 by a small group of developers who saw the need for an Open Source CA solution, which was innovatively named EJBCA. While we're great at many things, we do admit that naming products is maybe not one of them - I do bid you remember that this was the tail end of the IT-era; it could have been way worse. 
              PrimeKey's logo ca 2005
              FOSS was an important concept from the very start - both from a practical viewpoint (don't trust anything that you can't verify), but also ideological. PrimeKey was founded on the principal that cryptography (and by extension PKI) should be widely available, so was from the very start founded on FOSS principles, and PrimeKey have ever sought to make use of open source, as well as contributing to the projects that we use (such as BouncyCastle) both in code and monetarily. 
              PrimeKey's logo ca 2014
              PrimeKey has since then grown and evolved, from being a tiny one-room-everybody-does-everything-company to what it is today: a steadily growing, +100 person company with offices in three countries, specialized staff and specific roles going forward. 
              Our logo since 2017

              The Evolution of a Team

              I joined PrimeKey back in 2010, back in the heydays of the entire company sharing the same volume of air during a working day. Except for our then CEO and a couple of other staff, the bunch of us (<10 people) mostly filled the same roles to varying degrees: developer, professional services, IT, support, QA, documentation, tech sales - there was little delimitation and even less structure. You did what was needed and learned the skills required to overcome the next task at hand. We were happy in those days, though we were disorganized. 

              I was originally hired as a developer, but back in those rousing days the prospect of travel appealed to me as well. Between writing (and refactoring) mounds of code, working with customers took me from Ankara to Antwerpen, from Brussels to Baku. My first major project was working with our upcoming Common Criteria certification back in 2011, which taught me the joys of writing months worth of pointless documentation and speaking to auditors.

              What I'm getting at was that we existed in mostly a state of unmitigated pandemonium; working on customer requirements as they arose, our own fancies and interests, putting out wild bush fires and occasionally lighting them. At a tech conference in 2012 I described our work style as "Controlled Chaos", which very much makes me cringe today. 

              This finally started changing round about 2016 or so, when we were faced with a few issues:
              • We were evolving as a company, moving more towards corporate customers. A couple of bad experiences of letting customers specify implementations, implementing those specs to the letter and then discovering that the customer had asked for the wrong thing showed that we needed to involve ourselves more in specification work. 
              • While the free-form organization was great for allowing the removal of tech debt on a minor scale, non-critical refactoring that would have required major effort were difficult to organize. 
              • Our roadmap was basically just the JIRA backlog, meaning that release dates were largely hypothetical concepts. 
              • Long release cycles (3-4 months) coupled with a lack of issue slicing and cycle breaks (such as sprints) lead to monolithic commits waiting for months on review, occasionally turning out long after the fact to be unsatisfactory or incomplete. 
              We direly needed to change. I won't go into the whole process and evolution of how we got to where we are today (though I might write that as a blog post at a later date), I'd love to describe how the EJBCA development team works at present. 

              The Team(s)

              The goals of our teams are to be as self organizing as possible, wherein each has their own integrated Scrum Master in order to organize and synchronize the teams around common goals. With QA as integral parts of each team, we've started moving away from testing as a waterfall feature and instead testing proactively (and most importantly, just testing). 

              The teams each maintain their own culture and rules internally, and sync one day a week in either a general tech meeting to discuss ongoing tasks, hinderances or questions, and have a common retrospective at the end of each sprint in order to evaluate what went well and what went poorly. 

              Our Roadmap and Development Cycle 

              My role as Product Owner is primarily to maintain a vision and a roadmap in order to help the teams focus on the most important requirements for the moments, to give guidance and answer implementation questions that the teams can't answer themselves. Thus my main avenue of communication with the teams is maintaining and constantly updating the roadmap, which allows them to on their own prioritize and sort the backlog (with some input from myself). Versions are set for features and fixes only as they enter the near horizon (except for features with fixed dates such as customer implementations and specification implementations), which sends less false signals to customers in regards to completion dates, and gives a truer image of what can be expected in each release.

              The teams today follow three week development sprints, at the end of which all issues need to be resolved, reviewed and closed. Issues are sliced down to a three days or less if possible. This cuts down on both issue size and time-to-review, letting us catch design errors earlier, before they propagate. It also eliminates the large degree of release date uncertainty due to the large grey blob of review time (and resulting fixes) always invariably plaguing the end of each release cycle. Besides the retrospective mentioned above, sprints often end with an internal sprint demo to show what's been accomplished, and a release demo post release to show off for the rest of the company what's new. 

              The Result

              In the last couple of years we've taken great leaps forward in terms in terms of reliability, predictability and above all quality. While we still have a long way to go, we are extremely pleased with the results so far.

              The Evolution of an Office 

              The Stockholm office has changed addresses four times in nearly 20 years. The gang started off sitting in what amounted to a shoebox, before moving to slightly bigger digs in 2009, which is about the time I came into the picture.

              The new office was slightly larger than the old one, but the entire team still shared a single room (with an office for our CEO and VP Sales), happily all breathing the same air for the entire working day. 

              My desk back in 2010, with era-appropriate camera filter and still relevant stacks of DVD blanks. 
              We shared an office back then with two other companies, with constant bickering over which coffee machine to lease (bad coffee leads to bad code - you can quote me on that). We were on top of a children's osteopath, so on clear days the workday was hellishly audioscaped by the little moppets' wailings up through the ventilation. Good times. 

              With time we came to outgrow that office, first shifting out one of our office-mates before getting outshifted ourselves. We'd grown to expand over two rooms, and there was as little piece and quiet as there was space to move around the tightly packed desks. Upon finding new space in 2016, I sat down and wrote a manifesto of office design, arguing that the current and continued practices of open offices was provably based on faulty theories on workspace design, citing the esteemed Joel Spolsky, among other sources. I ranted! I raved! I built barricades out of hutches and obsolete cryptographic digests. Join me! I called. Let us throw off the yoke of office plan oppression, seize the means of production and be allowed to work without external interruptions! 

              But one colleague heeded my call. We were given our own room in the new office and told to shut up. We were happy. 
              The author exploring his new digs. New feats of concentration were attained in this small room. 
              Come this year (2018) we had once more outgrown the previous office. PrimeKey's success in the last few years led to huge growth for the company, and we finally expanded into having proper teams handling support, integration and sales - by extension allowing us to hire more developers and QA staff. Management located a new place only a stone's throw away from the existing one, this time moving us into a complete floor of a proper office building, complete with proper server room in the basement, a view and space for luxuries like a gaming room. 
              Our office since 2018
              A gaming room with a foosball table, the true sign of prosperity
              Upon planning the move our CEO Magnus very graciously (and wisely) asked a selection of employees our thoughts on the new office and ideas for an office plan, so for the developers we suggested a scheme that lies more in line with both our own philosophies and with what is considered modern practice. We actively rejected any suggestions for open office plans (or its blasphemous mutated step child, hot desking), but instead suggested that we put up walls or roof-to-floor-dividers, and space them out to create reasonably sound proof work areas containing 4-6 desks, which we consider the ideal team size. We felt that this would have the following advantages:
              • Humans are social creatures, and do well from interacting with others. Development work (particularly in cross functional teams) requires the ability to hold spontaneous meetings and interactions. For teams to form bonds they need to interact, tell in-jokes, form their own culture. 
              • Development work generally requires large degrees of concentration due to the mental effort of visualizing complex solutions, and unwanted distractions (others' phones, distant conversations, etc) lead to stress, anxiety and generally lower productivity. 
              • As humans we tend to nest in order to create a sense of belonging and familiarity in our surroundings, spreading around us items both useful (that extra phone charger) and decorative. We tend to do so in small groups as well, so this scheme would allow each team to be able to decorate their own spaces as they see fit. 
              In addition, the additions of walls and partitions would allow each team to have a dedicated whiteboard to use while collaborating on features, a large TV monitor to statically display information (such as CI machine status, roadmaps or JIRA boards). In the end I have to say, management delivered beautifully:
              Team Alice's work area

              The home of Team Bob
              The dwellings of the SignServer Team
              While it may not look like much, these spaces serve us perfectly in allowing each team to concentrate on problems and issues, allowing collaboration and social interaction while letting those needing to bite down on a problem concentrate while avoiding the angst-inducing sight of cubicle farms. 

              All in all, were constantly evolving here at PrimeKey - analyzing and reevaluating what makes us better as individuals, as teams and as a company.

              We're already doing what we love, and now we're a huge leap forward in how much we love doing it. 

              Cheers,
              Mike Agrenius Kushner
              Product Owner EJBCA

              EJBCA ♥ YubiKey

              $
              0
              0
              With the keygen tag in its final death throes, time has come to move on to new and better ways of managing keys on tokens. We here at PrimeKey are big fans of our friends at Yubico, so here is a neat little guide of how to get up and running with using your YubiKey with EJBCA.

              Disclaimer: This blog post is in now way sponsored nor endorsed by Yubico, though they were quite kind and provided us with a couple of tokens to play around with. We just honestly like them. 

              Prerequisites

              To get going, you're going to need to have the following installed on your workstation:

              Creating a key pair on your YubiKey


              1. Start up the YubiKey PIV Manager
              2. Under Applications, pick PIV and then Configure Certificates

              3. Under the Authentication tab, click Generate to create a new key pair on the token. This will take you through a guide of creating a key pair by picking an algorithm, key size and setting the Common Name for your token. 
              4. Make sure that you specify that you was a Certificate Signing Request (CSR)
              5. This will result in a CSR that you can use to enroll the key pair to EJBCA. 

              Enrolling the YubiKey to EJBCA

              Enrolling the newly created key pair is done just like with any other enrollment.

              1. Go to the EJBCA RA UI
              2. Click on Enroll, choose the appropriate certificate type and sub-type and choose Generated by User, which will prompt you to upload your CSR from the previous step.
              3. Fill in any other pertinent information, then choose Download PEM

              Importing the Certificate to the YubiKey 

              1. Open the YubiKey PIV Manager, and again choose Applications, pick PIV and then Configure Certificates
              2. Click Import and pick the new newly generated certificate.
              3. Congratulations - your YubiKey is now up and running, but we still need to configure the browser to play along. 

              Configuring FireFox to use YubiKey

              1. Open Firefox and enter about:preferences in the address bar
              2. Under Privacy and Security click on Security Devices 
              3. Click on Load to install OpenSC's PKCS#11 Driver
              4. Name the module and then locate the opensc-pkcs11.so (or similar) library
              5. The YubiKey will now be shown as a security module

              Configuring Access Rights in EJBCA 

              This is done using Roles as with any user EJBCA administrator, but here are the exact steps:

              1. In the EJBCA CA UI, pick Roles and either create a new Role or add the new administrator to an existing Role
              2. To add the administrator, click on Members, pick the appropriate CA and enter the identifying the information for the certificate, preferably the serial number
              3. An easy way to find the serial number is to view the certificate in OpenSSL using the command:
              $ openssl x509 -in alanwidget.pem -text -noout
              The serial number can be copied, converted from hex to decimal using a converter and then used in EJBCA.

              4. Finally, click on Access Rules and set the required rules for your administrator
              5. The next time you start a new session, your YubiKey will be offered as an option

              EJBCA 7.2.0 - CT improvements & Exteded REST API

              $
              0
              0
              Summer is here and as promised, so is EJBCA 7.2.0! Highlighted news are performance improvements to Certificate Transparency and additional functionality added to the REST API.

              Persistent Storage of Certificate Transparency SCT Responses

              Persistent caching of Certificate Transparency SCTs (Signed Certificate Timestamps), in the form of a database-backed storage, has been added in addition to the existing in-memory caching. This reduces the number of requests to the CT log server and increases the performance in the following ways:

              •  The database-backed storage will be used after a restart when the in-memory cache is empty.
              • The in-memory storage has a limit of 100 000 certificates by default, and will only keep the SCTs for the most recently requested certificates. The database-backed storage has no such limit and will be used for SCTs for less frequently requested certificates.
              • The database-backed storage will store partial results for a certificate, allowing EJBCA to retry a submission efficiently at a later point.

              Additionally, the default configuration was changed to rate-limit connections to logs that are down or return error codes. This reduces the load on both log servers and
              EJBCA. For example, if a CT log rate-limits EJBCA, then EJBCA will back off for 1 second by default.

              Crypto Token and CA Management REST API

              The EJBCA REST API has so far been limited to Certificate Management operations. We've now extended the REST API, adding resources for CA administration as well. This allows simpler remote integration and management as an option to the GUI. New endpoints support Crypto Token and CA Management including:
              • CA activation and deactivation.
              • Crypto Token activation and deactivation.
              • Key generation and removal.
              New REST end points in Swagger-UI          
















              Expect more news from us this autumn!

              Cheers,
              the PrimeKey EJBCA Team

              PGP Signing with SignServer

              $
              0
              0

              This blog post covers PGP signing support implemented in recent versions of SignServer

              In a previous blog post, we addressed Code Signing of Windows binaries (Authenticode) and gave some background on why Code Signing is important for secure software distribution.

              We are now pleased to introduce code signing with PGP, commonly used for Open Source software projects and packaging of software for Linux environments in general.

              OpenPGP Signing was first implemented in SignServer Enterprise 5.1 and will be available in SignServer Community 5.2, already available for download as a beta release.

              SignServer Installation

              To test the PGP support, download and install SignServer Enterprise 5.1 or SignServer Community 5.2.0.Beta1 or later.

              For installation instructions, refer to SignServer Installation.

              Setting up an OpenPGP Signer

              When SignServer is up and running, access the SignServer Administration Web to start setting up the workers.

              The Administration Web is available in SignServer Community as if 5.2.0.Beta1.

              Step 1: Set up Crypto Worker

              If you don’t already have a crypto worker configured, then set one up using, for example, the sample keystore:
              1. Select the AdminWeb Workers tab, and click Add.
              2. Click From Template, select keystore-crypto.properties in the list, and click Next.
              3. In the configuration text view, change the value for WORKERGENID1.KEYSTOREPATH so that the path corresponds to your SignServer installation, for example: WORKERGENID1.KEYSTOREPATH=/home/username/signserver/res/test/dss10/dss10_keystore.p12. 
              4. Click Apply.
              Remember the name of the crypto worker (for example, CryptoTokenP12) as you will need it in the next step when setting up the OpenPGP Signer.

              Step 2: Set up OpenPGP Signer

              To set up the new OpenPGP signer, do the following:
              1.  Select the SignServer AdminWeb Workers tab, and click Add to add a new worker.
              2. Choose the method From Template.
              3. Select openpgpsigner.properties in the Load from Template list and click Next.
              4. Change the sample configuration properties as needed, for example:
                • Update the CRYPTOTOKEN property with the name of your crypto worker (for example, CryptoTokenP12).
                • Update DEFAULTKEY to an existing key (or do this in a later step).
              1. Click Apply to load the configuration and list the worker in the All Workers list.
              2. Select the added worker in the list to open the Worker page.
              3. Check if the Worker status is Offline and if there are any errors listed. The "No key available for purpose" message means that the DEFAULTKEY property does not point to an existing key in the crypto token. In that case, either update the DEFAULTKEY property to point to an existing key or do the following to generate a new key to use with this signer:
                • Click Renew key and specify the following:
                  • Set a Key Algorithm, for example "RSA".
                  • Set a Key Specification, for examplethe key length "2048" (for RSA).
                  • Update the New Key Alias to the name of DEFAULTKEY property (typically change to the same value as the Old Key Alias).
                • Click Generate.
                • Select the worker in the list and confirm that the Worker status is Active and without errors listed. If not, confirm that the DEFAULTKEY property is correct and check in the Crypto Token tab of the crypto worker that a key with the specified name exists.

                Step 3: Add User ID to Public Key

                Follow the steps below to add User ID / Certification for the OpenPGP public key using the Generate CSR option.
                1. Select the AdminWeb Workers tab.
                2. Select the OpenPGP worker and click Generate CSR.
                3. Specify a Signature Algorithm, for example "SHA256withRSA"
                4. Specify DN asthe wanted User Id, for example "Markus (Code Signing) <markus@primekey.se>".
                5. Click Generate, and then click Download.
                6. Open the downloaded file using any text editor and copy its content.
                7. Select the worker and click the Configuration tab.
                8. For the PGPPUBLICKEY property, click Edit.
                9. Paste the public key content in the Value field, and click Submit.
                10. Click Status Summary and confirm that fields like PGP Key ID and PGP Public key are listed. Also, note that the User ID is listed. 

                Step 4: Sign

                The following example shows how to sign using the SignServer Public Web. You can test signing using any of the SignServer client interfaces.
                1. Click Client Web.
                2. Under File Upload, specify the Worker name used, for example, OpenPGPSigner.
                3. Select the file to create a detached signature for, for example, release.zip.
                4. Click Submit and store the resulting signature file, for example, release.zip.asc.

                Step 5: Verify Signature

                The following example shows how to verify the signature using the OpenPGP tool GnuPG. It should be possible to use any OpenPGP tool to verify the signature.

                Run the following to verify the signature using GnuPG:
                $ gpg --verify release.zip.asc release.zip

                If needed, first import the public key to GnuPG before verifying the signature in the third step:
                1. Store the public key (i.e. from PGPPUBLICKEY property) as signer001-pub.asc.
                2. Import the key to GnuPG:
                  $ gpg --import signer001-pub.asc

                More Information

                See also the OpenPGP Signer documentation and if you have any questions or comments don't hesitate to use our discussion forums.

                Cheers,
                the PrimeKey SignServer Team



                Enroll Using Device Certificates Using CMP with 3GPP/LTE

                $
                0
                0


                About 3GPP/LTE

                The 3rd Generation Partnership Project, 3GPP, has produced a technical specification for an entity authentication framework, which was developed in the context of the Network Domain Security work item.

                In practice, the main purpose of using CMP 3GPP is to allow a device to automatically provision itself with a device certificate without the vendor being required to expose their full PKI to the manufacturer. A typical use case is an IOT device vendor, whose devices are manufactured by a second party, and the vendor requires the devices to be enrolled to their PKI. The vendor may wish to prohibit the manufacturer from producing their own pirated devices that connect to the vendor's PKI, or is simply unwilling to expose their PKI directly to the manufacturer in order to enroll the devices on site.

                 To solve this, the following workflow is usually followed:


                1. The factory site is provisioned with a Vendor CA, separate from the main PKI intended to be used. The Vendor CA certificate is signed by the vendor's PKI. 
                2. The vendor prepares a series of unique identifiers (i.e serial numbers) for each device to be produced. This ensures that only the authorized set of devices will be able to enroll against the vendor's PKI. 
                3. As each device is manufactured it produces its own key pair. The public key is signed by the Vendor CA, and the device is initially provisioned with a Vendor Certificate (which includes the serial number). 
                4. As each device comes online it enrolls to the vendor's PKI over CMP with 3GPP, using the Vendor Certificate to authenticate itself. 
                5. The device then receives its device certificate from the vendor's PKI. 

                Generalized Workflow

                This section describes the general CMP 3GPP workflow, purely for overview purposes. The EJBCA specific workflow is slightly modified, see the next section. Next figure shows the general deployment architecture for certificate enrollment of a device at an operator PKI:


                The device is either pre-provisioned with a public-private key pair by the vendor or produces its own, and has the vendor-signed certificate of its public key pre-installed.

                On initial contact to the operator network, the device establishes a communication channel to the RA/CA of the vendor. Using a CMPv2, a request for a certificate is sent to the RA/CA. The network authenticates the messages from the device based on the vendor-signed certificate of the device and the vendor root certificate pre- installed in the network. The device checks the integrity protection on the messages from the RA/CA based on the operator root certificate provisioned in the device. In a response message, the device receives the operator-signed certificate. During the execution of the CMPv2 protocol, the device has to provide a successful proof of possession of the private key associated to the public key in order to be certified.

                The operator root certificate may be provisioned in the device prior to or during the CMPv2 protocol run. The protection of the operator root certificate during provisioning may be decided by operator security policy. If an operator root certificate provisioned prior to the CMPv2 protocol run is available, the device shall use it. Otherwise, the device shall use the operator root certificate provisioned during the CMPv2 run. If no operator root certificate is provisioned at all, then the device shall abort the procedure.

                If the operator wants to renew the device certificate, the same procedure will be executed with the old operator-signed device certificate taking the place of the vendor-signed certificate of the initial enrollment.

                The figure below describes the general message flow in both cases:

                1. The device discovers the RA/CA address.
                2. The device generates the private/public key pair to be enrolled in the operator CA, if this is not pre-provisioned.
                3. The device generates the Initialization Request (IR). The CertReqMsg inside the request specifies the requested certificate. If the suggested identity is known to the device, it includes this in the subject field. To provide proof of possession, the device generates the signature for the POPOSigningKey field of the CertReqMsg using the private key related to the public key to be certified by the RA/CA. The device signs the request using the vendor provided public key, and includes the digital signature in the PKIMessage. Its own vendor signed certificate and any intermediate certificates are included in the extraCerts field of the PKIMessage carrying the initialization request.
                4. The device sends the signed initialization request message to the RA/CA.
                5. The RA/CA verifies the digital signature on the initialization request message against the vendor root certificate using the certificate(s) sent by the device. The RA/CA also verifies the proof of the possession of the private key for the requested certificate.
                6. The RA/CA generates the certificate for the device. If the suggested identity of the device is not included in the initialization request message, the RA/CA determines the suggested identity, based on the vendor provided identity contained in the device certificate. The RA/CA may also replace a suggested identity sent by the device with another identity based on local information.
                7. The RA/CA generates an Initialization Response (IP) which includes the issued certificate. The RA/CA signs the response with the RA/CA private key (or the private key for signing CMP messages, if separate), and includes the signature, the RA/CA certificate(s) and the operator root certificate in the PKIMessage. The appropriate certificate chains for authenticating the RA/CA certificate(s) are included in the PKIMessage.
                8. The RA/CA sends the signed initialization response to the device.
                9. If the operator root certificate is not pre-provisioned to the device, the device extracts the operator root certificate from the PKIMessage. The device authenticates the PKIMessage using the RA/CA certificate and installs the device certificate on success.
                10. The device creates and signs the CertificateConfirm (certconf) message.
                11. The device sends the PKIMessage that includes the signed CertificateConfirm to the RA/CA.
                12. The RA/CA authenticates the PKI Message that includes the CertificateConfirm.
                13. The RA/CA creates and signs a Confirmation message (pkiconf).
                14. The RA/CA sends the signed PKIMessage including the pkiconf message to the device.
                15. The device authenticates the pkiconf message

                EJBCA Specific Workflow

                To use EJBCA with 3GPP, the setup above should be slightly adjusted:

                Direct CA - Device Communication

                In the case of direct contact between EJBCA and the device, EJBCA operates in client mode. Each device has a corresponding end entity in EJBCA. The initial enrollment request/certification request is send by the device to EJBCA as a CMP request signed by the key provided to the device by the vendor. The vendor issued certificate is attached to the request in the extraCerts field. EJBCA will authenticate the request by checking that the certificate in extraCerts was issued by the vendor CA (an external CA in EJBCA). If the authentication succeeds, EJBCA will issue a certificate for the device and includes it in the CMP response message.

                For future communication, when the device needs to update its certificate, the old EJBCA obtained certificate is used to authenticate the update or key renewal request. This is typically done by the device signing the update request with its private key and attaching its certificate (the one to be renewed) in the extraCerts field in the CMP message.

                CA - Device Communication Through a Bespoke RA

                In case of indirect communication between EJBCA and the device, EJBCA operates in RA mode. The device communicates with the CA through a third device/organization that acts as an RA. The RA has a corresponding end entity in EJBCA with an issued certificate. This certificate is transported to the RA manually. The RA is also registered in EJBCA as an administrator and is given the necessary privileges to process CMP requests on behalf of the device.

                Both initialization/certification requests and certificate update requests regarding the devices, are expected to be signed by the RA. Any changes or updates of the RA certificate are expected to be performed directly in EJBCA and transported to the RA manually.

                Cheers,
                Mike Agrenius Kushner
                Product Owner, EJBCA

                CVEs: PrimeKey takes a step forward

                $
                0
                0
                A question we've been posed through the last few years is whether PrimeKey writes CVEs for known security issues. We're now implementing a change in this policy, and we'd like to talk a bit about it.

                Our policy until now has been to fix minor issues with announcements in the release notes, while major vulnerabilities have been immediately patched and customers have been informed about the issue, its severity and possible workarounds.

                As PrimeKey has grown as a company and our product line has come to become one of the most commonly used solutions for PKI - in the internal corporate sphere, in distributed production models for IoT devices and not to mention the world of Web PKI - we've chosen to take a step forward and start submitting CVEs for all new and found exposures and vulnerabilities in EJBCA.

                What is a CVE? 

                CVE stands for Common Vulnerabilities and Exposures, and is a general format for describing an security issue. The original driving force for defining the format was the lack of commonality between the differing sets of vulnerability databases existent at the time. The point of CVE is not to replace these databases but to create a common catalogue of issues linking these together. In a CVE context
                • vulnerabilities are defined as issues where logic errors allow the application to be used in ways other than it was intended. 
                • exposures are configuration issues or bugs that causes the application to leak sensitive information. 
                The pertinent parts of a CVE are:
                • The CVE ID
                • A brief description of the issue
                • Links to the vendor's support portal or other source of security advisories
                Fix information, impact and other data about the vulnerability are not included in the CVE, but expected to be on the vendor's support portal, i.e PrimeKey's support portal in this case. 

                A CVE is created by a CVE Numbering Authority (CNA), which analyses reports and writes CVEs. A report can be submitted by anybody (not just the software vendor), and the CNA does its best to avoid duplicate reports. Many large vendors become CNAs in their own right, but the main CNA is the US government funded MITRE Corporation, which is the entity which would handle reports about PrimeKey products. 

                Once a CNA has written a CVE and assigned it a number it's submitted to the NIST National Vulnerability Database and assigned a score based on the severity. 

                PrimeKey and CVEs

                Starting from Q1 2020, PrimeKey has decided to start submitting all found vulnerabilities and exposures in EJBCA. Our internal policy is that once an issue which is classed as either is found, it is to be patched onto the latest stable releases and made available to customers, along with announcements on our support portal and and security announcements on our mailing lists.

                Two working weeks after the customer release we will submit the CVEs, hence making the found security issues public. This period is meant to give customers, if affected by the issue, a chance to upgrade to the latest patch before the issues become public knowledge. For any issues that we deem to be major we will also follow up with a release of EJBCA Community. 

                Classification

                In order to be completely transparent, PrimeKey has internally classified security issues as the following types:

                Vulnerability

                A logic error, bug or missing security check (such as XSS or CSRF) in one of our applications with a clear path of being able to make the application perform an action to which it was not intended, or otherwise allow a user to perform an action of which they are not intended to perform. A vulnerability does not need to end up with the application in a compromised state as multiple seemingly benign vulnerabilities can be linked together into a chain ending up in a successful compromise.
                Result: A CVE will be submitted

                Security Hardening 

                Similar to a vulnerability, but without any known exploit vector. Hardenings are performed preemptively in order to avoid vulnerabilities from forming in future code iterations. Examples of what we classify as hardings are adding or improving security headers of web apps (such as CSP headers) or redundant integrity checks on transmitted data. 
                Result: A CVE will not be submitted

                Exposure

                As described above, a common misconfiguration that allows a user to see sensitive data of which they're not privy. This does not include data such as stack traces or internal IDs, as they relay nothing which is either not public or already publicly known through the source code. 
                Result: A CVE will be submitted

                Vulnerability in an underlying library

                As our products make use of various 3rd party libraries, vulnerabilities may in time be reported in them (along with their respective CVEs). If we find that any of these vulnerabilities cause similar issues in existing versions of our products, we will submit our own CVE along with releasing patches.
                Result: A CVE will be submitted

                Our First CVEs

                Thanks to Matthias Kaiser of Apple Information Security, who performed some very diligent penetration testing, we have submitted the following CVEs for EJBCA:
                Mike Agrenius Kushner
                Product Owner EJBCA

                A practical analysis of the SSH Certificate format

                $
                0
                0
                I've been messing around a wee bit with SSH certificates, and while the specification is fairly easy to read, reading the actual format was not quite as much so and there was quite a bit of trial and error involved. For the sake of posterity, I thought I'd give a rundown of a sample SSH certificate and how to parse it.

                Why use SSH Certificates?
                The default use for SSH is with a username/password combo. Why relying purely on username/password is a poor idea is self evident, as passwords are commonly reused/stolen, so the next step up is using SSH keys so that an attacker needs to have also acquired the SSH private key, as well as the password used to protect the key pair. SSH keys can easily be produced using OpenSSH:
                $ ssh-keygen -b 384 -t ecdsa -f id_ec384 
                The common procedure is then to send your public key off to your favorite IT-admin, who adds it to a list of known keys. If you're an organization of 8000 employees all working from home, your IT-admin is going to be sad and depressed indeed. 

                Without going into details in the complete setup (that's a separate blog post, and can be found plenty elsewhere), what your IT-admin can do instead is set up a CA. From there they'll set up some form of RA, and what you instead can do is send in your public key, have it signed and receive a certificate back. This certificate is now your SSH passcode - the difference being that the IT-admin never had to in any way interface directly with your public key. As long as the signature is valid and the certificate hasn't expired, you're good to go.

                The Specification
                The specification for an RSA certificate is as follows:
                78:     string    "ssh-rsa-cert-v01@openssh.com"
                79:     string    nonce
                80:     mpint     e
                81:     mpint     n
                82:     uint64    serial
                83:     uint32    type
                84:     string    key id
                85:     string    valid principals
                86:     uint64    valid after
                87:     uint64    valid before
                88:     string    critical options
                89:     string    extensions
                90:     string    reserved
                91:     string    signature key
                92:     string    signature
                SSH certificates have no similarities to x509, as x509 was by the designers deemed to be overly complex for the purpose. The SSH certificate format also provides some nice perks that x509 does not. So, let's get into it. 

                Breaking it down
                A sample SSH certificate looks like this.
                ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAg5XCeFvniKnNbRZaclB83kTyF8zITCde4uRrv4mqesn4AAAADAQABAAABAQDiFqTBdKOWPeBeP1PiKSVy8ilfNChu5/6Z3iXu3Rdtg5ozu98IoAl4MtlklDdUDzvFkB+VPD/9gqHPKK8fTOhqgUPGoiCeZP3Ktr6NR53xd1QPQDeBvOMiYkPqQXziCQiVyL1WFzN616szrxsJ1Ni7WCHXcMTKOMruLv4es8FfB03wGDbBKVzMwo0JuZCicGg2pg/o8n9BPlzW6CvjUkmvUO3ycGKibPPFkiDgyuYynIbkMcmdShhY3XSOGB4UPeA3U4OiH6Z+09K9LqogWIcjxJeK0tObORd9QnQ4k1ba+/bbEfnFIQwLyzqXXPsPQ0Ud9upxVHD1lezRNE1DAIr9AAAAAAAAAAAAAAABAAAABWVqYmNhAAAAFAAAAAZlamJjYTAAAAAGZWpiY2ExAAAAAF7Q0HgAAAAAYLCytwAAAAAAAACCAAAAFXBlcm1pdC1YMTEtZm9yd2FyZGluZwAAAAAAAAAXcGVybWl0LWFnZW50LWZvcndhcmRpbmcAAAAAAAAAFnBlcm1pdC1wb3J0LWZvcndhcmRpbmcAAAAAAAAACnBlcm1pdC1wdHkAAAAAAAAADnBlcm1pdC11c2VyLXJjAAAAAAAAAAAAAAEXAAAAB3NzaC1yc2EAAAADAQABAAABAQC8ajEtOvKxSPYSRL+A1y7Ye0baYHaR65KkzaT3U5XugHKHusvVPsDlRfSl598TsMjPQhbJt0O1SefMvXCbqdj776PWok5I1ScnLKJWRKzreeslEJZdcKTOUoT9Y5sg/LxC3xXwhIz+yLm8SbvQ7yQvPMmmlg5ldwccC8/0cua/25Vrjm0JhRjgxny65s2bNkClXXLmtevhvlQ7rXMQhpGmg5th156Ny/BUac7CQPEnDkRkhfsH8zKuh0NX19Y/93bwLsI7z+zP7CJJ11C0CpZl5yi2/8vqZUkufjRu/TH78EnLdCE/bkKcn0yyahG5BTh9dInrSclgCSiEPOYojvzjAAABFAAAAAxyc2Etc2hhMi0yNTYAAAEAj4/d9pKGGReo7B1ZbVBtHD9ftBfa5fjyPnuM8qbEMtYWgbx/MlCqVf2CL6VfJe2lvsg4ZZWvHyq0XBucFQqVHMekHJ71CymAs5/boGF4efLo56Ck6FF7tqM4dYmcO0aWRRQt3DyC24bLUZ4ZcdkyAgEm4EbTj9nPyvzbR57VsP/p+6WlszrGAHPwBlZ6my0g3cwPJSxwdV0USfMUIWooMIXLS7ocVZ7a8y+HF6qC2FGYIXYSgJuBaG5jlfXOojfKwA4tzwdy3ZziHxW50WDRkPrw6ZnXeRantJfMOhJ7ol9NSt1WcdkiAHqzDbEUpOz9UF0aSwxtIQYI7ONgl29a7w== Mike's Certificate
                We can see right away a nice perk, the certificate begins by telling us what's going to be inside, so off the ball we can figure out how we're going to decode it. The astute of you will notice that the main body of the certificate (between the prefix declaring the type and the comment at the end) looks a lot like Base64, which it very correctly is. If you've seen a certificate or two you'll also notice that every certificate of the same type starts with the same text, and that's because the first characters are (as stated in the specification above) the certificate type, in this case ssh-rsa-cert-v01@openssh.com. So, throw the certificate body into your favorite Base64 decoder and let's move on. 

                The byte array follows a simple structure: first a four byte integer declaring the length of the structure, then the contents itself:
                What you actually find inside the contents is up to the specification above, hence the importance of knowing beforehand what you're parsing. There can also be additional byte arrays of this format hidden within the payload, as we'll see in a moment. Parsing our way through the byte array, we're going to encounter the following objects, in this exact order:
                Item   Description
                 nonce   A 16 or 32 bit random byte array generated on the CA, simply to make collision attacks less likely.    
                 e The RSA exponent of the public key for this certificate. Note that EC keys will have the entire key in its own byte structure instead of having its values directly in the certificate. 
                 n The RSA modulus of the public key for this certificate.   
                 serial 64 bit unsigned long with a serial number - up to the CA to determine the scheme
                 type 32 bit unsigned integer containing a 1 (for user certificates) or a 2 (host certificates) 
                 key id A string filled in by the CA to identify the holder (end entity in x509 terms) owning the certificate.
                 valid principals Our first internal byte structure. The list of principals contains the accounts on the host machine which may be used with this certificate. An empty list will allow any user to make use of this certificate. The structure will look as follows:


                 valid after A 64 bit unsigned long containing the lower bounds of the certificate's validity. 
                 valid before A 64 bit unsigned long containing the upper bounds of the certificate's validity.
                 critical options These will only be relevant for user certificates (as there are no official options for host certificates) and may be force-command (to have the client execute a certain command on authentication to the host) and/or source-address in order to bind the client to a single IP. This is a key-value pair, so adds another layer of complexity to the byte structure


                 extensions    The equivalent of x509 key usages, tells SSH what this certificate is authorized to do. There are extensions pre-defined in the specification, but it's up to you if you want to add your own as well. The structure is an array of strings much like principals


                 reserved   A blank string, declared but not used at the moment.
                 signature key This is where it starts getting fun. OpenSSH allows the signature key to be of any OpenSSH usable format regardless of the key being signed, so there is for example no reason why a RSA CA can't sign a set of EC keys. The signature key is going to be parsed as a byte structure and then parsed up into its component. The structure of the key is defined in RFC 4253, and for an RSA key would be as follows:
                string "ssh-rsa"
                mpint e
                mpint n
                The nice part is that the first thing the key does is declare itself, so you know exactly how to parse the rest of the structure. 


                 signature   Last but not least, the last byte array you're going to read is the signature. This is going to be again an embedded byte structure, starting with a string declaring the signature algorithm, and after that the actual signature, the data for which is all of the preceding fields including the signing key. 


                And that's pretty much it! Happy hacking, and I hope I've managed to make somebody's day a bit better.

                Cheers,
                Mike Agrenius Kushner
                Product Owner, EJBCA

                Using CertBot to issue certificates with ACME to an Apache Web Server

                $
                0
                0
                The popular ACME (RFC8555) agent CertBot can be used to automatically create and renew TLS certificates for an Apache web server. The same setup can easily be used for other web servers that CertBot has support for, for example NGINX. With a TLS certificate, the web server can be reached using the HTTPS protocol, and all traffic to and from the web server is encrypted.

                This post describes how to issue private TLS certificates, from your own CA, for usage in your organization.

                This picture shows a simplified image approximately what happens in the background when issuing a certificate with ACME.

                Prerequisites

                Issuing web host certificates using ACME makes use of DNS for authorizing issuance of certificates for a specific domain. Therefore it is important that both the web host and the CA have proper FQDNs and that these are in the DNS. The CA needs to be able to reach the web server, looking up its FQDN in DNS.

                The following prerequisites are required to complete the issuance:
                • EJBCA
                  • EJBCA Enterprise (with ACME support) deployed on an Ubuntu server, configured with:
                    • A CA that will issue web server certificates
                    • A certificate profile in EJBCA for the web server certificates
                    • An end entity profile in EJBCA for the web server certificates that is configured to use the web server certificate profile
                • Apache web server
                  • A server/VM installed with Ubuntu 19.04 (as used in this guide, other operating systems should work the same/similarly)
                • DNS host records
                  • A host record for the CA server, used by the web server to contact the CA (in this guide ejbca.example.com)
                  • A host record for the web server, used by the CA to contact the web server for ACME http-01 authorization (in this guide tgacme.com and www.tgacme.com

                Issue Web Server TLS Certificate over ACME with CertBot

                To complete issuance of a web server certificate, follow the steps outlined in the sections below.

                Step 1 - Trusted CA Certificate Configuration

                In order to contact the CA server over https, the CA certificate that signs your servers (EJBCA and Apache) TLS certificates needs to be installed as trusted in your systems, both the EJBCA host and the Web host. If not, CertBot will not be able to talk to the CA.

                In this guide, the Management CA (a Root CA) is used and the Management CA certificate has been downloaded as /tmp/ManagementCA.cacert.pem.

                Run the following on both servers:
                sudo mkdir /usr/share/ca-certificates/extra/
                sudo cp /tmp/ManagementCA.cacert.pem /usr/share/ca-certificates/extra/ManagementCA.cacert.crt
                echo 'extra/ManagementCA.cacert.crt' | sudo tee -a /etc/ca-certificates.conf
                sudo update-ca-certificates
                Next, test that you can access the CA server from both the CA itself and the web server. Example URL: https://ejbca.example.com:8442/

                Step 2 - Configure EJBCA on the CA Host

                Perform the following steps to configure EJBCA on the CA host:

                1. To configure the Management CA to allow the same subject DN on multiple end entities:
                • In the EJBCA Admin UI, click Certificate Authorities>Management CA>Edit and set the following:
                  • Enforce unique public keys = unchecked.
                  • Enforce unique DN = unchecked.
              1. To create a Server Certificate Profile, SslServerProfile :
                • To clone the SERVER certificate profile, click Certificate Profiles>SERVER>Clone and set the following:
                  • Extended Key Usage = Server Authentication.
                  • Available CA: Any CA.
              2. To create a Server End Entity Profile, SslServerProfile:
                • In the EJBCA Admin UI, click End Entity Profiles>Add profile and set the following:
                  • End Entity E-mail: Use, Modifiable.
                  • Subject DN Attributes: Only CN, Required and Modifiable.
                  • Subject Alternative Name: two DNSName.
                  • Default/Available Certificate Profile: SslServerProfile.
                  • Default/Available CA: Management CA.
              3. Enable the ACME protocol under System Configuration>Protocol Configuration.
              4. Add an ACME alias in EJBCA:
                • In the EJBCA Admin UI, click ACME Configuration>Add and set the following:
                  • End Entity Profile: SslServerProfile.
                  • Site URL: https://www.primekey.com/
                  • Terms of Service URL: https://primekey.com/products/software/
                  • DNS Resolver: 8.8.8.8.
              5. Set the ACME alias as Default ACME configuration in the ACME Configuration Overview (EJBCA Admin UI>ACME Configuration).
              6. The following displays an example ACME alias configuration:

                Step 3 - Install CertBot on the Apache Web Server Host

                On the Web host, install CertBot using the following command. Note that you may need to run sudo apt update on a fresh installation.
                sudo apt install python3-certbot-apache
                The above command installs the Apache2 web server automatically.

                Step 4 - Issue Web Server Certificate

                First, to test that https is not available (looks good in a demo), test the following with a web browser:
                • http://tgacme.com - Should show the Apache default web page
                • https://tgacme.com - Should show an error that the browser cannot connect
                Next, run certbot to install the certificate from the EJBCA server:
                sudo certbot --server https://ejbca.example.com:8442/ejbca/acme/directory -d tgacme.com --apache --agree-tos --email admin@example.com --no-eff-email --noninteractive
                Then test with the web browser again:
                • https://tgacme.com - Should now connect and show the Apache default web page.
                Additionally, you can go to the certificate view page of your web browser and inspect the web server certificate (that the issuer is the private Management CA).

                Step 5 - Configure CertBot for Automatic Monitoring of Expiry

                You can now configure CertBot for automatic monitoring of expiry. For information on configuring CertBot, refer to the CertBot documentation.

                Additional Notes

                Roles and responsibilities

                There are at least three distinct roles used in this guide, although they can be more.

                1. CA administrator, performing the configuration of EJBCA. This role can further be divided for CA role separation, for example:
                • CA policy administrator, configuring certificate- and end entity profiles ensuring that properly formatted certificates are issued
                • CA protocol administrator, configuring ACME aliases
              7. Web server administrator, performing configuration of the Apache server and CertBot on the web host.
              8. DNS administrator, adding records to the DNS enabling ACME authorization
              9. In addition it is recommended to monitor all web hosts for expiring certificates. There is a plethora of tools for this, and it's probably included as part of your organization server monitoring solution.

                Cleanup/Reset Web Server to Run Again

                A simple script can be run on the web host to re-install Apache and CertBot, making it straightforward to run the test as many times as you want, the same fresh installation every time.

                The steps are outlined below to describe the process although the script can be run during the initial setup as well.
                /home/user/certbot-reinstall.sh
                The script does the following:
                #!/bin/bash
                sudo apt-get -yq remove --purge python3-certbot-apache
                sudo apt-get -yq remove --purge apache2
                sudo rm -rf /etc/letsencrypt
                sudo rm -rf /etc/apache2
                sudo apt-get -yq --ignore-missing install python3-certbot-apache
                • Test with browser:
                  • http://tgacme.com - Shows the Apache default web page
                  • https://tgacme.com - Shows an error that the browser cannot connect.
                • sudo certbot --server https://ejbca.example.com:8442/ejbca/acme/directory -d tgacme.com --apache --agree-tos --email admin@example.com --no-eff-email --noninteractive
                • Test with browser:
                  • https://tgacme.com - Connects and shows the Apache default web page.
                • Show the web server certificate in the browser (and verify that it comes from the private Management CA)

                CertBot on a Fresh Ubuntu 18.04 or Lower Host

                Without updating the Ubuntu repos, the client that will be installed is 0.23. This is older and not supported by EJBCA version > 7.3.0.

                To install a newer CertBot version, use the following commands:
                sudo apt-get -y update
                sudo apt-get -y install software-properties-common
                sudo add-apt-repository -y universe
                sudo add-apt-repository -y ppa:certbot/certbot
                sudo apt-get -y update
                sudo apt-get -y install certbot python3-certbot-apache 

                Cheers,
                Tomas Gustavsson
                CTO 

                 EJBCA Enterprise PKI and PKI Appliance developed by PrimeKey.

                EJBCA is a registered trademark of PrimeKey Solutions AB in the EU, the United States, Japan and certain other countries.

                Supporting EdDSA - The Details

                $
                0
                0

                About EdDSA

                EdDSA is a fairly new signature algorithm, at least if we compare to the classic algorithms we use, where RSA was introduced in 1977 and ECDSA entering wide use in the early 2000's. In contrast EdDSA was published in 2011. EdDSA is meant to be simple, elegant, and well defined, so it is hard to make security catastrophic mistakes upon use, something that is rather easy to do with the classic algorithms. EdDSA, with regards to digital signatures, consist of two distinct variants, Ed25519 and Ed448, with different key lengths. The usage of EdDSA, as relevant for us, has been standardized in RFC8032, RFC8410 and RFC8419.

                EdDSA in EJBCA

                Albeit not very widely used, we have been asked on occasions for support of EdDSA in EJBCA, commonly in IoT related use cases. Due to these requests we added software support for Ed25519 and Ed448 in EJBCA 7.4.0 in June 2020. As EJBCA is used in high security PKIs, Hardware Security Modules are typically used, and we have recently tested support for EdDSA in HSMs. 

                This post describes the details of what is involved in supporting this new signature algorithm, in software and in hardware. The final result can be seen in the EJBCA documentation.

                A note of caution: implementing cryptography is not for everyone, and we could not have done it without the help of our friends from Bouncy Castle, who helped us with the hard core details, and even gave us an introductory training session on the specific topic of EdDSA. Bouncy Castle support contracts are available though Crypto Workshop.

                Software Support

                The first step when supporting a new algorithm for PKI usage, in Java, is to get all the ASN.1 and Java crypto stuff in place. Without that, there is no going forward. This includes at least, but not exclusively the following parts:

                • ASN.1 Object identifiers
                • Public and Private key classes
                • Reading and writing (encoding and decoding) said public and private keys
                • SubjectPublicKeyInfo ASN.1 structures for properly encoding public keys in certificates and CSRs
                • Signatures themselves, on at least certificates, CRLs, CSRs, OCSP responses and CMS messages
                • Conversion between names (for example Ed25519) and OIDs (1.3.101.112)

                A specific trick worth mentioning, that we stumbled upon, is that there are two versions of encoding/decoding format of EdDSA. A version 1 and a version 2, where different software implementation, for example OpenSSL, produces the v1 format, while others produce the (newer) v2 format. Needless to say, we needed to handle both.

                For EJBCA, we are lucky to use the Bouncy Castle crypto APIs, which are commonly among the first to implement anything new. As Bouncy Castle had support for all the relevant RFCs EJBCA could start adding the application layer support right away. There were a few additions needed on the way, mostly related to various corner cases or handling encoding/decoding of keys and PKCS#12 files from different sources, that needed minor additional features in Bouncy Castle. As always, they were fast to add the needed tricks in the crypto API.

                Usability

                Apart from the core crypto pieces, EJBCA also implement a bunch of usability features making it easy(!) for users to use PKI with various algorithms. With EdDSA being so simple, both the keys and signature algorithm is referred to Ed25519 and Ed448, it still needed some extra code to fit into the overall structure. For the classic algorithms there are countless combinations, for example an RSA 2048 bit key can be used with all RSA signature algorithms:

                • SHA256WithRSA
                • SHA384WithRSA
                • SHA512WithRSA
                • SHA256WithRSAandMGF1
                • ...

                Just to name a few. And the same goes for ECDSA, but with even more combinations are there are numerous different EC curves to choose from. All in all there are hundreds of combinations that can be used in EJBCA, and we try to make it easier by or example limiting the available signature algorithms based on the selected key type. So albeit EdDSA having limited number of combinations, some if's and but's in the code is still needed for it to fit in the overall usability framework.


                Another trick we play is that a suitable key encryption algorithm is selected, for Key Recovery, based on the signature algorithm used, typically this means selecting an RSA based algorithm, and we have a method for this, where EdDSA had to be added as well.

                Adding HSM Support

                We, and most of the world, use HSMs through the standard PKCS#11 API. In the until recently latest version of PKCS#11, version 2.40, there was no standardized support for EdDSA. As there was still a requirement from some users for EdDSA, the inevitable result was that some HSM vendors supported EdDSA using what is called Vendor Defined Mechanisms. This is of course a nightmare for product implementors, as specific support has be be built for HSMs from different vendors. PKCS#11 version 3 however, which was released only this year, introduced standardized support for EdDSA.

                Now HSM vendors have moved to use the standardized way of supporting EdDSA, which means it's a good time for us to look at supporting HSMs for this algorithm.

                Having recently introduced the P11-NG Crypto Token in EJBCA Enterprise, we have low level control of PKCS#11, as used by EJBCA, which was needed in order to support this new feature, P11v3 feature in a P11v2.40 library. In addition, SoftHSMv2 has support for EdDSA, making it easy to develop without access to a real hardware security module.

                The last trickery showed up when generating keys and reading them from the HSM. According to the PKCS#11v3 specification the EdDSA public key is generated using the mechanism CKM_EC_EDWARDS_KEY_PAIR_GEN with the same parameters as a normal ECDSA key, which means that a CKA_EC_PARAMS is used in the public key template, with the OID of the curve as parameter, in this case the OID of Ed25519. The public key is then stored as a CKA_EC_POINT. The CKA_EC_POINT is normally used to store EC curve points, but in the case of Ed the point it's not quite the same. This required an if statement and some special handling in the case of EdDSA keys.

                In the case of ECDSA:

                final java.security.spec.EllipticCurve ellipticCurve = EC5Util.convertCurve(bcspec.getCurve(), bcspec.getSeed());
                final java.security.spec.ECPoint ecPoint = ECPointUtil.decodePoint(ellipticCurve,
                        ASN1OctetString.getInstance(ckaQ.getValue()).getOctets());
                final org.bouncycastle.math.ec.ECPoint ecp = EC5Util.convertPoint(bcspec.getCurve(), ecPoint);
                final ECPublicKeySpec pubKeySpec = new ECPublicKeySpec(ecp, bcspec);
                final KeyFactory keyfact = KeyFactory.getInstance("ECDSA", BouncyCastleProvider.PROVIDER_NAME);
                return keyfact.generatePublic(pubKeySpec);

                 and in the case of EdDSA:

                X509EncodedKeySpec edSpec = createEdDSAPublicKeySpec(ckaQ.getValue());
                final KeyFactory keyfact = KeyFactory.getInstance(oid.getId(), BouncyCastleProvider.PROVIDER_NAME);
                return keyfact.generatePublic(edSpec);

                As usual, a big thanks to the team at Bouncy Castle for help.

                Summary

                With all the above details in place, we now have the functionality we need in EJBCA:

                • Generating Ed25519 and Ed448 key pairs (in software and in HSMs)
                • Retrieve public keys
                • Test a key pair
                • Sign and verify
                  • Certificate
                  • CRL
                  • OCSP response
                  • CSRs (PKCS#10 and CRMF)
                  • CMS message
                • Read and write
                  • PEM files
                  • PKCS#12 files
                • Presenting EdDSA in Web UIs in a user friendly way 


                Cheers,
                Tomas Gustavsson
                CTO 

                EJBCA Enterprise PKI and EJBCA Appliance developed by PrimeKey.

                PrimeKey® and EJBCA® are trademarks of PrimeKey Solutions AB, in the EU, the United States, Japan and certain other countries.

                A laymans guide to EJBCA compliance tools

                $
                0
                0

                Compliance Overview

                Standards and other specifications that you may be required to show compliance with are usually large with many options. Many times these options are also described vaguely requiring some level of interpretation. Interpretations usually get to a point of common understanding between different stakeholders after some period of time. Adding insult to the injury is that interpretations and specifications also change over time. In addition, many standards are large and contain many parts that are irrelevant for most use cases, so implementing a standard to the letter is not cost efficient neither for the implementor nor for the user. 

                All this considered, compliance is not a trivial concept.

                Related specifically to PKI, a very small pick of some specifications that you may be asked to be compliant with includes RFC5280, RFC4210, RFC4211, RFC7030, RFC8555, RFC6010, RFC6960, RFC3739, CA/B Forum BR 1.7.3, EV SSL Certificate Guidelines 1.7.4, EV Code Signing Guidelines v. 1.4, 3GPP 33.310, EN 319 401, EN 319 411, EN 319 412, ETSI TS 119 495, ICAO 9303, PCI-DSS, NIST SP 800-73, FIPS 201-2, FPKIPA, ETSI TS 103 097, IEEE 1609.2, just to name a few.

                It is safe to say that any type of compliance requires a fair amount of knowledge about a lot of details.

                Implementation or Operation

                A question that comes up is who manages compliance. Is it the implementor of a product or the organization operating the product delivering a service? In reality it is usually somewhere in between. Products should implement capabilities of configuring them, by the operator, to be compliant. Due to the number of standards, each requires different configurations and a configuration compliant with one specification may be non-compliant with another specification, here it is up to the operator to keep track of configuration.

                Compliance over Time

                Compliance with various standards is most of the time possible to demonstrate at a specific point in time, still considering that you don't fully implement many standards. But compliance is hard to keep up in the long run as specifications evolve constantly, interpretations change in various forums (some closed and some open). Just considering the sheer number of specifications to be compliant with, and the number of forums where these are handled in practice makes it impossible for the people actually implementing the standards to keep track of everything that is going on.

                Compliance is continuous work, it is not a one-time effort.

                Falling out of Compliance

                How does it happen that an organization, being compliant once, becomes non-compliant? There are a number of reasons this can happen, including but not limited to:

                • Compliance specification updates

                • Specification re-interpretation in the governing forum

                • Discovery of previously non-discovered compliance details

                • Accidental re-configuration of the system

                • Deliberate re-configuration of the system to achieve one compliance, breaking another

                • Software bugs

                As understood by now, maintaining compliance requires continuous work and tools to monitor the system and compliance, as well as to track changes and ensure it's done in a controlled and repeatable way.

                Do I need Compliance?

                This question has to be answered by yourself of course. There are basic things you absolutely want to be compliant with, such as RFC5280, if you want to be interoperable with various client software. There are other things that may become more of a burden, say a WebTrust or eIDAS audit if you do not have any external driving force for these. The reasons for compliance with the range of standards (a few listed above can be ranging depending on your use case:

                • As wide interoperability as possible
                • Industry-specific standards
                • Regulations
                • External or internal security requirements
                • Generic trust posture (also internal or external)

                You typically don't want compliance requirements that force you to do things that drive cost without making sense for your specific use case.

                One Time vs Continuous Monitoring

                One time, and regularly occurring, compliance monitoring plays an important role. When implementing a new system, or a new requirement, it is normal to manually verify compliance. During regular audits this is also verified. During these verifications personnel with the needed skills analyze systems and output, creating appropriate configuration, controls and processes.

                During operation of the system you can deploy tools, that continuously validate the compliance achieved in the above step, ensuring that things don't start to break unexpectedly.

                Any serious compliance work should involve both the regularly occurring (one time) compliance audits and continuous monitoring.

                EJBCA Compliance Assisting Tools

                EJBCA comes with a large set of tools that can help you manage compliance over a long time, as well as monitor for unexpected changes, keep track of changes and perform changes in a repeatable way. Using these tools, tailored for your specific needs, can help lower the risk of falling out of compliance.

                These tools are numerous and it can be hard to keep track of all of them. This blog post outlines the most important ones, as of the writing date. New tools are continuously developed, and new documentation added, so be sure to check the product documentation and release notes when new versions of EJBCA are released.

                Also note that different tools are more or less easily available on different platforms. For example using an Appliance or Cloud installation with limited access to the command line limit available options to run local scripts and similar.

                Validation and Compliance features

                This is a list of different features in EJBCA that are useful for compliance work. It is not possible to say which you should use for specific deployments and which not, as each environment is unique. 

                The list starts with basic configuration, and ends up with more specific tools.

                Naturally this list is a snapshot in time when this blog is posted, and also does not describe all possible features in EJBCA, but a subset.

                Certificate Profiles

                In certificate profiles you configure the basic technical contents of certificates. It specifies the certificate contents, in detail. What type of keys they can contain, what certificate extensions (such as key usage) should be present, and what can be overridden by the caller (RA or user). This is the static content of a type of certificate.

                See Certificate Profiles Overview in the EJBCA documentation.

                Important compliance fields are:

                End entity profiles

                The end entity profile defines the dynamic, or user-specific fields, of a certificate along with some meta data.

                See End Entity Profiles Overview in the EJBCA documentation.

                The most important fields are the Subject DN fields. Subject DN fields define, unless DN Override is allowed in the certificate profile, which subject DN fields must be present and which may be present. Other DN attributes that are not enabled in the end entity profile is not allowed.

                You can also enable validation of requested DN fields, by configuring the Validation field which is present for every configured DN field. This enables regexp validation of fields, for example size and other format restrictions.

                Validators

                Validators are functions that can be used to validate various aspects of a request. It is possible to use both built-in validators and external scripts.

                The built-in validators are:

                • RSA and EC Key Validators. Validates that public keys fulfill CA/B Forum Guidelines, including FIPS 186-4 and NIST (SP 800-89 and NIST SP 56A: Revision 2) requirements, and is not a ROCA (CVE-2017-15361) weak key.

                • Public Key Blocklist Validators: Validates that the public key not on one of the blocklists, uploaded by an administrator. Most commonly used to check that the key is not one of the old Debian weak keys.

                • Domain Blocklist Validator. Validates domain names to issue certificates for (as subject alternative DNSName's) against a administrator defined blocklist, i.e. domains forbidden to issue for.

                • CAA Validator. Validates domain names to issue certificates for (as subject alternative DNSName's) according to RFC 8659.

                • Google Safe Browsing Validator. Validates domain names to issue certificates for (as subject alternative DNSName's) against Google Safe Browsing database, i.e. that it is not a known phishing or malware spreading site.

                In addition to the built-in validators you can also call external scripts with the External Command Certificate Validator. For example using a tool such as Zlint to check the certificate against CA/B Forum requirements, or the eIDAS Inspector to check against eIDAS requirements.

                Validation can be performed in various stages of issuance, before or after the actual certificate has been created and signed. Check the documentation for the details.

                Audit logging

                Of course you can not talk about compliance without mentioning audit logging. Audit logs can be produced on file, shipped to syslog, and stored in the database. Audit logging is there to give a trace of every security related event in the PKI system. This is not the same as everything that happens, and an audit log is separate from a complete event log. For example, events that cause a change (such as issuing a certificate or editing a profile) are audit logged, while events that do not change anything (such as reading revocation status to send an OCSP response) are not logged because nothing was changed. At the same time, non-changing events such as granting access, or receiving a certificate request are also logged. It's not black and white, but it is documented.

                For the compliance and monitoring topic you will always be able to see in the audit log if a profile was changed. You will be able to see who, when and what changed. You can of course have triggers in your monitoring system on these events so no profile changes can happen undetected.

                Validation/Conformance tool

                In addition to other validation tools, there is also a separate Validation/Conformance tool shipped with EJBCA. The special feature about this tool is that it is a standalone tool that compares issued certificates (and OCSP responses) to a template that you create. Once you have a certificate the looks exactly the way you want it, you can compare the issued certificate with that to get an alarm if they suddenly stop matching. This is useful to detect configuration changes that cause some unexpected change to the output.

                It can also validate only a sampling, say every 100th, issued certificate or OCSP response, making it suitable for high performance deployments where you can't afford the validation latency in every certificate.

                ConfigDump

                 A tool designed to make repeatable installation and configuration simple is ConfigDump. ConfigDump enables you to export configuration, of almost everything, as human-readable, and machine parsable YAML. You can use the exported YAML files for multiple purposes, including but not limited to:

                • Creating and testing profiles and other configuration on a test system before moving it to production, where it can be imported.

                • Version control of configuration, tracking configuration in a VCS such as Git.

                • Configuration monitoring, exporting configuration nightly and comparing it to a defined version in the VCS.

                These are just some possible usages of ConfigDump, making it a great tool for compliance configuration and monitoring.

                Configuration checker

                For Administrators using the CA UI of EJBCA the experimental Configuration Checker, gives an immediate overview and warnings about some common misconfigurations that we have noticed out there.

                Publishers

                Publishers, while being used for the Validation/Conformance tool, can also be used for any custom validation that you may imagine, including sending certificates to your personal archive, an S3 bucket, or similar ideas.

                Performance! How to use EJBCA as a Massive PKI!

                $
                0
                0

                Are  your CRLs are scaling out of proportion, clients are complaining about timeouts and your VA is on its knees? Are your certificates counted not by thousands but by the millions? Never to fear, EJBCA is designed to handle some of the world's biggest PKI, so read on to find out how!

                What can you do about your Architecture?

                A large part of scaling up is adapting the architecture of your PKI to meet the requirements. Before we move on, here are two basic design choices that are the key to every large scale PKI.

                Clustering and Load Balancing

                The first step to being able to handle more issuances and traffic is by clustering: splitting the load between several instances of EJBCA working in concert. This has the added bonus of adding a layer of reliability to your PKI, a cluster can always survive one or more of its nodes failing. EJBCA has been designed to allow for hot-upgrading, meaning that your PKI is still active and running while the nodes in your cluster are running different versions of EJBCA, with zero downtime as a result. 


                Likewise, clustering can be performed on VAs or RAs to easen to load on your PKI, depending on where your PKI is having performance issues:

                • If you're experiencing long response times or timeouts in your VA infrastructure, then either the VA's HSM or the database are overloaded by queries - this can simply be solved by adding more VAs, but also by clustering the VA instances. 
                • If you're issuing/revoking certificates in large volumes, clustering the CAs will allow more nodes to do the work of revoking and publishing. Each revocation sent out to the VA's is just a single write per cluster.
                Essential if your have multiple VAs/VA clusters is to place them behind a Load Balancer in order to balance the load on each VA. 

                Database Sharding

                For databases of extreme volumes, it may be desirable to shard the database over several database instances in order to save space.  By setting the following value to true in database.properties:

                database.useSeparateCertificateTable = true

                the certificate body will be stored in the table Base64CertificateData instead of CertificateData


                Base64CertificateData can then be sharded and placed on a different database volume. 

                CRL Partitioning

                If your population of unexpired certificates is large and you rely on CRLs, you might start finding that CRL generation times are beginning to spin out of control, and that CRL sizes becomes unmanageable. EJBCA supports CRL partitioning in accordance with RFC 5280, allowing certificates to be assigned to a specific CRL shard. 

                CRL partitioning means that instead of a single CRL, the CRL is split into several shards. As the shards grow themselves in size, EJBCA allows you to suspend shards, automatically creating new ones. 

                Service Pinning

                In a clustered EJBCA instance, service execution happens at semi-random, the service being run by the first node to activate within the granted service interval. If some services - for example generating CRLs - are taking an inordinate amount of time, you may be experiencing latency in the cluster node executing the service, leading to intermittent delays being experienced while the service is running. The easiest solution is to pin the service to a single node and remove that node from the load balancer's roster, meaning that all service executions will happen on that node only, while enrollment, issuance and revocation operations are processed on the remaining node. 





                Ephemeral Certificates

                EJBCA can be configured to function as an Ephemeral Certificate CA. In this mode EJBCA simply functions as a high speed certificate factory, issuing certificates but not storing any trace of them in the local database.

                While the mode still allows for revocation of certificates, it does not allow for certificates to be searched for in the database or for any constraints based on existing certificates to be enforced.

                Precompiled OCSP Responses

                Each OCSP reply requires an individual signature by the crypto token on the VA. While generated responses are cached by the EJBCA VA,  validity times of OCSP replies are commonly short (< one day) and caches are not shared between nodes in a cluster, thus responses still need to be generated anew frequently. The traditional solution to this has been OCSP Stapling, caching the first reply encountered in the http proxy. While this may solve the problem to some extent, it moves the burden of administration of caching the replies over to you.

                Instead, EJBCA offers Precompiled OCSP Responses. Colloquially known as Canned OCSP, this functionality allows a VA to generate the full set of expected OCSP responses on a regular schedule within a set timeframe, when there are expected lulls in traffic. For any PKI, this will dramatically decrease the latency of the VA infrastructure.



                Enrolling chromeOS Devices against EJBCA

                $
                0
                0

                 Introduction

                chromeOS is an operating system based on Chromium (with Google Chrome as its primary UI) which is the default operating system on devices such as ChromeBooks, ChromeBoxes, ChromeBases and similar devices. In order to allow these devices to access the network, ensure internal network security and other PKI use cases, chromeOS can be easily set up to automatically enroll for certificates from EJBCA over the SCEP protocol. 

                This scenario requires three parties: 

                The Google Cloud Certificate Connector is a service installed on a third device which acts as an enrollment and administration portal for the enrolling chromeOS devices. 

                EJBCA Configuration

                As a part of this tutorial, it's assumed that you've already installed EJBCA and configured a CA you would like to enroll against. 

                Certificate Profile

                The pertinent fields in the Certificate Profile to set are as follows:
                • Authority Key Id: Use
                • Subject Key Id: Use
                • Key Usages: Digital Signature
                • Extended Key Usages: Client Authentication

                End Entity Profile

                The following values are expected to be available in the end entity profile:

                Subject DN Fields

                • Common Name (CN)
                • Organizational Unit (OU)
                • Organization (O)
                • Country (C)




                Subject Alt Names 

                • RFC 822 Name
                • DNS Name
                • IP Adress
                • MS User Principal Name


                SCEP Alias

                Lastly, the SCEP alias has been set up as follows:



                Google Cloud Certificate Connector

                Installation

                The Google Cloud Certificate Connector is downloaded when first setting up your Google Cloud account, as documented here. The Connector needs to be installed on a Microsoft Windows Server.

                To do so, perform the following steps:
                1. Create an Active Directory service account user which will run the Google Cloud certificate connector. This account must have a static password.
                2. Connect to the Google Admin Console with an administrator account
                3. Under Devices → Networks, select Secure SCEP connector
                4. The download connector page will give you access to:
                  1. The Connector Executable
                  2. The connector configuration JSON file (config.json)
                  3. The service account credentials JSON file (key.json)


                5. Copy all the files downloaded to the server hosting the Google Cloud certificate connector
                6. Run the installer as an Administrator






                7. Provide the AD service account user

                  Note: The connector cannot be installed with a non domain account

                8. Install the connector


                Configuration

                1. Put the connector configuration JSON file (config.json) and the service account credentials JSON file (key.json) in the Google Cloud certificate connector folder (Default location is: C:\Program Files\Google Cloud Certificate Connector).
                2. For the SSL handshake between the Google Cloud Certificate Connector and EJBCA to properly work, EJBCA's Management CA certificate needs to be added to the CA store of the Google Cloud certificate connector:
                  1. Locate the CA store of the Google Cloud certificate connector (default location is: C:\Program Files\Google Cloud Certificate Connector\rt\lib\security\cacerts)
                  2. Either install a Java SDK on the Google Cloud certificate connector server or copy the cacerts file to a computer where a Java SDK is installed
                  3. Add the Management CA certificate using keytool:

                    keytool.exe -import -keystore ./cacerts -trustcacerts -file <ManagementCA.pem> -storepass changeit



                  4. Copy the cacerts file back to the Google Cloud certificate connector server (default location: C:\Program Files\Google Cloud Certificate Connector\rt\lib\security) if keytool wasn’t run on the server itself.
                3. Start the Google Cloud Certificate Connector service.
                4. Check that everything is properly started in the event viewer:
                  1. The Google Cloud Certificate Connector should be able to parse its configuration:


                  2. Initialize the service


                  3. Every 30 second the service will check against the Google backend if there are any requests to process


                Adding your own CA to Google Cloud

                1. Connect to the Google admin console with an administrator account
                2. Under Devices → Networks → Certificates, select Add certificate. This should be done the root of the Google domain or for Chromebooks root OU


                3. Provide a name for the CA, or otherwise the common name of the issuer will be used), then upload the CA certificate in PEM format and choose to deploy on Chromebooks


                SCEP Profile Configuration

                1. Connect to the Google admin console with an administrator account.
                2. Under Devices → Networks → Secure SCEP connector, select Add secure SCEP profile. This can be done at the root domain level, at Chromebooks root OU in case of device certificates or Users root OU in case of user certificates.


                3. Set a profile name, subject and the key size. The following example is focused on issuing device certificates, but can easily be adapted for user certificates:

                  CSR subject fields are defined in the SCEP profile. Placeholder variables can be used in order to customize the CSR to the need. Available placeholder variables are defined in this article.

                4. If needed, Subject Alternative Names (SANs) can also be added:


                5. Configure:
                  1. The SCEP server URL, which should look something like https://<hostname>:<port>/ejbca/publicweb/apply/scep/<alias>/pkiclient.exe
                  2. the certificate characteristics
                  3. the static challenge (pass-phrase) used to authenticate the request coming from the Google Cloud certificate connector on the SCEP server and the corresponding certificate authority.


                6. Configure how this template should be applied on ChromeBooks, per user or per device:


                Testing

                1. Connect to a user session on the ChromeBook.
                2. Ensure that the device/user gets the policies to create the certificate request in chrome://policy (RequiredClientCertificateForDevice for a device certificate and RequiredClientCertificateForUser for a user certificate)
                3. Under chrome://certificate-manager, follow the certificate creation process.
                4. On the Google Cloud certificate connector event viewer, look for the following events:
                  1. Processed Requests


                  2. Google Cloud Certificate Connector submitting the SCEP request to EJBCA and receiving a certificate


                  3. ACK message between the Connector and the Google backend, pushing certificate to the Chromebook


                5. Check that the certificate has been properly added to the Chromebook under chrome://certificate-manager
                6. In the case of a device certificate, this process is also triggered just after a device enrollment


                Viewing all 76 articles
                Browse latest View live