A fundamental component of Hadoop clusters and security models is Accounting. Along with identification, authentication and authorization functions for users and services, it is with Audit log capabilities that the security ecosystem is complete. Hadoop components handle accounting differently depending on the purpose of the component. Components such as HDFS and HBase are data repositories whereas MapReduce, Hive, Impala are query engines and processing frameworks. So, the auditable events are unique for different elements.
HDFS Audit Logs
HDFS provides 2 different audit logs – hdfs-audit.log is used audit general user activity. SecurityAuth-hdfs.audit is used to audit service-level authorization activity. The setup for these logfiles involves hooking into log4j.category.Securitylogger and log4j.additivity.org.apache.hadoop.hdfs.server.namenode.FSNamesystem.audit.
Auditable events show various actions performed e.g. listStatus, create, setPermission, rename etc. Also, the logs demonstrate who the user is that the event was for, timestamp, IP address and various other bits of information. Also, all unsuccessful access attempts will be recorded.
MapReduce Audit Logs
MapReduce follows a similar approach, it contains 2 audit log files – mapred-audit.log and SecurityAuth-mapred.audit.
Let’s take an example –
- User Alice is identified by Kerberos principal firstname.lastname@example.org and she has successfully used kinit to receive a valid TGT
- MapReduce service-level authorization is not being used
- Alice submits a MapReduce job
- Alice kills the MapReduce job before it finishes
Example 1 (mapred-audit.log)
. . . 2016-10-14 18:11:46, 363 INFO mapred.Auditlogger: USER=alice IP=10.1.1.1 OPERATION=SUBMIT_JOB TARGET=job_201403112320_0001 RESULT=SUCCESS Example 2 (SecurityAuth-mapred.audit) . . . 2016-10-14 18:46:25, 200 INFO Securitylogger.org.apache.hadoop.ipc.Server: Auth successful for email@example.com (auth:SIMPLE) 2016-10-14 18:46:25,240 INFO Securitylogger.org.apache.hadoop.security.authorize.ServiceAuthorizationManager : Authorization successful for firstname.lastname@example.org (auth:KERBEROS) for protocol=interface.org.apache.mapred.JobsubmissionProtocol . . . 2016-10-14 18:47:11, 598 INFO Securitylogger.org.apache.hadoop.ipc.Server: Auth successful for email@example.com (auth:SIMPLE) 2016-10-14 18:47:11,667 INFO Securitylogger.org.apache.hadoop.security.authorize.ServiceAuthorizationManager : Authorization successful for firstname.lastname@example.org (auth:KERBEROS) for protocol=interface.org.apache.mapred.JobsubmissionProtocol . . .
Example 1 shows Alice performed the operation SUBMIT_JOB which results in MapReduce job id - job_201403112320_0001 along with date time and IP. Example 2 shows Alice authentication to job tracker, authorization and when Alice kills the running job.
YARN Audit Logs
YARN audit log events are scattered among the daemon logfiles. But they are easily identifiable because the class name is logged in the event. For the resource manager, it is org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; and for the name manager it is org.apache.hadoop.yarn.server.nodemanager.NMAuditLogger. These class names can be used to parse out audit events from normal application logs. For YARN to log audit events, the log4j properties need to be set and the hook to set this up is the log4j.category.SecurityLogger.
HIVE Audit Logs
Hive auditing is like YARN in that it does not have a dedicated audit logfile. Audit events occur inside the actual Hive metastore service log so it can be a bit of a challenge. However, the audit logger class names can be used to identify audit events. Other Hive components, such as Hive-Server 2, do not have explicit auditing, but Audit like information can still be gleaned from the service logs.
The audit events are tagged to org.apache.hadoop.hive.metastore.HiveMetaStore.audit. This makes it easier to search the logs specifically for audit events.
With Hive, only the username is shown instead of the full Kerberos UPN, the action performed by the user is identified by the cmd field.
Cloudera Impala Audit Logs
Impala Audit trails are logged into dedicated audit logs used by each Impala daemon (impalad). The audit log directory is specified using the flag audit_event_log_dir. A typical choice is the directory /var/log/impalad/audits. These logfiles are rolled after they reach a certain “size” dictated by a number of lines, as specified using the flag max_audit_event_log_file_size. A reasonable setting is 5,000 lines.
We will discuss HBase, Accumulo, Sentry and Log Aggregation in the next part.
As the industry is adopting Hadoop based Data Lakes, security is also maturing to enable CISO/CIO and business information security analysts to do forensics from an Audit perspective. Telecom, BFSI clients are demanding Audit log capabilities with a “boots on the ground” approach. To this effect, a better understanding of Hadoop and its ecosystems is paramount to achieving business objectives.