Bug 1847808

Summary: [RFE] AD authentication for accessing SQL Server metrics
Product: Red Hat Enterprise Linux 8 Reporter: Nathan Scott <nathans>
Component: pcpAssignee: Nathan Scott <nathans>
Status: CLOSED ERRATA QA Contact: Jan Kurik <jkurik>
Severity: high Docs Contact: Apurva Bhide <abhide>
Priority: unspecified    
Version: 8.4CC: abhide, agerstmayr, dpal, jkurik, kabbott, limershe, mgoodwin, nathans, patrickm, rdorr, tbowling
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcp-5.2.1 Doc Type: Enhancement
Doc Text:
.Active Directory authentication for accessing SQL Server metrics in PCP With this update, a system administrator can configure `pmdamssql(1)` to connect securely to the SQL Server metrics using Active Directory (AD) authentication.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:19:32 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nathan Scott 2020-06-17 06:06:51 UTC
Our internal Microsoft SQL Server folk and Microsoft engineers have requested we add support to the PCP SQL Server metrics extraction agent for Active Directory authentication.

From what I can tell so far this requires an extension to the pmdamssql(1) configuration file and some tweaks to the agent code establishing the connection to SQL Server.

Louis Imershein has found a series of notes to help us here:
https://stackoverflow.com/questions/49695990/authenticate-from-linux-to-windows-sql-server-with-pyodbc
Louis also recommended we discuss with Dmitri Pal as he may be able to assist us an AD setup to use for testing.

Tejas Shah from Microsoft has sent this link with examples:
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication?view=sql-server-ver15

And also notes "When a connection specific trusted connection= true, it uses integrated AD authentication mechanism from client library perspective. As long as SQL Server is configured to use AD auth as well, and client has appropriate kerberos ticket to authenticate itself against the SQL Server successfully, it should work seamlessly."

Comment 3 Nathan Scott 2020-08-25 05:06:19 UTC
Upstream implementation now available:

commit b63c279b7716bf84afd1b5ef3674c3bfd32e18f4
Author: Nathan Scott <nathans>
Date:   Tue Aug 25 14:59:14 2020 +1000

    pmdamssql: add support for Windows authentication
    
    Add a configuration option to mssql.conf and the PMDA
    code to allow the 'trusted_connection' pyodbc setting
    to be used.  This is a Kerberos-style authentication,
    and does not use username/password.  The default PMDA
    behaviour is to use the traditional username/password
    though, unless trusted=true is set.
    
    During testing (both styles) I've confirmed that this
    PMDA does not need to run as root so have enabled the
    privilege-dropping mode - it now runs as $PCP_USER.
    
    Resolves Red Hat BZ #1847808

Comment 9 Jan Kurik 2020-10-15 15:01:04 UTC
The verification of this RFE requires quite complex environment setup. The authentication is sensitive on correct setup of Kerberos, MSAD and MSSQL.
In general if '/opt/mssql-tools/bin/sqlcmd -E' works for 'pcp' user, then the authentication works as described in man page of the mssql PMDA. However, how to get to the point to make the 'sqlcmd -E' working is outside of the scope of this RFE (and the testing).

Comment 17 errata-xmlrpc 2021-05-18 15:19:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (pcp bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1754