ubuntu szerver csatlakoztatosa windows domain-hez

Fórumok

Kedves Mindenki!

Ubuntu 16.04.4 szervert szeretnek Windows domain-hez csatlakoztatni.
Ehhez keresek valami egyszeru es konnyen kovetheto guide-ot.
A kovetkezoket talaltam eddig:
https://repo.pbis.beyondtrust.com/apt.html
https://github.com/BeyondTrust/pbis-open/releases

https://www.centrify.com/express/linux/download/

Illetve meg ezeket a tutorial-okat:
https://help.ubuntu.com/lts/serverguide/sssd-ad.html
http://www.itadmintools.com/2011/04/active-directory-authentication-on…
http://www.itadmintools.com/2012/02/ubuntu-1110-logging-into-active.html

Az utolso link talan a legszimpatikusabbn, viszont eleg reginek tunik. Tudna valaki abban segiteni, hogy 2018-ban mi a legegyszerubb modja annak, hogy ubuntu vagy mas linux op.rendszereket windows tartomanyba lehessen leptetni?

Hozzászólások

Tegnap ezzel probalkoztam https://repo.pbis.beyondtrust.com/apt.html

A telepites utan be tudtam lepni a domainba a sudo domainjoin-cli join domain.local administrator paranccsal, Ad-ban fel is tunt az ubuntu gep a Computers mappaban, viszont utana egyetlen domain felhasznaloval sem engedett belepni az ubuntu gepre, Login incorrect-et dobott.

Erdekes, hogy mikor a User must change password at first login be volt tikkelve, kerte az uj jelszot, de megsem fogadta azt el utana.

Az ubuntu gep local admin-javal tovabbra is be lehetett lepni es a getent passwd parancs utan listazta a domain user-eket is.
Valakinek valami otlet, hogy miert nem mukodik az autentikacio?

Ezt vegul sikerult osszehoznom. Azt hiszem a hiba ott volt, hogy en a
/etc/resolv.conf fajlba irtam nameserver ip cimet, de innen minden torlodik egy ujrainditas utan.
Most a
/etc/resolvconf/resolv.conf.d/head fajlba irtam nameserver bejegyzest, amely permanensen beleirodik a
/etc/resolv.conf fajlba is. Igy mar mukodik az autentikacio. Juhe!

En ezzel a modszerrel tettem be 4 Debiant es 4 Ubuntu servert Domain-ba. Tokeletesen mukodik.

http://www.alandmoore.com/blog/2015/05/06/joining-debian-8-to-active-di…

Megy a domain login, ill. egy adott csoportot sudoers -e is tettem.

Ubuntu alatt van egy modosulas a leirashoz kepest:

Eredeti: sudo realm join --user=joe.smith my-domain.local

Amivel megy Ubuntu alatt: sudo realm join --user=joe.smith my-domain.local --install=/

Koszonom a tutorialt. Sajnos a
sudo realm join --user=joe.smith my-domain.local --install=/
parancs utan ezt kapom:
realm: Couldn't join realm: Insufficient permission to join the domain
pedig domain adminnel probalok csatlakozni.
A hiba szerintem valahol ott van, hogy a tutorialban azt irjak, hogy az sssd.conf fajlt a realmd fogja generalni, nekem viszont ilyen fajlom nincs.
systemctl status sssd.service alatt pedig azt latom, hogy Active: failed
Probaltam manualisan megkrealni touch /etc/sssd/sssd.conf hatha irodik bele valami, de ne migy tortent.

A config a csatlakozas utan generalodik le. Azert van, hogy addig a sssd el sem indul. Szoval az nem baj ha nincs ilyen config fajlod, hiszen ez csak akkor jon letre, ho sikeresen csatlakoztal.

Szeritem itt az AD korul lehet valami gond. Nekem mar volt olyan pl, hogy admin voltam bizonyos OU-ban, de pl a Computers-ben (ahova alapbol tenne a csatlakoztatott gepet) nem.

Szoval szerintem itt AD gond lesz, hiszen mint irtad, tobb modszerrel, leirassal is probalkoztal es egyik sem ment.

Szerk: Ahh kozben latom h sikerult :)

Kicsit probalkoztam meg a tutorialoddal, sajnos sikertelenul, verbose-zal ezt a hibauzenetet dobja:
Az utolso ketto felkialtojeles, ezek alapjan van valakinek valami otlete?

