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

人民日报网站谁做的互联网销售包括哪些

人民日报网站谁做的,互联网销售包括哪些,北京网站建设推,如何做分享赚钱的网站使用session_exec 、file_fdw以及自定义函数实现该功能。 缺陷:实测发现锁用户后,进去解锁特定用户。只能允许一次登陆,应该再次登陆的时候,触发函数,把之前的日志里的错误登陆的信息也计算到登录次数里了。而且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_libraries='session_exec'
session_exec.login_name='login'

     更改完之后需要重启数据库

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_severity='FATAL'into  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.tj-hxxt.cn/news/87242.html

相关文章:

  • 做网站制作需要多少钱zac seo博客
  • 最新域名解析网站uc浏览器网页版入口
  • 个人现在可以做哪些网站产品网络推广怎样做
  • 网站下载免费新版网络营销论坛
  • 网站建设专家重庆搜索引擎seo
  • 公司做阿里巴巴网站要多少钱新闻近期大事件
  • 商务局网站溪江农贸市场建设如何发布自己的广告
  • 湖北做网站系统哪家好陕西优化疫情防控措施
  • 网站备案网站名称国内最好的危机公关公司
  • 网站网站建设哪家便宜网络营销服务的特点有哪些
  • 食品销售公司网站制作廊坊首页霸屏排名优化
  • 武汉网站优化seo微信上如何投放广告
  • 汕头独立站建站行业网站
  • www 上海网站建设推广软件排行榜前十名
  • 文山市住房和城乡建设局网站免费下载百度app最新版本
  • 外汇跟单网站建设简述网站建设的流程
  • 网站的产品图片怎样做清晰seo属于什么职业部门
  • wordpress复制数据库结构seo网站优化服务
  • 做胎压的网站怎么优化自己网站的关键词
  • 微信对接网站企业建站模板
  • 济南有哪些网站是做家具团购的产品推广的渠道
  • 价目表app制作电商沙盘seo裤子关键词
  • 公司网页制作网站公司网站建设方案
  • 建设投资平台网站百度一下你就知道了官网
  • 网站如何做中英文双语言版本沧州网站建设
  • 广州网站改版 网站建设百度推广登陆
  • 为企业建网站过时了购物网站网页设计
  • 温州建设集团官方网站电商关键词一般用哪些工具
  • 动态网站建设包括哪些方面微博推广技巧
  • 论坛网站建设百度一下百度网页版主页