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

[YSQL] Improve LDAP logging in cases of authentication failure #10943

Closed
tanujnay112 opened this issue Dec 27, 2021 · 1 comment
Closed

[YSQL] Improve LDAP logging in cases of authentication failure #10943

tanujnay112 opened this issue Dec 27, 2021 · 1 comment
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)

Comments

@tanujnay112
Copy link
Contributor

Description

LDAP logging right now just prints the contents of pg_hba.conf upon authentication failure. This functionality needs to be improved in the case that there is sensitive content in that file.

@tanujnay112 tanujnay112 added the area/ysql Yugabyte SQL (YSQL) label Dec 27, 2021
tanujnay112 added a commit that referenced this issue Dec 27, 2021
Summary:
YSQL outputs the raw contents of ysql_hba.conf when LDAP authentication fails. These contents potentially include the ldapbindpasswd field which presents a security issue. This diff fixes that by masking this field when ysql_hba.conf is logged.

Before the logs upon LDAP authentication failure could display something like the following:

```
2021-12-22 20:06:24.177 PST [62208] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:06:24.177 PST [62208] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=blahblah123"
```

After these changes the corresponding logs will have the ldapbindpasswd field masked as such:

```
2021-12-22 20:09:27.990 PST [3970] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:09:27.990 PST [3970] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=***"
```

Test Plan: Jenkins

Reviewers: mihnea, smishra

Reviewed By: smishra

Subscribers: smishra, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D14508
@tanujnay112
Copy link
Contributor Author

Closed by 785b8e3

tanujnay112 added a commit that referenced this issue Dec 28, 2021
…uthentication fails

Summary:
YSQL outputs the raw contents of ysql_hba.conf when LDAP authentication fails. These contents potentially include the ldapbindpasswd field which presents a security issue. This diff fixes that by masking this field when ysql_hba.conf is logged.

Before the logs upon LDAP authentication failure could display something like the following:

```
2021-12-22 20:06:24.177 PST [62208] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:06:24.177 PST [62208] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=blahblah123"
```

After these changes the corresponding logs will have the ldapbindpasswd field masked as such:

```
2021-12-22 20:09:27.990 PST [3970] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:09:27.990 PST [3970] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=***"
```

Original commit: 785b8e3
Original revision: D14508

Test Plan: Jenkins: rebase: 2.6

Reviewers: mihnea, smishra

Reviewed By: smishra

Subscribers: yql, smishra

Differential Revision: https://phabricator.dev.yugabyte.com/D14522
tanujnay112 added a commit that referenced this issue Dec 28, 2021
…thentication fails

Summary:
YSQL outputs the raw contents of ysql_hba.conf when LDAP authentication fails. These contents potentially include the ldapbindpasswd field which presents a security issue. This diff fixes that by masking this field when ysql_hba.conf is logged.

Before the logs upon LDAP authentication failure could display something like the following:

```
2021-12-22 20:06:24.177 PST [62208] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:06:24.177 PST [62208] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=blahblah123"
```

After these changes the corresponding logs will have the ldapbindpasswd field masked as such:

```
2021-12-22 20:09:27.990 PST [3970] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:09:27.990 PST [3970] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=***"
```

Original commit: 785b8e3
Original revision: D14508

Test Plan: Jenkins

Reviewers: mihnea, smishra

Reviewed By: smishra

Subscribers: yql, smishra

Differential Revision: https://phabricator.dev.yugabyte.com/D14523
tanujnay112 added a commit that referenced this issue Dec 28, 2021
… authentication fails

Summary:
YSQL outputs the raw contents of ysql_hba.conf when LDAP authentication fails. These contents potentially include the ldapbindpasswd field which presents a security issue. This diff fixes that by masking this field when ysql_hba.conf is logged.

Before the logs upon LDAP authentication failure could display something like the following:

```
2021-12-22 20:06:24.177 PST [62208] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:06:24.177 PST [62208] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=blahblah123"
```

After these changes the corresponding logs will have the ldapbindpasswd field masked as such:

```
2021-12-22 20:09:27.990 PST [3970] FATAL:  LDAP authentication failed for user "riemann"
2021-12-22 20:09:27.990 PST [3970] DETAIL:  Connection matched pg_hba.conf line 5: "host all all 0.0.0.0/0  ldap ldapserver=ldap.yugabyte.com ldapbasedn="dc=yugabyte, dc=com" ldapsearchattribute=uid ldapbindpasswd=***"
```

Original commit: 785b8e3
Original revision: D14508

Test Plan: Jenkins

Reviewers: mihnea, smishra

Reviewed By: smishra

Subscribers: yql, smishra

Differential Revision: https://phabricator.dev.yugabyte.com/D14524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
Archived in project
Development

No branches or pull requests

1 participant