ESP <strong>简介</strong><strong>安装运行</strong> 介绍
简介
-
由于Elasticsearch没有提供权限管理功能(官方shield又收费),特开发此Proxy,可以针对Elasticsearch Rest的路径设置权限,可以指定信任IP,支持用户,群组授权
-
当前版本0.01试用版。
-
框架基于PHP-Swoole扩展开发,用fast-route库来做http route处理。
安装运行
环境:linux2.6+、PHP5.5+、MysqL5.5+、swoole1.7.20+
下载:https://github.com/xtjsxtj/esp
tar zxvf esp.zip cd esp ./bin/esp start 查看当前server进程状态: ./bin/esp status
配置文件
系统级配置文件,全局生效,不能reload,只能restart
server_conf.PHP
<?PHP class server_conf { public static $config=array( 'server_name' => 'es_proxy', //server名称 'log_level' => NOTICE, //跟踪级别TRACE,DEBUG,INFO,NOTICE,WARNING,ERROR 'listen' => 9501, //listen监听端口 'worker_num' => 1, //工作进程数 'daemonize' => true, //是否以守护进程方式运行 'log_file' => '/home/jfy/testprog/esproxy/proxy/index.log', //log文件 ); }
工作进程配置文件,支持reload worker_conf.PHP
<?PHP class worker_conf{ public static $config=array( 'log_level' => NOTICE, 'es_url' => 'http://localhost:9200', 'trust_ip' => [ '127.0.0.1' ], 'groups' => [ 'cpyf' => 'jfy,zyw', ], 'users' => [ 'jfy' => '123456', 'zyw' => '123456', ], 'auths' => [ ['OPTIONS', '/{param:.+}', '*'], ['GET', '/{param:.+}', '*'], ['POST', '/{param1}/_search', '*'], ['POST', '/{param1}/{param2}/_search', '*'], ['PUT', '/kibana-int/{param:.+}', '*'], ['DELETE', '/kibana-int/{param:.+}', '@cpyf'], ], ); }
针对Elasticsearch的访问权限配置上,只需要修改worker_conf配置文件即可。
配置文件一看上去就应该明白了:
-
es_url,后端Elasticsearch http地址
-
trust_ip,信任的IP列表,不做任何权限限制
-
auths,访问详细rest路径权限设置
method restpath users
ESP <strong>简介</strong><strong>安装运行</strong> 官网
https://github.com/xtjsxtj/esp
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。