Blacklisting OSGi Modules and Components

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:

  1. In the Control Panel, navigate to ConfigurationSystem SettingsBundle Blacklist.

  2. 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.

    Figure 1: This blacklist uninstalls the `com.liferay.docs.greeting.api` OSGi module, Liferay Marketplace LPKG, and `classic-theme` WAR.

  3. To export the blacklist to a file, click the Bundle Blacklist module’s actions button (Actions) 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"]
    
  4. 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.

  5. Copy the configuration file into the [Liferay_Home]/osgi/configs folder to deploy it.

Blacklist Bundle Symbolic Names

Type Bundle Symbolic Name
Module JARBundle-SymbolicName in bnd.bnd or MANIFEST.MF file
LPKGLPKG file name without the .lpkg extension
WARServlet 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:

  1. Open the configuration file com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config.

  2. 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:

The Liferay DXP log reports each module installation.

Blacklisting Components

Follow these steps to blacklist components:

  1. In the Control Panel, navigate to ConfigurationSystem SettingsComponent Blacklist Configuration.

  2. 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.

    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`.

  3. To export the blacklist, click on the Component Blacklist Configuration module’s actions button (Actions) 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 "]
    
  4. 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.

  5. 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:

  1. Open the configuration file com.liferay.portal.component.blacklist.internal.ComponentBlacklistConfiguration.config.

  2. 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.

« Liferay App TypesIntroduction to Configuring Liferay DXP »
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0