You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by alopresto <gi...@git.apache.org> on 2016/11/17 04:53:26 UTC

[GitHub] nifi pull request #1238: NIFI-3051 Fixed issue serializing commented or empt...

GitHub user alopresto opened a pull request:

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

    NIFI-3051 Fixed issue serializing commented or empty login-identity-p\u2026

    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?
    - [ ] 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)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] 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.
    
    \u2026roviders.xml.
    
    Updated and added unit tests. (+1 squashed commit)
    Squashed commits:
    [b187202] NIFI-3051 - checked in test demonstrating failure to serialize commented ldap-provider section.

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

    $ git pull https://github.com/alopresto/nifi NIFI-3051

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

    https://github.com/apache/nifi/pull/1238.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 #1238
    
----
commit decd5e4d6000a881ee867d9020a3b9e57673a03b
Author: Andy LoPresto <al...@apache.org>
Date:   2016-11-17T03:38:59Z

    NIFI-3051 Fixed issue serializing commented or empty login-identity-providers.xml.
    Updated and added unit tests. (+1 squashed commit)
    Squashed commits:
    [b187202] NIFI-3051 - checked in test demonstrating failure to serialize commented ldap-provider section.

----


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @YolandaMDavis please wait -- I realized I did not change the `serializeLoginIdentityProvidersAndPreserveFormat()` to use the new `class` criteria instead of the `identifier` as it was before. Need to provide a fix and test for that. 
    
    Also would like to get a fix for the logger stuff that was introduced in 1237 -- Maven build is fine but the tests that depend on asserting against `TestAppender` fail in IntelliJ for multiple developers. Removing the `<exclusion>` element for `ch.qos.logback:logback-classic` in `org.apache.nifi:nifi-properties-loader` in `nifi-toolkit-encrypt-config/pom.xml` resolves the test errors, but the built toolkit has logging issues because of conflicting logging libraries in the path. 


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    Example:
    
    ```
    # Commented login-identity-providers.xml file by default
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 62s @ 01:05:01 $ ./bin/encrypt-config.sh -b ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/bootstrap.conf -l ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml -k 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
    2016/11/18 01:05:11 WARN [main] org.apache.nifi.properties.ConfigEncryptionTool: The source login-identity-providers.xml and destination login-identity-providers.xml are identical [../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml] so the original will be overwritten
    2016/11/18 01:05:11 INFO [main] org.apache.nifi.properties.ConfigEncryptionTool: Loaded LoginIdentityProviders content (107 lines)
    2016/11/18 01:05:11 ERROR [main] org.apache.nifi.properties.ConfigEncryptionTool: No provider element with class org.apache.nifi.ldap.LdapProvider found in XML content; the file could be empty or the element may be missing or commented out
    
    # Uncomment the ldap-provider element
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 10s @ 01:05:12 $ subl ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml
    
    # Run the encrypt command against an empty ldap-provider element
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 26s @ 01:05:39 $ ./bin/encrypt-config.sh -b ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/bootstrap.conf -l ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml -k 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
    2016/11/18 01:06:02 WARN [main] org.apache.nifi.properties.ConfigEncryptionTool: The source login-identity-providers.xml and destination login-identity-providers.xml are identical [../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml] so the original will be overwritten
    2016/11/18 01:06:02 INFO [main] org.apache.nifi.properties.ConfigEncryptionTool: Loaded LoginIdentityProviders content (105 lines)
    
    # No populated passwords
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 24s @ 01:06:03 $ more ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml | grep Password
            'Manager Password' - The password of the manager that is used to bind to the LDAP server to
            'TLS - Keystore Password' - Password for the Keystore that is used when connecting to LDAP
            'TLS - Truststore Password' - Password for the Truststore that is used when connecting to
      <property name="Manager Password"/>
      <property name="TLS - Keystore Password"/>
      <property name="TLS - Truststore Password"/>
    
    # Populate passwords
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 21s @ 01:06:24 $ subl ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml
    
    # View the populated passwords
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 7s @ 01:06:32 $ more ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml | grep Password
            'Manager Password' - The password of the manager that is used to bind to the LDAP server to
            'TLS - Keystore Password' - Password for the Keystore that is used when connecting to LDAP
            'TLS - Truststore Password' - Password for the Truststore that is used when connecting to
      <property name="Manager Password">thisIsABadPassword</property>
      <property name="TLS - Keystore Password">thisIsABadPassword</property>
      <property name="TLS - Truststore Password">thisIsABadPassword</property>
    
    # Run the tool against the populated, uncommented ldap-provider
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 46s @ 01:07:19 $ ./bin/encrypt-config.sh -b ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/bootstrap.conf -l ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml -k 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
    2016/11/18 01:07:22 WARN [main] org.apache.nifi.properties.ConfigEncryptionTool: The source login-identity-providers.xml and destination login-identity-providers.xml are identical [../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml] so the original will be overwritten
    2016/11/18 01:07:22 INFO [main] org.apache.nifi.properties.ConfigEncryptionTool: Loaded LoginIdentityProviders content (101 lines)
    2016/11/18 01:07:23 INFO [main] org.apache.nifi.properties.AESSensitivePropertyProvider: AES Sensitive Property Provider encrypted a sensitive value successfully
    2016/11/18 01:07:23 INFO [main] org.apache.nifi.properties.AESSensitivePropertyProvider: AES Sensitive Property Provider encrypted a sensitive value successfully
    2016/11/18 01:07:23 INFO [main] org.apache.nifi.properties.AESSensitivePropertyProvider: AES Sensitive Property Provider encrypted a sensitive value successfully
    2016/11/18 01:07:23 INFO [main] org.apache.nifi.properties.ConfigEncryptionTool: Updated XML content: <?xml version="1.0" encoding="UTF-8"?><loginIdentityProviders>
      <provider>
        <identifier>ldap-provider</identifier>
        <class>org.apache.nifi.ldap.LdapProvider</class>
        <property name="Authentication Strategy">START_TLS</property>
        <property name="Manager DN"/>
        <property name="Manager Password" encryption="aes/gcm/256">1Fm/qp3OFXyDtrSp||jUTZZIoWWRmu+Z7/2a/oQrwi3c4QBW7sybIBGgH5/Xv9pg</property>
        <property name="TLS - Keystore"/>
        <property name="TLS - Keystore Password" encryption="aes/gcm/256">lHUTRoWGGGk5Mdvm||RC326w5m6/YenkB9QyeqAojZSkK2rn3SWc9Ug+XuRWrvgg</property>
        <property name="TLS - Keystore Type"/>
        <property name="TLS - Truststore"/>
        <property name="TLS - Truststore Password" encryption="aes/gcm/256">ZhobpvbTxi3uyhyd||CaqPbCXri6do3uGnVtO/hRv4fxtWEju56MesZxsWSFVAAQ</property>
        <property name="TLS - Truststore Type"/>
        <property name="TLS - Client Auth"/>
        <property name="TLS - Protocol"/>
        <property name="TLS - Shutdown Gracefully"/>
        <property name="Referral Strategy">FOLLOW</property>
        <property name="Connect Timeout">10 secs</property>
        <property name="Read Timeout">10 secs</property>
        <property name="Url"/>
        <property name="User Search Base"/>
        <property name="User Search Filter"/>
        <property name="Authentication Expiration">12 hours</property>
      </provider>
    </loginIdentityProviders>
    
    # Show the encrypted property elements
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 4s @ 01:07:24 $ more ../../../../../nifi-assembly/target/nifi-1.1.0-SNAPSHOT-bin/nifi-1.1.0-SNAPSHOT/conf/login-identity-providers.xml | grep Password
            'Manager Password' - The password of the manager that is used to bind to the LDAP server to
            'TLS - Keystore Password' - Password for the Keystore that is used when connecting to LDAP
            'TLS - Truststore Password' - Password for the Truststore that is used when connecting to
      <property encryption="aes/gcm/256" name="Manager Password">1Fm/qp3OFXyDtrSp||jUTZZIoWWRmu+Z7/2a/oQrwi3c4QBW7sybIBGgH5/Xv9pg</property>
      <property encryption="aes/gcm/256" name="TLS - Keystore Password">lHUTRoWGGGk5Mdvm||RC326w5m6/YenkB9QyeqAojZSkK2rn3SWc9Ug+XuRWrvgg</property>
      <property encryption="aes/gcm/256" name="TLS - Truststore Password">ZhobpvbTxi3uyhyd||CaqPbCXri6do3uGnVtO/hRv4fxtWEju56MesZxsWSFVAAQ</property>
    hw12203:...assembly/target/nifi-toolkit-1.1.0-SNAPSHOT-bin/nifi-toolkit-1.1.0-SNAPSHOT (master) alopresto
    \U0001f513 5s @ 01:07:30 $
    ```


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto was able to run tests both in IDE and Maven and reconfirmed test scenarios worked as expected.
    
    +1
    
    Ready for merge.


