Allow localhost graceful shutdown (#3650)

* Allow localhost graceful shutdown

* Update heron/shell/src/python/handlers/killexecutorhandler.py

Co-authored-by: Oliver Bristow <evilumbrella+github@gmail.com>

Co-authored-by: Oliver Bristow <evilumbrella+github@gmail.com>
diff --git a/heron/shell/src/python/handlers/killexecutorhandler.py b/heron/shell/src/python/handlers/killexecutorhandler.py
index 372770e..4dbed59 100644
--- a/heron/shell/src/python/handlers/killexecutorhandler.py
+++ b/heron/shell/src/python/handlers/killexecutorhandler.py
@@ -44,13 +44,16 @@
       logger.info("Killing parent executor")
       os.killpg(os.getppid(), signal.SIGTERM)
 
+    def is_local():
+      return self.request.remote_ip in ('localhost', '127.0.0.1', '::1')
+
     logger = logging.getLogger(__file__)
     logger.info("Received 'Killing process' request")
     data = dict(parse_qsl(self.request.body))
 
     # check shared secret
     sharedSecret = data.get('secret')
-    if sharedSecret != options.secret:
+    if not is_local() and sharedSecret != options.secret:
       status_finish(403)
       return