当前位置:网站首页>8 best practices to protect your IAC security!

8 best practices to protect your IAC security!

2022-07-01 13:47:00 InfoQ

Infrastructure is code (IaC)  It's a fast-growing technology , Utilize software development principles and practices , Configure infrastructure with software . With the traditional  IT  Compared with the infrastructure ,IaC  Software can be delivered more efficiently . Automation also unlocks the ability to flexibly configure , This function can effectively allocate resources under different loads .
 
Even though  IaC  There are many advantages , But the configuration is improper  IaC  It will also quickly spread misconfiguration throughout the system .
IaC  Automatic configuration of can improve efficiency , You can also magnify the error ,
These errors usually have an adverse impact on safety . insist  IaC  Best practice is an effective way to reduce the risk of successful supply chain cyber attacks and vulnerabilities , Consider the following 8 individual  IaC  Best practices , To protect the safety of enterprises .
 

scanning  IaC  Code , Troubleshoot misconfiguration


IaC  Is a powerful tool , But there are also certain security risks , For example, small configuration errors are propagated throughout the cloud infrastructure . Possible forms of incorrect configuration are : Unsafe default configuration , Publicly accessible  S3 buckets  Or unencrypted database .
 
SAST  and  SCA  Scanning is the best way to feature code , However, few enterprises give priority to protecting in this way  IaC. Yes  IaC  Code security scanning can effectively reduce the exposure and vulnerability caused by configuration errors . Besides , You can scan new  commit  To find changes to cloud deployment , To detect and correct the infrastructure that matches its original template .
 

Will automate  IaC  Security scanning is embedded in the development workflow


Finding and fixing vulnerabilities before they enter the production environment is more effective than post remediation
. Therefore, by will  IaC  Misconfigured checks are embedded in the developer workflow , Developers can find and correct problems in advance . May adopt pre-commit In the form of , In order to test the code when the developer saves his work , You can also use branch protection rules that automatically execute pull requests , Or as in CI Security build rules running in . Running a security scan in a developer's workflow can also ensure that developers get accurate information in a timely manner , And fix the wrong configuration , Improve repair efficiency .
 

Identify and correct environmental offsets


Environmental offset detection ( The configuration of different deployment environments is out of sync with their templates ) And fixing misconfiguration is  IaC  One of the best practices . Deviations in configuration usually occur during maintenance , And may cause the environment ( Such as testing and production ) change . as time goes on , This will cause the configuration to deviate from the safe state .
 
The environmental shift may be caused by careless mistakes , The resulting problems are difficult to repair and may lead to business downtime , work great damage . By way of  IaC  Compare with the actual production configuration to identify the offset , But manually completing this operation is cumbersome and time-consuming . therefore , Offset detection is  IaC  A good choice for security scanning tools .
 

Prevent hard coded keys from penetrating  IaC  in


IaC  One of the most widely recognized best practices is to avoid deploying code that contains credentials . The hard coded key can be in the feature code or  IaC  Introduced into the code , And enter  IaC  The key of the code may have a devastating impact on the security of the organization . The existence of hard coded keys also leads to the disclosure of relevant accounts due to password cracking , Let malicious attackers have a chance . So if the hard coded key remains in the program , Will cause authentication measures to fail , Because anyone who has access to the project can view these hard coded keys . And scanning  IaC  Security configuration errors are very similar , The initial evaluation should be in the main branch and version history  IaC  Find hard coded key in code . The best way is to scan  commit  To prevent these hard coded keys from entering the version control system .
 

Reduce the time and impact of code leaks


Unintentional disclosure of source code may lead to intellectual property theft 、 Exposure of hard coded keys, etc . The source code and  IaC  The code is usually in the same repository , expose  IaC  There are many risks in code , This includes the attacker finding the corresponding vulnerability by parsing the code 、 Risk of configuration errors and key cracking .
 
Establish protocols to avoid code leaks , At the same time, make an emergency plan , In case of leakage . Potential suspicious user activity should be investigated , For example, using  IaC  download 、 Clone or fork repositories . Enforcing a minimum privilege policy helps reduce the risk of code leakage . In addition, perform regular inspections , Prevent source code from continuing to be published to public repositories or code sharing sites , And ensure that any source code leaks are handled quickly . Open and proprietary  IaC  The longer the code takes , The more likely a malicious attacker is to use this to launch an attack . therefore , Set the alarm mechanism , It can reduce the risk of code leakage as much as possible .
 

Establish consistent standards for tool management mechanisms


IaC  One aspect of security that is often overlooked is  DevOps  Security settings and policies of the tools and infrastructure itself . Enhanced Authentication 、 Ensure the principle of minimum privilege and enforce the separation of duties , It is of great benefit in establishing agreements conducive to security . Developer credentials are a powerful tool for attackers and other malicious actors , However, the implementation of governance and protection measures can help prevent a single stolen account from endangering other parts of the system or accessing  IaC  Tools .
 
The consistent implementation of the implementation strategy is  IaC One of the best practices .Google  Of   SLSA  frame (Supply chain Levels for Software Artifacts)  Contains specific guidelines for ensuring source code integrity , This guide is designed to reduce the chance of code tampering , And prevent malicious activities from being ignored . These requirements are aimed at  IaC  Changes to can be tracked and reviewed . Establish consistent management standards , Every system in the software supply chain is required to be secure , Users cannot change the system without additional supervision .
 

prevent  IaC  Code tampering


If the developer's account is compromised , An attacker can tamper with  IaC  Code , Thus causing serious consequences , For example, make the database publicly accessible . therefore , Not only to strengthen the developer's account , It needs to be clear  IaC  When the configuration changes , And verify whether the change has been approved . stay  SDLC  Regular comparison between different stages of , By identifying the points where the source code does not match , Help reduce the risk of code tampering . At the same time, by comparing the different stages of the construction life cycle , Ensure code integrity , To reduce the risk of tampering with code . As mentioned earlier ,IaC  Will magnify the wrong configuration , Unauthorized changes may result in  IaC  Template change or configuration tampering , This leads to code leakage , Therefore, it is critical to check and confirm the subject who is implementing the change .
 
Key code monitoring is to reduce  IaC  Another way to tamper with risk . essentially , Key code monitoring is to alert each time a change occurs , For feature codes , Critical code monitoring must be used with caution . but  IaC  Code is a template for the infrastructure that initializes and deploys applications , Therefore, it is most appropriate to use key code monitoring . Because the infrastructure usually does not change , However, it should have high visibility when changes occur , To ensure that the change is not malicious .
 

Fully understand the security environment


The complicated environment is the biggest obstacle to ensure safety . It is very important to have a comprehensive understanding of the security environment , Because this can effectively reduce the response time required to repair security problems . By improving the safety environment , Ensure development safety , Avoid code leakage or code tampering . Besides , The priority of repair can be determined more effectively through the environment of multiple events and tools . This method can produce defense in depth , So as to reduce the risk of vulnerabilities and the impact of vulnerabilities on enterprises and organizations .

Reference link :
Supply chain Levels for Software Artifacts 
https://github.com/slsa-framework/slsa
原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207011318189065.html