Deploying a .NET IAST agent
This topic explains how to create a .NET IAST agent type on your web server.
Before you begin
If the server running IAST is behind a proxy, the IAST .NET agent supports two ways to configure an outbound HTTP proxy:
- System proxy settings, which are automatically detected from standard OS settings or the HTTP_PROXY, HTTPS_PROXY environment variables.
-
IAST-specific proxy settings, defined with the application’s own
environment variables. Configure them as
follows:
IAST_PROXY_HOST={proxy_ip} IAST_Deploy_dot_net.html
If the application-specific variables are set, they take precedence. Otherwise, the system proxy is used. If neither is defined, the application connects directly. Proxy settings are read at startup, so changes require a restart. Check the IAST log to verify that the proxy is configured correctly.
About this task
Procedure
-
Download the ASoC .NET IAST NuGet package:
- Follow the instructions at IAST scan documentation to download the agent.
-
Configure a NuGet package source:
- Open Visual Studio.
- Go to Menu > Tools > Options > NuGet Package Manager > Package Source.
- Click + to add a new package source.
- Enter a name for the source.
- Select the folder that contains the downloaded NuGet package.
- Click OK.
-
Identify web server projects:
Install the IAST agent only in projects that host web applications, such as:
- ASP.NET Framework applications
- ASP.NET MVC applications
- ASP.NET Core applications
These projects typically contain files or folders such as Startup.cs, Program.cs, Controllers, or wwwroot.
-
Install the IAST agent NuGet package:
- In Solution Explorer, right-click the web application project.
- Select Manage NuGet Packages.
- From the Package source drop-down list, select the package source that you created in Step 2.
-
Search for
com.HCL.AppScan.IAST.Agent. - Select the package and click Install.
- Repeat this step for each web application project that should be monitored.
Important:Several AppScan-related packages may be available. Make sure that you install com.HCL.AppScan.IAST.Agent from the package source configured earlier. Do not install HCL.AppScan.IAST.NetCore.Azure.SiteExtension, because it is intended for Azure App Service deployments and is not required for standard .NET Framework or .NET Core IAST deployments. -
Configure the application environment variable (for .NET Core
only): For .NET Core applications, configure the following
environment variable:
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SecagentCore" -
Verify the installation: Verify that the installation was
successful.
Results
Deploying to a separate server
Install the IAST NuGet package on the build or development machine, then deploy the application and all required IAST files to the target server.
About this task
Many .NET applications are developed and built on one machine and then deployed to a different server.
In this scenario, install the IAST NuGet package only in the application project on the build or development machine. Do not install the NuGet package separately on the target server.
Procedure
- Complete all steps in the previous procedure to install the IAST NuGet package in the application project on the build or development machine, and then follow the steps below.
-
Verify that the NuGet installation completed successfully.
Confirm that the following updates were made:
- The required IAST entries were added to web.config.
- The IAST assemblies were added to the application's output.
- Publish or deploy the application by using your standard deployment process.
-
Ensure that all required IAST files are copied to the target server.
This includes the following files:
- The IAST agent DLLs and dependencies.
- The modified web.config file for .NET Framework applications.
- Asoc-config.json for .NET Core applications.
The complete list of required agent files for each language version is provided in the NuGet package Dependencies folder.
Results
The application is deployed to the target server with the required IAST files.
What to do next
Important: The IAST agent consists of multiple assemblies. Missing files can prevent the agent from loading or operating correctly. Always verify the deployed files against the required file list after deployment.
Troubleshooting instructions
If the IAST session in ASoC does not reach the Connected status after the application starts, review the IAST agent log for additional diagnostic information.
On Windows, the log is typically created under the account running the application, for example: C:\Users\<user-name>\AppData\Local\Temp\Secagent
In some server environments, permission restrictions may prevent the agent from creating log files in this location. If no logs are present, configure a custom log directory by using one of the following methods:
- Create a folder in a location that is accessible to the application.
- Configure a custom log directory using one of the following
methods:
- Option 1: Environment variable
Create an environment variable named secagent.log and set its value to the full path of a folder that is accessible to the application.
- Option 2: Application configurationSpecify the log directory in the application's configuration:
.NET Framework (web.config): <appSettings> <add key="IASTAgentKey" value="..." /> <add key="IASTHost" value="..." /> <add key="IASTLogLocation" value="C:\Logs\Secagent" /> </appSettings> .NET Core (appsettings.json or equivalent configuration source): { "IASTAgentKey": "...", (optional) "IASTHost": "...", (optional) "IASTLogLocation": "C:\\Logs\\Secagent" (optional) }
- Option 1: Environment variable
- Restart the application. The agent log file is created in the
specified folder.Note:Ensure that the application account has read and write permissions for the configured log directory.