<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kerberos &#8211; Andromedabay Store</title>
	<atom:link href="https://andromedabay.ddns.net/category/my-topics/it-infrastructure-systems/kerberos/feed/" rel="self" type="application/rss+xml" />
	<link>https://andromedabay.ddns.net</link>
	<description>Your source of Technical Insight and Interesting Stuff</description>
	<lastBuildDate>Thu, 13 Jul 2023 23:01:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://andromedabay.ddns.net/wp-content/uploads/2015/08/cropped-myicon-32x32.png</url>
	<title>Kerberos &#8211; Andromedabay Store</title>
	<link>https://andromedabay.ddns.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MS-SQL: connecting Python on Linux &#8211; using Active Directory Credentials and Kerberos</title>
		<link>https://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/</link>
					<comments>https://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/#respond</comments>
		
		<dc:creator><![CDATA[Hammad Rauf]]></dc:creator>
		<pubDate>Tue, 26 Sep 2017 22:30:15 +0000</pubDate>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[MS-SQL Server]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MS-SQL]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[pymssql]]></category>
		<category><![CDATA[pyodbc]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://hammadr.wordpress.com/?p=328</guid>

					<description><![CDATA[Microsoft SQL Server (MS-SQL) is a very popular database server. Following the 3-tier architecture many applications use it as the back end database server. Apart]]></description>
										<content:encoded><![CDATA[<div class='booster-block booster-read-block'>
                <div class="twp-read-time">
                	<i class="booster-icon twp-clock"></i> <span>Read Time:</span>7 Minute, 19 Second                </div>

            </div><p>Microsoft SQL Server (MS-SQL) is a very popular database server. Following the 3-tier architecture many applications use it as the back end database server. Apart from Microsoft Windows based applications sometimes the application are deployed on Linux servers. What is required when connecting a Python Application (on Linux) to a MS-SQL back-end using Windows (Active Directory Domain) user account? After some searching on the Internet a solution was found that allowed this possibility.</p>
<p>Following is a summary of what is needed in order to accomplish this connection between a Python application running on Linux and MS-SQL back-end using Active Directory user account credentials. The contents below are based on several different web-sites where parts of the solution were discovered. These steps have been verified on CentOS Linux 6.8 (RHEL 6.8). I have collected all the steps in one article.</p>
<h2>Installing MS-SQL Driver (Pyodbc and Microsoft ODBC SQL Driver)</h2>
<p>It turns out that it is not possible to use &#8220;pymssql&#8221; to connect using Active Directory user account on Linux Centos 6.8 (RHEL 6.8). The pymssql python driver library only supports MS-SQL user accounts. So for this problem we had to use &#8220;pyodbc&#8221; with Microsoft provided ODBC SQL Driver.</p>
<p>To install &#8220;pyodbc&#8221; and MS ODBC SQL Driver use the following steps.</p>
<pre>sudo yum install gcc-c++
sudo yum install python-devel
sudo yum install python-pip
sudo yum install unixODBC-devel
sudo pip install pyodbc # failed
OR
sudo yum install pyodbc</pre>
<p>Now as root or Super User type the following. This will update the &#8220;yum&#8221; repositories list to include Microsoft published RHEL software site.</p>
<pre>sudo su
curl https://packages.microsoft.com/config/rhel/6/prod.repo &gt; /etc/yum.repos.d/mssql-release.repo
exit</pre>
<p>Now type the following to download the MS ODBC SQL Server driver. There are some optional components that you may find useful. These steps also update the $PATH environment variable to include the optional tools.</p>
<pre>sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
sudo ACCEPT_EULA=Y yum install msodbcsql
sudo ACCEPT_EULA=Y yum install mssql-tools # optional
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' &gt;&gt; ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' &gt;&gt; ~/.bashrc
source ~/.bashrc
sudo yum install unixODBC-devel # optional</pre>
<p>Use the following steps to verify that the pyodbc and MS-ODBC SQL Driver installed correctly.</p>
<pre>ls -l /usr/lib64/libodbc*
odbc_config --version --longodbcversion --cflags --ulen --libs --odbcinstini --odbcini
odbcinst -j
isql --version
ls -l /opt/microsoft/msodbcsql/lib64/
dltest /opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0 SQLGetInstalledDrivers
dltest /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.0 SQLGetInstalledDrivers
cat /etc/odbcinst.ini # should contain a section called [ODBC Driver 13 for SQL Server]</pre>
<h2>Connecting Via DSN</h2>
<p>You may want to create a Data Source Name (DSN) to connect to the database. If that is the case then create a text file with the following contents and save it as &#8220;myconnection_dsn_stub.dsn&#8221;.</p>
<pre>[MyDSNName]
Driver      = ODBC Driver 13 for SQL Server
Description = My Database DSN
Trace       = No
Server      = db_server.mycontoso.com,1433</pre>
<p>Now register the DSN entry and test connection in Python. Note that &#8220;Trusted connection = yes&#8221; forces the driver to use Active Directory (Kerberos) user account.</p>
<pre>cat /etc/odbcinst.ini
sudo odbcinst -i -s -f ./mycnonection_dsn_stub.dsn -l
cat /etc/odbc.ini
python -c "import pyodbc; print(pyodbc.connect('DSN=MyDSNName;DATABASE=db_name;UID=ad_user_id;PWD=*****;Trusted_Connection=yes'))"</pre>
<p>If you have not installed and configured Kerberos (See below) then you will get following error message.</p>
<pre>Traceback (most recent call last):
File "", line 1, in
pyodbc.Error: ('HY000', "[HY000] [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]SSPI Provider: Credentials cache file '/tmp/krb5cc_500' not found (851968) (SQLDriverConnectW)")</pre>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2435427972424429"
     crossorigin="anonymous"></script><br />
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-2435427972424429"
     data-ad-slot="3797637297"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<h2>Install Kerberos</h2>
<p>Linux servers use Kerberos to work with Microsoft Windows Active Directory Domain servers. Kerberos provides a reliable and secure way for Linux servers to authenticate on Active Directory domains.</p>
<p>Install Kerberos by using the following steps.</p>
<pre>sudo yum install krb5-workstation
cat /etc/krb5.conf</pre>
<p>To configure Kerberos to work in your Active Directory domains, you need to configure it. On a Windows Desktop computer perform the following steps to find out the Domain controller server name. Replace DOMAIN_NAME with actual domain name i.e. contoso.com .</p>
<pre>C:\&gt; nslookup
&gt; set type=all
&gt; _ldap._tcp.dc._msdcs.MYCONTOSO.COM
mycontoso.com nameserver = my-domain-controller-server.MYCONTOSO.com
......................
ping my-domain-controller-server.MYCONTOSO.com</pre>
<p>Now configure Kerberos as follows. Please note that the contents of &#8220;/etc/krb5.conf&#8221; file are shown as &#8220;cat&#8221; command output.</p>
<pre>sudo cp /etc/krb5.conf /etc/krb5.conf_backup
ls -l /etc/krb5*
sudo vi /etc/krb5.conf
cat /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

[libdefaults]
default_realm = MYCONTOSO.COM

[realms]
MYCONTOSO.COM = {
kdc = my-domain-controller-server.MYCONTOSO.com
}

[domain_realm]
.mycontoso.com = MYCONTOSO.COM
mycontoso.com = MYCONTOSO.COM</pre>
<p>Kerberos works by passing the user account and password information to Active Directory server, which authenticates the user. If the user is authenticated successfully then a temporary Kerberos Ticket is saved in &#8220;/tmp/krb5cc&#8221; file. This ticket can be used to login to Windows Servers before the ticket expires.</p>
<p>To obtain Kerberos Ticket interactively, for testing the connection type the following commands.</p>
<pre>kinit AD_USER_ID@MYCONTOSO.COM
# Enter User Password

klist  # Lists Kerberos Tickets
# Ticket cache: FILE:/tmp/krb5cc_500
# Default principal: AD_USER_ID@MYCONTOSO.COM
#
# Valid starting Expires Service principal
# 08/31/17 14:17:29 09/01/17 00:17:50 krbtgt/MYCONTOSO.COM@MYCONTOSO.COM
# renew until 09/01/17 14:17:29
# 08/31/17 14:18:56 09/01/17 00:17:50 MSSQLSvc/db_server.mycontoso.com:1433@MYCONTOSO.COM
# renew until 09/01/17 14:17:29</pre>
<h2>Connecting Python With Kerberos Ticket</h2>
<p>To test Connection with current Kerberos ticket type the following. Please note that this connection method is not using the DSN that we created earlier.</p>
<pre>$ cat testConnection.py
import pyodbc
cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER=db_server.mycontonso.com,1433;DATABASE=db_name;Trusted_Connection=yes')
cursor = cnxn.cursor()
cursor.execute('SELECT TOP 10 [ServerName],[RunID],[JobID],[TimeStamp] FROM [db_name].[dbo].[table_name] ORDER BY [RunID] DESC')
row = cursor.fetchone()
if not row:
print("No rows returned.")
while row:
print("ServerName=%s, JobID=%d, TimeStamp=%s" % (row[0], row[2], row[3]))
row = cursor.fetchone()
cnxn.close()

$ python testConnection.py</pre>
<p>Following is an example of how Python code can be used to obtain fresh Kerberos ticket and then connect to the MS-SQL database back-end.</p>
<pre>from subprocess import Popen, PIPE
import pyodbc

# Login Credentials
userid="AD_USER_ID"
password='******'
realm="MYCONTOSO.COM"
kinit = '/usr/bin/kinit'

# Get Fresh Kerberos Ticket
kinit_args = [ kinit, '%s@%s' % (userid, realm) ]
kinit = Popen(kinit_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
kinit.stdin.write('%s\n' % password)
kinit.wait()

cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER=db_server.mycontoso.com,1433;DATABASE=db_name;Trusted_Connection=yes')
cursor = cnxn.cursor()
cursor.execute('''SELECT TOP 10 CAST([ServerName] AS VARCHAR) AS SERVERNAME
,[RunID]
,[JobID]
,CAST([LongText] AS VARCHAR(MAX)) AS LONGTEXT
,[TimeStamp]
FROM [db_name].[dbo].[table_name]''')
row = cursor.fetchone()
if not row:
print("No rows returned.")
while row:
print("ServerName=%s, LongText=%s, JobID=%d, TimeStamp=%s" % (row[0], row[3], row[2], row[4]))
row = cursor.fetchone()
cnxn.close()</pre>
<div class="wpapp_widget"><div id="elements_wrapper_wpapp_paypal_button_0"><div class="wpapp_payment_subject"><span class="payment_subject"><strong>Is this content useful for you? Support this site by donating any amount....(takes you to Paypal website).</strong></span></div><select id="select_wpapp_paypal_button_0" name="select_wpapp_paypal_button_0" class=""><option value="proud-supporter-2-donation">Proud Supporter - $2 Donation</option><option value="bronze-supporter-5-donation">Bronze Supporter - $5 Donation</option><option value="silver-supporter-10-donation">Silver Supporter - $10 Donation</option><option value="gold-supporter-20-donation">Gold Supporter - $20 Donation</option></select><div class="wpapp_other_amount_label"><strong>Other Amount</strong></div><div class="wpapp_other_amount_input"><input type="number" min="1" step="any" name="wpapp_other_amt" title="Other Amount" value="" placeholder="" class="wpapp_other_amt_input" style="max-width:80px;" /></div><div style="margin-bottom:10px;"></div></div>    <div class="wpapp-ppcp-button-wrapper">

    <!-- PayPal button container where the button will be rendered -->
    <div id="wpapp_paypal_button_0" style="width: 250px;"></div>

    <script type="text/javascript">
        document.addEventListener( "wpapp_paypal_sdk_loaded", function() { 
            //Anything that goes here will only be executed after the PayPal SDK is loaded.
            console.log('PayPal JS SDK is loaded for WPAPP.');

            /**
             * See documentation: https://developer.paypal.com/sdk/js/reference/
             */
            paypal.Buttons({
                /**
                 * Optional styling for buttons.
                 * 
                 * See documentation: https://developer.paypal.com/sdk/js/reference/#link-style
                 */
                style: {
                    color: 'blue',
                    shape: 'rect',
                    height: 35,
                    label: 'checkout',
                    layout: 'vertical',
                },

                // Triggers when the button first renders.
                onInit: onInitHandler,

                // Triggers when the button is clicked.
                onClick: onClickHandler,

                // Setup the transaction.
                createOrder: createOrderHandler,

                // Handle the onApprove event.
                onApprove: onApproveHandler,

                // Handle unrecoverable errors.
                onError: onErrorHandler,

                // Handles onCancel event.
                onCancel: onCancelHandler,

            })
            .render('#wpapp_paypal_button_0')
            .catch((err) => {
                console.error('PayPal Buttons failed to render');
            });

            function onInitHandler(data, actions) {
                //This function is called when the button first renders.
            }

            function onClickHandler(data, actions) {
                //This function is called when the button is clicked.
            }

            
            /**
             * See documentation: https://developer.paypal.com/sdk/js/reference/#link-createorder
             */
            async function createOrderHandler() {
                // Create the order in PayPal using the PayPal API.
                // https://developer.paypal.com/docs/checkout/standard/integrate/
                // The server-side Create Order API is used to generate the Order. Then the Order-ID is returned.                    
                console.log('Setting up the AJAX request for create-order call.');

                // First, select the interacted button's wrapper div by its ID (so  we can target various elements within it)
                const wrapper_div_interacted_button = document.getElementById('elements_wrapper_wpapp_paypal_button_0');
                //console.log(wrapper_div_interacted_button);

                // Read the select element and get the selected option's value and text.
                js_on_page_embed_button_id = 'wpapp_paypal_button_0';
                var selectId = 'select_' + js_on_page_embed_button_id; // Construct the select ID
                var selectElement = document.getElementById(selectId);
                //console.log("Select Element: ", selectElement);

                //Get the other amount field value.
                var other_amount_input = wrapper_div_interacted_button.querySelector('.wpapp_other_amt_input');

                //Get the reference field value.
                var pp_reference_field = wrapper_div_interacted_button.querySelector('.wp_pp_button_reference');

                let pp_bn_data = {};
                pp_bn_data.transient_name = '6a271ebc0b386_wpapp_paypal_button_0';
                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_0';
                pp_bn_data.selected_val = selectElement.value;//value of the selected option. (we can use it get the item name from the transient).
                pp_bn_data.other_amount_val = other_amount_input ? other_amount_input.value : '';
                pp_bn_data.pp_reference_field = pp_reference_field ? pp_reference_field.value : '';
                console.log('WPAPP Button Data Below');
                console.log(pp_bn_data);

                //Ajax action: <prefix>_pp_create_order 
                let post_data = 'action=wpapp_pp_create_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=844e9ff9bc';
                //console.log('Post Data: ', post_data);//Debugging purposes only.

                try {
                    // Using fetch for AJAX request. This is supported in all modern browsers.
                    const response = await fetch("https://andromedabay.ddns.net/wp-admin/admin-ajax.php", {
                        method: "post",
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        },
                        body: post_data
                    });

                    const response_data = await response.json();

                    if (response_data.order_id) {
                        console.log('Create-order API call to PayPal completed successfully.');
                        //If we need to see the order details, uncomment the following line.
                        //const order_data = response_data.order_data;
                        //console.log('Order data: ' + JSON.stringify(order_data));
                        return response_data.order_id;
                    } else {
                        const error_message = JSON.stringify(response_data);
                        console.error('Error occurred during create-order call to PayPal. ' + error_message);
                        throw new Error(error_message);
                    }
                } catch (error) {
                    console.error(error);
                    alert('Could not initiate PayPal Checkout...\n\n' + JSON.stringify(error));
                }
            }

            async function onApproveHandler(data, actions) {
                console.log('Successfully created a transaction.');

                // Show the spinner while we process this transaction.
                // First, select the button container by its ID.
                const pp_button_container = document.getElementById('wpapp_paypal_button_0');
                // Then, navigate to the parent element of the PPCP button container.
                const parent_wrapper = pp_button_container.parentElement;
                // Finally, within the parent wrapper, select the spinner container
                const pp_button_spinner_container = parent_wrapper.querySelector('.wpapp-pp-button-spinner-container');
                //console.log('Button spinner container: ', pp_button_spinner_container);

                pp_button_container.style.display = 'none'; //Hide the buttons
                pp_button_spinner_container.style.display = 'inline-block'; //Show the spinner.

                // Capture the order in PayPal using the PayPal API.
                // https://developer.paypal.com/docs/checkout/standard/integrate/
                // The server-side capture-order API is used. Then the Capture-ID is returned.
                console.log('Setting up the AJAX request for capture-order call.');
                let pp_bn_data = {};
                pp_bn_data.order_id = data.orderID;
                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_0';
                pp_bn_data.transient_name = '6a271ebc0b386_wpapp_paypal_button_0';
                //pp_bn_data.custom_field = encodeURIComponent(custom_data);//If you have any custom data to send to the server (it needs to be URI encoded so special characters are not lost.)

                //Ajax action: <prefix>_pp_capture_order
                let post_data = 'action=wpapp_pp_capture_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=844e9ff9bc';
                try {
                    const response = await fetch("https://andromedabay.ddns.net/wp-admin/admin-ajax.php", {
                        method: "post",
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        },
                        body: post_data
                    });

                    const response_data = await response.json();
                    const txn_data = response_data.txn_data;
                    const error_detail = txn_data?.details?.[0];
                    const error_msg = response_data.error_msg;//Our custom error message.
                    // Three cases to handle:
                    // (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()
                    // (2) Other non-recoverable errors -> Show a failure message
                    // (3) Successful transaction -> Show confirmation or thank you message

                    if (response_data.capture_id) {
                        // Successful transaction -> Show confirmation or thank you message
                        console.log('Capture-order API call to PayPal completed successfully.');

                        //Redirect to the Thank you page URL if it is set.
                        return_url = 'https://andromedabay.ddns.net/thanks/';
                        if( return_url ){
                            //redirect to the Thank you page URL.
                            console.log('Redirecting to the Thank you page URL: ' + return_url);
                            window.location.href = return_url;
                            return;
                        } else {
                            //No return URL is set. Just show a success message.
                            console.log('No return URL is set in the settings. Showing a success message.');

                            //We are going to show the success message in the wpapp-ppcp-button-wrapper's container.
                            txn_success_msg = 'Transaction completed successfully! Feel free to browse our site for another checkout.';
                            // Select all elements with the class 'wpapp-ppcp-button-wrapper'
                            var button_divs = document.querySelectorAll('.wpapp-ppcp-button-wrapper');

                            // Loop through the NodeList and update each element
                            button_divs.forEach(function(div, index) {
                                div.innerHTML = '<div id="wpapp-btn-txn-success-msg-' + index + '" class="wpapp-btn-txn-success-msg">' + txn_success_msg + '</div>';
                            });

                            // Scroll to the success message container of the button we are interacting with.
                            const interacted_button_container_element = document.getElementById(elements_wrapper_wpapp_paypal_button_0);
                            if (interacted_button_container_element) {
                                interacted_button_container_element.scrollIntoView({ behavior: 'smooth', block: 'start' });
                            }
                            return;
                        }

                    } else if (error_detail?.issue === "INSTRUMENT_DECLINED") {
                        // Recoverable INSTRUMENT_DECLINED -> call actions.restart()
                        console.log('Recoverable INSTRUMENT_DECLINED error. Calling actions.restart()');
                        return actions.restart();
                    } else if ( error_msg && error_msg.trim() !== '' ) {
                        //Our custom error message from the server.
                        console.error('Error occurred during PayPal checkout process.');
                        console.error( error_msg );
                        alert( error_msg );
                    } else {
                        // Other non-recoverable errors -> Show a failure message
                        console.error('Non-recoverable error occurred during PayPal checkout process.');
                        console.error( error_detail );
                        //alert('Unexpected error occurred with the transaction. Enable debug logging to get more details.\n\n' + JSON.stringify(error_detail));
                    }

                    //Return the button and the spinner back to their orignal display state.
                    pp_button_container.style.display = 'block'; // Show the buttons
                    pp_button_spinner_container.style.display = 'none'; // Hide the spinner

                } catch (error) {
                    console.error(error);
                    alert('PayPal returned an error! Transaction could not be processed. Enable the debug logging feature to get more details...\n\n' + JSON.stringify(error));
                }
            }

            function onErrorHandler(err) {
                console.error('An error prevented the user from checking out with PayPal. ' + JSON.stringify(err));
                alert( 'Error occurred during PayPal checkout process.\n\n' + JSON.stringify(err) );
            }
            
            function onCancelHandler (data) {
                console.log('Checkout operation cancelled by the customer.');
                //Return to the parent page which the button does by default.
            }            

        });
    </script>

    <style>
        @keyframes wpapp-pp-button-spinner {
            to {transform: rotate(360deg);}
        }
        .wpapp-pp-button-spinner {
            margin: 0 auto;
            text-indent: -9999px;
            vertical-align: middle;
            box-sizing: border-box;
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            border: 5px solid #ccc;
            border-top-color: #0070ba;
            animation: wpapp-pp-button-spinner .6s linear infinite;
        }
        .wpapp-pp-button-spinner-container {
            width: 100%;
            text-align: center;
            margin-top:10px;
            display: none;
        }
    </style>
    <div class="wpapp-pp-button-spinner-container">
        <div class="wpapp-pp-button-spinner"></div>
    </div>    
    </div><!-- end of button-wrapper -->
    </div>
<h2>Further Reading</h2>
<p>The following list is not complete, but it provides some pointers for further reading on the topics discussed in this article.</p>
<ol>
<li style="list-style-type: none;">
<ol>
<li>Python Kerberos Kinit &#8211; <a href="https://pypi.python.org/pypi/kerberos" target="_blank" rel="noopener">https://pypi.python.org/pypi/kerberos</a> , Date accessed: September 26, 2017</li>
<li>Python Kerberos &#8211; <a href="http://python-notes.curiousefficiency.org/en/latest/python_kerberos.html" target="_blank" rel="noopener">http://python-notes.curiousefficiency.org/en/latest/python_kerberos.html</a> , Date accessed: September 26, 2017</li>
<li>CentOS Home page- <a href="https://wiki.centos.org/FrontPage" target="_blank" rel="noopener">https://wiki.centos.org/FrontPage</a> , Date accessed: September 26, 2017</li>
<li>Three Tier Architecture &#8211; <a href="https://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture" target="_blank" rel="noopener">https://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture</a> , Date accessed: September 26, 2017</li>
<li>Kerberos Reference &#8211; <a href="https://web.mit.edu/kerberos/" target="_blank" rel="noopener">https://web.mit.edu/kerberos/</a> , Date accessed: September 26, 2017</li>
<li>pyodbc Driver/Bridge &#8211; <a href="https://mkleehammer.github.io/pyodbc/" target="_blank" rel="noopener">https://mkleehammer.github.io/pyodbc/</a> , Date accessed: September 26, 2017</li>
<li>Microsoft ODBC SQL Driver installation &#8211; <a href="https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development</a> , Date accessed: September 26, 2017</li>
<li>Microsoft ODBC Driver installation 2 &#8211; <a href="https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server</a> , Date accessed: September 26, 2017</li>
<li>Active Directory &#8211; <a href="https://en.m.wikipedia.org/wiki/Active_Directory" target="_blank" rel="noopener">https://en.m.wikipedia.org/wiki/Active_Directory</a> , Date accessed: September 26, 2017</li>
</ol>
</li>
</ol>


		<div class=" twp-social-share  booster-clear">

						    <header class="twp-plugin-title twp-share-title">
			        <h2>Share</h2>
			    </header>
			
		    <div class="twp-share-container">
				<div class="twp-social-icons twp-social-facebook">										<a class="twp-icon-holder" rel="nofollow"  onclick="twp_be_popup_new_window( event,'https://www.facebook.com/sharer/sharer.php?u=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/'); "  href="https://www.facebook.com/sharer/sharer.php?u=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/" >
			                                <span class="twp-social-count"><span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M 23.25 9 L 15 9 L 15 0.75 C 15 0.335938 14.664062 0 14.25 0 L 9.75 0 C 9.335938 0 9 0.335938 9 0.75 L 9 9 L 0.75 9 C 0.335938 9 0 9.335938 0 9.75 L 0 14.25 C 0 14.664062 0.335938 15 0.75 15 L 9 15 L 9 23.25 C 9 23.664062 9.335938 24 9.75 24 L 14.25 24 C 14.664062 24 15 23.664062 15 23.25 L 15 15 L 23.25 15 C 23.664062 15 24 14.664062 24 14.25 L 24 9.75 C 24 9.335938 23.664062 9 23.25 9 Z M 23.25 9" /></svg></span></span>												<span class="twp-share-media">

													<span class="twp-share-label">
                                                        <span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M22.675 0h-21.35c-.732 0-1.325.593-1.325 1.325v21.351c0 .731.593 1.324 1.325 1.324h11.495v-9.294h-3.128v-3.622h3.128v-2.671c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.795.143v3.24l-1.918.001c-1.504 0-1.795.715-1.795 1.763v2.313h3.587l-.467 3.622h-3.12v9.293h6.116c.73 0 1.323-.593 1.323-1.325v-21.35c0-.732-.593-1.325-1.325-1.325z" /></svg></span>
				                                        <span class="twp-label-title">
				                                            Facebook				                                        </span>
				                                    </span>
												</span>
																					</a>
									</div><div class="twp-social-icons twp-social-twitter">										<a class="twp-icon-holder" rel="nofollow"  onclick="twp_be_popup_new_window( event,'https://twitter.com/intent/tweet?text=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos&#038;url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/'); "  href="https://twitter.com/intent/tweet?text=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos&#038;url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/" >
			                                <span class="twp-social-count"><span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M 23.25 9 L 15 9 L 15 0.75 C 15 0.335938 14.664062 0 14.25 0 L 9.75 0 C 9.335938 0 9 0.335938 9 0.75 L 9 9 L 0.75 9 C 0.335938 9 0 9.335938 0 9.75 L 0 14.25 C 0 14.664062 0.335938 15 0.75 15 L 9 15 L 9 23.25 C 9 23.664062 9.335938 24 9.75 24 L 14.25 24 C 14.664062 24 15 23.664062 15 23.25 L 15 15 L 23.25 15 C 23.664062 15 24 14.664062 24 14.25 L 24 9.75 C 24 9.335938 23.664062 9 23.25 9 Z M 23.25 9" /></svg></span></span>												<span class="twp-share-media">
													<span class="twp-share-label">
                                                        <span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></svg></span>
				                                        <span class="twp-label-title">
				                                            Twitter				                                        </span>
												    </span>
												</span>
																					</a>
									</div><div class="twp-social-icons twp-social-pinterest">										<a class="twp-icon-holder" rel="nofollow" href="javascript:twp_be_pinterest()">
											<span class="twp-social-count"><span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M 23.25 9 L 15 9 L 15 0.75 C 15 0.335938 14.664062 0 14.25 0 L 9.75 0 C 9.335938 0 9 0.335938 9 0.75 L 9 9 L 0.75 9 C 0.335938 9 0 9.335938 0 9.75 L 0 14.25 C 0 14.664062 0.335938 15 0.75 15 L 9 15 L 9 23.25 C 9 23.664062 9.335938 24 9.75 24 L 14.25 24 C 14.664062 24 15 23.664062 15 23.25 L 15 15 L 23.25 15 C 23.664062 15 24 14.664062 24 14.25 L 24 9.75 C 24 9.335938 23.664062 9 23.25 9 Z M 23.25 9" /></svg></span></span>				                                <span class="twp-share-media">
													<span class="twp-share-label">
                                                        <span class="booster-svg-icon"><svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"></path></svg></span>
				                                        <span class="twp-label-title">
				                                            Pinterest				                                        </span>
				                                    </span>
												</span>
																					</a>
									</div><div class="twp-social-icons twp-social-linkedin">										<a class="twp-icon-holder" rel="nofollow"  onclick="twp_be_popup_new_window( event,'http://www.linkedin.com/shareArticle?mini=true&#038;title=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos&#038;url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/'); "  href="http://www.linkedin.com/shareArticle?mini=true&#038;title=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos&#038;url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/" >
																							<span class="twp-share-media">
				                                    <span class="share-media-nocount">
													    <svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg>				                                    </span>
													<span class="twp-share-label twp-label-title">
				                                        LinkedIn				                                    </span>
												</span>
																					</a>
										</div><div class="twp-social-icons twp-social-email">										<a class="twp-icon-holder" rel="nofollow"  href="mailto:?subject=:&amp;body= MS-SQL: connecting Python on Linux &#8211; using Active Directory Credentials and Kerberos http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/">
																							<span class="twp-share-media">
				                                    <span class="share-media-nocount">
													    <svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M0 3v18h24v-18h-24zm6.623 7.929l-4.623 5.712v-9.458l4.623 3.746zm-4.141-5.929h19.035l-9.517 7.713-9.518-7.713zm5.694 7.188l3.824 3.099 3.83-3.104 5.612 6.817h-18.779l5.513-6.812zm9.208-1.264l4.616-3.741v9.348l-4.616-5.607z" /></svg>				                                    </span>
				                                    <span class="twp-share-label twp-label-title">
				                                        Email				                                    </span>
												</span>
																					</a>
										</div><div class="twp-social-icons twp-social-vk">										<a class="twp-icon-holder" rel="nofollow"  onclick="twp_be_popup_new_window( event,'http://vk.com/share.php?url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/&#038;caption=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos'); "  href="http://vk.com/share.php?url=http://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/&#038;caption=MS-SQL:%20connecting%20Python%20on%20Linux%20&#8211;%20using%20Active%20Directory%20Credentials%20and%20Kerberos" >
																							<span class="twp-share-media">
				                                    <span class="share-media-nocount">
													    <svg class="booster-svg" aria-hidden="true" role="img" focusable="false" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M22,7.1c0.2,0.4-0.4,1.5-1.6,3.1c-0.2,0.2-0.4,0.5-0.7,0.9c-0.5,0.7-0.9,1.1-0.9,1.4c-0.1,0.3-0.1,0.6,0.1,0.8 c0.1,0.1,0.4,0.4,0.8,0.9h0l0,0c1,0.9,1.6,1.7,2,2.3c0,0,0,0.1,0.1,0.1c0,0.1,0,0.1,0.1,0.3c0,0.1,0,0.2,0,0.4 c0,0.1-0.1,0.2-0.3,0.3c-0.1,0.1-0.4,0.1-0.6,0.1l-2.7,0c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.1-0.5-0.2l-0.2-0.1 c-0.2-0.1-0.5-0.4-0.7-0.7s-0.5-0.6-0.7-0.8c-0.2-0.2-0.4-0.4-0.6-0.6C14.8,15,14.6,15,14.4,15c0,0,0,0-0.1,0c0,0-0.1,0.1-0.2,0.2 c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.1-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.5-0.1,0.8c0,0.1,0,0.2,0,0.3c0,0.1-0.1,0.2-0.1,0.2l0,0.1 c-0.1,0.1-0.3,0.2-0.6,0.2h-1.2c-0.5,0-1,0-1.5-0.2c-0.5-0.1-1-0.3-1.4-0.6s-0.7-0.5-1.1-0.7s-0.6-0.4-0.7-0.6l-0.3-0.3 c-0.1-0.1-0.2-0.2-0.3-0.3s-0.4-0.5-0.7-0.9s-0.7-1-1.1-1.6c-0.4-0.6-0.8-1.3-1.3-2.2C2.9,9.4,2.5,8.5,2.1,7.5C2,7.4,2,7.3,2,7.2 c0-0.1,0-0.1,0-0.2l0-0.1c0.1-0.1,0.3-0.2,0.6-0.2l2.9,0c0.1,0,0.2,0,0.2,0.1S5.9,6.9,5.9,7L6,7c0.1,0.1,0.2,0.2,0.3,0.3 C6.4,7.7,6.5,8,6.7,8.4C6.9,8.8,7,9,7.1,9.2l0.2,0.3c0.2,0.4,0.4,0.8,0.6,1.1c0.2,0.3,0.4,0.5,0.5,0.7s0.3,0.3,0.4,0.4 c0.1,0.1,0.3,0.1,0.4,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0,0,0.1-0.1c0,0,0.1-0.1,0.1-0.2c0.1-0.1,0.1-0.3,0.1-0.5c0-0.2,0.1-0.5,0.1-0.8 c0-0.4,0-0.8,0-1.3c0-0.3,0-0.5-0.1-0.8c0-0.2-0.1-0.4-0.1-0.5L9.6,7.6C9.4,7.3,9.1,7.2,8.7,7.1C8.6,7.1,8.6,7,8.7,6.9 C8.9,6.7,9,6.6,9.1,6.5c0.4-0.2,1.2-0.3,2.5-0.3c0.6,0,1,0.1,1.4,0.1c0.1,0,0.3,0.1,0.3,0.1c0.1,0.1,0.2,0.1,0.2,0.3 c0,0.1,0.1,0.2,0.1,0.3s0,0.3,0,0.5c0,0.2,0,0.4,0,0.6c0,0.2,0,0.4,0,0.7c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.4c0,0.2,0,0.4,0,0.5 c0,0.1,0,0.3,0,0.4s0.1,0.3,0.1,0.4c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.3-0.1c0.1-0.1,0.2-0.2,0.4-0.4 s0.3-0.4,0.5-0.7c0.2-0.3,0.5-0.7,0.7-1.1c0.4-0.7,0.8-1.5,1.1-2.3c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0.1-0.1,0.1-0.1l0,0l0.1,0 c0,0,0,0,0.1,0s0.2,0,0.2,0l3,0c0.3,0,0.5,0,0.7,0S21.9,7,21.9,7L22,7.1z"></path></svg>				                                    </span>
													<span class="twp-share-label twp-label-title">
				                                        VK				                                    </span>
												</span>
																					</a>
										</div>			</div>
		</div>

	]]></content:encoded>
					
					<wfw:commentRss>https://andromedabay.ddns.net/ms-sql-connecting-python-on-linux-using-active-directory-credentials-and-kerberos/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: andromedabay.ddns.net @ 2026-06-08 15:57:48 by W3 Total Cache
-->