sudo realm join -v --user=Administrator domain.local --install=/
*Resolving: _ldap._tcp.domain.local
*Performing LDAP DSE lookup on: 192.168.0.1
*Successfully discovered: domain.local
Password for Administrator:
*Assuming packages are installed
*LANG=C /usr/sbin/adcli join --verbose --domain domain.local --domain-realm DOMAIN.LOCAL --domain-controller 192.168.0.1 --login-type user --login-user Administrator --stdin-password
*Using domain name: domain.local
*Calculated computer account name from fqdn: UBUNTU
*Using domain realm: domain.local
*Sending netlogon pings to domain controller: cldap://192.168.0.1
*Received NetLogon info from: COMPUTER.domain.local
*Wrote out krb5.conf snippet to /var/cache/realmd/adcli-krb5-RwVyc1/krb5.d/adcli-krb5-conf-lP1Cpx
*Authenticated as user Administrator@DOMAIN.LOCAL
!Couldn't authenticate to active directory: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Ticket expired)
adcli: couldn't connect to domain.local domain: Couldn't authenticate to active directory: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Ticket expired)
!Insufficient permissions to join the domain
realm: Couldn't join realm: Insufficient permissions to join the domain

Probald csekkolni az ido beallitasokat!

Az AD szerveren es a csatlakoztatni kivant szerveren azonos az idozona? (nem eleg, ha az ido egyet mutat, az idozonanak is stimmelni kell!) A csatlakoztatni kivant szerveren megy az NTP szolgaltatas es jol van beallitva? Ezek szoktak lenni a tipikus hibak ilyen hibauzenetnel.

Igen! Ez volt a hiba, igy hogy egy idozonaban vannak es van dns szerver a resolv.conf fajlban, mukodik a tutorial!
Csak ket hibauzenet lathato verbose-zal:
!Couldn’t set service principals on computer account CN=UBUNTU,CN=Computers,DC=domain,DC=local: 00002083: AttrErr: DSID-03151904, #1
0: 00002083: DSID-03151904, problem 1006 (ATT_OR_VALUE_EXISTS), data 0, Att 90303 (servicePrincipalName)

update-rc.d: error: cannot find LSB script for sssd

De user authentikacio mukodik, ugy, hogy ezen mar nem fogom nagyon torni magam.

sub

"I'd rather be hated for who I am, than loved for who I am not."

2023 update:

1. https://ubuntu.com/blog/new-active-directory-integration-features-in-ub…

22.04 sees the introduction of a new Active Directory client

Ubuntu Desktop 22.04 sees the introduction of ADsys, our new Active Directory client which contains everything you need to integrate Ubuntu to your Active Directory, including admx and adml template files.

ADsys it is made of two components: adsysd, a daemon that implements the Group Policy protocol and relies on Kerberos, Samba and LDAP for authentication and policy retrieval, and adsysctl, a command line interface that controls the daemon and its status.

ADsys does not replace SSSD and PAM, which are still responsible for user authentication and setting the home directory, rather it compliments them to add the following functionalities:

2. https://ubuntu.com/server/docs/service-sssd-ad

SSSD and Active Directory

This section describes the use of sssd to authenticate user logins against an Active Directory via using sssd’s “ad” provider. At the end, Active Directory users will be able to login on the host using their AD credentials. Group membership will also be maintained.

Prerequisites, Assumptions, and Requirements

  • This guide does not explain Active Directory, how it works, how to set one up, or how to maintain it.

  • This guide assumes that a working Active Directory domain is already configured and you have access to the credentials to join a machine to that domain.

  • The domain controller is acting as an authoritative DNS server for the domain.

  • The domain controller is the primary DNS resolver (check with systemd-resolve --status)

  • System time is correct and in sync, maintained via a service like chrony or ntp

  • The domain used in this example is ad1.example.com .

Software Installation

Install the following packages:

sudo apt install sssd-ad sssd-tools realmd adcli

Join the domain

We will use the realm command, from the realmd package, to join the domain and create the sssd configuration.

Let’s verify the domain is discoverable via DNS:

$ sudo realm -v discover ad1.example.com
 * Resolving: _ldap._tcp.ad1.example.com
 * Performing LDAP DSE lookup on: 10.51.0.5
 * Successfully discovered: ad1.example.com
