atna-audit
Assists in the creation of ATNA audit trail messages for IHE profiles.
Last updated 3 years ago by bmartinos .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install atna-audit 
SYNC missed versions from official npm registry.

Build Status codecov.io

ATNA Audit Trail library

Assists in the creation of ATNA audit trail messages for IHE profiles.

Install with:

$ npm install --save atna-audit

Use the simple convenience function as follows:

var audit = atna.construct.userLoginAudit(atna.OUTCOME_SUCCESS, 'openhim', 'x.x.x.x', 'testUser', 'testRole', '123');
var syslog = atna.construct.wrapInSyslog(audit);

Or construct your own custom audits like this:

var eventID = new atna.construct.Code(110114, 'UserAuthenticated', 'DCM');
var typeCode = new atna.construct.Code(110122, 'Login', 'DCM');
var eIdent = new atna.construct.EventIdentification(atna.EVENT_ACTION_EXECUTE, new Date(), atna.OUTCOME_SUCCESS, eventID, typeCode);
var sysRoleCode = new atna.construct.Code(110150, 'Application', 'DCM');
var sysParticipant = new atna.construct.ActiveParticipant(sysname, '', true, sysIp, atna.NET_AP_TYPE_IP, [sysRoleCode]);
var userRoleCodeDef = new atna.construct.Code(userRole, userRole, userRoleCode);
var userParticipant = new atna.construct.ActiveParticipant(username, '', true, null, null, [userRoleCodeDef]);
var sourceTypeCode = new atna.construct.Code(atna.AUDIT_SRC_TYPE_UI, '', '');
var sourceIdent = new atna.construct.AuditSourceIdentification(null, sysname, sourceTypeCode);
var audit = new atna.construct.AuditMessage(eIdent, [sysParticipant, userParticipant], null, [sourceIdent]);
var xml = audit.toXML();

Sending an Audit to an ATNA supported server

Connection Details

var connDetails = {
  interface: 'udp|tls|tcp', // specify the interface to use when sending the audit
  host: 'localhost', // specify the host 
  port: 5050, // specify the port 
  options: { // when interface type is 'tls', you need to supply the certificate details
    key: fs.readFileSync('./path/to/key.pem').toString(), 
    cert: fs.readFileSync('./path/to/cert.pem').toString(),
    ca: fs.readFileSync('./path/to/cert.pem').toString(),
  }
}

Sending the Audit

atna.send.sendAuditEvent(msg, connDetail, function (err) {
  // handle errors if needed
})

Testing

To test the code you will need xmllint and trang on your PATH. sudo apt-get install libxml2-utils trang

Then run npm test

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

7 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |