Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an update_process_title setting #285

Closed
fluca1978 opened this issue Jun 30, 2022 · 0 comments · Fixed by #286
Closed

Create an update_process_title setting #285

fluca1978 opened this issue Jun 30, 2022 · 0 comments · Fixed by #286
Labels
feature New feature

Comments

@fluca1978
Copy link
Collaborator

See discussion related to #215 here #284 (comment).
Provide a configuration setting, likely update_process_title, that can have values within the range:

off - Don't touch anything
strict - <= strlen(argv)
minimal - user/database
verbose - user@host:port/database (default)

and call pgagroal_set_proc_title and friends depending on such configuration setting.

@fluca1978 fluca1978 added the feature New feature label Jun 30, 2022
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Jul 1, 2022
This commit adds the `update_process_title` configuration setting.
Values for such setting are:
- `never` or `off`, means the user does not want to update the process
title at all;
- `strict` (used on Linux and systems that do no provide a native call
to update the process title) allows for changing the process title
without overflowing the length of the initial command line;
- `minimal` sets the process title to `user/database` even if this
exceeds the initial command line length;
- `verbose` sets the process title to `user@host:port/database` even
if this overflows the initial command line length.

By default the setting is configured as `verbose`, but this could
break some aggressively secured environments, where no native way to
set the process title is provided.

The `pgagroal_set_proc_title` function has been refactored so that, if
the update policy is set to `never` the process title will never be
updated. This can be confusing because even the "main" process will
not have a title update.
Likely, if the policy is `strict`, the function will never try to
overflow the initial command line length.

On those systems that do provide a native way to set the process
title, there is no difference between `strict` and `minimal` and the
`minmal` policy is always adopted.

Documentation updated.

Close agroal#285
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Jul 11, 2022
This commit adds the `update_process_title` configuration setting.
Values for such setting are:
- `never` or `off`, means the user does not want to update the process
title at all;
- `strict` (used on Linux and systems that do no provide a native call
to update the process title) allows for changing the process title
without overflowing the length of the initial command line;
- `minimal` sets the process title to `user/database` even if this
exceeds the initial command line length;
- `verbose` sets the process title to `user@host:port/database` even
if this overflows the initial command line length.

By default the setting is configured as `verbose`, but this could
break some aggressively secured environments, where no native way to
set the process title is provided.

The `pgagroal_set_proc_title` function has been refactored so that, if
the update policy is set to `never` the process title will never be
updated. This can be confusing because even the "main" process will
not have a title update.
Likely, if the policy is `strict`, the function will never try to
overflow the initial command line length.

On those systems that do provide a native way to set the process
title, there is no difference between `strict` and `minimal` and the
`minmal` policy is always adopted.

Documentation updated.

Close agroal#285
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Jul 13, 2022
This commit adds the `update_process_title` configuration setting.
Values for such setting are:
- `never` or `off`, means the user does not want to update the process
title at all;
- `strict` (used on Linux and systems that do no provide a native call
to update the process title) allows for changing the process title
without overflowing the length of the initial command line;
- `minimal` sets the process title to `user/database` even if this
exceeds the initial command line length;
- `verbose` sets the process title to `user@host:port/database` even
if this overflows the initial command line length.

By default the setting is configured as `verbose`, but this could
break some aggressively secured environments, where no native way to
set the process title is provided.

The `pgagroal_set_proc_title` function has been refactored so that, if
the update policy is set to `never` the process title will never be
updated. This can be confusing because even the "main" process will
not have a title update.
Likely, if the policy is `strict`, the function will never try to
overflow the initial command line length.

When set to `verbose` or leaved as default, the process title is built
with information about the hostname, port, username and database. A
dynamically allocated string is used to store such information. If the
primary cannot be found, the title is leaved as `minimal`.

On those systems that do provide a native way to set the process
title, there is no difference between `strict` and `minimal` and the
`minmal` policy is always adopted.

Documentation updated.

Close agroal#285
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Jul 14, 2022
This commit adds the `update_process_title` configuration setting.
Values for such setting are:
- `never` or `off`, means the user does not want to update the process
title at all;
- `strict` (used on Linux and systems that do no provide a native call
to update the process title) allows for changing the process title
without overflowing the length of the initial command line;
- `minimal` sets the process title to `user/database` even if this
exceeds the initial command line length;
- `verbose` sets the process title to `user@host:port/database` even
if this overflows the initial command line length.

By default the setting is configured as `verbose`, but this could
break some aggressively secured environments, where no native way to
set the process title is provided.

The `pgagroal_set_proc_title` function has been refactored so that, if
the update policy is set to `never` the process title will never be
updated. This can be confusing because even the "main" process will
not have a title update.
Likely, if the policy is `strict`, the function will never try to
overflow the initial command line length.

When set to `verbose` or leaved as default, the process title is built
with information about the hostname, port, username and database.
This can produce a very long title, that is in any case cut at
`MAX_PROCESS_TITLE_LENGTH` (256 bytes, including the terminator).
In the unluckily case the primary server cannot be determined, the
`verbose` mode is set back to `minimal`, but this indicates there is
something wrong somewhere else.

On those systems that do provide a native way to set the process
title, there is no difference between `strict` and `minimal` and the
`minmal` policy is always adopted. Even on these system, the `verbose`
configuration produces a title that is not any longer than
`MAX_PROCESS_TITLE_LENGTH` bytes.

Documentation updated.

Close agroal#285
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant