PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

Lock down SetManagerConfig servlet #138

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. SetManagerConfig Servlet will accept new configuration even if there are 
Connectors currently configured

What is the expected output? What do you see instead?

SetManagerConfig Servlet should only accept updates if it has never been 
configured.  Manual reset of the configuration should be required after 
that point.

Original issue reported on code.google.com by mgron...@gmail.com on 4 Apr 2009 at 3:38

GoogleCodeExporter commented 8 years ago
Fixed r1637.

Adding a feature where updates to the Manager configuration are locked out if a
lock property is missing or set to 'true' in the applicationContext.properties
file.  Also drop a latch when the Connector Manager configuration is
successfully
changed that has to be removed manually.

Note to Users and Developers:

Versions of the Connector Manager built with this patch will now latch the
Connector Manager configuration settings.  The SetManagerConfig Servlet will be
locked out if; A) the applicationContext.properties file does not contain a
'manager.locked' property as part of the upgrade, or B) the 'manager.locked'
property is set to 'true' after successfully setting the Connector Manager
configuration.

If an attempt is made to set the Connector Manager configuration to a new host
or port while it's latched the Servlet will reply with a status of 5416 and a
log entry should appear as follows:

  WARNING: Attempt has been made to change configuration on a locked Connector
  Manager. You must update the locked property on the Connector Manager before
  continuing.
  Request: feederGateHost=<new_host_value>; feederGatePort=<new_port_value>

To unlock a latched Connector Manager simply edit the
WEB-INF/appliationContext.properties file in the deployed WebApp and change the
value of the 'manager.locked' property to false as follows:

  manager.locked=false

NOTE: This can be done while the Connector Manager is running.  There is no need
to restart the server or redeploy the Web App.  The changes to the property file
will be detected the next time the request is made to the Connector Manager
Servlet to SetManagerConfig.

Tests Passed:

- All Unit Tests
- Tested with two GSAs.  Registered CM with first GSA and then tried to register
  with second.  Second attempt failed with status code 5416.  Was able to
  reregister the CM with the initial GSA.

Original comment by mgron...@gmail.com on 4 Apr 2009 at 3:42

GoogleCodeExporter commented 8 years ago

Original comment by mgron...@gmail.com on 4 Apr 2009 at 3:48

GoogleCodeExporter commented 8 years ago
Further testing revealed a bug in the Issue 138 changes committed
with r1637.  Specifically, Java Properties.store() cannot handle
comments with embedded newlines.

Since we wrap Properties.store() inside PropertiesUtils, I
enhanced PropertiesUtils.storeProperties() to correctly comment
out multiline comments.

I also improved the properties file comment string, providing
better definition as to the names of the properties documented.

I changed the default applicationContext.properties file to
reflect the ehnanced property documentation.

I bumped the googlePropertiesVersion so we can differentiate
older properties files from ones that should have the latch.

Lastly, I enhanced Contex.isManagerLocked() to consider that
older version applicationContext.properties files that have
not been configured (gsa.feed.host is still 'localhost'), as
unlocked.

Change Log:
----------
M  
connector-manager/source/java/com/google/enterprise/connector/common/PropertiesU
tils.java
   - handle multi-line comments written to Properties files.
   - bump googlePropertiesVersion.

M  
connector-manager/source/java/com/google/enterprise/connector/manager/Context.ja
va
   - clarified properties documentation comment.
   - consider old, unconfigured properties files as unlocked.

M  connector-manager/etc/applicationContext.properties
   - enhanced comments to reflect the one generated by Context.

Fixed on the trunk in Connector Manager Revision r1652   06 April 2009
Fixed on the 1.3.x branch in Connector Manager Revision r1653   06 April 2009

Original comment by Brett.Mi...@gmail.com on 6 Apr 2009 at 11:49