Install - .NET 3 / 6 / 7 / 8 Agent Controller on Containerized Windows Service App for Dynamic Analysis
Installation Steps
- Download the latest vFunction Windows Controller Installation ZIP
- Download a sample installation.yaml
- Set the Configurable Settings in the downloaded installation.yaml
- Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
- Add the vFunction Windows Controller Installation ZIP and the installation.yaml to the Artifact Repository
- Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
- Modify the Application’s Dockerfile
Please be aware of the commented out notes that include find-and-replace workflows to modify the workflow below
FROM base_image_like_mcr.microsoft.com/dotnet/framework/aspnet
RUN existing_application_dockerfile_stuff
########### vFunction ###########
# Place Windows Controller Installation Zip and Installation.yaml in vf-install directory on image
COPY vf-install/* /app
# Unzip the Controller Installation ZIP
# This Dockerfile uses c:\vfunction as the location from which vFunction runs, find-and-replace this string if desired to run from a different location
RUN Expand-Archive -Path c:\app\vfunction-controller-windows-installation.zip -DestinationPath c:\vfunction -Force
# Place the installation.yaml in the location where it needs to exist
RUN Copy-Item -Path c:\app\installation.yaml -Destination c:\vfunction\config\installation\instances\default-dotnet\installation.yaml
# Set up vFunction's Controller, Viper to run as Processes but don't start those processes at Build Time
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\install.ps1 -instance default-dotnet -runAsServices false -scriptMode true -noServices true"
# Add Environmental Variables to the Windows Service Registry Key
# If using a different App Pool besides DefaultAppPool, find-and-replace that string
# Find-and-replace SERVICE_NAME with the actual name of the Service
RUN $vf_values=@("VF_AGENT_CONF_LOCATION=C:\vfunction\config\agent\instances\REPLACE_INSTANCE\conf.json", "CORECLR_PROFILER_PATH_64=C:\vfunction\agent\vfagent.net.dll", "CORECLR_PROFILER_PATH_32=C:\vfunction\agent\vfagent.net.x86.dll", "CORECLR_ENABLE_PROFILING=1 CORECLR_PROFILER={cd7d4b53-96c8-4552-9c11-6e41df8eab8a}", "DOTNET_TailCallOpt=0")
RUN New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SERVICE_NAME" -Name "Environment" -Value $vf_values -PropertyType MultiString
# In the Application's start.ps1, add the following line before the actual application starts
# This starts the Controller and Viper process at Runtime as background processes
# powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\restart-controller.ps1 -instance default-dotnet"
ENTRYPOINT ["powershell", "C:\\inetpub\\wwwroot\\start.ps1"]
- Build and deploy the Application
- Confirm that the Application comes up and functions as expected
- If any issues arise: