Name
Set-JS7Feature.ps1
SYNOPSIS
Enables and disables software packages included with the installation of JS7 products
SYNTAX
Set-JS7Feature.ps1 [-HomeDir] <String> [[-Features] <String>] [[-SBOM] <String>] [[-Enable] <String[]>] [[-Disable] <String[]>] [[-BackupDir] <String>] [[-LogDir] <String>] [-List] [-ShowLogs] [-MakeDirs] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Disabling software packages can be an immediate means for mitigation of vulnerabilities in 3rd-party components used by JS7 products.
The JS7 products ship with a Software Bill of Materials that can be used to identify vulnerable components and package dependencies.
For disabling of components the script is used to remove component files such as .jar files from a JS7 product installation.
The script can be used later on to restore disabled components.
The script is available on Windows and Unix platforms supporting PowerShell 5.1, 6, 7
For download see https://kb.sos-berlin.com/display/JS7/JS7+-+Download
PARAMETERS
HomeDir
-HomeDir <String>
Specifies the directory in which the JS7 product is installed.
Required? | true |
Position? | 1 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Features
-Features <String>
Specifies the path to a file in .json format that stores information about enabled and disabled software packages.
By default the <home>/features.json file is used.
The file does not exist by default but is automatically created when enabling and disabling packages.
Required? | false |
Position? | 2 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
SBOM
-SBOM <String>
Specifies the path to a file that holds the Software Bill of Materials. The file ships with the respective JS7 products.
For Controller and Agents the <home>/sbom.json file is used. For JOC Cockpit the JETTY_BASE/webapps/joc/sbom.json file is used.
Required? | false |
Position? | 3 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Enable
-Enable <String[]>
Specifies software packages that should be enabled. A number of software packages can be specified separated by comma.
As a prerequisite when disabling software packages
* the information is stored in the features.json file, see -Features argument. This information is later on used to enable software packages.
* the backup directory has to be specified, see -BackupDir argument, that is used as the source when enabling software packages.
If a software package is not available from the backup directory then the software package cannot be enabled.
Instead the JS7 product has to be re-installed or updated.
Required? | false |
Position? | 4 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Disable
-Disable <String[]>
Specifies software packages that should be disabled. A number of software packages can be specified separated by comma.
The files related to a software package such as *.jar files will be removed from the JS7 product installation.
To allow later enabling a backup directory is specified with the -BackupDir argument.
Users who do not want to use a backup directory can apply the -Force switch.
Required? | false |
Position? | 5 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
BackupDir
-BackupDir <String>
If a backup directory is specified when disabling software packages then related files
such as *.jar files are moved to this directory.
The backup directory holds a lib sub-folder with related sub-folders of the JS7 product's
lib directory such as lib/sos, lib/3rd-party etc.
Required? | false |
Position? | 6 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
LogDir
-LogDir <String>
If a log directory is specified then the Software Package Management Script will log information
about processing steps to a log file in this directory.
File names are created according to the pattern: js7_set_feature.<hostname>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
For example: js7_set_feature.centostest_primary.2022-03-19T20-50-45.log
Required? | false |
Position? | 7 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
List
-List <SwitchParameter>
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
ShowLogs
-ShowLogs <SwitchParameter>
Displays the log output created by the Software Package Management Script if the -LogDir argument is used.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
MakeDirs
-MakeDirs <SwitchParameter>
If directories are missing that are indicated with the -BackupDir or -LogDir arguments then they will be created.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Force
-Force <SwitchParameter>
Specifies that a software package is disabled, i.e. its files are removed from the JS7 product installation,
without use of a backup directory.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
WhatIf
-WhatIf <SwitchParameter>
Required? | false |
Position? | named |
Default value | |
Accept pipeline input? | false |
Accept wildcard characters? | false |
Confirm
-Confirm <SwitchParameter>
Required? | false |
Position? | named |
Default value | |
Accept pipeline input? | false |
Accept wildcard characters? | false |
EXAMPLES
-------------------------- EXAMPLE 1 --------------------------
PS > ./Set-JS7Feature.ps1 -HomeDir "C:\Program Files\sos-berlin.com\js7\agent" -List
Displays list of enabled/disabled packages.
-------------------------- EXAMPLE 2 --------------------------
PS > ./Set-JS7Feature.ps1 -HomeDir "C:\Program Files\sos-berlin.com\js7\agent" -Disable simple-xml,snakeyaml -BackupDir C:\tmp\backup -MakeDirs
Disables the indicated packages and moves related .jar files from the JS7 products home directory to the backup directory.
-------------------------- EXAMPLE 3 --------------------------
PS > ./Set-JS7Feature.ps1 -HomeDir "C:\Program Files\sos-berlin.com\js7\agent" -Enable simple-xml,snakeyaml -BackupDir C:\tmp\backup
Enables the indicated packages and moves related .jar files from the backup directory to the home directory of the JS7 product.