Blacklists are used for good and evil. An evil blacklist penalizes unfairly; a good blacklist protects. Liferay DXP’s OSGi module blacklists and component blacklists are files dropped in a folder to prevent particular modules from installing and particular components from enabling, saving you from the uninstalling and disabling them individually with the Application Manager, Components list, or Gogo shell.
Using the Control Panel’s Bundle Blacklist screen and Component Blacklist Configuration screen are the best ways to create blacklist files.
Blacklisting Modules
Follow these steps to blacklist modules:
-
In the Control Panel, navigate to Configuration → System Settings → Bundle Blacklist.
-
In the Bundle Blacklist screen, add the bundle symbolic names (see the table below) for the OSGi module JARs, LPKGs, or WARs to uninstall. Click on the Save button.
Figure 1: This blacklist uninstalls the `com.liferay.docs.greeting.api` OSGi module, Liferay Marketplace LPKG, and `classic-theme` WAR.
-
To export the blacklist to a file, click the Bundle Blacklist module’s actions button (
) and then click Export. The blacklist configuration file
com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config
downloads. Here are contents from an example file:blacklistBundleSymbolicNames=["com.liferay.docs.greeting.api","Liferay\ Marketplace","classic-theme"]
-
Add the bundle symbolic names of any modules not already listed that you want to prevent Liferay from installing.
Important: Configuration values must not contain any extra spaces. Extra spaces can short-circuit lists or invalidate the configuration entry.
-
Copy the configuration file into the
[Liferay_Home]/osgi/configs
folder to deploy it.
Blacklist Bundle Symbolic Names
Type | Bundle Symbolic Name |
---|---|
Module JAR | Bundle-SymbolicName in bnd.bnd or MANIFEST.MF file |
LPKG | LPKG file name without the .lpkg extension |
WAR | Servlet context name in liferay-plugin-package.properties file or the WAR file name (minus .war ), if there is no servlet context name property |
Liferay DXP removes installed modules on the blacklist. Blacklisted modules can’t be installed. The Liferay DXP log reports each module uninstallation.
Reinstalling Blacklisted Modules
To reinstall and permit installation of blacklisted modules, follow these steps:
-
Open the configuration file
com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config
. -
Remove the symbolic names of the modules, LPKGs, or WARs from the
blacklistBundleSymbolicNames
list and save the file.
To reinstall all the blacklisted modules execute one of these options:
- Remove the configuration file.
- Uninstall the module
com.liferay.portal.bundle.blacklist
using the Application Manager or Felix Gogo Shell.
The Liferay DXP log reports each module installation.
Blacklisting Components
Follow these steps to blacklist components:
-
In the Control Panel, navigate to Configuration → System Settings → Component Blacklist Configuration.
-
Add the names of components to disable and click on the Update button.
Figure 2: This blacklist disables the components `com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth` and `com.liferay.ip.geocoder.sample.web.internal.portlet.IPGeocoderSamplePortlet`.
-
To export the blacklist, click on the Component Blacklist Configuration module’s actions button (
) and then click Export. The blacklist configuration file
com.liferay.portal.component.blacklist.internal.ComponentBlacklistConfiguration.config
downloads. Here are contents from an example file:blacklistComponentNames=["com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth","com.liferay.ip.geocoder.sample.web.internal.portlet.IPGeocoderSamplePortlet "]
-
Add the names of any components not already listed (e.g., components of modules not yet installed) that you want to prevent Liferay from activating.
Important: Configuration values must not contain any extra spaces. Extra spaces can short-circuit lists or invalidate the configuration entry.
-
Copy the configuration file into the
[Liferay_Home]/osgi/configs
folder to deploy it.
Re-enabling Blacklisted Components
To re-enable and permit enabling of blacklisted components, follow these steps:
-
Open the configuration file
com.liferay.portal.component.blacklist.internal.ComponentBlacklistConfiguration.config
. -
Remove the names of the components from the
blacklistComponentNames
list and save the file.
To enable all the blacklisted components remove the configuration file.
Now you know how to use the blacklisting features for modules and components.