大网数据广告活动
服务器运维问答

How to track origin of a ghost process in ubuntu that is causing postgres to take 100% of CPU usage in Amazon EC2 container?

· 52CE 我爱测

I am running PostgreSQL 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1) on an AWS EC2 micro instance. Previously, I had allowed remote connections to postgres db from anywhere. After some days, I am seeing an unknown process run by the pos…

问题原文

原帖链接 · Subhankar Mukherjee · CC BY-SA 4.0

I am running PostgreSQL 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1) on an AWS EC2 micro instance. Previously, I had allowed remote connections to postgres db from anywhere. After some days, I am seeing an unknown process run by the postgres user is taking 100% of CPU usage. Running top command gives similar output.

8092 postgres  20   0  302872 266776      0 S 99.3 26.5   2574:21 WI0oUt

There is no active query that is running long in the background. I stopped the postgres DB, even then that ghost process is running. I got probable answer of the problem here. But I need to know which parent process is starting the execution of such ghost child processes? If I run ps with the PID, I get PPID as 1. I need to know what is the infected program that is running those child processes?

I already tried running man,appros for the processname, I tried resetting the postgres user password to tackle the compromise,but no effect. Anyway to find out which infected program is causing this? or how can I handle this situation without formatting the server?

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

It’s very hard to un-compromise a server. Best bet is to:

  • dump your database (using pg_dump),
  • delete the EC2 instance,
  • create new instance,
  • reinstall postgres, and
  • reload the data.

Lesson: Never ever leave database servers open to the world. Use Security Group to restrict access only to the IPs that actually need access. And ideally use AWS RDS that can automatically patch your database to mitigate security issues.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-02-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。