From hdfs-issues-return-277583-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Aug 14 16:53:23 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id E908D180651 for ; Wed, 14 Aug 2019 18:53:22 +0200 (CEST) Received: (qmail 91244 invoked by uid 500); 14 Aug 2019 16:52:04 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 91168 invoked by uid 99); 14 Aug 2019 16:52:02 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Aug 2019 16:52:02 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 45F76E304B for ; Wed, 14 Aug 2019 16:52:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 671D02778D for ; Wed, 14 Aug 2019 16:52:00 +0000 (UTC) Date: Wed, 14 Aug 2019 16:52:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Work logged] (HDDS-1768) Audit xxxAcl methods in OzoneManager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDDS-1768?focusedWorklogId=294865&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-294865 ] ASF GitHub Bot logged work on HDDS-1768: ---------------------------------------- Author: ASF GitHub Bot Created on: 14/Aug/19 16:51 Start Date: 14/Aug/19 16:51 Worklog Time Spent: 10m Work Description: bharatviswa504 commented on pull request #1204: HDDS-1768. Audit xxxAcl methods in OzoneManager URL: https://github.com/apache/hadoop/pull/1204#discussion_r313978226 ########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java ########## @@ -2999,23 +3016,36 @@ public OmKeyInfo lookupFile(OmKeyArgs args) throws IOException { */ @Override public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { - if(isAclEnabled) { - checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, - obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); - } - // TODO: Audit ACL operation. - switch (obj.getResourceType()) { - case VOLUME: - return volumeManager.addAcl(obj, acl); - case BUCKET: - return bucketManager.addAcl(obj, acl); - case KEY: - return keyManager.addAcl(obj, acl); - case PREFIX: - return prefixManager.addAcl(obj, acl); - default: - throw new OMException("Unexpected resource type: " + - obj.getResourceType(), INVALID_REQUEST); + boolean auditSuccess = true; + + try{ + if(isAclEnabled) { + checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, + obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); + } + switch (obj.getResourceType()) { + case VOLUME: + return volumeManager.addAcl(obj, acl); + case BUCKET: + return bucketManager.addAcl(obj, acl); + case KEY: + return keyManager.addAcl(obj, acl); + case PREFIX: + return prefixManager.addAcl(obj, acl); + default: + throw new OMException("Unexpected resource type: " + + obj.getResourceType(), INVALID_REQUEST); + } + } catch(Exception ex) { + auditSuccess = false; + auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL, Review comment: My comment is to change only modify the auditAcl as below. private void auditAcl(OzoneObj ozoneObj, List ozoneAcl, OMAction omAction, Exception ex) { Map auditMap = ozoneObj.toAuditMap(); if(ozoneAcl != null) { auditMap.put(OzoneConsts.ACL, ozoneAcl.toString()); } if(exception == null) { AUDIT.logWriteSuccess( buildAuditMessageForSuccess(omAction, auditMap)); } else { AUDIT.logWriteFailure( buildAuditMessageForFailure(omAction, auditMap, ex)); } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 294865) Time Spent: 4h (was: 3h 50m) > Audit xxxAcl methods in OzoneManager > ------------------------------------ > > Key: HDDS-1768 > URL: https://issues.apache.org/jira/browse/HDDS-1768 > Project: Hadoop Distributed Data Store > Issue Type: Sub-task > Reporter: Ajay Kumar > Assignee: Dinesh Chitlangia > Priority: Major > Labels: pull-request-available > Time Spent: 4h > Remaining Estimate: 0h > > Audit permission failures from authorizer -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org