手动安装安全代理
GuardDuty 提供了以下两种方法,来在 Amazon EC2 实例上安装 GuardDuty 安全代理。在继续操作之前,请务必完成先决条件 – 手动创建 Amazon VPC 端点下的步骤。
选择一种您偏好的访问方法,在您的 Amazon EC2 资源中安装安全代理。
-
方法 1 – 使用 Amazon Systems Manager:此方法需要由 Amazon Systems Manager 托管您的 Amazon EC2 实例。
-
方法 2 – 使用 Linux 软件包管理器:无论您的 Amazon EC2 实例是否由 Amazon Systems Manager 托管,都可以使用此方法。根据您的操作系统发行版,您可以选择合适的方法来安装 RPM 脚本或 Debian 脚本。如果您使用 Fedora 平台,则必须使用此方法来安装代理。
要使用此方法,请确保您的 Amazon EC2 实例由 Amazon Systems Manager 托管,然后安装代理。
Amazon Systems Manager 托管的 Amazon EC2 实例
按照以下步骤操作,以确保您的 Amazon EC2 实例由 Amazon Systems Manager 托管。
-
Amazon Systems Manager 会帮助您端到端地管理 Amazon 应用程序和资源,让您能够安全地大规模运营。
要使用 Amazon Systems Manager 管理 Amazon EC2 实例,请参阅《Amazon Systems Manager 用户指南》中的为 Amazon EC2 实例设置 Systems Manager。
-
下表展示了新的 GuardDuty 托管式 Amazon Systems Manager 文档:
文档名称 文档类型 用途 AmazonGuardDuty-RuntimeMonitoringSsmPlugin分销商
打包 GuardDuty 安全代理。
AmazonGuardDuty-ConfigureRuntimeMonitoringSsmPlugin命令
运行安装/卸载脚本来安装 GuardDuty 安全代理。
有关 Amazon Systems Manager 的更多信息,请参阅《Amazon Systems Manager 用户指南》中的 Amazon EC2 Systems Manager 文档。
对于 Debian Server
要使用 Amazon 提供的适用于 Debian Server 的亚马逊机器映像(AMI),您需要安装 Amazon Systems Manager Agent(SSM Agent)。您需要执行额外的步骤来安装 SSM Agent,以确保 Amazon EC2 Debian 服务器实例由 SSM 托管。有关您需要执行的步骤的信息,请参阅《Amazon Systems Manager 用户指南》中的在 Debian Server 实例上手动安装 SSM Agent。
使用 Amazon Systems Manager 安装适用于 Amazon EC2 实例的 GuardDuty 代理
访问 https://console.aws.amazon.com/systems-manager/
,打开 Amazon Systems Manager 控制台。 -
在导航窗格中,选择文档
-
在由 Amazon 所有中,选择
AmazonGuardDuty-ConfigureRuntimeMonitoringSsmPlugin。 -
选择 Run Command。
-
输入以下 Run 命令参数
-
操作:选择安装。
-
安装类型:选择安装或卸载。
-
名称:
AmazonGuardDuty-RuntimeMonitoringSsmPlugin -
版本:如果此参数保留为空,您将获得 GuardDuty 安全代理的最新版本。有关发行版本的更多信息,请参阅适用于 Amazon EC2 实例的 GuardDuty 安全代理版本。
-
-
选择目标 Amazon EC2 实例。您可以选择一个或多个 Amazon EC2 实例。有关更多信息,请参阅《Amazon Systems Manager 用户指南》中的从控制台运行 Amazon Systems Manager 命令。
-
验证 GuardDuty 代理安装是否正常。有关更多信息,请参阅 验证 GuardDuty 安全代理的安装状态。
使用这种方法,您可以通过运行 RPM 脚本或 Debian 脚本来安装 GuardDuty 安全代理。您可以根据操作系统来选择一种偏好的方法:
-
使用 RPM 脚本在 AL2、AL2023、RedHat、CentOS 或 Fedora 操作系统发行版上安装安全代理。
-
使用 Debian 脚本在 Ubuntu 或 Debian 操作系统发行版上安装安全代理。有关支持的 Ubuntu 和 Debian 操作系统发行版的信息,请参阅 验证架构要求。
- RPM installation
-
重要
我们建议首先验证 GuardDuty 安全代理 RPM 签名,然后再将安全代理安装到您的计算机上。
-
验证 GuardDuty 安全代理 RPM 签名
-
准备模板
使用适当的公有密钥、x86_64 RPM 签名、arm64 RPM 签名以及指向 Amazon S3 存储桶中所托管 RPM 脚本的相应访问链接来准备命令。替换 Amazon Web Services 区域、Amazon 账户 ID 和 GuardDuty 代理版本的值以访问 RPM 脚本。
-
公有密钥:
s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/publickey.pem -
GuardDuty 安全代理 RPM 签名:
- x86_64 RPM 签名
-
s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/x86_64/amazon-guardduty-agent-1.9.0.x86_64.sig - arm64 RPM 签名
-
s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/arm64/amazon-guardduty-agent-1.9.0.arm64.sig
-
Amazon S3 存储桶中 RPM 脚本的访问链接:
- x86_64 RPM 访问链接
-
s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/x86_64/amazon-guardduty-agent-1.9.0.x86_64.rpm - arm64 RPM 访问链接
-
s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/arm64/amazon-guardduty-agent-1.9.0.arm64.rpm
Amazon Web Services 区域 区域名称 Amazon 账户 ID eu-west-1欧洲地区(爱尔兰) 694911143906 us-east-1美国东部(弗吉尼亚州北部) 593207742271 us-west-2美国西部(俄勒冈州) 733349766148 eu-west-3欧洲地区(巴黎) 665651866788 us-east-2美国东部(俄亥俄州) 307168627858 eu-central-1欧洲地区(法兰克福) 323658145986 ap-northeast-2亚太地区(首尔) 914738172881 eu-north-1欧洲地区(斯德哥尔摩) 591436053604 ap-east-1亚太地区(香港) 258348409381 me-south-1中东(巴林) 536382113932 eu-west-2欧洲地区(伦敦) 892757235363 ap-northeast-1亚太地区(东京) 533107202818 ap-southeast-1亚太地区(新加坡) 174946120834 ap-south-1亚太地区(孟买) 251508486986 ap-southeast-3亚太地区(雅加达) 510637619217 sa-east-1南美洲(圣保罗) 758426053663 ap-northeast-3亚太地区(大阪) 273192626886 eu-south-1欧洲地区(米兰) 266869475730 af-south-1非洲(开普敦) 197869348890 ap-southeast-2亚太地区(悉尼) 005257825471 me-central-1中东(阿联酋) 000014521398 us-west-1美国西部(加利福尼亚北部) 684579721401 ca-central-1加拿大(中部) 354763396469 ca-west-1加拿大西部(卡尔加里) 339712888787 ap-south-2亚太地区(海得拉巴) 950823858135 eu-south-2欧洲地区(西班牙) 919611009337 eu-central-2欧洲(苏黎世) 529164026651 ap-southeast-4亚太地区(墨尔本) 251357961535 ap-southeast-7亚太地区(泰国) 054037130133 il-central-1以色列(特拉维夫) 870907303882 mx-central-1墨西哥(中部) 982081086614 ap-east-2亚太地区(台北) 259886477082 -
-
下载模板
以下命令用于下载相应的公有密钥、x86_64 RPM 签名、arm64 RPM 签名以及指向 Amazon S3 存储桶中所托管 RPM 脚本的相应访问链接,务必要将账户 ID 替换为相应 Amazon Web Services 账户 ID,将区域替换为您当前所在的区域。
aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/x86_64/amazon-guardduty-agent-1.9.0.x86_64.rpm ./amazon-guardduty-agent-1.9.0.x86_64.rpm aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/x86_64/amazon-guardduty-agent-1.9.0.x86_64.sig ./amazon-guardduty-agent-1.9.0.x86_64.sig aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-rpm-artifacts/1.9.0/publickey.pem ./publickey.pem -
导入公有密钥
使用以下命令将公有密钥导入到数据库:
gpg --import publickey.pemgpg 显示导入成功
gpg: key 093FF49D: public key "AwsGuardDuty" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) -
验证签名
使用以下命令验证签名
gpg --verify amazon-guardduty-agent-1.9.0.x86_64.sig amazon-guardduty-agent-1.9.0.x86_64.rpm如果通过验证,您将看到类似于以下结果的消息。您现在可以继续使用 RPM 安装 GuardDuty 安全代理。
输出示例:
gpg: Signature made Fri 17 Nov 2023 07:58:11 PM UTC using ? key ID 093FF49D gpg: Good signature from "AwsGuardDuty" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 7478 91EF 5378 1334 4456 7603 06C9 06A7 093F F49D如果验证失败,则意味着 RPM 上的签名可能已被篡改。您必须从数据库中移除该公有密钥并重试验证过程。
示例:
gpg: Signature made Fri 17 Nov 2023 07:58:11 PM UTC using ? key ID 093FF49D gpg: BAD signature from "AwsGuardDuty"使用以下命令从数据库中移除公有密钥:
gpg --delete-keys AwsGuardDuty现在,再次尝试验证过程。
-
-
使用以下命令安装 GuardDuty 安全代理:
sudo rpm -ivh amazon-guardduty-agent-1.9.0.x86_64.rpm -
验证 GuardDuty 代理安装是否正常。有关这些步骤的更多信息,请参阅验证 GuardDuty 安全代理的安装状态。
-
- Debian installation
-
重要
我们建议首先验证 GuardDuty 安全代理 Debian 签名,然后再将安全代理安装到您的计算机上。
-
验证 GuardDuty 安全代理 Debian 签名
-
为相应的公有密钥、amd64 Debian 软件包签名、arm64 Debian 软件包签名以及 Amazon S3 存储桶中所托管 Debian 脚本的相应访问链接准备模板
在以下模板中,请替换 Amazon Web Services 区域、Amazon 账户 ID 和 GuardDuty 代理版本的值以访问 Debian 软件包脚本。
-
公有密钥:
s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/publickey.pem -
GuardDuty 安全代理 Debian 签名:
- amd64 签名
-
s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/amd64/amazon-guardduty-agent-1.9.0.amd64.sig - arm64 签名
-
s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/arm64/amazon-guardduty-agent-1.9.0.arm64.sig
-
Amazon S3 存储桶中 Debian 脚本的访问链接:
- amd64 访问链接
-
s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/amd64/amazon-guardduty-agent-1.9.0.amd64.deb - arm64 访问链接
-
s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/arm64/amazon-guardduty-agent-1.9.0.arm64.deb
Amazon Web Services 区域 区域名称 Amazon 账户 ID eu-west-1欧洲地区(爱尔兰) 694911143906 us-east-1美国东部(弗吉尼亚州北部) 593207742271 us-west-2美国西部(俄勒冈州) 733349766148 eu-west-3欧洲地区(巴黎) 665651866788 us-east-2美国东部(俄亥俄州) 307168627858 eu-central-1欧洲地区(法兰克福) 323658145986 ap-northeast-2亚太地区(首尔) 914738172881 eu-north-1欧洲地区(斯德哥尔摩) 591436053604 ap-east-1亚太地区(香港) 258348409381 me-south-1中东(巴林) 536382113932 eu-west-2欧洲地区(伦敦) 892757235363 ap-northeast-1亚太地区(东京) 533107202818 ap-southeast-1亚太地区(新加坡) 174946120834 ap-south-1亚太地区(孟买) 251508486986 ap-southeast-3亚太地区(雅加达) 510637619217 sa-east-1南美洲(圣保罗) 758426053663 ap-northeast-3亚太地区(大阪) 273192626886 eu-south-1欧洲地区(米兰) 266869475730 af-south-1非洲(开普敦) 197869348890 ap-southeast-2亚太地区(悉尼) 005257825471 me-central-1中东(阿联酋) 000014521398 us-west-1美国西部(加利福尼亚北部) 684579721401 ca-central-1加拿大(中部) 354763396469 ca-west-1加拿大西部(卡尔加里) 339712888787 ap-south-2亚太地区(海得拉巴) 950823858135 eu-south-2欧洲地区(西班牙) 919611009337 eu-central-2欧洲(苏黎世) 529164026651 ap-southeast-4亚太地区(墨尔本) 251357961535 il-central-1以色列(特拉维夫) 870907303882 mx-central-1墨西哥(中部) 982081086614 ap-east-2亚太地区(台北) 259886477082 -
-
下载相应的公有密钥、amd64 签名、arm64 签名以及 Amazon S3 存储桶中所托管 Debian 脚本的相应访问链接
在以下命令中,将账户 ID 替换为相应的 Amazon Web Services 账户 ID,将区域替换为您当前所在的区域。
aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/amd64/amazon-guardduty-agent-1.9.0.amd64.deb ./amazon-guardduty-agent-1.9.0.amd64.deb aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/amd64/amazon-guardduty-agent-1.9.0.amd64.sig ./amazon-guardduty-agent-1.9.0.amd64.sig aws s3 cp s3://694911143906-eu-west-1-guardduty-agent-deb-artifacts/1.9.0/publickey.pem ./publickey.pem -
将公有密钥导入数据库中
gpg --import publickey.pemgpg 显示导入成功
gpg: key 093FF49D: public key "AwsGuardDuty" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) -
验证签名
gpg --verify amazon-guardduty-agent-1.9.0.amd64.sig amazon-guardduty-agent-1.9.0.amd64.deb如果验证成功,您将看到与以下结果类似的消息:
输出示例:
gpg: Signature made Fri 17 Nov 2023 07:58:11 PM UTC using ? key ID 093FF49D gpg: Good signature from "AwsGuardDuty" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 7478 91EF 5378 1334 4456 7603 06C9 06A7 093F F49D您现在可以继续使用 Debian 安装 GuardDuty 安全代理。
但如果验证失败,则意味着 Debian 软件包中的签名可能已被篡改。
示例:
gpg: Signature made Fri 17 Nov 2023 07:58:11 PM UTC using ? key ID 093FF49D gpg: BAD signature from "AwsGuardDuty"使用以下命令从数据库中移除公有密钥:
gpg --delete-keys AwsGuardDuty现在,重新尝试验证过程。
-
-
使用以下命令安装 GuardDuty 安全代理:
sudo dpkg -i amazon-guardduty-agent-1.9.0.amd64.deb -
验证 GuardDuty 代理安装是否正常。有关这些步骤的更多信息,请参阅验证 GuardDuty 安全代理的安装状态。
-
内存不足错误
如果您在手动为 Amazon EC2 安装或更新 GuardDuty 安全代理时遇到 out-of-memory 错误,请参阅内存不足问题的故障排除。
验证 GuardDuty 安全代理的安装状态
完成安装 GuardDuty 安全代理的步骤后,请使用以下步骤验证代理的状态:
验证 GuardDuty 安全代理是否正常
-
运行以下命令来检查 GuardDuty 安全代理的状态:
sudo systemctl status amazon-guardduty-agent
要查看安全代理安装日志,可通过路径 /var/log/amzn-guardduty-agent/ 获取。
要查看日志,请运行 sudo journalctl -u
amazon-guardduty-agent。