Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1881

Shutdown server immediately upon PrivilegedActionException

    Details

    • Type: Improvement
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.4.5
    • Fix Version/s: 3.5.4, 3.6.0
    • Component/s: server
    • Labels:
      None

      Description

      It seems when an SaslServer cannot be created due to a PriviledgedActionException, it is better to shutdown the server immediately instead of letting it to propagate. The current behaviour will just set ServerCncx.zooKeeperSaslServer to null, and later every time when an SASL request comes in it will be rejected. If we already detect the loophole early, we should just reject it early.

      private SaslServer createSaslServer(final Login login) {
          catch (PrivilegedActionException e) {
              // TODO: exit server at this point(?)
              LOG.error("Zookeeper Quorum member experienced a PrivilegedActionException exception while creating a SaslServer using a JAAS principal context:" + e);
              e.printStackTrace();
          }
      

      For what it is worth, attaching an attempt to patch it. The idea of the patch is to propagate this PrivilegedActionException to ServerCnxnFactory and shut down all the connections and server. Not sure if this is the right way to solve it. Any comments are appreciated!

      Also in the patch are two additional logging on two unlogged exceptions.

        Attachments

          Activity

            People

            • Assignee:
              d.yuan Ding Yuan
              Reporter:
              d.yuan Ding Yuan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: