Realizzare una rete aziendale con linux e samba

31
Andrea Mauro

description

Presentazione per l'OpenSourceDay 2013

Transcript of Realizzare una rete aziendale con linux e samba

Page 1: Realizzare una rete aziendale con linux e samba

Andrea Mauro

Page 2: Realizzare una rete aziendale con linux e samba

CHI SONO

• Geek dagli anni 80

• Commodore 64

• Linuxaro dal 1995

• Distribuzione Slackware

• Professionista IT

• Virtualizzazione, Sistemi Operativi, Storage, …

• VMware, Microsoft, Citrix, …

• Andrea Mauro

• Twitter: @Andrea_Mauro

Page 3: Realizzare una rete aziendale con linux e samba

PERCHÉ WINDOWS?

• Perché non esiste il mondo perfetto

• Client prevalentemente Windows

• Realtà eterogenee

• Protocolli Microsoft più usati di NIS/NFS

• Problema dei client

Page 4: Realizzare una rete aziendale con linux e samba

Source: HitsLink (desktop, May 2012), IDC (server, Q1 2012), Gartner (mobile, May 2012), and IDC (March 2012).

Page 5: Realizzare una rete aziendale con linux e samba

PERCHÉ ACTIVE DIRECTORY?

• Standard «De Facto» per i domini

• Utile per diverse compliance

• Utile nelle fasi di acquisizioni/fusioni/trasformazioni aziendali

• Altri tipi di domini

• Domini NT4

• Domini NIS

• Directory Novell

• Soluzioni basate su LDAP

• …

Page 6: Realizzare una rete aziendale con linux e samba

ACTIVE DIRECTORY

Sistema integrato e distribuito di directory service

• rilasciata come beta nel 1996

• rilasciata per la prima volta con Windows 2000

Integrazione di diversi standard

• Domain Name Service

• sostituisce ai Domini NT i Domini DNS

• X.500

• Utilizzato per elencare gli oggetti

• Lightweight Directory Access Protocol

• Utilizzato la comunicazione

• Kerberos V5

• Utilizzato per l’autenticazione

• Active Directory Service Interfaces (ADSI)

Page 7: Realizzare una rete aziendale con linux e samba

ACTIVE DIRECTORY STANDARD

DHCP

SNTP

LDAP

X.509

TCP/IP

LDIF

Internet-Standard Technologies

DNS

Kerberos

Page 8: Realizzare una rete aziendale con linux e samba

DIRECTORY

Repository contenente oggetti:

• Utenti, gruppi e/o contatti

• Stampanti condivise

• Computer e/o Server

• Unità disco condivise

Organizzato in modo gerarchico all’interno di

• Domini (Domain)

• Organization Unit (OU)

Simile ad un database

• informazioni tipicamente usate in lettura

Accesso non transazionale

Permesse inconsistenze temporanee

Page 9: Realizzare una rete aziendale con linux e samba

TERMINOLOGIA AD (1)

Dominio

• contenitore di oggetti

• deve includere almeno un controller di dominio (DC)

• può contenere dei computer client e/o stampanti e/o …

• Root Domain

Struttura (Albero – “Tree”)

• raggruppamento di uno o più domini Windows

• può essere costituita da un solo dominio più altri sottodomini appartenenti allo stesso spazio dei nomi contiguo

Insieme di Strutture (Foresta – “Forest”)

• raggruppamento di una o più strutture

Organizational Unit (OU)

• contenitore di oggetti

• delimita il raggio d’azione delle policy

• permette la delega amministrativa

Page 10: Realizzare una rete aziendale con linux e samba

TERMINOLOGIA AD (2)

Sito

• rappresenta il raccordo tra la struttura logica di Active Directory e la rete fisica che la ospita

• delimita il contesto di replica tra i vari Domain Controller

Schema

• definisce tutti gli elementi che appartengono all’Active Directory

NTDS (database di Active Directory)

• directory del nuovo dominio e contiene tutti gli oggetti memorizzati nell'archivio di Active Directory

• il percorso predefinito del database è c:\windows\ntds

• il file che contiene il database di directory si chiama Ntds.dit

SYSVOL (Volume di sistema condiviso)

• struttura di cartelle che esiste in tutti i controller di dominio

• memorizza gli script e alcuni oggetti per il dominio

• il percorso predefinito del sistema condiviso è: c:\windows\sysvol

Page 11: Realizzare una rete aziendale con linux e samba

TERMINOLOGIA AD (3)

Tipo di server

• Domain Controller

• Domain Member

Tipi di DC

• Global Catalog

• Read Only Domain Controller (RODC)

• Ruoli FSMO (Flexible Single Master Operation)• A livello di foresta

• Schema master

• Domain naming master

• A livello di dominio

• PDC emulator

• RID master

• Infrastructure master

Page 12: Realizzare una rete aziendale con linux e samba

RISOLUZIONE DEI NOMI

Problemi

• Conversione nomi in indirizzi IP

• Service Discovery

Utilizzo del DNS

• A record

• Risoluzione dei nomi macchina

• Sostituisce il vecchio WINS

• Service (SRV) record

• Discovery dei server per i servizi di AD

• LDAP, GC, DC, Kerberos

Page 13: Realizzare una rete aziendale con linux e samba

NAMING CONVENTION

LDAP

• Distinguished name

• Relative distinguished name

Kerberos

• User Principal Name (UPN) e suffissi alternativi

Service Principal Name (SPN)

Globally Unique IDentifier (GUID)

Universal Naming Convention (UNC)

CN=Jeff Smith, CN=Users, DC=contoso, DC=msft

[email protected]

Page 14: Realizzare una rete aziendale con linux e samba

PROTOCOLLO SMB

Server Message Block

• It is a protocol by which a lot of PC-related machines share files and printers and other information such as lists of available files and printers

• Operating systems that support this natively include Windows NT, OS/2, and Linux

What is CIFS?

• CIFS – Common Internet File System is a protocol that is basically an updated SMB.

Page 15: Realizzare una rete aziendale con linux e samba

SMB – DA NT 4.0 A NT 6.2

Versioni esistenti

• CIFS

• Microsoft Windows NT 4.0 (1996)

• SMB 1.0 (o SMB1)

• Windows 2000, Windows XP, Windows Server 2003 e Windows

Server 2003 R2

• SMB 2.0 (o SMB2)

• Windows Vista (SP1 or later) e Windows Server 2008

• SMB 2.1 (or SMB2.1)

• Windows 7 e Windows Server 2008 R2

• SMB 3.0 (or SMB3) – Anche noto come SMB 2.2

• Windows 8 e Windows Server 2012

Verificare la versione

• PowerShell: Get-SmbConnection

Page 16: Realizzare una rete aziendale con linux e samba

COSA È SAMBA?

• Samba is a suite of programs which work together to allow clients to access to a server's filespace and printers via the SMB (Server Message Block) and CIFS (Common Internet Filesystem) protocols

• Samba is freely available and is an OpenSource project

• With Samba, you can share a Linux filesystem with Windows 95, 98, 2000 and NT and vice versa

• You can also share printers connected to either Linux or a system with Windows 95, 98, 2000 or NT

• Samba enables a Linux or Unix server to function as a file server for client PCs running Windows software

• Andrew Tridgell developed the first version of Samba Unix in December 1991 and January 1992

Page 17: Realizzare una rete aziendale con linux e samba

SAMBA 4

Version 4.x (12/11/12) brings AD compatible Domain

Controller or join to existing DC

• Samba Active Directory Domain

• LDAP Server

• Heimdal Kerberos Authentication

• Dynamic DNS

• Group policy

• Roaming profiles

• SMB 2.1 / 3

Page 18: Realizzare una rete aziendale con linux e samba

SAMBA 4.1

• October 11, 2013

• Più funzioni e compatibilità

• http://www.samba.org/samba/history/samba-4.1.0.html

Page 19: Realizzare una rete aziendale con linux e samba

SAMBA4 AD

Page 20: Realizzare una rete aziendale con linux e samba

PROBLEMA DELLA DISTRIBUZIONE

• Samba3 è ancora il default

• Poche includono versioni (vecchie) di Samba4

• (Nessuna) include Samba 4.1

• Sorgenti esterni

• Spesso incompleti

• Oppure ricompilazione dai sorgenti

Page 21: Realizzare una rete aziendale con linux e samba

FUNZIONALITÀ E COMPATIBILITÀ

• “Officially" supported in 4.0:

• forests: 1, domains: 1, domain controllers: 1*

• Trusts:

• Samba can be trusted

• Samba can not trust (yet)

• Replication:

• directory replication works

• sysvol replication not implemented yet• *multiple Samba DCs possible (sysvol replicated externally)

• SMB 3.0 TODO:

• multi channel

• RDMA

• cluster concepts (scale-out/continuous availability)

Page 22: Realizzare una rete aziendale con linux e samba

COMPONENTI DI SAMBA (1)

• smb.conf: This is the configuration file for smbd

• smbd daemon: This provides the file and print services to SMB clients such as Windows NT or other Linux or Unix clients

• nmbd daemon: This daemon provides NetBIOS nameserving and browsing support

• smbclient: This is an smb client program that implement a simple FTP-like client on a Linux or Unix box

• smbmount: This mounting program enables mounting of server directories on a Linux or Unix box

• smbstatus: This programs lists the current Samba connections

Page 23: Realizzare una rete aziendale con linux e samba

COMPONENTI DI SAMBA (2)

• testparm: This utility is used to test the smb.conf configuration file

• SWAT: Swat allows a Samba administrator to configure the smb.conf file via a Web browser

• smbpasswd: This allows the user to change the password used for their SMB sessions

• NTVFS file server: This file server is what was used prior to the beta2 release of Samba 4.0; expect to move smbd to in the longer term

• CTDB: Samba4 Clustered Filesystem

• samba-tool: Provision of a new AD domain

Page 24: Realizzare una rete aziendale con linux e samba

COMPILARE SAMBA

git clone git://git.samba.org/samba.git samba-master

cd samba-master

./configure

make

make install

Page 25: Realizzare una rete aziendale con linux e samba

I PARAMETRI DI BASE

File smb.conf

Definizione del Workgroup/Dominio

• direttiva workgroup

Definizione delle reti autorizzate

• SMB su TCP/IP funziona anche su Internet!

Definizione dell’autenticazione

• direttiva security

• nel caso di security=user è importante definire le password degli utenti SAMBA

• Microsoft e Unix hanno password cifrate diverse!

Definizione delle share

Page 26: Realizzare una rete aziendale con linux e samba

SAMBA COME AD DC

http://wiki.samba.org/index.php/Samba_AD_DC_HOWTO

samba-tool domain provision

Scelta del back-end DNS

DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE)

Kerberos e problemi con alcune distro

Page 27: Realizzare una rete aziendale con linux e samba

SAMBA COME DC AGGIUNTIVO

https://wiki.samba.org/index.php/Samba4/HOWTO/Join_a_domain_as_a_DC

samba-tool domain join

DC | RODC | MEMBER

Migrare i ruoli FSMO

samba-tool fsmo seize --role=....

Global Catalog

Sysvol

Problemi con Windows Server 2012

Page 28: Realizzare una rete aziendale con linux e samba

“ESTENDERE” SAMBA

Stackable VFS modules

• Included Modules

• audit

• extd_audit

• fake_perms

• recycle

• netatalk

• shadow_copy

• VFS Modules Available Elsewhere

• DatabaseFS

• Vscan

Per saperne di più

• http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/VFS.html

Page 29: Realizzare una rete aziendale con linux e samba

FILE SYSTEM PER SAMBA

• Problema dei permessi

• Unix utilizza i bit dei permessi

• Windows le ACL

• Filesystem con opzione acl

• Nota

• If you are using an ext3 or ext4 filesystem on Linux, you should ensure that the filesystem is mounted with the options:

• user_xattr,acl,barrier=1

• LVM per il supporto alle snapshot

Page 30: Realizzare una rete aziendale con linux e samba

CONSIDERAZIONI FINALI

• Interoperabilità

• Compatibilità

• Non tutte le funzioni sono implementate

• Disponibilità

• AD è già progettata per alta disponibilità

• Con Linux vi sono poi interessanti opzioni

• Sicurezza

• AD non è una soluzione multi-tenant

• Adatta solo in reti locali

• http://www.golinuxhub.com/2013/09/iptable-rules-for-samba-4-in-red-hat.html

Page 31: Realizzare una rete aziendale con linux e samba

SAMBA EXPERIENCE

• The Samba eXPerience is the international Samba conference for users and developers

• May 13th - 16th, 2014

• the 13th international Samba conference

• Hotel Freizeit In Göttingen, Germany

• http://www.sambaxp.org