Custom Provisioning
- 08 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
- PDF
Custom Provisioning
- Updated on 08 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
About this Article
This article provides details about when provisioning scripts needs to be invoked, script configuration and usecases.
Custom provisioning/un-provisioning is Optional and is available only for VM.
Custom provisioning/un-provisioning can be utilized when the user wishes to execute custom commands during Application provisioning/un-provisioning. VSP provides an ability to write and execute custom scripts during both the scenarios.
When are the scripts invoked?
- The custom provisioning script is invoked during the below two scenarios:
- The Application is provisioned on the CMS
- The Probe services are restarted
- The custom un-provisioning script is invoked when the Application is un-provisioned on the CMS
NOTE
- The custom provision and un-provision scripts are common for all Applications deployed on the instance. Using the appcontext parameter provided to the script, required actions for each application can be taken
- The custom provision and un-provision scripts are NOT invoked when the Application is restarted during upgrade or maintenance
- When an Application is un-provisioned on CMS, the changes are not reflected until the Application is restarted
Custom Script Configuration
- Login to the Probe as virsec user
- Navigate to the directory: /opt/virsec-web-mem/<Language>/scripts
- To customize the provisioning process, create a directory cust-prov using the below command and copy the required script in the newly created directory cust-prov
mkdir cust-prov
- The custom script is invoked with the below parameters:
- Ruby on Rails:
<Script_Name> <Deployment Directory>
- Example with default script:
/opt/virsec-web-mem/iae-ruby/scripts/provisionRor.sh "/opt/open-source-billing"
- Example with default script:
- Java:
<Script> <Server type> <Application Config File Path> <AppCollectiveID> <Server name> --applicationType <Application Type> --filterType <Filter Type> --instrumentationFilterClass <Filter Class> --filterMethod <Filter Method> –filterPosition <Filter Position>
NOTEServer name is applicable when the Server Type is JBoss and the script is XML- Example with default script:
/opt/virsec-web-mem/iae-java/scripts/provision.sh "Tomcat" "/opt/apache-tomcat-8.5.30/bin/setenv.sh" "tomcat8_rhel7_webgoat_vm" "" --applicationType "Other Application" --filterType "ServletFilter" --instrumentationFilterClass "NA" --filterMethod "doFilter" –filterPosition "First"
- Example with default script:
- PHP:
<Script> <Prov/Clean> php <Deployment Directory> <Server Type> <PHP version> <AppCollectiveID> <Empty String> <Running Application Count>
NOTERunning Application Count can be used to remove the extension php from php.ini if the value is 0- Example with default script:
/opt/virsec-web-mem/iae-php/scripts prov php "/var/www/html/mutillidae" "Apache" "7.3" "rhel8-apache" "" "0"
- Example with default script:
- Ensure that the VSP script: /opt/virsec-web-mem/<Technology>/scripts/provision.sh is invoked from this custom script
- Ruby on Rails:
- To customize the un-provisioning process, follow the below process:
mkdir cust-unprov
- Copy the required script under the newly created directory: cust-unprov
- Ensure that the VSP script: /opt/virsec-web-mem/<Technology>/scripts/unprovision.sh is invoked from this custom script
- The custom scripts are executed as the root user. Ensure that the user is changed to the required user in the script for Application start or stop actions
- To remove the customization, delete the below directories
- /opt/virsec-web-mem/<Language>/scripts/cust-prov
- /opt/virsec-web-mem/<Language>/scripts/cust-unprov
Usecases
- Server Restart: In cases, where the Server needs a restart during provisioning or un-provisioning, custom scripts can be utilized:Step 1: Invoke VSP Provision/Un-provision Script
Step 2: Change User (if needed)
Step 3: Restart Application Server- In cases where the Application restart takes more than 3 minutes, the provisioning will time out. In such cases, invoke the Application restart script asynchronously so that provisioning on CMS succeeds
- Backup and Restore: Whenever a backup is needed, custom scripts can be utilized:Step 1: Take backup
Step 2: Invoke VSP Provision/Un-provision Script
Step 3: Restore from Backup
Was this article helpful?