ad1.example.com
  type: kerberos
  realm-name: AD1.EXAMPLE.COM
  domain-name: ad1.example.com
  configured: no
  server-software: active-directory
  client-software: sssd
  required-package: sssd-tools
  required-package: sssd
  required-package: libnss-sss
  required-package: libpam-sss
  required-package: adcli
  required-package: samba-common-bin

This performs several checks and determines the best software stack to use with sssd. sssd can install the missing packages via packagekit, but we installed them already previously.

Now let’s join the domain:

$ sudo realm join ad1.example.com
Password for Administrator: 

That was quite uneventful. If you want to see what it was doing, pass the -v option:

$ sudo realm join -v ad1.example.com
 * Resolving: _ldap._tcp.ad1.example.com
 * Performing LDAP DSE lookup on: 10.51.0.5
 * Successfully discovered: ad1.example.com
Password for Administrator: 
 * Unconditionally checking packages
 * Resolving required packages
 * LANG=C /usr/sbin/adcli join --verbose --domain ad1.example.com --domain-realm AD1.EXAMPLE.COM --domain-controller 10.51.0.5 --login-type user --login-user Administrator --stdin-password
 * Using domain name: ad1.example.com
 * Calculated computer account name from fqdn: AD-CLIENT
 * Using domain realm: ad1.example.com
 * Sending NetLogon ping to domain controller: 10.51.0.5
 * Received NetLogon info from: SERVER1.ad1.example.com
 * Wrote out krb5.conf snippet to /var/cache/realmd/adcli-krb5-hUfTUg/krb5.d/adcli-krb5-conf-hv2kzi
 * Authenticated as user: Administrator@AD1.EXAMPLE.COM
 * Looked up short domain name: AD1
 * Looked up domain SID: S-1-5-21-2660147319-831819607-3409034899
 * Using fully qualified name: ad-client.ad1.example.com
 * Using domain name: ad1.example.com
 * Using computer account name: AD-CLIENT
 * Using domain realm: ad1.example.com
 * Calculated computer account name from fqdn: AD-CLIENT
 * Generated 120 character computer password
 * Using keytab: FILE:/etc/krb5.keytab
 * Found computer account for AD-CLIENT$ at: CN=AD-CLIENT,CN=Computers,DC=ad1,DC=example,DC=com
 * Sending NetLogon ping to domain controller: 10.51.0.5
 * Received NetLogon info from: SERVER1.ad1.example.com
 * Set computer password
 * Retrieved kvno '3' for computer account in directory: CN=AD-CLIENT,CN=Computers,DC=ad1,DC=example,DC=com
 * Checking RestrictedKrbHost/ad-client.ad1.example.com
 *    Added RestrictedKrbHost/ad-client.ad1.example.com
 * Checking RestrictedKrbHost/AD-CLIENT
 *    Added RestrictedKrbHost/AD-CLIENT
 * Checking host/ad-client.ad1.example.com
 *    Added host/ad-client.ad1.example.com
 * Checking host/AD-CLIENT
 *    Added host/AD-CLIENT
 * Discovered which keytab salt to use
 * Added the entries to the keytab: AD-CLIENT$@AD1.EXAMPLE.COM: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: host/AD-CLIENT@AD1.EXAMPLE.COM: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: host/ad-client.ad1.example.com@AD1.EXAMPLE.COM: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/AD-CLIENT@AD1.EXAMPLE.COM: FILE:/etc/krb5.keytab
 * Added the entries to the keytab: RestrictedKrbHost/ad-client.ad1.example.com@AD1.EXAMPLE.COM: FILE:/etc/krb5.keytab
 * /usr/sbin/update-rc.d sssd enable
 * /usr/sbin/service sssd restart
 * Successfully enrolled machine in realm

By default, realm will use the Administrator account of the domain to request the join. If you need to use another account, pass it to the tool with the -U option.

Another popular way of joining a domain is using an OTP, or One Time Password, token. For that, use the --one-time-password option.

SSSD Configuration

The realm tool already took care of creating an sssd configuration, adding the pam and nss modules, and starting the necessary services.

Let’s take a look at /etc/sssd/sssd.conf:

[sssd]
domains = ad1.example.com
config_file_version = 2
services = nss, pam

[domain/ad1.example.com]
default_shell = /bin/bash
krb5_store_password_if_offline = True
cache_credentials = True
krb5_realm = AD1.EXAMPLE.COM
realmd_tags = manages-system joined-with-adcli 
id_provider = ad
fallback_homedir = /home/%u@%d
ad_domain = ad1.example.com
use_fully_qualified_names = True
ldap_id_mapping = True
access_provider = ad

