{"id":79,"date":"2016-10-27T20:57:37","date_gmt":"2016-10-27T18:57:37","guid":{"rendered":"http:\/\/www.petersplanet.nl\/?p=79"},"modified":"2016-10-28T21:35:03","modified_gmt":"2016-10-28T19:35:03","slug":"add-a-linux-host-to-active-directory-with-ldap-and-kerberos","status":"publish","type":"post","link":"https:\/\/www.petersplanet.nl\/index.php\/2016\/10\/27\/add-a-linux-host-to-active-directory-with-ldap-and-kerberos\/","title":{"rendered":"Add a Linux host to Active Directory with LDAP and Kerberos"},"content":{"rendered":"<p>In this post I describe how you can add a CentOS 7 host to a Windows Active Directory domain. Happy experimenting.<br \/>\n<!--more--><br \/>\nPrecondition: <span style=\"font-size: 0.875rem;\"><br \/>\nWindows 2012R2 with Windows Active Directory services in place.<br \/>\n<\/span><span style=\"font-size: 0.875rem;\">A Linux server. In this case CentOS 7.<\/span><\/p>\n<p>On Windows<br \/>\nAdd the Linux server in DNS for the forward lookup zone including the associated pointer record.<br \/>\nMake sure you have a user with sufficient priviliges to add a server to a domain.<\/p>\n<p>On Linux<br \/>\n<span style=\"font-size: 0.875rem;\">Install the necessary additional packages.<br \/>\n<\/span>Make sure the Linux server uses the DNS server of the Windows domain.<\/p>\n<pre>yum -y install sssd realmd krb5-workstation\r\n<\/pre>\n<p>Create an empty sssd.conf<\/p>\n<pre>cp \/usr\/share\/doc\/sssd-common-1.13.0\/sssd-example.conf \/etc\/sssd\/sssd.conf\r\nchmod 600 \/etc\/sssd\/sssd.conf\r\n<\/pre>\n<p>The Linux server is not part of a domain.<br \/>\nSome checks:<\/p>\n<pre>realm discover\r\nrealm discover petersplanet.intranet\r\n<\/pre>\n<p>Now it is time to add the Linux server to the Windows domain:<\/p>\n<pre>realm join -U peter@petersplanet.intranet petersplanet.intranet\r\nrealm discover petersplanet.intranet\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-100\" src=\"http:\/\/www.petersplanet.nl\/wp-content\/uploads\/2016\/10\/Linux.png\" alt=\"linux\" width=\"692\" height=\"386\" \/><\/p>\n<p>Test the result:<\/p>\n<pre>getent passwd peter@petersplanet.intranet<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-82\" src=\"http:\/\/www.petersplanet.nl\/wp-content\/uploads\/2016\/10\/getent.png\" alt=\"getent\" width=\"742\" height=\"221\" \/><\/p>\n<p>A disadvantage is that it looks like you always have to use the fully qualified domain name (FQDN) for a user.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-113\" src=\"http:\/\/www.petersplanet.nl\/wp-content\/uploads\/2016\/10\/Putty.png\" alt=\"putty\" width=\"652\" height=\"171\" \/><\/p>\n<p>Now it is time to finetune the configuration. For instance limit the acces to the Linux host for a certain group of users.<\/p>\n<p>The contents of \/etc\/sssd\/sssd.conf which has been generated by the realm command can be seen below:<\/p>\n<pre>[sssd]\r\nconfig_file_version = 2\r\nservices = nss, pam\r\ndomains = petersplanet.intranet\r\n\r\n[nss]\r\n\r\n[pam]\r\n\r\n[domain\/petersplanet.intranet]\r\nad_domain = petersplanet.intranet\r\nkrb5_realm = PETERSPLANET.INTRANET\r\nrealmd_tags = manages-system joined-with-samba\r\ncache_credentials = True\r\nid_provider = ad\r\nkrb5_store_password_if_offline = True\r\ndefault_shell = \/bin\/bash\r\nldap_id_mapping = True\r\nuse_fully_qualified_names = True\r\nfallback_homedir = \/home\/%u@%d\r\naccess_provider = ad\r\n<\/pre>\n<p>References:<br \/>\n<a href=\"https:\/\/fedorahosted.org\/sssd\/wiki\/Configuring_sssd_with_ad_server\">https:\/\/fedorahosted.org\/sssd\/wiki\/Configuring_sssd_with_ad_server<br \/>\n<\/a><a href=\"http:\/\/docs.aws.amazon.com\/directoryservice\/latest\/admin-guide\/join_linux_instance.html\">http:\/\/docs.aws.amazon.com\/directoryservice\/latest\/admin-guide\/join_linux_instance.html<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I describe how you can add a CentOS 7 host to a Windows Active Directory domain. Happy experimenting.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":32,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/79\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}