Skip to main content
Version 3.1.0

Database Access Rules Configuration

Given an already created instance (Cluster Initialization), PostgreSQL provides mechanisms that allow limiting access to data. This is the first level of security for the PostgreSQL instance, which will determine whether a connection can be opened or not.

Client authentication is controlled by the pg_hba.conf configuration file, also stored in the cluster's data directory (hba stands for host-based authentication). A default pg_hba.conf file is installed when the cluster is initialized.

In the Access Rules configuration, it will be possible to specify the type of connection, the name(s) of the Database(s), the identification of user(s) or group(s), the subnet or authorized host, and the authentication method.

Prerequisites
Command Syntax
Terminal input
    pgsmart cluster config [Flags]

Flags:

  • -D, --pgdata=<path> [Default: data]. => PostgreSQL instance Data Directory.
  • -M, --pgversion=(11|12|13|14|15). => Major version of PostgreSQL.
  • -a, --agent= <agent>. => Alias, hostname, or IP of the server where a PgSmart Agent is installed.
  • -h, --help. => Help
Non-Interactive Configuration

Non-interactive execution is disabled for this operation.

Interactive Configuration
Terminal input
    pgsmart cluster config

Configuring Cluster Access Rules

  1. Select the PgSmart Agent (or register new Agent).

  2. Select Instance settings from the options menu.

  3. Select the PostgreSQL instance Data Directory for which you want to configure access rules.

  4. Select the Access Rules option.

When selecting the Access Rules option, the following operations will be available:

  • List: Allows viewing existing access rules.
  • Create: Allows creating a new access rule.
  • Modify: Allows modifying an access rule.
  • Duplicate: Allows duplicating an access rule.
  • Remove: Allows removing an access rule.

List Access Rules

  1. Select the List operation.

    The list of current Access Rules will be displayed.

    Figure 1 - Regras de Acesso - Lista
    Figure 1 - Regras de Acesso - Lista

Create an Access Rule

  1. Select the Create operation.

  2. Select the type of access rule.

  3. Specify which databases will be covered by the new Access Rule. (Default: all - any local host connection will enter for any database.)

  4. Specify the users or groups that will be covered by the new Access Rule (Default: all - everyone)

  5. Specify the subnet or authorized host .

  6. Select the Authentication Method

  7. Confirm the creation of the new Access Rule.

  8. Confirm the Reload for the new Access Rules to take effect.

    Figure 2 - Regras de Acesso - Cria
    Figure 2 - Regras de Acesso - Cria

Modify an Access Rule

  1. Select the Modify operation.

Upon selecting this action, PgSmart will provide a list of valid access rules.

  1. Select the Rule you want to modify.

  2. Adjust the desired item(s) in the sequence of options that will be presented, confirming each item with an [Enter].

  3. Confirm the modification of the Access Rule.

  4. Confirm the Reload of the PostgreSQL instance.

    Figure 3 - Regras de Acesso - Altera
    Figure 3 - Regras de Acesso - Altera

Remove an Access Rule

  1. Select the Remove operation.

Upon selecting this action, PgSmart will provide a list of valid access rules.

  1. Select the Access Rule you wish to remove.

  2. Confirm the removal.

  3. Confirm the RELOAD of the PostgreSQL instance.

    Figure 4 - Regras de Acesso - Remove
    Figure 4 - Regras de Acesso - Remove

Duplicate an Access Rule

  1. Select the Duplicate operation.

Upon selecting this action, PgSmart will provide a list of valid access rules.

  1. Select the rule you wish to duplicate.

  2. Adjust each option presented for the new rule, confirming each item with an [Enter]:

  3. Confirm the duplication of the Access Rule.

  4. Confirm the Reload of the PostgreSQL instance.

    Figure 5 - Regras de Acesso - Duplica
    Figure 5 - Regras de Acesso - Duplica
Final Notes
note
  • To implement actions on Access Rules, it is necessary to perform the RELOAD of the PostgreSQL instance.

  • This option is given by PgSmart at the time of confirming operations.

  • If the Reload is not confirmed, the configuration will remain in the file until the reload of the instance is executed.