Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Optional Feature

Grid Indexing is an optional feature. If your organization does not require it, you can disable this functionality.

This change is made by adding a configuration option to the PCR-360 ini

constants.GRID_INDEXING_ENABLED = false

Requirements

  • Database Setup:

    • MongoDB is required to enable Grid Indexing.

    • It can be installed locally on the same machine as the application or hosted remotely on a separate server.

  • Security and Authentication

    • Authentication: MongoDB must be configured to require authentication to ensure security. This means users will need valid credentials to access the database.

    • Credentials

      • The application requires login credentials (username and password) to connect to MongoDB.

      • These credentials must have permissions to create and manage databases and tables.

Installation

Intalling the MongoDB server

https://www.mongodb.com/docs/manual/administration/install-on-linux/

Installing the MongoDB PHP Driver

https://www.mongodb.com/docs/drivers/php-drivers/

Securing the MongoDb Server

Setting up the Admin User

The password should be alphanumeric and can include hyphens - and underscores _ but should avoid special characters like ^#@%* and quotes ' “ because it can cause issues with the terminal login used by the MongoDb PHP Driver.

mongosh
>
use admin
>
db.createUser(
{
user: "pcr360",
pwd: passwordPrompt(),
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)
>
exit

Enabling Secure Login

vi /etc/mongod.conf
>
# find
#security:
# and replace with
security.authorization: enabled
>
:wq
# Restart
sudo systemctl restart mongod
sudo systemctl status mongod

Testing Login

No Access

mongosh
>
show dbs
>
MongoServerError: command listDatabases requires authentication
>
exit

Admin Access

mongosh -u pcr360 -p --authenticationDatabase admin
>
show dbs
>
admin 132.00 KiB
config 60.00 KiB
local 72.00 KiB
>
exit

Configuring PCR-360

Encrypting a Password

PCR-360's CLI can be used to encrypt MongoDB passwords

// Example is for a standard installation of a production environment and may need to be adjusted for non-standard or customer installs.
php /var/www/pcr360/prod/cli/zfcli.php -a cron.db.encrypt-password -e prod -i /var/www/pcr360/configs/pcr360.ini --js '{\"encrypt\":\"SET_PASSWORD_HERE\"}'"

Database Connection

  • PCR-360 configuration Options

    • Ooptions must be placed in the correct section for the environment. Usually, test or prod

    • the INI is usually located /var/www/pcr360/configs/pcr360.ini

[prod : default]
mongodb.encryptPassword = 1;
mongodb.host = localhost
mongodb.port = 27017
mongodb.dbname = pcr360_prod
mongodb.username = pcr360
mongodb.password = "some-Unique_Password"

[test: prod ]
mongodb.encryptPassword = 1;
mongodb.host = localhost
mongodb.port = 27017
mongodb.dbname = pcr360_test
mongodb.username = pcr360
mongodb.password = "some-Unique_Password"

Disabling the Index

Setting this constant to false will disable the indexing and prevent any attampted connection to MongoDB. This is intended to disable the index for customers whose hardware cannot support it.

constants.GRID_INDEXING_ENABLED = true

Indexed grids use the Index, by default, for grid queries

To disable, set this config option to false

constants.GRID_INDEX_DEFAULT_ON = true
  • No labels