{"id":377515,"date":"2024-05-30T15:00:41","date_gmt":"2024-05-30T15:00:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=377515"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=377515","title":{"rendered":"<span>\u041e\u0431\u0437\u043e\u0440 \u0441\u043a\u0430\u043d\u0435\u0440\u043e\u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Terraform<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/edb\/fd3\/cf9\/edbfd3cf92043296b0e40145ad9762a5.jpg\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/edb\/fd3\/cf9\/edbfd3cf92043296b0e40145ad9762a5.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043a\u0430\u043a \u043a\u043e\u0434\u043e\u043c (\u0430\u043d\u0433\u043b. Infrastructure-as-Code, \u0441\u043e\u043a\u0440. Iac). \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>Terraform<\/strong>.<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c\u0438, \u043a\u0430\u043a Amazon Web Services, Microsoft Azure, Google Cloud Platform, Oracle Cloud. \u0422\u0430\u043a\u0436\u0435 Terraform \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0435\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0432 \u0438\u0445 \u0447\u0438\u0441\u043b\u0435 Active Directory, Docker, VMware vSphere.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u2014 \u043d\u0435\u0441\u0430\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f, \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0430\u0442\u0430\u043a\u0438, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u043d\u0441\u0430\u0439\u0434\u0435\u0440\u0441\u043a\u0438\u0435 \u0443\u0433\u0440\u043e\u0437\u044b. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 Terraform.<\/p>\n<h2>\u0423\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 Terraform-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h2>\n<h3>Tfsec<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/aquasecurity\/tfsec\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/aquasecurity.github.io\/tfsec\/v1.28.1\/\"><u>github.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c. Tfsec \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 Windows, macOS \u0438 Linux\/Unix. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0442\u043d\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b JSON, SARIF, CSV, CheckStyle, JUnit, text, Gif;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 IDE (JetBrains, VSCode, Vim);<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 (\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445) \u043f\u0440\u0430\u0432\u0438\u043b.<\/p>\n<\/li>\n<\/ul>\n<p><strong>Tfsec<\/strong> \u2014 \u0441\u043a\u0430\u043d\u0435\u0440 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Terraform. Tfsec \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 \u0432 \u0441\u0444\u0435\u0440\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u2014 Aqua Security. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043c\u043e\u0434\u0443\u043b\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0443\u0433\u0440\u043e\u0437 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u043a\u0430\u043a AWS, Azure, CloudStack, DigitalOcean, Google Cloud, Oracle Cloud.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 \u041e\u0421 Ubuntu 22.04. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>curl -s https:\/\/raw.githubusercontent.com\/aquasecurity\/tfsec\/master\/scripts\/install_linux.sh | bash<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/103\/a41\/b47\/103a41b47f55c975026d4c473740f88b.png\" width=\"1132\" height=\"1330\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/103\/a41\/b47\/103a41b47f55c975026d4c473740f88b.png\"\/><\/figure>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>tfsec<\/code> \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Terraform. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>tfsec \/root\/aws\/aws_ec2_ebs_docker_host.<\/code><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EC2. \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c tfsec:<\/p>\n<pre><code>tfsec<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e00\/968\/6e6\/e009686e6a45141221c2e5cdf174f5c5.png\" width=\"1130\" height=\"786\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e00\/968\/6e6\/e009686e6a45141221c2e5cdf174f5c5.png\"\/><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0432\u044b\u0448\u0435, tfsec \u043d\u0430\u0448\u0435\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Terraform. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>Result #1 CRITICAL Security group rule allows egress to multiple public internet addresses.<br \/><\/strong>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u043a\u0430\u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f (CRITICAL). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 tfsec \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f CRITICAL, HIGH, MEDIUM, LOW. <\/p>\n<p>CRITICAL \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LOW \u2014 \u0441\u0430\u043c\u0430\u044f \u043d\u0438\u0437\u043a\u0430\u044f.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0418\u0437 \u043d\u0435\u0433\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e\u00a0 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<p><strong>security.tf:20<br \/><\/strong>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 (<strong>security.tf<\/strong>) \u0438 \u0441\u0442\u0440\u043e\u043a\u0430, \u0433\u0434\u0435 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c (\u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c <strong>20<\/strong>).<\/p>\n<p><strong>14\u00a0 \u00a0 resource &#171;aws_security_group_rule&#187; &#171;outgoing_any&#187; {<\/strong><\/p>\n<p><strong>15\u00a0 \u00a0 \u00a0 security_group_id = &#171;<\/strong><\/p>\n<p><strong>16\u00a0 \u00a0 \u00a0 type\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;egress&#187;<\/strong><\/p>\n<p><strong>17\u00a0 \u00a0 \u00a0 from_port \u00a0 \u00a0 \u00a0 \u00a0 = 0<\/strong><\/p>\n<p><strong>18\u00a0 \u00a0 \u00a0 to_port \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = 0<\/strong><\/p>\n<p><strong>19\u00a0 \u00a0 \u00a0 protocol\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;-1&#187;<\/strong><\/p>\n<p><strong>20\u00a0 [ \u00a0 cidr_blocks \u00a0 \u00a0 \u00a0 = [&#171;0.0.0.0\/0&#187;]<\/strong><\/p>\n<p><strong>21\u00a0 \u00a0 }<br \/><\/strong>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p><strong>aws-ec2-no-public-egress-sgr<br \/><\/strong>ID \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f <a href=\"https:\/\/aquasecurity.github.io\/tfsec\/v1.28.5\/checks\/aws\/\"><u>\u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 tfsec<\/u><\/a>.<\/p>\n<p><strong>Impact Your port is egressing data to the internet<\/strong>\u00a0<br \/>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Resolution Set a more restrictive cidr range<br \/><\/strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e tfsec \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>tfsec --out results -f json<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d0d\/797\/083\/d0d79708391a7a3718e627c85dea726f.png\" width=\"1126\" height=\"482\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d0d\/797\/083\/d0d79708391a7a3718e627c85dea726f.png\"\/><\/figure>\n<p>\u0413\u0434\u0435:<br \/><strong>&#8212;out results<\/strong> \u2014 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b tfsec;<br \/><strong>-f json<\/strong> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b tfsec. \u0412\u043c\u0435\u0441\u0442\u043e json \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u2014 sarif, csv, checkstyle, junit, text, gif.<\/p>\n<h3>Terrascan<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/tenable\/terrascan\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/runterrascan.io\/docs\/\"><u>runterrascan.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Windows, macOS \u0438 Linux\/Unix. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker;<\/p>\n<\/li>\n<li>\n<p>\u0411\u043e\u043b\u0435\u0435 500 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/runterrascan.io\/docs\/policies\/\"><u>\u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/u><\/a> \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b CI\/CD. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/runterrascan.io\/docs\/integrations\/\"><u>\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.\u00a0<\/p>\n<\/li>\n<\/ul>\n<p><strong>Terrascan<\/strong> \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Iac. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b AWS, Azure, GCP, \u0430 \u0442\u0430\u043a\u0436\u0435 Kubernetes, \u0444\u0430\u0439\u043b\u044b Dockerfile \u0438 GitHub.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 \u041e\u0421 Ubuntu 22.04. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>1) \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<pre><code>curl -L \"\" class=\"formula inline\">(curl -s https:\/\/api.github.com\/repos\/tenable\/terrascan\/releases\/latest | grep -o -E \"https:\/\/.+?_Linux_x86_64.tar.gz\")\" > terrascan.tar.gz<\/code><\/pre>\n<p>2) \u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0445\u0438\u0432:<\/p>\n<pre><code>tar -xf terrascan.tar.gz terrascan &amp;&amp; rm terrascan.tar.gz<\/code><\/pre>\n<p>3) \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b terrascan \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/usr\/local\/bin \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b terrascan \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code>install terrascan \/usr\/local\/bin &amp;&amp; rm terrascan<\/code><\/pre>\n<p>4) \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0430\u0441\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0435\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<pre><code>terrascan<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0431\u0430\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b terrascan \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>terrascan init<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EC2. \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c terrascan:<\/p>\n<pre><code>terrascan scan<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0432\u044b\u0448\u0435, terrascan \u043d\u0430\u0448\u0435\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a56\/e92\/0c7\/a56e920c7f96ae3ce7a66be934b96bd2.png\" width=\"1600\" height=\"1166\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a56\/e92\/0c7\/a56e920c7f96ae3ce7a66be934b96bd2.png\"\/><\/figure>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>Description: Security Groups &#8212; Unrestricted Specific Ports &#8212; (HTTP,80)<\/strong> <br \/>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u2014 80. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 (\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445) \u043f\u043e\u0440\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438;<\/p>\n<p><strong>File: <\/strong><a href=\"http:\/\/security.tf\"><strong>security.tf<\/strong><\/a>\u00a0<br \/>\u0424\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.\u00a0<\/p>\n<p><strong>Module Name<\/strong>: <strong>root<\/strong>\u00a0<br \/>\u0418\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f terrascan, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Plan Root: .\/<br \/><\/strong>\u041f\u0443\u0442\u044c \u0434\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Line: 225<\/strong>\u00a0<br \/>\u0421\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Severity: HIGH<\/strong>\u00a0<br \/>\u0421\u0442\u0435\u043f\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 terrascan \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f HIGH, MEDIUM, LOW. \u0417\u0434\u0435\u0441\u044c HIGH \u2014 \u044d\u0442\u043e \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LOW \u2014 \u043d\u0438\u0437\u043a\u0430\u044f.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p><strong>Scan Summary &#8212;<\/strong><\/p>\n<p><strong>File\/Folder \u00a0 \u00a0 \u00a0 \u00a0 :\/root\/aws\/aws_ec2_ebs_docker_host<\/strong><\/p>\n<p><strong>IaC Type\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :terraform<\/strong><\/p>\n<p><strong>Scanned At\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :2024-04-24 13:01:48.922916892 +0000 UTC<\/strong><\/p>\n<p><strong>Policies Validated\u00a0 :142<\/strong><\/p>\n<p><strong>Violated Policies \u00a0 :7<\/strong><\/p>\n<p><strong>Low \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :1<\/strong><\/p>\n<p><strong>Medium\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :1<\/strong><\/p>\n<p><strong>High\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :5<\/strong><\/p>\n<p><strong>Policies Validated <\/strong>\u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, <strong>Violated Policies <\/strong>\u2014<strong> <\/strong>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e terrascan \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b. \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>terrascan scan -o json > results<\/code><\/pre>\n<p>\u0413\u0434\u0435:<br \/><strong>-o json<\/strong> \u2014 \u0442\u0438\u043f \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0442\u0438\u043b\u0438\u0442\u044b. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b human, json, yaml, xml;<br \/><strong>> results<\/strong> \u2014 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0432 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c results.<\/p>\n<h3>Checkov<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/bridgecrewio\/checkov\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/www.checkov.io\/1.Welcome\/Quick%20Start.html\"><u>checkov.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 Palo Alto Networks. \u0422\u0430\u043a\u0436\u0435 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 Prisma Cloud;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Terraform, Terraform plan, Cloudformation, AWS SAM, Kubernetes, Helm, Kustomize, Dockerfile, Serverless, Bicep, OpenAPI;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/bridgecrewio\/checkov\/main\/docs\/5.Policy%20Index\/all.md\"><u>\u0411\u043e\u043b\u0435\u0435 1000 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a;<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.checkov.io\/3.Custom%20Policies\/YAML%20Custom%20Policies.htm\"><u>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Checkov \u043d\u0430 Ubuntu 22.04. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 pip \u0434\u043b\u044f Python. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d pip. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>pip3<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u0444\u0440\u0430\u0437\u0430 <strong>\u201cCommand &#8216;pip3&#8217; not found\u201d<\/strong>, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 pip \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>apt -y install python3-pip<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Checkov:<\/p>\n<pre><code>pip3 install checkov<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>Checkov \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0446\u0435\u043b\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 terraform, \u0442\u0430\u043a \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e &#8212;directory:<\/p>\n<pre><code>checkov --directory \/root\/aws\/aws_reverse_proxy<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/473\/739\/b1b\/473739b1b716a4fdfe5780a6cac24677.png\" width=\"1600\" height=\"1304\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/473\/739\/b1b\/473739b1b716a4fdfe5780a6cac24677.png\"\/><\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e &#8212;file:<\/p>\n<pre><code>checkov --file \/root\/aws\/aws_reverse_proxy\/lambda.tf<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 AWS Lambda \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0432\u043e\u0434 \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<p><strong>Check: CKV_AWS_50: &#171;X-Ray tracing is enabled for Lambda&#187;<\/strong><\/p>\n<p><strong>File: \/lambda.tf:35-49<\/strong><\/p>\n<p><strong>Guide: https:\/\/docs.prismacloud.io\/en\/enterprise-edition\/policy-reference\/aws-policies\/aws-serverless-policies\/bc-aws-serverless-4<\/strong><\/p>\n<p><strong>35 | resource &#171;aws_lambda_function&#187; &#171;viewer_request&#187; {<\/strong><\/p>\n<p><strong>36 | \u00a0 provider = &#171;aws.us_east_1&#187; # because: error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function must be in region &#8216;us-east-1&#8217;<\/strong><\/p>\n<p><strong>37 |<\/strong><\/p>\n<p><strong>38 | \u00a0 # lambda_zip.output_path will be absolute, i.e. different on different machines.<\/strong><\/p>\n<p><strong>39 | \u00a0 # This can cause Terraform to notice differences that aren&#8217;t actually there, so let&#8217;s convert it to a relative one.<\/strong><\/p>\n<p><strong>40 | \u00a0 # https:\/\/github.com\/hashicorp\/terraform\/issues\/7613#issuecomment-332238441<\/strong><\/p>\n<p><strong>41 | \u00a0 filename = &#171;${substr(data.archive_file.lambda_zip.output_path, length(path.cwd) + 1, -1)}&#187;<\/strong><\/p>\n<p><strong>42\u00a0<\/strong><\/p>\n<p><strong>43 | \u00a0 source_code_hash = &#171;${data.archive_file.lambda_zip.output_base64sha256}&#187;<\/strong><\/p>\n<p><strong>44 | \u00a0 function_name\u00a0 \u00a0 = &#171;${local.prefix_with_domain}&#8212;viewer_request&#187;<\/strong><\/p>\n<p><strong>45 | \u00a0 role \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;${aws_iam_role.this.arn}&#187;<\/strong><\/p>\n<p><strong>46 | \u00a0 description\u00a0 \u00a0 \u00a0 = &#171;${var.comment_prefix}${var.site_domain} (request handler)&#187;<\/strong><\/p>\n<p><strong>47 | \u00a0 handler\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;lambda.viewer_request&#187;<\/strong><\/p>\n<p><strong>48 | \u00a0 runtime\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;nodejs8.10&#187;<\/strong><\/p>\n<p><strong>49 | \u00a0 publish\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = true<\/strong><\/p>\n<p><strong>Check: CKV_AWS_50: &#171;X-Ray tracing is enabled for Lambda&#187;<\/strong><\/p>\n<p>\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438 Checkov \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.checkov.io\/5.Policy%20Index\/all.html\"><u>\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/u><\/a>;<\/p>\n<p><strong>File: \/lambda.tf:35-49<br \/><\/strong>\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u043e\u043a \u0441 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438;<\/p>\n<p><strong>Guide: <\/strong><a href=\"https:\/\/docs.prismacloud.io\/en\/enterprise-edition\/policy-reference\/aws-policies\/aws-serverless-policies\/bc-aws-serverless-4\"><strong>https:\/\/docs.prismacloud.io\/en\/enterprise-edition\/policy-reference\/aws-policies\/aws-serverless-policies\/bc-aws-serverless-4<\/strong><\/a><strong><br \/><\/strong>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b Prisma Cloud, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0448\u0430\u0433\u0438 \u0434\u043b\u044f \u0435\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>35 | resource &#171;aws_lambda_function&#187; &#171;viewer_request&#187; {<\/strong><\/p>\n<p><strong>36 | \u00a0 provider = &#171;aws.us_east_1&#187; # because: error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function must be in region &#8216;us-east-1&#8217;<\/strong><\/p>\n<p><strong>37 |<\/strong><\/p>\n<p><strong>38 | \u00a0 # lambda_zip.output_path will be absolute, i.e. different on different machines.<\/strong><\/p>\n<p><strong>39 | \u00a0 # This can cause Terraform to notice differences that aren&#8217;t actually there, so let&#8217;s convert it to a relative one.<\/strong><\/p>\n<p><strong>40 | \u00a0 # https:\/\/github.com\/hashicorp\/terraform\/issues\/7613#issuecomment-332238441<\/strong><\/p>\n<p><strong>41 | \u00a0 filename = &#171;${substr(data.archive_file.lambda_zip.output_path, length(path.cwd) + 1, -1)}&#187;<\/strong><\/p>\n<p><strong>42 |<\/strong><\/p>\n<p><strong>43 | \u00a0 source_code_hash = &#171;${data.archive_file.lambda_zip.output_base64sha256}&#187;<\/strong><\/p>\n<p><strong>44 | \u00a0 function_name\u00a0 \u00a0 = &#171;${local.prefix_with_domain}&#8212;viewer_request&#187;<\/strong><\/p>\n<p><strong>45 | \u00a0 role \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;${aws_iam_role.this.arn}&#187;<\/strong><\/p>\n<p><strong>46 | \u00a0 description\u00a0 \u00a0 \u00a0 = &#171;${var.comment_prefix}${var.site_domain} (request handler)&#187;<\/strong><\/p>\n<p><strong>47 | \u00a0 handler\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;lambda.viewer_request&#187;<\/strong><\/p>\n<p><strong>48 | \u00a0 runtime\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;nodejs8.10&#187;<\/strong><\/p>\n<p><strong>49 | \u00a0 publish\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = true<\/strong><\/p>\n<p>\u041f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b Checkov \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e\u00a0 <strong>&#8212;output-file-path<\/strong> \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u043e\u0442\u0447\u0435\u0442:<\/p>\n<pre><code>checkov --directory \/root\/aws\/aws_reverse_proxy --output-file-path results.json<\/code><\/pre>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 json, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c csv, sarif, spdx \u0438 xml.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c. \u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u2014 Tfsec, Terrascan, Checkov. \u041a\u0430\u0436\u0434\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0432\u043e\u044e \u0431\u0430\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.\u00a0\u0421 \u0446\u0435\u043b\u044c\u044e \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 3 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0441\u0440\u0430\u0437\u0443. <\/p>\n<hr\/>\n<p>\u041d\u041b\u041e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430:<br \/>\u2014\u00a0<a href=\"https:\/\/firstvds.ru\/?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=product&amp;utm_content=vds15exeptprogrev\"><u>15% \u043d\u0430 \u0437\u0430\u043a\u0430\u0437 \u043b\u044e\u0431\u043e\u0433\u043e VDS<\/u><\/a>\u00a0(\u043a\u0440\u043e\u043c\u0435 \u0442\u0430\u0440\u0438\u0444\u0430 \u041f\u0440\u043e\u0433\u0440\u0435\u0432) \u2014\u00a0<strong>HABRFIRSTVDS<\/strong>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/818259\/\"> https:\/\/habr.com\/ru\/articles\/818259\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043a\u0430\u043a \u043a\u043e\u0434\u043e\u043c (\u0430\u043d\u0433\u043b. Infrastructure-as-Code, \u0441\u043e\u043a\u0440. Iac). \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>Terraform<\/strong>.<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c\u0438, \u043a\u0430\u043a Amazon Web Services, Microsoft Azure, Google Cloud Platform, Oracle Cloud. \u0422\u0430\u043a\u0436\u0435 Terraform \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0435\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0432 \u0438\u0445 \u0447\u0438\u0441\u043b\u0435 Active Directory, Docker, VMware vSphere.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u2014 \u043d\u0435\u0441\u0430\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f, \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0430\u0442\u0430\u043a\u0438, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u043d\u0441\u0430\u0439\u0434\u0435\u0440\u0441\u043a\u0438\u0435 \u0443\u0433\u0440\u043e\u0437\u044b. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 Terraform.<\/p>\n<h2>\u0423\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 Terraform-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h2>\n<h3>Tfsec<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/aquasecurity\/tfsec\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/aquasecurity.github.io\/tfsec\/v1.28.1\/\"><u>github.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c. Tfsec \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 Windows, macOS \u0438 Linux\/Unix. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0442\u043d\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b JSON, SARIF, CSV, CheckStyle, JUnit, text, Gif;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 IDE (JetBrains, VSCode, Vim);<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 (\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445) \u043f\u0440\u0430\u0432\u0438\u043b.<\/p>\n<\/li>\n<\/ul>\n<p><strong>Tfsec<\/strong> \u2014 \u0441\u043a\u0430\u043d\u0435\u0440 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Terraform. Tfsec \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 \u0432 \u0441\u0444\u0435\u0440\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u2014 Aqua Security. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043c\u043e\u0434\u0443\u043b\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0443\u0433\u0440\u043e\u0437 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u043a\u0430\u043a AWS, Azure, CloudStack, DigitalOcean, Google Cloud, Oracle Cloud.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 \u041e\u0421 Ubuntu 22.04. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>curl -s https:\/\/raw.githubusercontent.com\/aquasecurity\/tfsec\/master\/scripts\/install_linux.sh | bash<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>tfsec<\/code> \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Terraform. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>tfsec \/root\/aws\/aws_ec2_ebs_docker_host.<\/code><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EC2. \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c tfsec:<\/p>\n<pre><code>tfsec<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0432\u044b\u0448\u0435, tfsec \u043d\u0430\u0448\u0435\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Terraform. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>Result #1 CRITICAL Security group rule allows egress to multiple public internet addresses.<br \/><\/strong>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u043a\u0430\u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f (CRITICAL). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 tfsec \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f CRITICAL, HIGH, MEDIUM, LOW. <\/p>\n<p>CRITICAL \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LOW \u2014 \u0441\u0430\u043c\u0430\u044f \u043d\u0438\u0437\u043a\u0430\u044f.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0418\u0437 \u043d\u0435\u0433\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e\u00a0 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<p><strong>security.tf:20<br \/><\/strong>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 (<strong>security.tf<\/strong>) \u0438 \u0441\u0442\u0440\u043e\u043a\u0430, \u0433\u0434\u0435 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c (\u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c <strong>20<\/strong>).<\/p>\n<p><strong>14\u00a0 \u00a0 resource &#171;aws_security_group_rule&#187; &#171;outgoing_any&#187; {<\/strong><\/p>\n<p><strong>15\u00a0 \u00a0 \u00a0 security_group_id = &#171;<\/strong><\/p>\n<p><strong>16\u00a0 \u00a0 \u00a0 type\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;egress&#187;<\/strong><\/p>\n<p><strong>17\u00a0 \u00a0 \u00a0 from_port \u00a0 \u00a0 \u00a0 \u00a0 = 0<\/strong><\/p>\n<p><strong>18\u00a0 \u00a0 \u00a0 to_port \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = 0<\/strong><\/p>\n<p><strong>19\u00a0 \u00a0 \u00a0 protocol\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;-1&#187;<\/strong><\/p>\n<p><strong>20\u00a0 [ \u00a0 cidr_blocks \u00a0 \u00a0 \u00a0 = [&#171;0.0.0.0\/0&#187;]<\/strong><\/p>\n<p><strong>21\u00a0 \u00a0 }<br \/><\/strong>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p><strong>aws-ec2-no-public-egress-sgr<br \/><\/strong>ID \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f <a href=\"https:\/\/aquasecurity.github.io\/tfsec\/v1.28.5\/checks\/aws\/\"><u>\u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 tfsec<\/u><\/a>.<\/p>\n<p><strong>Impact Your port is egressing data to the internet<\/strong>\u00a0<br \/>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Resolution Set a more restrictive cidr range<br \/><\/strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e tfsec \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>tfsec --out results -f json<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0413\u0434\u0435:<br \/><strong>&#8212;out results<\/strong> \u2014 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b tfsec;<br \/><strong>-f json<\/strong> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b tfsec. \u0412\u043c\u0435\u0441\u0442\u043e json \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u2014 sarif, csv, checkstyle, junit, text, gif.<\/p>\n<h3>Terrascan<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/tenable\/terrascan\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/runterrascan.io\/docs\/\"><u>runterrascan.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Windows, macOS \u0438 Linux\/Unix. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker;<\/p>\n<\/li>\n<li>\n<p>\u0411\u043e\u043b\u0435\u0435 500 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/runterrascan.io\/docs\/policies\/\"><u>\u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/u><\/a> \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b CI\/CD. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/runterrascan.io\/docs\/integrations\/\"><u>\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.\u00a0<\/p>\n<\/li>\n<\/ul>\n<p><strong>Terrascan<\/strong> \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Iac. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b AWS, Azure, GCP, \u0430 \u0442\u0430\u043a\u0436\u0435 Kubernetes, \u0444\u0430\u0439\u043b\u044b Dockerfile \u0438 GitHub.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 \u041e\u0421 Ubuntu 22.04. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>1) \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<pre><code>curl -L \"\" class=\"formula inline\">(curl -s https:\/\/api.github.com\/repos\/tenable\/terrascan\/releases\/latest | grep -o -E \"https:\/\/.+?_Linux_x86_64.tar.gz\")\" > terrascan.tar.gz<\/code><\/pre>\n<p>2) \u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0445\u0438\u0432:<\/p>\n<pre><code>tar -xf terrascan.tar.gz terrascan &amp;&amp; rm terrascan.tar.gz<\/code><\/pre>\n<p>3) \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b terrascan \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/usr\/local\/bin \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b terrascan \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code>install terrascan \/usr\/local\/bin &amp;&amp; rm terrascan<\/code><\/pre>\n<p>4) \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0430\u0441\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0435\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<pre><code>terrascan<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0431\u0430\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b terrascan \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>terrascan init<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EC2. \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 Terraform \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c terrascan:<\/p>\n<pre><code>terrascan scan<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0432\u044b\u0448\u0435, terrascan \u043d\u0430\u0448\u0435\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>Description: Security Groups &#8212; Unrestricted Specific Ports &#8212; (HTTP,80)<\/strong> <br \/>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u2014 80. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 (\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445) \u043f\u043e\u0440\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438;<\/p>\n<p><strong>File: <\/strong><a href=\"http:\/\/security.tf\"><strong>security.tf<\/strong><\/a>\u00a0<br \/>\u0424\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.\u00a0<\/p>\n<p><strong>Module Name<\/strong>: <strong>root<\/strong>\u00a0<br \/>\u0418\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f terrascan, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Plan Root: .\/<br \/><\/strong>\u041f\u0443\u0442\u044c \u0434\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Line: 225<\/strong>\u00a0<br \/>\u0421\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>Severity: HIGH<\/strong>\u00a0<br \/>\u0421\u0442\u0435\u043f\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 terrascan \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f HIGH, MEDIUM, LOW. \u0417\u0434\u0435\u0441\u044c HIGH \u2014 \u044d\u0442\u043e \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LOW \u2014 \u043d\u0438\u0437\u043a\u0430\u044f.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p><strong>Scan Summary &#8212;<\/strong><\/p>\n<p><strong>File\/Folder \u00a0 \u00a0 \u00a0 \u00a0 :\/root\/aws\/aws_ec2_ebs_docker_host<\/strong><\/p>\n<p><strong>IaC Type\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :terraform<\/strong><\/p>\n<p><strong>Scanned At\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :2024-04-24 13:01:48.922916892 +0000 UTC<\/strong><\/p>\n<p><strong>Policies Validated\u00a0 :142<\/strong><\/p>\n<p><strong>Violated Policies \u00a0 :7<\/strong><\/p>\n<p><strong>Low \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :1<\/strong><\/p>\n<p><strong>Medium\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :1<\/strong><\/p>\n<p><strong>High\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 :5<\/strong><\/p>\n<p><strong>Policies Validated <\/strong>\u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, <strong>Violated Policies <\/strong>\u2014<strong> <\/strong>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e terrascan \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b. \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>terrascan scan -o json > results<\/code><\/pre>\n<p>\u0413\u0434\u0435:<br \/><strong>-o json<\/strong> \u2014 \u0442\u0438\u043f \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0442\u0438\u043b\u0438\u0442\u044b. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b human, json, yaml, xml;<br \/><strong>> results<\/strong> \u2014 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0432 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c results.<\/p>\n<h3>Checkov<\/h3>\n<p><strong>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442<\/strong>: <a href=\"https:\/\/github.com\/bridgecrewio\/checkov\"><u>github.com<\/u><\/a><\/p>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>: <a href=\"https:\/\/www.checkov.io\/1.Welcome\/Quick%20Start.html\"><u>checkov.io<\/u><\/a><\/p>\n<p><strong>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f<\/strong>: Open-source<\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 Palo Alto Networks. \u0422\u0430\u043a\u0436\u0435 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 Prisma Cloud;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Terraform, Terraform plan, Cloudformation, AWS SAM, Kubernetes, Helm, Kustomize, Dockerfile, Serverless, Bicep, OpenAPI;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/bridgecrewio\/checkov\/main\/docs\/5.Policy%20Index\/all.md\"><u>\u0411\u043e\u043b\u0435\u0435 1000 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a;<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.checkov.io\/3.Custom%20Policies\/YAML%20Custom%20Policies.htm\"><u>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Checkov \u043d\u0430 Ubuntu 22.04. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 pip \u0434\u043b\u044f Python. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d pip. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>pip3<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u0444\u0440\u0430\u0437\u0430 <strong>\u201cCommand &#8216;pip3&#8217; not found\u201d<\/strong>, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 pip \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>apt -y install python3-pip<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Checkov:<\/p>\n<pre><code>pip3 install checkov<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a<\/h4>\n<p>Checkov \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0446\u0435\u043b\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 terraform, \u0442\u0430\u043a \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e &#8212;directory:<\/p>\n<pre><code>checkov --directory \/root\/aws\/aws_reverse_proxy<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e &#8212;file:<\/p>\n<pre><code>checkov --file \/root\/aws\/aws_reverse_proxy\/lambda.tf<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 AWS Lambda \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0432\u043e\u0434 \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<p><strong>Check: CKV_AWS_50: &#171;X-Ray tracing is enabled for Lambda&#187;<\/strong><\/p>\n<p><strong>File: \/lambda.tf:35-49<\/strong><\/p>\n<p><strong>Guide: https:\/\/docs.prismacloud.io\/en\/enterprise-edition\/policy-reference\/aws-policies\/aws-serverless-policies\/bc-aws-serverless-4<\/strong><\/p>\n<p><strong>35 | resource &#171;aws_lambda_function&#187; &#171;viewer_request&#187; {<\/strong><\/p>\n<p><strong>36 | \u00a0 provider = &#171;aws.us_east_1&#187; # because: error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function must be in region &#8216;us-east-1&#8217;<\/strong><\/p>\n<p><strong>37 |<\/strong><\/p>\n<p><strong>38 | \u00a0 # lambda_zip.output_path will be absolute, i.e. different on different machines.<\/strong><\/p>\n<p><strong>39 | \u00a0 # This can cause Terraform to notice differences that aren&#8217;t actually there, so let&#8217;s convert it to a relative one.<\/strong><\/p>\n<p><strong>40 | \u00a0 # https:\/\/github.com\/hashicorp\/terraform\/issues\/7613#issuecomment-332238441<\/strong><\/p>\n<p><strong>41 | \u00a0 filename = &#171;${substr(data.archive_file.lambda_zip.output_path, length(path.cwd) + 1, -1)}&#187;<\/strong><\/p>\n<p><strong>42\u00a0<\/strong><\/p>\n<p><strong>43 | \u00a0 source_code_hash = &#171;${data.archive_file.lambda_zip.output_base64sha256}&#187;<\/strong><\/p>\n<p><strong>44 | \u00a0 function_name\u00a0 \u00a0 = &#171;${local.prefix_with_domain}&#8212;viewer_request&#187;<\/strong><\/p>\n<p><strong>45 | \u00a0 role \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;${aws_iam_role.this.arn}&#187;<\/strong><\/p>\n<p><strong>46 | \u00a0 description\u00a0 \u00a0 \u00a0 = &#171;${var.comment_prefix}${var.site_domain} (request handler)&#187;<\/strong><\/p>\n<p><strong>47 | \u00a0 handler\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;lambda.viewer_request&#187;<\/strong><\/p>\n<p><strong>48 | \u00a0 runtime\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = &#171;nodejs8.10&#187;<\/strong><\/p>\n<p><strong>49 | \u00a0 publish\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = true<\/strong><\/p>\n<p><strong>Check: CKV_AWS_50: &#171;X-Ray tracing is enabled for Lambda&#187;<\/strong><\/p>\n<p>\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-377515","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377515"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377515\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}