Vamshi Chigulla
ServiceNow Employee
ServiceNow Employee

Publisher Name: Primekey

Product: EJBCA Enterprise

 

About Primekey EJBCA Enterprise:

As the world’s most used PKI (Public Key Infrastructure), certificate issuing and management software, EJBCA Enterprise provides you with the basic security services for trusted identities and secure communication in any environment and use case. It is a multipurpose PKI software that supports multiple Cas/levels of CAs to enable you to build a complete infrastructure (or several) for multiple use cases within one instance of the software.

 

Servicenow Cloud Infrastructure has purchased licenses for the below four products from Primekey:

  1. EJBCA XS 
  2. EJBCA M 
  3. EJBCA RA 
  4. EJBCA VA

 

As part of SAMPro implementation we must create Discovery Models to calculate the utilisation of software, hence we need to trigger API or run CLI commands as part of Discovery to get software licenses from the device.

 

It is confirmed that we do not have any API or commands to grab software licenses from host/server, from Product owners in ServiceNow and also Primekey Vendor Service Engineering team. So we do not have automated process to identify the host with particular licenses.

 

The final solution approach followed by Service Cloud Infrastructure team is:

 

  1. Get the details of hosts/servers and EJBCA licenses list installed on those servers.
  2. Create scheduled job to query CMDB Table to grab list of servers for specific software license and feed the records into cmdb_sam_sw_install.

 

Code:

 var grLinux = new GlideRecord('cmdb_ci_linux_server');

                                grLinux.addQuery('nameLIKEejbca-rootca^ORnameLIKEejbca-subca^ORnameLIKEejbca-ra^ORnameLIKEejbca-va');

        grLinux.addQuery('operational_status','1');

                                grLinux.query();

                                gs.print("Records in NetGear table: " + grLinux.getRowCount()); 

                               

                                while (grLinux.next()) {

                                                var installedOn = grLinux.getValue("sys_id");

                                                var publisher = "PrimeKey";

                                                var displayName = "ejbca";

                                               

                                // Read data from Sam Install table

                                var grSamTable = new GlideRecord('cmdb_sam_sw_install');

                                                grSamTable.addQuery('installed_on',installedOn);

                                                grSamTable.addQuery('publisher',publisher);

                                                grSamTable.addQuery('display_name','CONTAINS',displayName);

                                                grSamTable.query();

                                                var matchCount = grSamTable.getRowCount();

                                                gs.print("Matching records in Sam table: " + matchCount + " for " + installedOn);

                                                if(matchCount < 1)

                                                                {

                                                                                var licensedetails;

                                                                                var license_name = grLinux.getValue("name");

                                                                                if(license_name.contains('ejbca-rootca'))

                                                                                                {

                                                                                                                licensedetails = 'EJBCA XS';

                                                                                                }

                                                                                else if(license_name.contains('ejbca-ra'))

                                                                                                {

                                                                                                                licensedetails = 'EJBCA RA';

                                                                                                }

                                                                                else if(license_name.contains('ejbca-va'))

                                                                                                {

                                                                                                                licensedetails = 'EJBCA VA';

                                                                                                }

                                                                                else if(license_name.contains('ejbca-subca'))

                                                                                                {

                                                                                                                licensedetails = 'EJBCA M';

                                                                                                }

                                                               

                                                                                //Inserting new record.

                                                                                grSamTable.next();

                                                                                grSamTable.initialize();

                                                                                grSamTable.setValue('display_name', licensedetails);

                                                                                grSamTable.setValue('installed_on', installedOn);

                                                                                grSamTable.setValue('publisher', publisher);

                                                                                grSamTable.setValue('active', true);

                                                                                grSamTable.insert();

                                                                }

                                }

 

Thanks,

Vamshi Krishna Chigullapally

Version history
Last update:
‎10-13-2021 03:59 AM
Updated by: