当前位置: 首页 > news >正文

创业 做网站网站快照查询

创业 做网站,网站快照查询,建邺html5响应式网站,产品设计学什么使用session_exec 、file_fdw以及自定义函数实现该功能。 缺陷#xff1a;实测发现锁用户后#xff0c;进去解锁特定用户。只能允许一次登陆#xff0c;应该再次登陆的时候#xff0c;触发函数#xff0c;把之前的日志里的错误登陆的信息也计算到登录次数里了。而且foreig…使用session_exec 、file_fdw以及自定义函数实现该功能。 缺陷实测发现锁用户后进去解锁特定用户。只能允许一次登陆应该再次登陆的时候触发函数把之前的日志里的错误登陆的信息也计算到登录次数里了。而且foreign table不能在数据库里清理。需要删除对应的pg_log才能使foreign table信息清理掉来重制该用户的密码错误记录。 https://github.com/okbob/session_exec unzip session_exec-master.zip cd session_exec-master/ make pg_config$PGHOME/bin/pg_config make pg_config$PGHOME/bin/pg_config install更改配置文件 logging_collector on log_destination csvlog session_preload_librariessession_exec session_exec.login_namelogin更改完之后需要重启数据库 pg_ctl restart安装file_fdw扩展 cd contrib/file_fdw/ # 安装命令 make make install创建外部表postgres_log create extension file_fdw;CREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw;CREATE FOREIGN TABLE public.postgres_log( log_time timestamp(3) with time zone,user_name text,database_name text,process_id integer,connection_from text,session_id text,session_line_num bigint,command_tag text,session_start_time timestamp with time zone,virtual_transaction_id text,transaction_id bigint,error_severity text,sql_state_code text,message text,detail text,hint text,internal_query text,internal_query_pos integer,context text,query text,query_pos integer,location text,application_name text ) SERVER pglog OPTIONS ( program find /home/pg13/data/log/ -type f -name *.csv -mtime -1 -exec cat {} \;, format csv );grant SELECT on postgres_log to PUBLIC;如下设置的是5次 5次登录失败就锁定用户 create or replace function public.login() returns void as $$ declare res record; failed_login_times int 5; failed_login int 0; begin --获取数据库中所有可连接数据库的用户 for res in select rolname from pg_catalog.pg_roles where rolcanlogin t and rolname !postgres loopraise notice user: %!,res.rolname;--获取当前用户最近连续登录失败次数select count(*)from (select log_time,user_name,error_severity,message,detail from public.postgres_log where command_tag authentication and user_name res.rolname and (detail is null or detail not like Role % does not exist.%) order by log_time desc limit failed_login_times) AWHERE A.error_severityFATALinto failed_login ;raise notice failed_login_times: %! failed_login: %!,failed_login_times,failed_login;--用户最近密码输入错误次数达到5次或以上if failed_login failed_login_times then--锁定用户EXECUTE format(alter user %I nologin,res.rolname);raise notice Account % is locked!,res.rolname;end if; end loop; end; $$ language plpgsql strict security definer set search_path to public; 用户是否被锁/是否允许登陆可以查看pg_roles系统视图里的rolcanlogin字段。 验证密码失败 使用如下语句可以查询登陆失败的记录。 select log_time,user_name,error_severity,message,detail from public.postgres_log where command_tag authentication order by log_time desc limit 10 offset 0 解锁用户命令如下 alter user test_user login; 解锁同时需要删除pg_log下csv文件里的对应有改用户登陆失败的日志记录重制密码登录错误的记录否则可能会重复计算之前的错误登陆记录。
http://www.hkea.cn/news/14493044/

相关文章:

  • 深圳外贸soho网站建设win7 iis网站无法显示
  • 西安网站维护 策划app一般用什么开发
  • 上海营销型网站设计郴州seo推广
  • 网站开发的相关技术如何加入百度推广
  • 北京企业网站备案住建部网站2015年城市建设统计
  • 大型企业门户网站能力建设探索与实践销售类网站开发
  • 十堰 网站建设wordpress添加网易云音乐播放器
  • 网站建设shzanenwordpress-4.9.4 演示
  • 韩文网站域名备案如何自己弄一个网站
  • 营销型网站建设的价格营销型网站重要性
  • 网站结构有哪些wordpress用还得shopif好用
  • 兼职网站的建设目标怎么写淄博网站推广
  • 奇趣统计网站谁做的如何设计一款软件
  • 用什么做网站简单做新媒体国外网站
  • 长沙自动化网站建设上海比较有名的外贸公司
  • 环保网站设计规划书注册网站建设
  • 天津进口网站建设电话wordpress结构图数据库图
  • 2008iis7建立网站盐津铺子网络营销推广方法
  • 东莞网站优化是什么成都旅游网站建设地址
  • 冠县企业做网站推广上海网站建设千元漂亮
  • 哪个网站做视频挣钱网站用户细分
  • h5网站怎么做的吗公司网站建设合同模板
  • 柬埔寨旅游网站建设服装网站建设的利益分析
  • 镇江网站关键字优化机构wordpress 地图 注记
  • 网站行高wordpress pdf
  • 郑州市精神文明建设 网站学做网站论坛vip码
  • 广州市建设工程项目代建局网站手机网站建设 广州
  • 北京住房城乡建设部网站首页品牌网站建设的关键要点
  • 双拥网站建设申请太原网站改版
  • 百度竞价 百度流量 网站权重广东圆心科技网站开发