FATAL: password authentication failed for user “postgres”

前端 未结 4 1857
花落未央
花落未央 2020-12-30 10:54

getting this error message in ubuntu. in pg_hba.conf file, I tried using \'ident\',\'peer\',\'trust\',\'md5\' in different times.but no go. please help.

4条回答
  •  渐次进展
    2020-12-30 11:34

    It might be came from malicious traffic, check if the logs repeated almost each seconds like below

    2019-04-17 16:10:39.228 UTC [32] FATAL:  
            password authentication failed for user "postgres"
    2019-04-17 16:10:39.228 UTC [32] DETAIL:  
            Connection matched pg_hba.conf line 95: "host all all all md5"
    2019-04-17 16:10:41.916 UTC [33] FATAL:  
            password authentication failed for user "postgres"
    2019-04-17 16:10:41.916 UTC [33] DETAIL:  
            Connection matched pg_hba.conf line 95: "host all all all md5"
    ...
    ...
    

    Lets verify TCP Traffic on port 5432 using tcpdump command

    $ sudo tcpdump port 5432 and '(tcp-syn|tcp-ack)!=0'
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes
    16:19:26.472838 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [S], seq 1779566115, win 29200, options [mss 1380,sackOK,TS val 451453976 ecr 0,nop,wscale 7], length 0
    16:19:26.473135 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903: Flags [S.], seq 4028889669, ack 1779566116, win 28960, options [mss 1460,sackOK,TS val 2412144 ecr 451453976,nop,wscale 7], length 0
    16:19:26.525816 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [.], ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 0
    16:19:26.525875 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net: Flags [P.], seq 1:42, ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 41
    ...
    ...
    

    If this is the case then set firewall rules and necessary securities to combat bots or unwanted traffics.

提交回复
热议问题