You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by trixpan <gi...@git.apache.org> on 2017/03/02 11:13:20 UTC

[GitHub] nifi pull request #1551: NIFI-3054 - Create default all default directions a...

GitHub user trixpan opened a pull request:

    https://github.com/apache/nifi/pull/1551

    NIFI-3054 - Create default all default directions as part of maven-as\u2026

    \u2026sembly
    
                Update Admin Guide with recommended directory permissions
                Update some minor file permissions
    
    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [X] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [X] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [X] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [X] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [X] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [X] ~~~Have you written or updated unit tests to verify your changes?~~~
    - [X] ~~~If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?~~~ 
    - [X] ~~~If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?~~~
    - [X] ~~~If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?~~~
    - [X] ~~~If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?~~~
    
    ### For documentation related changes:
    - [X] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/trixpan/nifi NIFI-3054

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/1551.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1551
    
----
commit ae16017443b7e59cf6804c1240ef63decd7e3aed
Author: Andre F de Miranda <tr...@users.noreply.github.com>
Date:   2017-03-02T11:11:14Z

    NIFI-3054 - Create default all default directions as part of maven-assembly
                Update Admin Guide with recommended directory permissions
                Update some minor file permissions

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create all default directories as part of mave...

Posted by PuspenduBanerjee <gi...@git.apache.org>.
Github user PuspenduBanerjee commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    Additionally, can we provide a script, that a sysadmin can use to audit and report any discrepancy in permissions ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create all default directories as part of mave...

Posted by trixpan <gi...@git.apache.org>.
Github user trixpan commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    @joewitt thanks for your comments. 
    
    I understand your concerns but isn't the user change of the default settings (we do ship with default location settings after all)  a voluntary action that implies further changes? 
    
    The way I see is a bit like: should Microsoft not ship Windows with default folder structures and permission just because someone may decide to install an application straight into c:\? 
    
    We by now know many users will not read the administration guide before playing with the platform (and sometimes rolling it to prod), what I am trying here is to help those users from harm caused by setting up what is for all intends and purposes a remote execution environment.
    
    The scenario I am trying to address here is: Think of someone who install NiFi in AWS instance, using the default settings as a linux service. That user went far enough to create a nifi user. Any attackers could:
    
    - Find instance
    - Add ExecuteScript processor
    - Change `$NIFI_HOME/bin/nifi.sh` to obtain persistent control over the node (note that when running as a service, this is still run as root, with the privilege drop happening WITHIN the script, not before)
    - Use the machine to launch DDoS against users.
    
    A normal answer would be: Just change the permissions of `$NIFI_HOME/bin`. Fair enough! But the challenge is that due to to the way Unix/Linux ACLs work, in order to truly change the settings of `$NIFI_HOME/bin` you must change the settings of `$NIFI_HOME`, otherwise you can always:
    
    - Move the `bin` to `bin.old`
    - Create a new `bin` directory
    - Copy all content from `bin.old` the new `bin`
    - Modify `nifi.sh`
    - Wait for system to restart
    Source: [1]
    
    To prevent the simple 3 steps above, we must change the permissions of $HOME_NIFI
    
    And the problem is: We cannot change the permissions of $HOME_NIFI without creating the directories representing the default settings, otherwise would crash on start, unable to start (due to permissions).
    
    So long history short, the idea here isn't to randomly create things where we don't need them, I am just trying to avoid we fall into the MongoDB track of "shipping with insecure default settings" as this can easily tarnish a project reputation (my LinkedIn feed was full of sales rep from competitors spreading the word about MongoDBs ransomware woes).
    
    Hope this helps to clarify what the objective of this PR is.
    
    [1]The first 3 steps of this technique is so old that I can't find references to it anymore, but IIRC, affected the good old SunOS 4.1.3. The two other steps have been used by me many times in PenTests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create all default directories as part of mave...

Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    It is prudent to restrict the ACLs of the files and directories we ship with to their most conservative level possible.  I'll refer to these as 'SA' (shipped artifacts) for my comments below.
    
    It is also prudent to ensure we restrict the ACLs of the files and directories our code creates to their most conservative level possible.  I'll refer to these as 'CA' (created artifacts) for my comments below.
    
    We control the permissions of SA through our build process which specifically is our maven assembly.  Your PR shows we have a few areas to tighten and we should.  These include, for example, the base install directory, the bin directory, the conf directory, NOTICE, LICENSE, etc..
    
    We do not, until this PR, control the permissions of our CA through our build process/maven assembly.  Our CA items should be controlled by the code creating these items in the most restrictive way possible and through honoring operating system settings for things like umask, etc..  And we should have clearly documented and allocated area(s) where CA items under default settings would go in the event that they are actually invoked/created.
    
    For cases where you'd like to make the base directory (an SA) more restrictive than it can presently be due to common/default settings that result in CA of things like flowfile/content/prov repositories then consider changing the default storage location of those CAs to a specifically controlled subdirectory like 'state' or something else.  We can then document this 'state' directory as the location accessible to the NiFi process to write to.  Keeping in mind of course that we have common practices today such as using conf directory for things like the flow.xml.gz and a directory under it for backup flows and so on.  There are some things to think through there.
    
    I think the mongodb lesson is important.  We have to continually revisit tradeoffs and decisions we've made regarding out of the box usability to support onboarding new users and the effort required to have a secured system.  We need to continually make 'out of the box ease' and 'security' come closer together.  I think we're all in agreement there.
    
    In summary, I'm supportive of us finding the most restrictive SA configuration we can.  I think we should adjust our code that generates CAs to create things as restrictive as possible.  I do think we should avoid pre-generating CA artifacts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create default all default directions as part ...

Posted by trixpan <gi...@git.apache.org>.
Github user trixpan commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    @alopresto may I ask your opinion on this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create all default directories as part of mave...

Posted by trixpan <gi...@git.apache.org>.
Github user trixpan commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    @joewitt. Thanks for the comment. I will go through your notes and adjust the PR accordingly. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1551: NIFI-3054 - Create all default directories as part of mave...

Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on the issue:

    https://github.com/apache/nifi/pull/1551
  
    @trixpan we cannot do this.  Several of these directories are configurable by the users and are subject to the selection of specific repository implementations.  We must avoid setting these.  Restricting the base install dir, the conf dir, license/notice is fine.  But the rest of these is a bridge too far.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---