This procedure shows how to configure the settings for MetaDefender or any custom virus scanner to implement virus scanning of packages before uploading them to a file server. Scanning is performed asynchronously but waits until the response from the scanner is received before starting to upload the package.
If the scan fails, the package is not uploaded and the user will receive a notification about any virus that is detected.
-
If no MetaDefender URI is specified, or a specified MetaDefender endpoint does not exist, or MetaDefender throws an exception, the software will use a customer-implemented scanner.
-
The IVirusScanner interface is provided for you to implement a custom scanner:
-
If no custom scanning is configured, the package will be uploaded without performing a virus scan.
Configure MetaDefender virus scanner
Locate the folder where SEM Web API is installed, for example: "C:\Program Files (x86)\Smart\Engineering Manager\4.0".
-
Under the installation root path, navigate to "..\Smart\Engineering Manager\4.0\Server".
-
From the Server folder, open the web.config file using a text editor.
-
Go to the <appSettings> section and locate the following row:
<!--Settings for Metadefender VirusScan-->
-
Enter values for the following parameters, for example:
<add key="MetaDefender_URI" value="http://semappmetdef01.mycloud.net:8008" />
<add key="MetaDefender_ApiKey" value="" />
<add key="MetaDefender_PollingInterval" value="200" />
<add key="MetaDefender_Timeout" value="1000000" />
-
The MetaDefender_ApiKey value is relevant where the MetaDefender URI is secured. For details of how to generate a key, see https://onlinehelp.opswat.com/vault/Generate_an_API_key_from_Metadefender_Core.html. If the MetaDefender URI is not secured, the MetaDefender_ApiKey parameter value should be left blank.
-
The MetaDefender_PollingInterval parameter determines the sleep time between polling scan results.
-
Values of the MetaDefender_PollingInterval and MetaDefender_Timeout parameters are in milliseconds.
-
-
Save and close the web.config file.
Use custom virus scanner to perform scanning
The custom scanner example shown here makes use of the Clam AV virus scanner.
-
Implement the IVirusScanner interface and create an assembly out of it.
-
Place the assembly in the ~\VirusScanner folder, for example: C:\Program Files (x86)\Smart\Engineering Manager\4.0\Server\VirusScanner, along with any other dependent files.
-
Locate the folder where SEM Web API is installed, for example: "C:\Program Files (x86)\Smart\Engineering Manager\4.0".
-
Under the installation root path, navigate to "..\Smart\Engineering Manager\4.0\Server".
-
From the Server folder, open the web.config file using a text editor.
-
Go to the <appSettings> section and add the following rows:
<!-- Scan using customer implemented virus scanner dll(s) -->
<add key="CustomerVirusScanner_FullClassName" value="" />
-
Enter a value for the CustomerVirusScanner_FullClassName parameter based on the format Namespace.Classname, for example: CustomScanner_Example.ClamAvScanner:
-
Save and close the web.config file.