elasticsearch-head plug to add safety certification

elasticsearch-head is a cluster management, data visualization, additions and deletions to check change, query visualization tools sentence; it can data additions and deletions to check change, for data security is at risk, and therefore minimize the use in a production environment, use the plug ip address or at least to limit the use of secure authentication login! Under the premise installed elasticsearch-head plug, if not installed, you can follow ELK7.1.1 installation of the plug-in installed, mainly to modify index.html under the directory elasticsearch-head

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>elasticsearch-head</title>
        <link rel="stylesheet" href="_site/base/reset.css">
        <link rel="stylesheet" href="_site/vendor.css">
        <link rel="stylesheet" href="_site/app.css">
        <script src="_site/i18n.js" data-baseDir="_site/lang" data-langs="en,fr,pt,zh,tr,ja"></script>
        <script src="_site/vendor.js"></script>
        <script src="_site/app.js"></script>
        <script>
            var loginClick = function() {
                <!--下面是我们的user、passwd的配置-->
                if(document.getElementById("userName").value!="admin" || document.getElementById("userPassword").value!="wzxmt"){
                   document.getElementById("isNotVerified").style.display="block";
                   return;
                } else {
                    document.getElementById("loginDiv").style.display="none";
                }
                if(location.href.contains("/_plugin/")) {
                    var base_uri = location.href.replace(/_plugin\/.*/, '');
                }
                var args = location.search.substring(1).split("&").reduce(function(r, p) {
                    r[decodeURIComponent(p.split("=")[0])] = decodeURIComponent(p.split("=")[1]); return r;
                }, {});
                new app.App("body", {
                    id: "es",
                    base_uri: args["base_uri"] || base_uri,
                    auth_user : args["auth_user"] || "",
                    auth_password : args["auth_password"],
                    dashboard: args["dashboard"]
                });
            };
        </script>
                <! - disable right -> 
                < Script >  
                        document.oncontextmenu =  function () { 
                                       Alert ( ' guy, like doing! ' );
                                        Return  to false ; 
                                } 
                </ Script >  
                <! - Disable F12 -> 
                < Script >  
                       document.onkeydown =  function () {
                            IF (the window.event && window.event.keyCode == 123) {
                               alert("又想偷窥源码");
                               event.keyCode=0;
                               event.returnValue=false;
                           }
                           if(window.event && window.event.keyCode == 13) {
                               window.event.keyCode = 505;
                           }
                           if(window.event && window.event.keyCode == 8) {
                               Alert (STR+ " \ N-Del key using the delete operation of the character! " ); 
                               Window.event.returnValue = to false ; 
                           } 
                       } 
                </ Script >  

        < Link the rel = "icon" the href = "Base / favicon.png" type = " Image / PNG " > 
    </ head > 
    < body > 
        < div width =" 100% " name =" loginDiv " ID =" loginDiv " style =" text-align = left: Center; ">
            <div width="100%" style="text-align: center;">登录<br></div>
            <div width="100%" style="text-align: center;">用户名:<input type="text" name="userName" id="userName"></div><br>
            <div width="100%" style="text-align: center;">密 码:<input type="password" name="userPassword" id="userPassword"></div><br>
            <div width="100%" style="text-align: center;"><button onclick="loginClick();">确定</button></div><br>
            <div width="100%" id="isNotVerified" style="text-align: center;display: none"><font color="red">div> </font</User name or password is entered incorrectly><br>
        </div>
    </body>
</html>

 Under normal circumstances, just press the right or F12, you can see our certification information, therefore, you need to disable the right and F12, just add the following code to

<! - disable right -> 
       < Script >  
               document.oncontextmenu =  function () { 
                              Alert ( ' guy, like doing! ' );
                               Return  to false ; 
                       } 
       </ Script >  
<! - Disable F12 -> 
       < Script >  
              document.onkeydown =  function () {
                   IF (the window.event && window.event.keyCode ==  123 ) {
                      Alert ( " want peeping source " ); 
                      event.keyCode = 0 ; 
                      event.returnValue = to false ; 
                  } 
                  IF (the window.event && window.event.keyCode ==  13 is ) { 
                      window.event.keyCode =  505 ; 
                  } 
                  IF ( window.event && window.event.keyCode ==  8 ) { 
                      Alert (str + " \ the n-use Del key to delete a character! ");
                      window.event.returnValue=false;
                  }
              }
       </script> 

 

Guess you like

Origin www.cnblogs.com/wzxmt/p/11101983.html