Note

Something very important to remember is that this file must have permissions 0600 and ownership root:root, or else sssd won’t start!

Let’s highlight a few things from this config:

  • cache_credentials: this allows logins when the AD server is unreachable
  • home directory: it’s by default /home/<user>@<domain>. For example, the AD user john will have a home directory of /home/john@ad1.example.com
  • use_fully_qualified_names: users will be of the form user@domain, not just user. This should only be changed if you are certain no other domains will ever join the AD forest, via one of the several possible trust relationships

Automatic home directory creation

What the realm tool didn’t do for us is setup pam_mkhomedir, so that network users can get a home directory when they login. This remaining step can be done by running the following command:

sudo pam-auth-update --enable mkhomedir

Checks

You should now be able to fetch information about AD users. In this example, John Smith is an AD user:

$ getent passwd john@ad1.example.com
john@ad1.example.com:*:1725801106:1725800513:John Smith:/home/john@ad1.example.com:/bin/bash

Let’s see his groups:

$ groups john@ad1.example.com
john@ad1.example.com : domain users@ad1.example.com engineering@ad1.example.com

Note

If you just changed the group membership of a user, it may be a while before sssd notices due to caching.

Finally, how about we try a login:

$ sudo login
ad-client login: john@ad1.example.com
Password: 
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-24-generic x86_64)
...
Creating directory '/home/john@ad1.example.com'.
john@ad1.example.com@ad-client:~$ 

Notice how the home directory was automatically created.

You can also use ssh, but note that the command will look a bit funny because of the multiple @ signs:

$ ssh john@ad1.example.com@10.51.0.11
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-24-generic x86_64)
(...)
Last login: Thu Apr 16 21:22:55 2020
john@ad1.example.com@ad-client:~$ 

Note

In the ssh example, public key authentication was used, so no password was required. Remember that ssh password authentication is by default disabled in /etc/ssh/sshd_config.

Kerberos Tickets

If you install krb5-user, your AD users will also get a kerberos ticket upon logging in:

john@ad1.example.com@ad-client:~$ klist
Ticket cache: FILE:/tmp/krb5cc_1725801106_9UxVIz
Default principal: john@AD1.EXAMPLE.COM

Valid starting     Expires            Service principal
04/16/20 21:32:12  04/17/20 07:32:12  krbtgt/AD1.EXAMPLE.COM@AD1.EXAMPLE.COM
	renew until 04/17/20 21:32:12

Note

realm also configured /etc/krb5.conf for you, so there should be no further configuration prompts when installing krb5-user

Let’s test with smbclient using kerberos authentication to list he shares of the domain controller:

john@ad1.example.com@ad-client:~$ smbclient -k -L server1.ad1.example.com

	Sharename       Type      Comment
	---------       ----      -------
	ADMIN$          Disk      Remote Admin
	C$              Disk      Default share
	IPC$            IPC       Remote IPC
	NETLOGON        Disk      Logon server share 
	SYSVOL          Disk      Logon server share 
SMB1 disabled -- no workgroup available

Notice how we now have a ticket for the cifs service, which was used for the share list above:

john@ad1.example.com@ad-client:~$ klist
Ticket cache: FILE:/tmp/krb5cc_1725801106_9UxVIz
Default principal: john@AD1.EXAMPLE.COM

Valid starting     Expires            Service principal
04/16/20 21:32:12  04/17/20 07:32:12  krbtgt/AD1.EXAMPLE.COM@AD1.EXAMPLE.COM
	renew until 04/17/20 21:32:12
04/16/20 21:32:21  04/17/20 07:32:12  cifs/server1.ad1.example.com@AD1.EXAMPLE.COM

Desktop Ubuntu Authentication

The desktop login only shows local users in the list to pick from, and that’s on purpose.

To login with an Active Directory user for the first time, follow these steps:

  • click on the “Not listed?” option:
  • type in the login name followed by the password:
  • the next time you login, the AD user will be listed as if it was a local user:

Known Issues

When logging in on a system joined with an Active Directory domain, sssd (the package responsible for this integration) will try to apply Group Policies by default. There are cases where if a specific policy is missing, the login will be denied.
This is being tracked in bug #1934997. Until the fix becomes available, please see comment #5 in that bug report for existing workarounds.