{"id":18971,"date":"2023-09-07T02:52:29","date_gmt":"2023-09-07T02:52:29","guid":{"rendered":"https:\/\/www.insentragroup.com\/gb\/insights\/uncategorized\/enabling-kerberos-authentication-for-multihomed-servers\/"},"modified":"2024-12-13T02:20:27","modified_gmt":"2024-12-13T02:20:27","slug":"enabling-kerberos-authentication-for-multihomed-servers","status":"publish","type":"post","link":"https:\/\/www.insentragroup.com\/gb\/insights\/geek-speak\/secure-workplace\/enabling-kerberos-authentication-for-multihomed-servers\/","title":{"rendered":"Enabling Kerberos Authentication for Multihomed servers"},"content":{"rendered":"\n<p>In the dynamic landscape of server configurations, ensuring seamless and secure connections is paramount. This blog post dives into the critical process of enabling Kerberos Authentication for multihomed servers. We&#8217;ll walk you through the steps required to add the principal that allows kerberized SSH sessions to the server, ensuring a robust and encrypted communication channel.<\/p>\n\n\n\n<p>If you enrolled your server to the idM domain, the host principal will be created automatically for the first interface. But what if you need to connect the server to another network and you would like to enable the kerberized connections?&nbsp;&nbsp;<\/p>\n\n\n\n<p>By default, this is how you would see the host on the idM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# ipa host-show samba \n<br>\n  Host name: samba.example.net \n<br>\n  Platform: x86_64 \n<br>\n  Operating system: 4.18.0-348.23.1.el8_5.x86_64 \n<br>\n  Principal name: host\/samba.example.net@EXAMPLE.NET \n<br>\n  Principal alias: host\/samba.example.net@EXAMPLE.NET \n<br>\n  SSH public key fingerprint: SHA256:rBsQcIz3m\/N2hT\/MeHZWi9NNyp9qYGM8B4TB4eu8LGg root@samba.example.net (ssh-rsa), \n<br>\n<br>                              SHA256:5x44Ls1OPHm6WqniXwwu28lZ197yBRjdxz4soAnKUfE root@samba.example.net (ecdsa- \n<br>\n                              sha2-nistp256), SHA256:Kn9S3fpTLEOunJ1V5c6JPV7+ubheTBzbTw14louFOKQ root@samba.example.net \n<br>\n                              (ssh-ed25519) \n<br>\n  Password: False \n<br>\n  Keytab: True \n<br>\n  Managed by: samba.example.net <\/code><\/pre>\n\n\n\n<p>Note in the example above the Principal and the Principal alias. They have been automatically created during enrolment of the server to the idM.&nbsp;&nbsp;<\/p>\n\n\n\n<p>With the configuration presented above, the kerberized ssh connection should work without any issues:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;nesiuser01@example.net@idm01 ~]$ klist \n<br>\nTicket cache: KCM:1737800004 \n<br>\nDefault principal: nesiuser01@EXAMPLE.NET \n<br>\n<br> \n<br>\nValid starting       Expires              Service principal \n<br>\n05\/03\/2022 06:21:53  05\/04\/2022 06:21:50  krbtgt\/EXAMPLE.NET@EXAMPLE.NET \n<br>\n05\/03\/2022 06:22:08  05\/04\/2022 06:21:50  cifs\/samba.example.net@EXAMPLE.NET \n<br>\n&#91;nesiuser01@example.net@idm01 ~]$ ssh -k samba \n<br>\nRegister this system with Red Hat Insights: insights-client --register \n<br>\nCreate an account or view all your systems at https:\/\/red.ht\/insights-dashboard \n<br>\nActivate the web console with: systemctl enable --now cockpit.socket \n<br>\n<br> \n<br>\nLast login: Tue May  3 06:19:59 2022 \n<br>\n&#91;nesiuser01@samba ~]$  <\/code><\/pre>\n\n\n\n<p>Let\u2019s add to the configuration additional interface and see what happens. We are adding interface 192.168.1.26 and attempting to ssh with the kerberos ticket to that IP address. Obviously kerberos cannot obtain the ticket for the new interface. As the result, even if we have the kerberos ticket issued for the user, we cannot login as the interface is not knowns.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>3: eth1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000 \n<br>\n    link\/ether fa:16:3e:98:c2:fa brd ff:ff:ff:ff:ff:ff \n<br>\n    inet 192.168.1.26\/24 brd 192.168.1.255 scope global dynamic noprefixroute eth1 \n<br>\n       valid_lft 86399sec preferred_lft 86399sec \n<br>\n    inet6 fe80::a831:9304:4c63:865f\/64 scope link noprefixroute  \n<br>\n       valid_lft forever preferred_lft forever \n<br>\n&#91;nesiuser01@samba ~]$ exit \n<br>\nlogout \n<br>\nConnection to samba closed. \n<br>\n&#91;nesiuser01@example.net@idm01 ~]$ ssh -k 192.168.1.26 \n<br>\nThe authenticity of host '192.168.1.26 (&lt;no hostip for proxy command&gt;)' can't be established. \n<br>\nECDSA key fingerprint is SHA256:5x44Ls1OPHm6WqniXwwu28lZ197yBRjdxz4soAnKUfE. \n<br>\nAre you sure you want to continue connecting (yes\/no\/&#91;fingerprint])? yes \n<br>\nWarning: Permanently added '192.168.1.26' (ECDSA) to the list of known hosts. \n<br>\nPassword:<\/code><\/pre>\n\n\n\n<p>Let\u2019s fix that one step at the time.&nbsp;&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, we need to add the new IP address to the DNS and create both A and PTR records:&nbsp;&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# kinit admin \n<br>\nPassword for admin@EXAMPLE.NET:  \n<br>\n&#91;root@idm01 ~]# ipa dnsrecord-add example.net samba-vpn --a-rec 192.168.1.26 --a-create-reverse \n<br>\n  Record name: samba-vpn \n<br>\n  A record: 192.168.1.26 <\/code><\/pre>\n\n\n\n<p>Let\u2019s verify&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# ipa dnsrecord-show \n<br>\nRecord name: samba-vpn \n<br>\nZone name: example.net \n<br>\n  Record name: samba-vpn \n<br>\n  A record: 192.168.1.26 <\/code><\/pre>\n\n\n\n<p>Is it enough to enable the kerberized ssh? Let\u2019s try:&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# su - nesiuser01 \n<br>\nLast login: Tue May  3 20:07:33 EDT 2022 on pts\/1 \n<br>\n&#91;nesiuser01@example.net@idm01 ~]$ nslookup samba-vpn \n<br>\nServer:\t\t127.0.0.1 \n<br>\nAddress:\t127.0.0.1#53 \n<br>\n <br>\n<br>\nName:\tsamba-vpn.example.net \n<br>\nAddress: 192.168.1.26 \n<br>\n <br>\n<br>\n&#91;nesiuser01@example.net@idm01 ~]$ ssh -k samba-vpn \n<br>\nThe authenticity of host 'samba-vpn (&lt;no hostip for proxy command&gt;)' can't be established. \n<br>\nECDSA key fingerprint is SHA256:5x44Ls1OPHm6WqniXwwu28lZ197yBRjdxz4soAnKUfE. \n<br>\nAre you sure you want to continue connecting (yes\/no\/&#91;fingerprint])? yes \n<br>\nWarning: Permanently added 'samba-vpn' (ECDSA) to the list of known hosts. \n<br>\nPassword:  <\/code><\/pre>\n\n\n\n<p>Seems it is not enough. We need to add host principal:&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# ipa host-add-principal samba.example.net 'host\/samba-vpn.example.net@EXAMPLE.NET' \n<br>\n---------------------------------------------------- \n<br>\nAdded new aliases to host \"samba.example.net\" \n<br>\n---------------------------------------------------- \n<br>\n  Host name: samba.example.net \n<br>\n  Principal alias: host\/samba.example.net@EXAMPLE.NET, host\/samba-vpn.example.net@EXAMPLE.NET \n<br>\n&#91;root@idm01 ~]# ipa host-show samba.example.net \n<br>\n  Host name: samba.example.net \n<br>\n  Platform: x86_64 \n<br>\n  Operating system: 4.18.0-348.23.1.el8_5.x86_64 \n<br>\n  Principal name: host\/samba.example.net@EXAMPLE.NET \n<br>\n  Principal alias: host\/samba.example.net@EXAMPLE.NET, host\/samba-vpn.example.net@EXAMPLE.NET \n<br>\n  SSH public key fingerprint: SHA256:rBsQcIz3m\/N2hT\/MeHZWi9NNyp9qYGM8B4TB4eu8LGg root@samba.example.net (ssh-rsa), \n<br>\n <br>                             SHA256:5x44Ls1OPHm6WqniXwwu28lZ197yBRjdxz4soAnKUfE root@samba.example.net (ecdsa- \n<br>\n                              sha2-nistp256), SHA256:Kn9S3fpTLEOunJ1V5c6JPV7+ubheTBzbTw14louFOKQ root@samba.example.net \n<br>\n                              (ssh-ed25519) \n<br>\n  Password: False \n<br>\n  Keytab: True \n<br>\n  Managed by: samba.example.net <\/code><\/pre>\n\n\n\n<p>Let\u2019s try to connect again:&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@idm01 ~]# su - nesiuser01 \n<br>\nLast login: Tue May  3 20:24:28 EDT 2022 on pts\/1 \n<br>\n&#91;nesiuser01@example.net@idm01 ~]$ ssh -k samba-vpn \n<br>\nRegister this system with Red Hat Insights: insights-client --register \n<br>\nCreate an account or view all your systems at https:\/\/red.ht\/insights-dashboard \n<br>\nActivate the web console with: systemctl enable --now cockpit.socket \n<br>\n <br>\n<br>\nLast login: Tue May  3 20:07:45 2022 from 192.168.0.11 \n<br>\n&#91;nesiuser01@samba ~]$  <\/code><\/pre>\n\n\n\n<p>It is working now. Let\u2019s investigate the kerberos tickets:&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;nesiuser01@example.net@idm01 ~]$ klist \n<br>\nTicket cache: KCM:1737800004 \n<br>\nDefault principal: nesiuser01@EXAMPLE.NET \n<br>\n<br> \n<br>\nValid starting       Expires              Service principal \n<br>\n05\/03\/2022 20:07:42  05\/04\/2022 06:21:50  host\/samba.example.net@EXAMPLE.NET \n<br>\n05\/03\/2022 06:21:53  05\/04\/2022 06:21:50  krbtgt\/EXAMPLE.NET@EXAMPLE.NET \n<br>\n05\/03\/2022 06:22:08  05\/04\/2022 06:21:50  cifs\/samba.example.net@EXAMPLE.NET \n<br>\n05\/03\/2022 20:27:08  05\/04\/2022 06:21:50  host\/samba-vpn.example.net@EXAMPLE.NET <\/code><\/pre>\n\n\n\n<p>In the excerpt above, we can see that a new host principal created for an additional interface is visible in the cache.&nbsp;&nbsp;<\/p>\n\n\n\n<p>If you have further questions or need assistance with implementing Kerberos Authentication in your environment, don&#8217;t hesitate to reach out to us. Our team at Insentra is here to support you in maximising the security and efficiency of your server infrastructure. <a href=\"https:\/\/www.insentragroup.com\/gb\/contact\/\" target=\"_blank\" rel=\"noreferrer noopener\">Contact us<\/a> today to elevate your server access security to the next level.&nbsp;<\/p>\n\n\n\n<style>\nbody .wp-block-code>code {\n    font-family: Menlo,Consolas,monaco,monospace;\n    color: #000;\n    padding: 30px 40px;\n    border: none;\n    border-radius: 4px;\n    background: #ddd;\n}\n<\/style>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to enable Kerberos Authentication for multihomed servers. Ensure robust and encrypted connections with our step-by-step guide.<\/p>\n","protected":false},"author":67,"featured_media":18972,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[20],"tags":[],"class_list":["post-18971","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-secure-workplace","entry"],"_links":{"self":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/18971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/comments?post=18971"}],"version-history":[{"count":4,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/18971\/revisions"}],"predecessor-version":[{"id":22608,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/posts\/18971\/revisions\/22608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/media\/18972"}],"wp:attachment":[{"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/media?parent=18971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/categories?post=18971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insentragroup.com\/gb\/wp-json\/wp\/v2\/tags?post=18971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}