---
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 pull request #1238: NIFI-3051 Fixed issue serializing commented or empt...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto I rebased this with master and I have 7 tests are failing. I believe this may be due to recent changes in logging for toolkit, since all failed tests rely on assertions against events in the TestAppender class which doesn't get populated during the run.  Also I ran ConfigEncryptionToolTest in master (without this change) and the test is failing there as well.


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @jtstorck and I resolved the logging issue. Because the Zookeeper migrator has an explicit dependency on `log4j` instead of `slf4j`, `log4j` was competing with the existing `logback` implementation that was already present in the `lib/`. I switched the `TestAppender` implementation in `ConfigEncryptionToolTest` to extend `log4j`'s `AppenderSkeleton` instead of `logback`'s `AppenderBase<LoggingEvent>` and updated a couple tests. Now the tests run properly in both an IDE and Maven, and all the tools (TLS, ZK, and EC) run properly (print expected output to console and do not warn about multiple available logging implementations). 


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto actually correction, maven run of this test worked however individual execution of test in my IDE does not so this may not be an issue, probably a configuration problem on my end.


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    As @YolandaMDavis pointed out above, this branch came from a branch that was demoing the failed test, so it was not rebased against master. Due to the logging changes in [PR 1237](https://github.com/apache/nifi/pull/1237) there are differences in the logging infrastructure that need to be resolved. 


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    Copied from Jira discussion:
    
    > I am willing to look for `<class>org.apache.nifi.ldap.LdapProvider</class>` rather than a specific identifier, but much farther down that path would lead to anarchy \u2013 people have to define the XML content to validly define an LDAP provider, not just arbitrary passwords.


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    I talked to @YolandaMDavis -- she will review and give a final yes/no and then I can merge. 


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto just thought of a particular scenario.  If a user defines a provider with an identifier not equal to "ldap-provider" however has securable properties like those found in the ldap-provider template the tool currently does not catch that.  I'm wondering if it's possible to do something similar to what happens in nifi.properties where it searches for the value of password as a property and encrypts/decrypts that value?


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto agreed with fixing the test.  I've actually logged the issue here:
    
    https://issues.apache.org/jira/browse/NIFI-3060
    
    Once that is addressed and you've updated your test I can reevaluate.


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto thanks for the update.  Was able to retest with the following scenarios:
    
    encryption with fully commented file (as in the original template without edits)
    encryption with one provider (using an Ldap Provider class) commented out, another provider available
    encryption with ldap provider available
    
    All scenarios work as expected.
    
    +1
    
    Will merge shortly into master


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    I rebased against master and fixed the issue with `serialize...` I described above. For posterity, the un-rebased branch with the same fixes is still available [in my repo](https://github.com/alopresto/nifi/tree/NIFI-3051-before-rebase). 


---
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 #1238: NIFI-3051 Fixed issue serializing commented or empty login...

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

    https://github.com/apache/nifi/pull/1238
  
    @alopresto will review


---
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.
---