Configuracion Ubuntu Server 10-04 Samba)

download Configuracion Ubuntu Server 10-04 Samba)

of 51

Transcript of Configuracion Ubuntu Server 10-04 Samba)

Configuracion Ubuntu Server 10.04

Elaborado por: Luis Alonso Hernndez Monge

Fecha 25/5/2011

1

ContenidoConfiguracion de interfaces virtuales ........................................................................................... 3 Configuracion servicio dhcp (dhcp3) ............................................................................................. 5 Configuracion servicio dns (bind9) ................................................................................................ 7 Configuracion servicio https (apache2)..................................................................................... 12 Configuracion servicio ftp (vsftpd) ............................................................................................. 14 Configuracion servicio de correo (postfix y dovecot) ............................................................... 16 Postfix ...................................................................................................................................... 16 Dovecot ................................................................................................................................... 19 Configuracion servicio para clientes Windows ( LDAP y Samba) ................................................ 35 LDAP ........................................................................................................................................ 35 Samba ...................................................................................................................................... 40

2

Configuracion de interfaces virtualesEs necesario para la gestion de configuracion estar cambiando la configuracion de las interfaces virtual; ya que sin esto no se podran probar los servicios y mucho menos configurarlos. Debemos tener en cuenta 2 Aspectos: 1. Configuracion. La configuracion de un servicio conlleva que configuremos la interface de manera que obtenga el acceso a internet de la maquina host.

Terminal Llamamos al navegador de archivos sudo nautilus

Archivo interfaces ubicado en /etc/network/ # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp

Terminal Reiniciamos el servicio sudo etc/init.d/networking restart

3

2. Prueba. La configuracion de un servicio conlleva que configuremos la interface de manera que se tenga un puente entre la maquina y el exterior y que esta funcione tal como se va a aplicar en la practica, eso si sobre la maquina host. Terminal Llamamos al navegador de archivos sudo nautilus

Archivo interfaces ubicado en /etc/network/ # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 172.17.20.3 netmask 255.255.255.0

Terminal Reiniciamos el servicio sudo etc/init.d/networking restart

4

Configuracion servicio dhcp (dhcp3)Terminal Instalamos el servicio sudo apt-get install dhcp3-server Llamamos al navegador de archivos sudo nautilus

5

Archivo dhcpd

ubicado en /etc/dhcp3/

#configuracion general del dhcp server-identifier grupo03; ddns-updates on; ddns-update-style interim; ddns-domainname "redes.net"; ddns-rev-domainname "in-addr.arpa."; allow client-updates; option domain-name "redes.net"; option domain-name-servers 172.17.20.3; default-lease-time 600; max-lease-time 7200; log-facility local7; include "/etc/bind/rndc.key"; zone redes.net.{ primary 127.0.0.1; key rndc-key; } subnet 172.17.20.0 netmask 255.255.255.0{ range 172.17.20.100 172.17.20.254; option subnet-mask 255.255.255.0; option broadcast-address 172.17.20.255; option routers 172.17.20.1; option domain-name "profesores.redes.net."; option domain-name-servers 172.17.20.3; option netbios-name-servers 172.17.20.3; option netbios-node-type 8; zone 20.17.172.in-addr.arpa. { primary 172.17.20.3; key rndc-key; } zone localdomain. { primary 172.17.20.3; key rndc-key; } } subnet 172.18.20.0 netmask 255.255.255.0{ range 172.18.20.100 172.18.20.254; option subnet-mask 255.255.255.0; option broadcast-address 172.18.20.255; option routers 172.18.20.1; option domain-name "estudiantes.redes.net."; option domain-name-servers 172.17.20.3; option netbios-name-servers 172.17.20.3; option netbios-node-type 8; zone 20.18.172.in-addr.arpa. { primary 172.17.20.3; key rndc-key; } zone localdomain. { primary 172.17.20.3; key rndc-key; } } subnet 172.16.10.0 netmask 255.255.255.0{ range 172.16.10.100 172.16.10.254; option subnet-mask 255.255.255.0; option broadcast-address 172.16.10.255; option routers 172.16.10.1; option domain-name "laboratorio.redes.net."; option domain-name-servers 172.17.20.3; option netbios-name-servers 172.17.20.3; option netbios-node-type 8; zone 10.16.172.in-addr.arpa. { primary 172.17.20.3; key rndc-key; } zone localdomain. { primary 172.17.20.3; key rndc-key; } }

6

Terminal Reiniciamos el servicio sudo /etc/init.d/dhcp3-server restart Si genera algn error con el rndc.key entonces ponemos esta instruccion sudo chown root:bind /etc/bind/rndc.key

Configuracion servicio dns (bind9)Terminal Instalamos el servicio sudo aptitude install bind9 Llamamos al navegador de archivos sudo nautilus

Ahora procedemos a crear los archivos de las zonas y sus repectivas inversas.

7

Archivo

named.conf.local ubicado en /etc/bind/

// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; zone "redes.net."{ type master; file "/etc/bind/redes.net"; allow-update { key "rndc-key" ; } ; notify yes; }; zone "profesores.redes.net."{ type master; file "/etc/bind/profesores.redes.net"; allow-update{ key "rndc-key" ; } ; notify yes; }; zone "estudiantes.redes.net."{ type master; file "/etc/bind/estudiantes.redes.net"; allow-update { key "rndc-key" ; } ; notify yes; }; zone "laboratorio.redes.net."{ type master; file "/etc/bind/laboratorio.redes.net"; allow-update { key "rndc-key" ; } ; notify yes; }; zone "20.17.172.in-addr.arpa."{ type master; file "/etc/bind/rev.20.17.172.in-addr.arpa"; allow-update { key "rndc-key" ; } ; notify yes; }; zone "20.18.172.in-addr.arpa."{ type master; file "/etc/bind/rev.20.18.172.in-addr.arpa"; allow-update { key "rndc-key" ; } ; notify yes; }; zone "10.16.172.in-addr.arpa."{ type master; file "/etc/bind/rev.10.16.172.in-addr.arpa"; allow-update { key "rndc-key" ; } ; notify yes; }; include "/etc/bind/rndc.key";

8

Crear archivo redes.net ubicado en /etc/bind/ ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.redes.net. root.localhost. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.redes.net. @ IN NS grupo03b.redes.net. @ IN A 172.17.20.3 @ IN A 172.17.20.4 @ IN MX 0 grupo03b.redes.net. grupo03 IN A 172.17.20.3 grupo03b IN A 172.17.20.4 Aclaremos bien que para efectos de este problema tenamos el servidor de correo y el de dns en distintas localizaciones por eso requerian mas instrucciones; quitaremos todo las lineas que digan 172.17.20.4 o grupo03b

Crear archivo estudiantes.redes.net ubicado en /etc/bind/ ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.estudiantes.redes.net. root.localhost. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.estudiantes.redes.net. @ IN A 172.17.20.3 grupo03 IN A 172.17.20.3

9

Crear archivo

profesores.redes.net ubicado en /etc/bind/

; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.profesores.redes.net. root.localhost. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.profesores.redes.net. @ IN A 172.17.20.3 grupo03 IN A 172.17.20.3

Crear archivo

laboratorio.redes.net ubicado en /etc/bind/

; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.laboratorio.redes.net. root.localhost. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.laboratorio.redes.net. @ IN A 172.17.20.3 grupo03 IN A 172.17.20.3

10

Crear archivo rev.10.16.172.in-addr ubicado en /etc/bind/ ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.laboratorio.redes.net. root.localhost. ( 7 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.laboratorio.redes.net. 3 IN PTR grupo03.laboratorio.redes.net.

Crear archivo rev.20.17.172.in-addr ubicado en /etc/bind/ ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.profesores.redes.net. root.localhost. ( 7 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.profesores.redes.net. 3 IN PTR grupo03.profesores.redes.net. @ IN NS grupo03b.profesores.redes.net. 4 IN PTR grupo03b.profesores.redes.net.

Crear archivo rev.20.18.172.in-addr ubicado en /etc/bind/ ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA grupo03.estudiantes.redes.net. root.localhost. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS grupo03.estudiantes.redes.net. 3 IN PTR grupo03.estudiantes.redes.net. 11

Terminal Cambiamos permisos al archivo rndc.key sudo chmod 644 /etc/bind/rndc.key Reiniciamos el servicio sudo /etc/init.d/bind9 restart

Configuracion servicio https (apache2)Terminal Instalamos el servicio sudo apt-get install apache2 Instalamos el certificado sudo apt-get install openssl ssl-cert sudo openssl req $@ -new -x509 -days 365 -nodes -out sudo /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem Se despliega lo siguiente Country Name (2 letter code) [AU]: Ingresamos State or Province Name (full name) [Some-State]:Ingresamos Locality Name (eg, city) []: Ingresamos Organization Name (eg, company) [Internet Widgits Pty Ltd]: Ingresamos Organizational Unit Name (eg, section) []:Ingresamos Common Name (eg, YOUR name) []:Ingresamos Email Address []:Ingresamos Cambiamos permisos chmod 600 /etc/apache2/apache.pem

12

verificar Listen 443 en /etc/apache2/ports.conf # If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default # This is also true if you have upgraded from before 2.2.9-3 (i.e. from # Debian etch). See /usr/share/doc/apache2.2common/NEWS.Debian.gz and # README.Debian.gz NameVirtualHost *:80 Listen 80 # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sitesavailable/default-ssl # to # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 Listen 443

Terminal sudo a2enmod ssl Reiniciamos el servicio sudo /etc/init.d/apache2 restart sudo a2ensite default-ssl Formasamos el servcio a reiniciar sudo /etc/init.d/apache2 reload

13

Configuracion servicio ftp (vsftpd)Terminal Instalamos el servicio sudo apt-get install vsftpd

Archivo vsftpd.conf ubicado en /etc/ listen=YES anonymous_enable=NO local_enable=YES write_enable=YES dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES idle_session_timeout=600 data_connection_timeout=120 ftpd_banner=Welcome to blah FTP service. chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list pam_service_name=vsftpd pasv_enable=YES pasv_min_port=40000 pasv_max_port=4020 max_clients=5 max_per_ip=3 vsftpd_log_file=/var/log/vsftpd.log log_ftp_protocol=YES

14

Creamos archivo vsftpd.chroot_list ubicado en /etc/ Administrator

Creamos archivo vsftpd.user_list ubicado en /etc/ ftpgrupo03

Terminal Adherimos un grupo para usar ftp sudo groupadd usuariosftp Cambiamos permisos a la carpeta que queremos que actue de recipiente (debemos crear dicha carpeta) sudo chmod 755 /home/ftp sudo chown root:usuariosftp /home/ftp Creamos un usuario y proporcionamos su contrasea sudo useradd -g usuariosftp -d /home/ftp -s /bin/false ftpgrupo03 sudo passwd ftpgrupo03 Reiniciamos el servicio sudo service vsftpd restart

15

Configuracion servicio de correo (postfix y dovecot)PostfixTerminal Instalamos el servicio postfix aptitude install postfix Llamamos al gestor de configuracin de postfix por consola dpkg-reconfigure postfix Para cada apartado de configuracin debemos poner los siguientes parametros -General type of mail configuration: Internet Site -NONE DOEST'N APPEAR TO BE REQUESTED IN COURRENT CONFIG -System mail name: redes.net -Root and postmaster mail recipient: root -other destinations for mail: redes.net,localhost,localhost.redes.net,grupo03.redes.net -setting synchronous mail queue updates: false -setting mynetworks: 127.0.0.0/8 -Yes -setting mailbox_size_limit: 0 -setting recipient_delimiter: + -setting inet_protocols: all Seguido de esta configuaracion seguimos con los siguientes comandos sudo postconf -e 'home_mailbox = Maildir/' sudo postconf -e 'mailbox_command =' sudo postconf -e 'smtpd_sasl_local_domain =' sudo postconf -e 'smtpd_sasl_auth_enable = yes' sudo postconf -e 'smtpd_sasl_security_options = noanonymous' sudo postconf -e 'broken_sasl_auth_clients = yes' sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destina tion' sudo postconf -e 'inet_interfaces =all' Nos situamos en la carpeta sasl cd /etc/postfix/sasl Creamos y editamos el archivo smtpd.conf sudo gedit smtpd.conf

16

Creamos archivo smtpd.conf ubicado en /etc/postfix/sasl pwcheck_method: saslauthd mech_list: plain login

Terminal sudo touch smtpd.key sudo chmod 600 smtpd.key sudo openssl genrsa 1024 > smtpd.key sudo openssl req -new -key smtpd.key -x509 -days 3650 -out smtpd.crt # has prompts sudo openssl req -new -x509 -extensions v3_ca -keyout cakey.pem out cacert.pem -days 3650 # has prompts sudo mv smtpd.key /etc/ssl/private/ sudo mv smtpd.crt /etc/ssl/certs/ sudo mv cakey.pem /etc/ssl/private/ sudo mv cacert.pem /etc/ssl/certs/ sudo postconf -e 'smtp_tls_security_level =may' sudo postconf -e 'smtpd_tls_security_level =may' sudo postconf -e 'smtpd_tls_auth_only = no' sudo postconf -e 'smtp_tls_note_starttls_offer = yes' sudo postconf -e 'smtpd_tls_key_file = /etc/ssl/private/smtpd.key' sudo postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt' sudo postconf -e 'smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem' sudo postconf -e 'smtpd_tls_loglevel =1' sudo postconf -e 'smtpd_tls_received_header = yes' sudo postconf -e 'smtpd_tls_session_cache_timeout = 3600s' sudo postconf -e 'tls_random_source= dev:/dev/urandom' sudo postconf -e 'myhostname = mail.redes.net' sudo /etc/init.d/postfix restart sudo apt-get install libsasl2-2 sasl2-bin sudo cd /var/spool/postfix sudo mkdir -p var/run sudo cd var/run sudo ln -s /var/run/saslauthd Nos situamos en la carpeta default sudo cd /etc/default Creamos y editamos el archivo saslauthd sudo gedit saslauthd

17

Creamos archivo saslauthd ubicado en /etc/default# # Settings for saslauthd daemon # Please read /usr/share/doc/sasl2-bin/README.Debian for details. # # Should saslauthd run automatically on startup? (default: no) START=yes PWDIR="/var/spool/postfix/var/run/saslauthd" PARAMS="-m ${PWDIR}" PIDFILE="${PWDIR}/saslauthd.pid" # Description of this saslauthd instance. Recommended. # (suggestion: SASL Authentication Daemon) DESC="SASL Authentication Daemon" # Short name of this saslauthd instance. Strongly recommended. # (suggestion: saslauthd) NAME="saslauthd" # Which authentication mechanisms should saslauthd use? (default: pam) # # Available options in this Debian package: # getpwent -- use the getpwent() library function # kerberos5 -- use Kerberos 5 # pam -- use PAM # rimap -- use a remote IMAP server # shadow -- use the local shadow password file # sasldb -- use the local sasldb database file # ldap -- use LDAP (configuration is in /etc/saslauthd.conf) # # Only one option may be used at a time. See the saslauthd man page # for more information. # # Example: MECHANISMS="pam" MECHANISMS="pam" # Additional options for this mechanism. (default: none) # See the saslauthd man page for information about mech-specific options. MECH_OPTIONS="" # How many saslauthd processes should we run? (default: 5) # A value of 0 will fork a new process for each connection. THREADS=5 # Other options (default: -c -m /var/run/saslauthd) # Note: You MUST specify the -m option or saslauthd won't run! # # WARNING: DO NOT SPECIFY THE -d OPTION. # The -d option will cause saslauthd to run in the foreground instead of as # a daemon. This will PREVENT YOUR SYSTEM FROM BOOTING PROPERLY. If you wish # to run saslauthd in debug mode, please run it by hand to be safe. # # See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information. # See the saslauthd man page and the output of 'saslauthd -h' for general # information about these options. # # Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd" OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

18

Terminal sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthds

DovecotTerminal Instalamos el servicio sudo aptitude install dovecot-imapd dovecot-pop3d Nos situamos en la carpeta dovecot sudo cd /etc/dovecot Creamos y editamos el archivo dovecot.conf sudo gedit dovecot.conf

19

Creamos archivo dovecot.conf ubicado en /etc/dovecot debemos chequear que todo lo este igual que este (buscar bien todas las lneas que no estn comentadas y comparar)## Dovecot configuration file # If you're in a hurry, see http://wiki.dovecot.org/QuickConfiguration # "dovecot -n" command gives a clean output of the changed settings. Use it # instead of copy&pasting this file when posting to the Dovecot mailing list. # '#' character and everything after it is treated as comments. Extra spaces # and tabs are ignored. If you want to use either of these explicitly, put the # value inside quotes, eg.: key = "# char and trailing whitespace " # # # # # # Default values are shown for each setting, it's not required to uncomment those. These are exceptions to this though: No sections (e.g. namespace {}) or plugin settings are added by default, they're listed only as examples. Paths are also just examples with the real defaults being based on configure options. The paths listed here are for configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-ssldir=/etc/ssl

# Base directory where to store runtime data. #base_dir = /var/run/dovecot # Protocols we want to be serving: imap imaps pop3 pop3s managesieve # If you only want to use dovecot-auth, you can set this to "none". #protocols = imap imaps protocols = imap imaps pop3 pop3s pop3_uidl_format= %08Xu%08Xv mail_location = maildir:~/Maildir # A space separated list of IP or host addresses where to listen in for # connections. "*" listens in all IPv4 interfaces. "[::]" listens in all IPv6 # interfaces. Use "*, [::]" for listening both IPv4 and IPv6. # # If you want to specify ports for each service, you will need to configure # these settings inside the protocol imap/pop3/managesieve { ... } section, # so you can specify different ports for IMAP/POP3/MANAGESIEVE. For example: protocol imap { # listen = *:10143 # ssl_listen = *:10943 # .. # } # protocol pop3 { # listen = *:10100 # .. # } # protocol managesieve { # listen = *:12000 # .. # } listen = * # Disable LOGIN command and all other plaintext authentications unless # SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP # matches the local IP (ie. you're connecting from the same computer), the # connection is considered secure and plaintext authentication is allowed. disable_plaintext_auth = no # Should all IMAP and POP3 processes be killed when Dovecot master process # shuts down. Setting this to "no" means that Dovecot can be upgraded without # forcing existing client connections to close (although that could also be # a problem if the upgrade is eg. because of a security fix). This however # means that after master process has died, the client processes can't write # to log files anymore. #shutdown_clients = yes ## ## Logging ## # Log file to use for error messages, instead of sending them to syslog. # /dev/stderr can be used to log into stderr. #log_path = # Log file to use for informational and debug messages. # Default is the same as log_path. #info_log_path = # Prefix for each line written to log file. % codes are in strftime(3) # format. #log_timestamp = "%b %d %H:%M:%S " log_timestamp = "%Y-%m-%d %H:%M:%S "

20

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# Syslog facility to use if you're logging to syslog. Usually if you don't # want to use "mail", you'll use local0..local7. Also other standard # facilities are supported. #syslog_facility = mail ## ## SSL settings ## ssl_disable = yes # IP or host address where to listen in for SSL connections. Remember to also # add imaps and/or pop3s to protocols setting. Defaults to same as "listen" # setting if not specified. #ssl_listen = # SSL/TLS support: yes, no, required. #ssl = yes # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before # dropping root privileges, so keep the key file unreadable by anyone but # root. #ssl_cert_file = /etc/ssl/certs/dovecot.pem #ssl_key_file = /etc/ssl/private/dovecot.pem # If key file is password protected, give the password here. Alternatively # give it when starting dovecot with -p parameter. Since this file is often # world-readable, you may want to place this setting instead to a different # root owned 0600 file by using !include_try . #ssl_key_password = # File containing trusted SSL certificate authorities. Set this only if you # intend to use ssl_verify_client_cert=yes. The CAfile should contain the # CA-certificate(s) followed by the matching CRL(s). #ssl_ca_file = # Request client to send a certificate. If you also want to require it, set # ssl_require_client_cert=yes in auth section. #ssl_verify_client_cert = no # Which field from certificate to use for username. commonName and # x500UniqueIdentifier are the usual choices. You'll also need to set # ssl_username_from_cert=yes. #ssl_cert_username_field = commonName # How often to regenerate the SSL parameters file. Generation is quite CPU # intensive operation. The value is in hours, 0 disables regeneration # entirely. #ssl_parameters_regenerate = 168 # SSL ciphers to use #ssl_cipher_list = ALL:!LOW:!SSLv2 # Show protocol level SSL errors. #verbose_ssl = no ## ## Login processes ## # # Directory where authentication process places authentication UNIX sockets # which login needs to be able to connect to. The sockets are created when # running as root, so you don't have to worry about permissions. Note that # everything in this directory is deleted when Dovecot is started. #login_dir = /var/run/dovecot/login # chroot login process to the login_dir. Only reason not to do this is if you # wish to run the whole Dovecot without roots. #login_chroot = yes # User to use for the login process. Create a completely new user for this, # and don't use it anywhere else. The user must also belong to a group where # only it has access, it's used to control access for authentication process. # Note that this user is NOT used to access mails. #login_user = dovecot # Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. #login_process_size = 64 # Should each login be processed in it's own process (yes), or should one # login process be allowed to process multiple connections (no)? Yes is more # secure, espcially with SSL/TLS enabled. No is faster since there's no need # to create processes all the time. #login_process_per_connection = yes # Number of login processes to keep for listening new connections. #login_processes_count = 3

21

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# Maximum number of login processes to create. The listening process count # usually stays at login_processes_count, but when multiple users start logging # in at the same time more extra processes are created. To prevent fork-bombing # we check only once in a second if new processes should be created - if all # of them are used at the time, we double their amount until the limit set by # this setting is reached. #login_max_processes_count = 128 # Maximum number of connections allowed per each login process. This setting # is used only if login_process_per_connection=no. Once the limit is reached, # the process notifies master so that it can create a new login process. #login_max_connections = 256 # Greeting message for clients. #login_greeting = Dovecot ready. # Space separated list of trusted network ranges. Connections from these # IPs are allowed to override their IP addresses and ports (for logging and # for authentication checks). disable_plaintext_auth is also ignored for # these networks. Typically you'd specify your IMAP proxy servers here. #login_trusted_networks = # Space-separated list of elements we want to log. The elements which have # a non-empty variable value are joined together to form a comma-separated # string. #login_log_format_elements = user= method=%m rip=%r lip=%l %c # Login log format. %$ contains login_log_format_elements string, %s contains # the data we want to log. #login_log_format = %$: %s ## ## Mailbox locations and namespaces ## # Location for users' mailboxes. This is the same as the old default_mail_env # setting. The default is empty, which means that Dovecot tries to find the # mailboxes automatically. This won't work if the user doesn't have any mail # yet, so you should explicitly tell Dovecot the full location. # # If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u) # isn't enough. You'll also need to tell Dovecot where the other mailboxes are # kept. This is called the "root mail directory", and it must be the first # path given in the mail_location setting. # # There are a few special variables you can use, eg.: # # %u - username # %n - user part in user@domain, same as %u if there's no domain # %d - domain part in user@domain, empty if there's no domain # %h - home directory # # See for full list. # Some examples: # # mail_location = maildir:~/Maildir # mail_location = mbox:~/mail:INBOX=/var/mail/%u # mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n # # # #mail_location = # If you need to set multiple mailbox locations or want to change default # namespace settings, you can do it by defining namespace sections. # # You can have private, shared and public namespaces. Private namespaces # are for user's personal mails. Shared namespaces are for accessing other # users' mailboxes that have been shared. Public namespaces are for shared # mailboxes that are managed by sysadmin. If you create any shared or public # namespaces you'll typically want to enable ACL plugin also, otherwise all # users can access all the shared mailboxes, assuming they have permissions # on filesystem level to do so. # # REMEMBER: If you add any namespaces, the default namespace must be added # explicitly, ie. mail_location does nothing unless you have a namespace # without a location setting. Default namespace is simply done by having a # namespace with empty prefix.

22

Continuacion archivo dovecot.conf ubicado en /etc/dovecot#namespace private { # Hierarchy separator to use. You should use the same separator for all # namespaces or some clients get confused. '/' is usually a good one. # The default however depends on the underlying mail storage format. #separator = # Prefix required to access this namespace. This needs to be different for # all namespaces. For example "Public/". #prefix = # Physical location of the mailbox. This is in same format as # mail_location, which is also the default for it. #location = # There can be only one INBOX, and this setting defines which namespace # has it. #inbox = no # If namespace is hidden, it's not advertised to clients via NAMESPACE # extension. You'll most likely also want to set list=no. This is mostly # useful when converting from another server with different namespaces which # you want to deprecate but still keep working. For example you can create # hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/". #hidden = yes # Show the mailboxes under this namespace with LIST command. This makes the # namespace visible for clients that don't support NAMESPACE extension. # "children" value lists child mailboxes, but hides the namespace prefix. #list = yes # Namespace handles its own subscriptions. If set to "no", the parent # namespace handles them (empty prefix should always have this as "yes") #subscriptions = yes #} # Example shared namespace configuration #namespace shared { #separator = / # Mailboxes are visible under "shared/user@domain/" # %%n, %%d and %%u are expanded to the destination user. #prefix = shared/%%u/ # Mail location for other users' mailboxes. Note that %variables and ~/ # expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the # destination user's data. #location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u # Use the default namespace for saving subscriptions. #subscriptions = no # List the shared/ namespace only if there are visible shared mailboxes. #list = children #} # System user and group used to access mails. If you use multiple, userdb # can override these by returning uid or gid fields. You can use either numbers # or names. #mail_uid = #mail_gid = # Group to enable temporarily for privileged operations. Currently this is # used only with INBOX when either its initial creation or dotlocking fails. # Typically this is set to "mail" to give access to /var/mail. #mail_privileged_group = mail_privileged_group = mail # Grant access to these supplementary groups for mail processes. Typically # these are used to set up access to shared mailboxes. Note that it may be # dangerous to set these if users can create symlinks (e.g. if "mail" group is # set here, ln -s /var/mail ~/mail/var could allow a user to delete others' # mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it). #mail_access_groups = # Allow full filesystem access to clients. There's no access checks other than # what the operating system does for the active UID/GID. It works with both # maildir and mboxes, allowing you to prefix mailboxes names with eg. /path/ # or ~user/. #mail_full_filesystem_access = no ## ## Mail processes ## # Enable mail process debugging. This can help you figure out why Dovecot # isn't finding your mails. #mail_debug = no # Log prefix for mail processes. See # for list of possible variables you can use. #mail_log_prefix = "%Us(%u): " # Max. number of lines a mail process is allowed to log per second before it's # throttled. 0 means unlimited. Typically there's no need to change this # unless you're using mail_log plugin, which may log a lot. This setting is # ignored while mail_debug=yes to avoid pointless throttling. #mail_log_max_lines_per_sec = 10

23

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# Don't use mmap() at all. This is required if you store indexes to shared # filesystems (NFS or clustered filesystem). #mmap_disable = no # Rely on O_EXCL to work when creating dotlock files. NFS supports O_EXCL # since version 3, so this should be safe to use nowadays by default. #dotlock_use_excl = yes # Don't use fsync() or fdatasync() calls. This makes the performance better # at the cost of potential data loss if the server (or the file server) # goes down. #fsync_disable = no # Mail storage exists in NFS. Set this to yes to make Dovecot flush NFS caches # whenever needed. If you're using only a single mail server this isn't needed. #mail_nfs_storage = no # Mail index files also exist in NFS. Setting this to yes requires # mmap_disable=yes and fsync_disable=no. #mail_nfs_index = no # Locking method for index files. Alternatives are fcntl, flock and dotlock. # Dotlocking uses some tricks which may create more disk I/O than other locking # methods. NFS users: flock doesn't work, remember to change mmap_disable. #lock_method = fcntl # Drop all privileges before exec()ing the mail process. This is mostly # meant for debugging, otherwise you don't get core dumps. It could be a small # security risk if you use single UID for multiple users, as the users could # ptrace() each others processes then. #mail_drop_priv_before_exec = no # Show more verbose process titles (in ps). Currently shows user name and # IP address. Useful for seeing who are actually using the IMAP processes # (eg. shared mailboxes or if same uid is used for multiple accounts). #verbose_proctitle = no # Valid UID range for users, defaults to 500 and above. This is mostly # to make sure that users can't log in as daemons or other system users. # Note that denying root logins is hardcoded to dovecot binary and can't # be done even if first_valid_uid is set to 0. #first_valid_uid = 500 #last_valid_uid = 0 # Valid GID range for users, defaults to non-root/wheel. Users having # non-valid GID as primary group ID aren't allowed to log in. If user # belongs to supplementary groups with non-valid GIDs, those groups are # not set. #first_valid_gid = 1 #last_valid_gid = 0 # Maximum number of running mail processes. When this limit is reached, # new users aren't allowed to log in. #max_mail_processes = 512 # Set max. process size in megabytes. Most of the memory goes to mmap()ing # files, so it shouldn't harm much even if this limit is set pretty high. #mail_process_size = 256 # Maximum allowed length for mail keyword name. It's only forced when trying # to create new keywords. #mail_max_keyword_length = 50 # ':' separated list of directories under which chrooting is allowed for mail # processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too). # This setting doesn't affect login_chroot, mail_chroot or auth chroot # settings. If this setting is empty, "/./" in home dirs are ignored. # WARNING: Never add directories here which local users can modify, that # may lead to root exploit. Usually this should be done only if you don't # allow shell access for users. #valid_chroot_dirs = # Default chroot directory for mail processes. This can be overridden for # specific users in user database by giving /./ in user's home directory # (eg. /home/./user chroots into /home). Note that usually there is no real # need to do chrooting, Dovecot doesn't allow users to access files outside # their mail directory anyway. If your home directories are prefixed with # the chroot directory, append "/." to mail_chroot. #mail_chroot = ## ## Mailbox handling optimizations ## # The minimum number of mails in a mailbox before updates are done to cache # file. This allows optimizing Dovecot's behavior to do less disk writes at # the cost of more disk reads. #mail_cache_min_mail_count = 0 # When IDLE command is running, mailbox is checked once in a while to see if # there are any new mails or other changes. This setting defines the minimum # time in seconds to wait between those checks. Dovecot can also use dnotify, # inotify and kqueue to find out immediately when changes occur. #mailbox_idle_check_interval = 30

24

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# Save mails with CR+LF instead of plain LF. This makes sending those mails # take less CPU, especially with sendfile() syscall with Linux and FreeBSD. # But it also creates a bit more disk I/O which may just make it slower. # Also note that if other software reads the mboxes/maildirs, they may handle # the extra CRs wrong and cause problems. #mail_save_crlf = no ## ## Maildir-specific settings ## # By default LIST command returns all entries in maildir beginning with a dot. # Enabling this option makes Dovecot return only entries which are directories. # This is done by stat()ing each entry, so it causes more disk I/O. # (For systems setting struct dirent->d_type, this check is free and it's # done always regardless of this setting) #maildir_stat_dirs = no # When copying a message, do it with hard links whenever possible. This makes # the performance much better, and it's unlikely to have any side effects. #maildir_copy_with_hardlinks = yes # When copying a message, try to preserve the base filename. Only if the # destination mailbox already contains the same name (ie. the mail is being # copied there twice), a new name is given. The destination filename check is # done only by looking at dovecot-uidlist file, so if something outside # Dovecot does similar filename preserving copies, you may run into problems. # NOTE: This setting requires maildir_copy_with_hardlinks = yes to work. #maildir_copy_preserve_filename = no # Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only # when its mtime changes unexpectedly or when we can't find the mail otherwise. #maildir_very_dirty_syncs = no ## ## mbox-specific settings ## # Which locking methods to use for locking mbox. There are four available: # dotlock: Create .lock file. This is the oldest and most NFS-safe # solution. If you want to use /var/mail/ like directory, the users # will need write access to that directory. # dotlock_try: Same as dotlock, but if it fails because of permissions or # because there isn't enough disk space, just skip it. # fcntl : Use this if possible. Works with NFS too if lockd is used. # flock : May not exist in all systems. Doesn't work with NFS. # lockf : May not exist in all systems. Doesn't work with NFS. # # You can use multiple locking methods; if you do the order they're declared # in is important to avoid deadlocks if other MTAs/MUAs are using multiple # locking methods as well. Some operating systems don't allow using some of # them simultaneously. # # The Debian value for mbox_write_locks differs from upstream Dovecot. It is # changed to be compliant with Debian Policy (section 11.6) for NFS safety. # Dovecot: mbox_write_locks = dotlock fcntl # Debian: mbox_write_locks = fcntl dotlock # #mbox_read_locks = fcntl #mbox_write_locks = fcntl dotlock # Maximum time in seconds to wait for lock (all of them) before aborting. #mbox_lock_timeout = 300 # If dotlock exists but the mailbox isn't modified in any way, override the # lock file after this many seconds. #mbox_dotlock_change_timeout = 120 # When mbox changes unexpectedly we have to fully read it to find out what # changed. If the mbox is large this can take a long time. Since the change # is usually just a newly appended mail, it'd be faster to simply read the # new mails. If this setting is enabled, Dovecot does this but still safely # fallbacks to re-reading the whole mbox file whenever something in mbox isn't # how it's expected to be. The only real downside to this setting is that if # some other MUA changes message flags, Dovecot doesn't notice it immediately. # Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK # commands. #mbox_dirty_syncs = yes # Like mbox_dirty_syncs, but don't do full syncs even with SELECT, EXAMINE, # EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored. #mbox_very_dirty_syncs = no # Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK # commands and when closing the mailbox). This is especially useful for POP3 # where clients often delete all mails. The downside is that our changes # aren't immediately visible to other MUAs. #mbox_lazy_writes = yes # If mbox size is smaller than this (in kilobytes), don't write index files. # If an index file already exists it's still read, just not updated. #mbox_min_index_size = 0

25

Continuacion archivo dovecot.conf ubicado en /etc/dovecot## ## dbox-specific settings ## # Maximum dbox file size in kilobytes until it's rotated. #dbox_rotate_size = 2048 # Minimum dbox file size in kilobytes before it's rotated # (overrides dbox_rotate_days) #dbox_rotate_min_size = 16 # Maximum dbox file age in days until it's rotated. Day always begins from # midnight, so 1 = today, 2 = yesterday, etc. 0 = check disabled. #dbox_rotate_days = 0 ## ## IMAP specific settings ## protocol imap { # Login executable location. #login_executable = /usr/lib/dovecot/imap-login # IMAP executable location. Changing this allows you to execute other # binaries before the imap process is executed. # # This would write rawlogs into user's ~/dovecot.rawlog/, if it exists: # mail_executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap # # # This would attach gdb into the imap process and write backtraces into # /tmp/gdbhelper.* files: # mail_executable = /usr/lib/dovecot/gdbhelper /usr/lib/dovecot/imap # #mail_executable = /usr/lib/dovecot/imap # Maximum IMAP command line length in bytes. Some clients generate very long # command lines with huge mailboxes, so you may need to raise this if you get # "Too long argument" or "IMAP command line too large" errors often. #imap_max_line_length = 65536 # Maximum number of IMAP connections allowed for a user from each IP address. # NOTE: The username is compared case-sensitively. #mail_max_userip_connections = 10 # Support for dynamically loadable plugins. mail_plugins is a space separated # list of plugins to load. #mail_plugins = #mail_plugin_dir = /usr/lib/dovecot/modules/imap # IMAP logout format string: # %i - total number of bytes read from client # %o - total number of bytes sent to client #imap_logout_format = bytes=%i/%o # Override the IMAP CAPABILITY response. #imap_capability = # How many seconds to wait between "OK Still here" notifications when # client is IDLEing. #imap_idle_notify_interval = 120 # ID field names and values to send to clients. Using * as the value makes # Dovecot use the default value. The following fields have default values # currently: name, version, os, os-version, support-url, support-email. #imap_id_send = # ID fields sent by client to log. * means everything. #imap_id_log = # Workarounds for various client bugs: # delay-newmail: # Send EXISTS/RECENT new mail notifications only when replying to NOOP # and CHECK commands. Some clients ignore them otherwise, for example OSX # Mail ( to characters. For example "#@/@" means # that '#' and '/' characters are translated to '@'. #auth_username_translation = # Username formatting before it's looked up from databases. You can use # the standard variables here, eg. %Lu would lowercase the username, %n would # drop away the domain if it was given, or "%n-AT-%d" would change the '@' into # "-AT-". This translation is done after auth_username_translation changes. #auth_username_format = # If you want to allow master users to log in by specifying the master # username within the normal username string (ie. not using SASL mechanism's # support for it), you can specify the separator character here. The format # is then . UW-IMAP uses "*" as the # separator, so that could be a good choice. #auth_master_user_separator = # Username to use for users logging in with ANONYMOUS SASL mechanism #auth_anonymous_username = anonymous # Log unsuccessful authentication attempts and the reasons why they failed. #auth_verbose = no # Even more verbose logging for debugging purposes. Shows for example SQL # queries. #auth_debug = no # In case of password mismatches, log the passwords and used scheme so the # problem can be debugged. Enabling this also enables auth_debug. #auth_debug_passwords = no # Maximum number of dovecot-auth worker processes. They're used to execute # blocking passdb and userdb queries (eg. MySQL and PAM). They're # automatically created and destroyed as needed. #auth_worker_max_count = 30 # Host name to use in GSSAPI principal names. The default is to use the # name returned by gethostname(). Use "$ALL" to allow all keytab entries. #auth_gssapi_hostname = # Kerberos keytab to use for the GSSAPI mechanism. Will use the system # default (usually /etc/krb5.keytab) if not specified. #auth_krb5_keytab = # Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and # ntlm_auth helper. # #auth_use_winbind = no # Path for Samba's ntlm_auth helper binary. #auth_winbind_helper_path = /usr/bin/ntlm_auth # Number of seconds to delay before replying to failed authentications. #auth_failure_delay = 2 auth default { # Space separated list of wanted authentication mechanisms: # plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey # gss-spnego # NOTE: See also disable_plaintext_auth setting. mechanisms = plain # # Password database is used to verify user's password (and nothing more). # You can have multiple passdbs and userdbs. This is useful if you want to # allow both system users (/etc/passwd) and virtual users to login without # duplicating the system users into virtual database. # # # # By adding master=yes setting inside a passdb you make the passdb a list # of "master users", who can log in as anyone else. Unless you're using PAM, # you probably still want the destination user to be looked up from passdb # that it really exists. This can be done by adding pass=yes setting to the # master passdb. # Users can be temporarily disabled by adding a passdb with deny=yes. # If the user is found from that database, authentication will fail. # The deny passdb should always be specified before others, so it gets # checked first. Here's an example: #passdb passwd-file { # File contains a list of usernames, one per line #args = /etc/dovecot/dovecot.deny #deny = yes #} 29

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# PAM authentication. Preferred nowadays by most systems. # Note that PAM can only be used to verify if user's password is correct, # so it can't be used as userdb. If you don't want to use a separate user # database (passwd usually), you can use static userdb. # REMEMBER: You'll need /etc/pam.d/dovecot file created for PAM # authentication to actually work. passdb pam { # [session=yes] [setcred=yes] [failure_show_msg=yes] [max_requests=] # [cache_key=] [] # # session=yes makes Dovecot open and immediately close PAM session. Some # PAM plugins need this to work, such as pam_mkhomedir. # # setcred=yes makes Dovecot establish PAM credentials if some PAM plugins # need that. They aren't ever deleted though, so this isn't enabled by # default. # # max_requests specifies how many PAM lookups to do in one process before # recreating the process. The default is 100, because many PAM plugins # leak memory. # # cache_key can be used to enable authentication caching for PAM # (auth_cache_size also needs to be set). It isn't enabled by default # because PAM modules can do all kinds of checks besides checking password, # such as checking IP address. Dovecot can't know about these checks # without some help. cache_key is simply a list of variables (see # /usr/share/doc/dovecot-common/wiki/Variables.txt) which must match # for the cached data to be used. # Here are some examples: # %u - Username must match. Probably sufficient for most uses. # %u%r - Username and remote IP address must match. # %u%s - Username and service (ie. IMAP, POP3) must match. # # The service name can contain variables, for example %Ls expands to # pop3 or imap. # # Some examples: # args = session=yes %Ls # args = cache_key=%u dovecot #args = dovecot } # System users (NSS, /etc/passwd, or similiar) # In many systems nowadays this uses Name Service Switch, which is # configured in /etc/nsswitch.conf. #passdb passwd { # [blocking=yes] - See userdb passwd for explanation #args = #} # Shadow passwords for system users (NSS, /etc/shadow or similiar). # Deprecated by PAM nowadays. # #passdb shadow { # [blocking=yes] - See userdb passwd for explanation #args = #} # PAM-like authentication for OpenBSD. # #passdb bsdauth { # [cache_key=] - See cache_key in PAM for explanation. #args = #} # passwd-like file with specified location # #passdb passwd-file { # [scheme=] [username_format=] # #args = #} # checkpassword executable authentication # NOTE: You will probably want to use "userdb prefetch" with this. # #passdb checkpassword { # Path for checkpassword binary #args = #}

30

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# SQL database #passdb sql { # Path for SQL configuration file #args = /etc/dovecot/dovecot-sql.conf #} # LDAP database #passdb ldap { # Path for LDAP configuration file #args = /etc/dovecot/dovecot-ldap.conf #} # vpopmail authentication #passdb vpopmail { # [cache_key=] - See cache_key in PAM for explanation. # [quota_template=] - %q expands to Maildir++ quota # (eg. quota_template=quota_rule=*:backend=%q) #args = #} # # User database specifies where mails are located and what user/group IDs # own them. For single-UID configuration use "static". # # # # "prefetch" user database means that the passdb already provided the # needed information and there's no need to do a separate userdb lookup. # This can be made to work with SQL and LDAP databases, see their example # configuration files for more information how to do it. # #userdb prefetch { #} # System users (NSS, /etc/passwd, or similiar). In many systems nowadays this # uses Name Service Switch, which is configured in /etc/nsswitch.conf. # userdb passwd { # [blocking=yes] - By default the lookups are done in the main dovecot-auth # process. This setting causes the lookups to be done in auth worker # proceses. Useful with remote NSS lookups that may block. # NOTE: Be sure to use this setting with nss_ldap or users might get # logged in as each others! #args = } # passwd-like file with specified location # #userdb passwd-file { # [username_format=] #args = #} # checkpassword executable user database lookup # #userdb checkpassword { # Path for checkpassword binary #args = #} # static settings generated from template #userdb static { # Template for the fields. Can return anything a userdb could normally # return. For example: # # args = uid=500 gid=500 home=/var/mail/%u # # If you use deliver, it needs to look up users only from the userdb. This # of course doesn't work with static because there is no list of users. # Normally static userdb handles this by doing a passdb lookup. This works # with most passdbs, with PAM being the most notable exception. If you do # the user verification another way, you can add allow_all_users=yes to # the args in which case the passdb lookup is skipped. # #args = #} # SQL database #userdb sql { # Path for SQL configuration file #args = /etc/dovecot/dovecot-sql.conf #}

31

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# LDAP database #userdb ldap { # Path for LDAP configuration file #args = /etc/dovecot/dovecot-ldap.conf #} # vpopmail #userdb vpopmail { #} # User to use for the process. This user needs access to only user and # password databases, nothing else. Only shadow and pam authentication # requires roots, so use something else if possible. Note that passwd # authentication with BSDs internally accesses shadow files, which also # requires roots. Note that this user is NOT used to access mails. # That user is specified by userdb above. user = root # Directory where to chroot the process. Most authentication backends don't # work if this is set, and there's no point chrooting if auth_user is root. # Note that valid_chroot_dirs isn't needed to use this setting. #chroot = # Number of authentication processes to create #count = 1 # Require a valid SSL client certificate or the authentication fails. #ssl_require_client_cert = no # Take the username from client's SSL certificate, using # X509_NAME_get_text_by_NID() which returns the subject's DN's # CommonName. #ssl_username_from_cert = no # It's possible to export the authentication interface to other programs: #socket listen { #master { # Master socket provides access to userdb information. It's typically # used to give Dovecot's local delivery agent access to userdb so it # can find mailbox locations. #path = /var/run/dovecot/auth-master #mode = 0600 # Default user/group is the one who started dovecot-auth (root) #user = #group =

#}#client { # The client socket is generally safe to export to everyone. Typical use # is to export it to your SMTP server so it can do SMTP AUTH lookups # using it. #path = /var/run/dovecot/auth-client #mode = 0660 #} #} !include_try /etc/dovecot/auth.d/*.auth } # If you wish to use another authentication server than dovecot-auth, you can # use connect sockets. They are assumed to be already running, Dovecot's master # process only tries to connect to them. They don't need any other settings # than the path for the master socket, as the configuration is done elsewhere. # Note that the client sockets must exist in the login_dir. #auth external { # socket connect { # master { # path = /var/run/dovecot/auth-master # } # } #} ## ## Dictionary server settings ## # Dictionary can be used by some plugins to store key=value lists, such as # quota, expire and acl plugins. The dictionary can be used either directly or # though a dictionary server. The following dict block maps dictionary names to # URIs when the server is used. These can then be referenced using URIs in # format "proxy::". dict { #quota = mysql:/etc/dovecot/dovecot-dict-quota.conf #expire = db:/var/lib/dovecot/expire.db } # Path to Berkeley DB's configuration file. See doc/dovecot-db-example.conf #dict_db_config = ## ## Plugin settings ##

32

Continuacion archivo dovecot.conf ubicado en /etc/dovecotplugin { # Here you can give some extra environment variables to mail processes. # This is mostly meant for passing parameters to plugins. %variable # expansion is done for all values. # Quota plugin. Multiple backends are supported: # dirsize: Find and sum all the files found from mail directory. # Extremely SLOW with Maildir. It'll eat your CPU and disk I/O. # dict: Keep quota stored in dictionary (eg. SQL) # maildir: Maildir++ quota # fs: Read-only support for filesystem quota # # Quota limits are set using "quota_rule" parameters, either in here or in # userdb. It's also possible to give mailbox-specific limits, for example: # quota_rule = *:storage=1048576 # quota_rule2 = Trash:storage=102400 # User has now 1GB quota, but when saving to Trash mailbox the user gets # additional 100MB. # # Multiple quota roots are also possible, for example: # quota = dict:user::proxy::quota # quota2 = dict:domain:%d:proxy::quota_domain # quota_rule = *:storage=102400 # quota2_rule = *:storage=1048576 # Gives each user their own 100MB quota and one shared 1GB quota within # the domain. # # You can execute a given command when user exceeds a specified quota limit. # Each quota root has separate limits. Only the command for the first # exceeded limit is excecuted, so put the highest limit first. # Note that % needs to be escaped as %%, otherwise "% " expands to empty. # quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95 # quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80 #quota = maildir # ACL plugin. vfile backend reads ACLs from "dovecot-acl" file from maildir # directory. You can also optionally give a global ACL directory path where # ACLs are applied to all users' mailboxes. The global ACL directory contains # one file for each mailbox, eg. INBOX or sub.mailbox. cache_secs parameter # specifies how many seconds to wait between stat()ing dovecot-acl file # to see if it changed. #acl = vfile:/etc/dovecot/dovecot-acls:cache_secs=300 # To let users LIST mailboxes shared by other users, Dovecot needs a # shared mailbox dictionary. For example: #acl_shared_dict = file:/var/lib/dovecot/shared-mailboxes # Convert plugin. If set, specifies the source storage path which is # converted to destination storage (mail_location) when the user logs in. # The existing mail directory is renamed to -converted. #convert_mail = mbox:%h/mail # Skip mailboxes which we can't open successfully instead of aborting. #convert_skip_broken_mailboxes = no # Skip directories beginning with '.' #convert_skip_dotdirs = no # If source storage has mailbox names with destination storage's hierarchy # separators, replace them with this character. #convert_alt_hierarchy_char = _ # Trash plugin. When saving a message would make user go over quota, this # plugin automatically deletes the oldest mails from configured mailboxes # until the message can be saved within quota limits. The configuration file # is a text file where each line is in format: # Mails are first deleted in lowest -> highest priority number order #trash = /etc/dovecot/dovecot-trash.conf # Expire plugin. Mails are expunged from mailboxes after being there the # configurable time. The first expiration date for each mailbox is stored in # a dictionary so it can be quickly determined which mailboxes contain # expired mails. The actual expunging is done in a nightly cronjob, which # you must set up: # dovecot --exec-mail ext /usr/lib/dovecot/expire-tool #expire = Trash 7 Spam 30 #expire_dict = proxy::expire # Lazy expunge plugin. Currently works only with maildirs. When a user # expunges mails, the mails are moved to a mailbox in another namespace # (1st). When a mailbox is deleted, the mailbox is moved to another namespace # (2nd) as well. Also if the deleted mailbox had any expunged messages, # they're moved to a 3rd namespace. The mails won't be counted in quota, # and they're not deleted automatically (use a cronjob or something). #lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/ # Events to log. Also available: flag_change append #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename # Group events within a transaction to one line. #mail_log_group_events = no

33

Continuacion archivo dovecot.conf ubicado en /etc/dovecot# Available fields: uid, box, msgid, from, subject, size, vsize, flags # size and vsize are available only for expunge and copy events. #mail_log_fields = uid box msgid size # Sieve plugin (http://wiki.dovecot.org/LDA/Sieve) and ManageSieve service # # Location of the active script. When ManageSieve is used this is actually # a symlink pointing to the active script in the sieve storage directory. #sieve=~/.dovecot.sieve # # The path to the directory where the personal Sieve scripts are stored. For # ManageSieve this is where the uploaded scripts are stored. #sieve_dir=~/sieve } # Config files can also be included. deliver doesn't support them currently. #!include /etc/dovecot/conf.d/*.conf # Optional configurations, don't give an error if it's not found: !include_try /etc/dovecot/conf.d/*.conf #!include_try /etc/dovecot/extra.conf

Terminal sudo sudo sudo sudo sudo maildirmake.dovecot maildirmake.dovecot maildirmake.dovecot maildirmake.dovecot maildirmake.dovecot /etc/skel/Maildir /etc/skel/Maildir/.Drafts /etc/skel/Maildir/.Sent /etc/skel/Maildir/.Trash /etc/skel/Maildir/.Templates

Iniciamos el servicio sudo /etc/init.d/dovecot start Y los probamos Dovecot sudo telnet localhost pop3 Postfix sudo telnet localhost 25

34

Configuracion servicio para clientes Windows ( LDAP y Samba)LDAPTerminal Instalamos las utilidades de LDAP sudo apt-get --yes install slapd ldap-utils db4.6-util samba-doc Configuramos el ldaphome y su permisos sudo mkdir /ldaphome sudo chmod 777 /ldaphome -R sudo rm -r /etc/ldap/slapd.d Creamos y editamos el archivo slapd sudo gedit /etc/default/slapd

Archivo slapd ubicado en /etc/default/# Location of the slapd configuration to use. If using the cn=config # backend to store configuration in LDIF, set this variable to the # directory containing the cn=config data; otherwise set it to the location # of your slapd.conf file. If empty, use the compiled-in default # (/etc/ldap/slapd.d). SLAPD_CONF=/etc/ldap/slapd.conf # System account to run the slapd server under. If empty the server # will run as root. SLAPD_USER="openldap" # System group to run the slapd server under. If empty the server will # run in the primary group of its user. SLAPD_GROUP="openldap" # Path to the pid file of the slapd server. If not set the init.d script # will try to figure it out from $SLAPD_CONF (/etc/ldap/slapd.d by # default) SLAPD_PIDFILE= # slapd normally serves ldap only on all TCP-ports 389. slapd can also # service requests on TCP-port 636 (ldaps) and requests via unix # sockets. # Example usage: # SLAPD_SERVICES="ldap://127.0.0.1:389/ ldaps:/// ldapi:///" SLAPD_SERVICES="ldap:/// ldapi:///" # If SLAPD_NO_START is set, the init script will not start or restart # slapd (but stop will still work). Uncomment this if you are # starting slapd via some other means or if you don't want slapd normally # started at boot. #SLAPD_NO_START=1 # If SLAPD_SENTINEL_FILE is set to path to a file and that file exists, # the init script will not start or restart slapd (but stop will still # work). Use this for temporarily disabling startup of slapd (when doing # maintenance, for example, or through a configuration management system) # when you don't want to edit a configuration file. SLAPD_SENTINEL_FILE=/etc/ldap/noslapd # For Kerberos authentication (via SASL), slapd by default uses the system # keytab file (/etc/krb5.keytab). To use a different keytab file, # uncomment this line and change the path. #export KRB5_KTNAME=/etc/krb5.keytab # Additional options to pass to slapd SLAPD_OPTIONS=""

35

Terminal Desempaquetamos los esquemas del samba sudogunzip /usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz sudo cp -v /usr/share/doc/samba-doc/examples/LDAP/samba.schema /etc/ldap/schema Creamos una contrasea(muy importante acordarse de esta) sudo slappasswd -s grupo03 Eso nos genera una contrasea cifrada esta hay que guardarla {SSHA}J24Mw+ziqt03r4KQIeyETNuHP2BsFHA3 Creamos y editamos el archivo init.ldif sudo gedit /etc/ldap/init.ldif

Archivo init.ldif ubicado en / etc/ldap/ Acordarse primer dc=redes y el segundo dc=net para efectos de este proyecto. Y ademas la contrasea cifrada ponerla donde dice userPassword dn: dc=redes,dc=net objectClass: dcObject objectClass: organizationalUnit dc: redes ou: My redes File dn: cn=admin, dc=redes,dc=net objectClass: simpleSecurityObject objectClass: organizationalRole cn: admin description: LDAP administrator userPassword: {SSHA}J24Mw+ziqt03r4KQIeyETNuHP2BsFHA3 dn: ou=Users, dc=redes,dc=net objectClass: organizationalUnit ou: Users dn: ou=Groups, dc=redes,dc=net objectClass: organizationalUnit ou: Groups dn: ou=Computers, dc=redes,dc=net objectClass: organizationalUnit ou: Computers dn: ou=Idmap, dc=redes,dc=net objectClass: organizationalUnit ou: Idmap 36

Terminal Creamos y editamos el archivo slapd.conf sudo gedit /etc/ldap/slapd.conf tenemos cuidado de cambiar en dc=redes,dc=net y rootpw por la contrasea cifrada generada

37

Archivo slapd.conf ubicado en / etc/ldap/ Acordarse primer dc=redes y el segundo dc=net para efectos de este proyecto. Y ademas la contrasea cifrada ponerla donde dice rootpw# Remember to replace suffix "dc=example,dc=local" with your domain name # Change the rootpw entry with the results from slappaswd (Must match the same you pasted on init.ldif) # /etc/ldap/slapd.conf # This is the main slapd configuration file. See slapd.conf(5) for more # info on the configuration options. ######################################################################## #Global Directives: # Features to permit #allow bind_v2 # Schema and objectClass definitions include /etc/ldap/schema/core.schema include /etc/ldap/schema/cosine.schema include /etc/ldap/schema/nis.schema include /etc/ldap/schema/inetorgperson.schema include /etc/ldap/schema/samba.schema include /etc/ldap/schema/misc.schema # Where the pid file is put. The init.d script # will not stop the server if you change this. pidfile /var/run/slapd/slapd.pid # List of arguments that were passed to the server argsfile /var/run/slapd/slapd.args # Read slapd.conf(5) for possible valuesloglevel 0 # Where the dynamically loaded modules are stored modulepath /usr/lib/ldap moduleload back_bdb # The maximum number of entries that is returned for a search operation sizelimit 500 # The tool-threads parameter sets the actual amount of cpu's that is used # for indexing. tool-threads 1 ####################################################################### # Specific Backend Directives for bdb: # Backend specific directives apply to this backend until another # 'backend' directive occurs backend bdb #checkpoint 512 30 ####################################################################### # Specific Backend Directives for 'other': # Backend specific directives apply to this backend until another # 'backend' directive occurs #backend ####################################################################### # Specific Directives for database #1, of type bdb: # Database specific directives apply to this databasse until another # 'database' directive occurs database bdb # The base of your directory in database #1 suffix "dc=redes,dc=net" # rootdn directive for specifying a superuser on the database. This is needed # for syncrepl. rootdn "cn=admin,dc=redes,dc=net" rootpw {SSHA}J24Mw+ziqt03r4KQIeyETNuHP2BsFHA3 # Where the database file are physically stored for database #1 directory "/var/lib/ldap" # For the Debian package we use 2MB as default but be sure to update this # value if you have plenty of RAM dbconfig set_cachesize 0 2097152 0 # Sven Hartge reported that he had to set this value incredibly high # to get slapd running at all. See http://bugs.debian.org/303057 # for more information. # Number of objects that can be locked at the same time. dbconfig set_lk_max_objects 1500 # Number of locks (both requested and granted) dbconfig set_lk_max_locks 1500 # Number of lockers dbconfig set_lk_max_lockers 1500 # Indexing options for database #1 #index objectClass eq, pres index ou,cn,sn,mail,givenname eq,pres,sub index uidNumber,gidNumber,memberUid eq,pres index loginShell eq,pres index uniqueMember eq,pres index uid pres,sub,eq index displayName pres,sub,eq index sambaSID eq index sambaPrimaryGroupSID eq 38 index sambaDomainName eq

Continuacion archivo slapd.conf ubicado en / etc/ldap/ Acordarse primer dc=redes y el segundo dc=net para efectos de este proyecto. Y ademas la contrasea cifrada ponerla donde dice rootpwindex default #index uid pres,eq,sub # Save the time that the entry gets modified, for database #1 lastmod on # Where to store the replica logs for database #1 # replogfile /var/lib/ldap/replog # The userPassword by default can be changed # by the entry owning it if they are authenticated. # Others should not be able to see it, except the # admin entry below # These access lines apply to database #1 only access to attrs=userPassword,shadowLastChange,sambaNTPassword,sambaLMPassword by dn="cn=admin,dc=redes,dc=net" write by anonymous auth by self write by * none # Ensure read access to the base for things like # supportedSASLMechanisms. Without this you may # have problems with SASL not knowing what # mechanisms are available and the like. # Note that this is covered by the 'access to *' # ACL below too but if you change that as people # are wont to do you'll still need this if you # want SASL (and possible other things) to work # happily. access to dn.base="" by * read # The admin dn has full write access, everyone else # can read everything. access to * by dn="cn=admin,dc=redes,dc=net" write by * read # For Netscape Roaming support, each user gets a roaming # profile for which they have write access to #access to dn=".*,ou=Roaming,o=morsnet" # by dn="cn=admin,dc=redes,dc=ch" write # by dnattr=owner write ###################################################################### # Specific Directives for database #2, of type 'other' (can be bdb too): # Database specific directives apply to this databasse until another # 'database' directive occurs #database # The base of your directory for database #2 #suffix "dc=debian,dc=org" sub

39

Terminal Detenemos el servicio sudo /etc/init.d/slapd stop sudo rm -rf /var/lib/ldap/* sudo slapadd -v -l /etc/ldap/init.ldif Esta instruccion nos debe generar esto #################### 100.00% eta none elapsed none fast! sudo chown -R openldap:openldap /var/lib/ldap Iniciamos el servicio sudo /etc/init.d/slapd start Probamos funcionamiento sudo ldapsearch -xLLL -b "dc=redes,dc=net"

Samba

Terminal Instalamos las herramientas de samba sudo apt-get --yes install samba libpam-smbpass smbldap-tools Configuramos samba para utilizarlo con ldap sudo mkdir -v /var/lib/samba/profiles sudo chmod 777 /var/lib/samba/profiles sudo mkdir -v -p /var/lib/samba/netlogon Creamos y editamos el archivo smb.conf sudo gedit /etc/samba/smb.conf

40

Archivo smb.conf ubicado en /etc/samba/smb.conf[global] # Domain name .. workgroup = redes # Server name - as seen by Windows PCs .. netbios name = redes # Be a PDC .. domain logons = Yes domain master = Yes # Be a WINS server .. wins support = true obey pam restrictions = Yes dns proxy = No os level = 35 log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d pam password change = Yes # Allows users on WinXP PCs to change their password when they press Ctrl-Alt-Del unix password sync = no ldap passwd sync = yes # Printing from PCs will go via CUPS .. load printers = yes printing = cups printcap name = cups # Use LDAP for Samba user accounts and groups .. passdb backend = ldapsam:ldap://localhost # This must match init.ldif .. ldap suffix = dc=redes,dc=net # The password for cn=admin MUST be stored in /etc/samba/secrets.tdb # This is done by running 'sudo smbpasswd -w'. ldap admin dn = cn=admin,dc=redes,dc=net # 4 OUs that Samba uses when creating user accounts, computer accounts, etc. # (Because we are using smbldap-tools, call them 'Users', 'Computers', etc.) ldap machine suffix = ou=Computers ldap user suffix = ou=Users ldap group suffix = ou=Groups ldap idmap suffix = ou=Idmap # Samba and LDAP server are on the same server in this example. ldap ssl = no # Scripts for Samba to use if it creates users, groups, etc. add user script = /usr/sbin/smbldap-useradd -m '%u' delete user script = /usr/sbin/smbldap-userdel %u add group script = /usr/sbin/smbldap-groupadd -p '%g' delete group script = /usr/sbin/smbldap-groupdel '%g' add user to group script = /usr/sbin/smbldap-groupmod -m '%u' '%g' delete user from group script = /usr/sbin/smbldap-groupmod -x '%u' '%g' set primary group script = /usr/sbin/smbldap-usermod -g '%g' '%u' # Script that Samba users when a PC joins the domain .. # (when changing 'Computer Properties' on the PC) add machine script = /usr/sbin/smbldap-useradd -w '%u' # Values used when a new user is created .. # (Note: '%L' does not work properly with smbldap-tools 0.9.4-1) logon script = logon.bat logon path = \\%L\profiles\%U logon drive = F: logon home = \\%L\%U # This is required for Windows XP client .. server signing = auto server schannel = Auto [homes] comment = Home Directories valid users = %S read only = No browseable = No [netlogon] comment = Network Logon Service path = /var/lib/samba/netlogon admin users = root guest ok = Yes browseable = No

41

Continuacion archivo smb.conf ubicado en /etc/samba/smb.conf[Profiles] comment = Roaming Profile Share # would probably change this to elsewhere in a production system .. path = /var/lib/samba/profiles read only = No profile acls = Yes browsable = No [printers] comment = All Printers path = /var/spool/samba use client driver = Yes create mask = 0600 guest ok = Yes printable = Yes browseable = No public = yes writable = yes admin users = root write list = root [print$] comment = Printer Drivers Share path = /var/lib/samba/printers write list = root create mask = 0664 directory mask = 0775 admin users = root

Terminal sudo smbpasswd W Este comando nos solicitara una contrasea y confirmacin para efectos del proyecto es menester recordarla Reiniciamos el servicio service smbd restart Configuramos los ldap-tools sudo sudo sudo sudo sudo cd /usr/share/doc/smbldap-tools/examples/ cp smbldap_bind.conf /etc/smbldap-tools/ cp smbldap.conf.gz /etc/smbldap-tools/ gzip -d /etc/smbldap-tools/smbldap.conf.gz cd /etc/smbldap-tools/

sudo net getlocalsid Este comando nos retorna una clave o id tambien hay que guardarlos Creamos y editamos el archivo smbladp.conf gedit /etc/smbldap-tools/smbldap.conf

42

Archivo smbladp.conf ubicado en /etc/smbldap-tools Se debe tener cuidado hay un lugar donde pide el localsid obtenido anteriormente# $Source: $ # $Id: smbldap.conf,v 1.18 2005/05/27 14:28:47 jtournier Exp $ # # smbldap-tools.conf : Q & D configuration file for smbldap-tools # This code was developped by IDEALX (http://IDEALX.org/) and # contributors (their names can be found in the CONTRIBUTORS file). # # Copyright (C) 2001-2002 IDEALX # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # Purpose : # . be the configuration file for all smbldap-tools scripts ############################################################################## # # General Configuration # ############################################################################## # Put your own SID. To obtain this number do: "net getlocalsid". # If not defined, parameter is taking from "net getlocalsid" return SID="S-1-5-21-4097895232-1690665193-4185829980" # Domain name the Samba server is in charged. # If not defined, parameter is taking from smb.conf configuration file # Ex: sambaDomain="IDEALX-NT" sambaDomain="redes" ############################################################################## # # LDAP Configuration # ############################################################################## # Notes: to use to dual ldap servers backend for Samba, you must patch # Samba with the dual-head patch from IDEALX. If not using this patch # just use the same server for slaveLDAP and masterLDAP. # Those two servers declarations can also be used when you have # . one master LDAP server where all writing operations must be done # . one slave LDAP server where all reading operations must be done # (typically a replication directory) # Slave LDAP server # Ex: slaveLDAP=127.0.0.1 # If not defined, parameter is set to "127.0.0.1" slaveLDAP=127.0.0.1 # Slave LDAP port # If not defined, parameter is set to "389" slavePort="389" # Master LDAP server: needed for write operations # Ex: masterLDAP=127.0.0.1 # If not defined, parameter is set to "127.0.0.1" masterLDAP=127.0.0.1 # Master LDAP port # If not defined, parameter is set to "389" #masterPort="389" masterPort="389" # Use TLS for LDAP # If set to 1, this option will use start_tls for connection # (you should also used the port 389) # If not defined, parameter is set to "0" ldapTLS="0" # Use SSL for LDAP # If set to 1, this option will use SSL for connection # (standard port for ldaps is 636) # If not defined, parameter is set to "0" ldapSSL="0" # How to verify the server's certificate (none, optional or require) # see "man Net::LDAP" in start_tls section for more details verify="require"

43

Continuacion archivo smbladp.conf ubicado en /etc/smbldap-tools# CA certificate # see "man Net::LDAP" in start_tls section for more details cafile="/etc/smbldap-tools/ca.pem" # certificate to use to connect to the ldap server # see "man Net::LDAP" in start_tls section for more details clientcert="/etc/smbldap-tools/smbldap-tools.iallanis.info.pem" # key certificate to use to connect to the ldap server # see "man Net::LDAP" in start_tls section for more details clientkey="/etc/smbldap-tools/smbldap-tools.iallanis.info.key" # LDAP Suffix # Ex: suffix=dc=IDEALX,dc=ORG suffix="dc=redes,dc=net" # Where are stored Users # Ex: usersdn="ou=Users,dc=IDEALX,dc=ORG" # Warning: if 'suffix' is not set here, you must set the full dn for usersdn usersdn="ou=Users,${suffix}" # Where are stored Computers # Ex: computersdn="ou=Computers,dc=IDEALX,dc=ORG" # Warning: if 'suffix' is not set here, you must set the full dn for computersdn computersdn="ou=Computers,${suffix}" # Where are stored Groups # Ex: groupsdn="ou=Groups,dc=IDEALX,dc=ORG" # Warning: if 'suffix' is not set here, you must set the full dn for groupsdn groupsdn="ou=Groups,${suffix}" # Where are stored Idmap entries (used if samba is a domain member server) # Ex: groupsdn="ou=Idmap,dc=IDEALX,dc=ORG" # Warning: if 'suffix' is not set here, you must set the full dn for idmapdn idmapdn="ou=Idmap,${suffix}" # Where to store next uidNumber and gidNumber available for new users and groups # If not defined, entries are stored in sambaDomainName object. # Ex: sambaUnixIdPooldn="sambaDomainName=${sambaDomain},${suffix}" # Ex: sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}" sambaUnixIdPooldn="sambaDomainName=redes,${suffix}" # Default scope Used scope="sub" # Unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA, CLEARTEXT) hash_encrypt="SSHA" # if hash_encrypt is set to CRYPT, you may set a salt format. # default is "%s", but many systems will generate MD5 hashed # passwords if you use "$1$%.8s". This parameter is optional! crypt_salt_format="%s" ############################################################################## # # Unix Accounts Configuration # ############################################################################## # Login defs # Default Login Shell # Ex: userLoginShell="/bin/bash" userLoginShell="/bin/bash" # Home directory # Ex: userHome="/home/%U" userHome="/ldaphome/%U" # Default mode used for user homeDirectory userHomeDirectoryMode="700" # Gecos userGecos="System User" # Default User (POSIX and Samba) GID defaultUserGid="513" # Default Computer (Samba) GID defaultComputerGid="515" # Skel dir skeletonDir="/etc/skel" # Default password validation time (time in days) Comment the next line if # you don't want password to be enable for defaultMaxPasswordAge days (be # careful to the sambaPwdMustChange attribute's value) defaultMaxPasswordAge="45"

44

Continuacion archivo smbladp.conf ubicado en /etc/smbldap-tools############################################################################## # # SAMBA Configuration # ############################################################################## # The UNC path to home drives location (%U username substitution) # Just set it to a null string if you want to use the smb.conf 'logon home' # directive and/or disable roaming profiles # Ex: userSmbHome="\\PDC-SMB3\%U" userSmbHome= # The UNC path to profiles locations (%U username substitution) # Just set it to a null string if you want to use the smb.conf 'logon path' # directive and/or disable roaming profiles # Ex: userProfile="\\PDC-SMB3\profiles\%U" userProfile= # The default Home Drive Letter mapping # (will be automatically mapped at logon time if home directory exist) # Ex: userHomeDrive="H:" userHomeDrive= # The default user netlogon script name (%U username substitution) # if not used, will be automatically username.cmd # make sure script file is edited under dos # Ex: userScript="startup.cmd" # make sure script file is edited under dos userScript= # Domain appended to the users "mail"-attribute # when smbldap-useradd -M is used # Ex: mailDomain="idealx.com" mailDomain="redes.net" ############################################################################## # # SMBLDAP-TOOLS Configuration (default are ok for a RedHat) # ############################################################################## # Allows not to use smbpasswd (if with_smbpasswd == 0 in smbldap_conf.pm) but # prefer Crypt::SmbHash library with_smbpasswd="0" smbpasswd="/usr/bin/smbpasswd" # Allows not to use slappasswd (if with_slappasswd == 0 in smbldap_conf.pm) # but prefer Crypt:: libraries with_slappasswd="0" slappasswd="/usr/sbin/slappasswd" # comment out the following line to get rid of the default banner # no_banner="1"

Terminal Creamos y editamos el archivo smbbladp_bind.conf gedit /etc/smbldap-tools/smbldap_bind.conf

Archivo smbbladp_bind.conf ubicado en /etc/smbldap-tools ############################ # Credential Configuration # ############################ # Notes: you can specify two differents configuration if you use a # master ldap for writing access and a slave ldap server for reading access # By default, we will use the same DN (so it will work for standard Samba # release) slaveDN="cn=admin,dc=redes,dc=net" slavePw="grupo03" masterDN="cn=admin,dc=redes,dc=net" masterPw="grupo03" 45

Terminal sudo chmod 0644 /etc/smbldap-tools/smbldap.conf sudo chmod 0600 /etc/smbldap-tools/smbldap_bind.conf sudo smbldap-populate Aparecera algo como esto Populating LDAP directory for domain EXAMPLE(S-1-5-21-28996292684176875250-2352135513) Detenemos el servicio /etc/init.d/slapd stop Configuramos y cambiamos permisos sudo slapindex sudo chown openldap:openldap /var/lib/ldap/* Iniciamos el servicio sudo /etc/init.d/slapd start Creamos usuarios para el samba y ldap Sudo smbldap-useradd -a -m alonsoG3

smbldap-passwd alonsoG03 Nos pide contrasea sudo /usr/sbin/smbldap-groupmod -m alonsoG03'Administrators' sudo /usr/sbin/smbldap-groupmod -m 'root' 'Administrators' Configurar la autenticacion sudo apt-get --yes install ldap-auth-client Se responden las preguntas de la siguiente manera LDAP server Uniform Resource Identifier:ldap://127.0.0.1 Distinguished name of the search base:dc=redes,dc=net LDAP version to use: 3 Make local root Database admin:Yes Does the LDAP database require login?No LDAP account for root:cn=admin,dc=redes,dc=net LDAP root account password: grupo03

46

Terminal Creamos y editamos el archivo ldap.conf gedit /etc/ldap.conf

Archivo ladp.conf ubicado en /etc/###DEBCONF### ## ## Configuration of this file will be managed by debconf as long as the ## first line of the file says '###DEBCONF###' ## ## You should use dpkg-reconfigure to configure this file via debconf ## # # @(#)$Id: ldap.conf,v 1.38 2006/05/15 08:13:31 lukeh Exp $ # # This is the configuration file for the LDAP nameservice # switch library and the LDAP PAM module. # # PADL Software # http://www.padl.com # # Your LDAP server. Must be resolvable without using LDAP. # Multiple hosts may be specified, each separated by a # space. How long nss_ldap takes to failover depends on # whether your LDAP client library supports configurable # network or connect timeouts (see bind_timelimit). host 127.0.0.1 # The distinguished name of the search base. base dc=redes,dc=net # Another way to specify your LDAP server is to provide an #uri ldap://127.0.0.1 # Unix Domain Sockets to connect to a local LDAP Server. uri ldap://127.0.0.1/ #uri ldaps://127.0.0.1/ #uri ldapi://%2fvar%2frun%2fldapi_sock/ # Note: %2f encodes the '/' used as directory separator # The LDAP version to use (defaults to 3 # if supported by client library) ldap_version 3 # The distinguished name to bind to the server with. # Optional: default is to bind anonymously. #binddn cn=proxyuser,dc=padl,dc=com # The credentials to bind with. # Optional: default is no credential. #bindpw secret # The distinguished name to bind to the server with # if the effective user ID is root. Password is # stored in /etc/ldap.secret (mode 600) rootbinddn cn=admin,dc=redes,dc=net # The port. # Optional: default is 389. #port 389 # The search scope. #scope sub #scope one #scope base # Search timelimit #timelimit 30 # Bind/connect timelimit #bind_timelimit 30 # Reconnect policy: hard (default) will retry connecting to # the software with exponential backoff, soft will fail # immediately. bind_policy soft # Idle timelimit; client will close connections # (nss_ldap only) if the server has not been contacted # for the number of seconds specified below. #idle_timelimit 3600 # Filter to AND with uid=%s #pam_filter objectclass=account

47

Continuacion archivo ladp.conf ubicado en /etc/# The user ID attribute (defaults to uid) #pam_login_attribute uid # Search the root DSE for the password policy (works # with Netscape Directory Server) #pam_lookup_policy yes # Check the 'host' attribute for access control # Default is no; if set to yes, and user has no # value for the host attribute, and pam_ldap is # configured for account management (authorization) # then the user will not be allowed to login. #pam_check_host_attr yes # Check the 'authorizedService' attribute for access # control # Default is no; if set to yes, and the user has no # value for the authorizedService attribute, and # pam_ldap is configured for account management # (authorization) then the user will not be allowed # to login. #pam_check_service_attr yes # Group to enforce membership of #pam_groupdn cn=PAM,ou=Groups,dc=padl,dc=com # Group member attribute #pam_member_attribute uniquemember # Specify a minium or maximum UID number allowed #pam_min_uid 0 #pam_max_uid 0 # Template login attribute, default template user # (can be overriden by value of former attribute # in user's entry) #pam_login_attribute userPrincipalName #pam_template_login_attribute uid #pam_template_login nobody # HEADS UP: the pam_crypt, pam_nds_passwd, # and pam_ad_passwd options are no # longer supported. # # Do not hash the password at all; presume # the directory server will do it, if # necessary. This is the default. pam_password md5 # Hash password locally; required for University of # Michigan LDAP server, and works with Netscape # Directory Server if you're using the UNIX-Crypt # hash mechanism and not using the NT Synchronization # service. #pam_password crypt # Remove old password first, then update in # cleartext. Necessary for use with Novell # Directory Services (NDS) #pam_password clear_remove_old #pam_password nds # RACF is an alias for the above. For use with # IBM RACF #pam_password racf # Update Active Directory password, by # creating Unicode password and updating # unicodePwd attribute. #pam_password ad # Use the OpenLDAP password change # extended operation to update the password. #pam_password exop # Redirect users to a URL or somesuch on password # changes. #pam_password_prohibit_message Please visit http://internal to change your password. # RFC2307bis naming contexts # Syntax: # nss_base_XXX base?scope?filter # where scope is {base,one,sub} # and filter is a filter to be &'d with the # default filter. # You can omit the suffix eg: # nss_base_passwd ou=People, # to append the default base DN but this # may incur a small performance impact. #nss_base_passwd ou=People,dc=padl,dc=com?one #nss_base_shadow ou=People,dc=padl,dc=com?one #nss_base_group ou=Group,dc=padl,dc=com?one #nss_base_hosts ou=Hosts,dc=padl,dc=com?one #nss_base_services ou=Services,dc=padl,dc=com?one #nss_base_networks ou=Networks,dc=padl,dc=com?one #nss_base_protocols ou=Protocols,dc=padl,dc=com?one

48

Continuacion archivo ladp.conf ubicado en /etc/#nss_base_rpc ou=Rpc,dc=padl,dc=com?one #nss_base_ethers ou=Ethers,dc=padl,dc=com?one #nss_base_netmasks ou=Networks,dc=padl,dc=com?ne #nss_base_bootparams ou=Ethers,dc=padl,dc=com?one #nss_base_aliases ou=Aliases,dc=padl,dc=com?one #nss_base_netgroup ou=Netgroup,dc=padl,dc=com?one # attribute/objectclass mapping # Syntax: #nss_map_attribute rfc2307attribute mapped_attribute #nss_map_objectclass rfc2307objectclass mapped_objectclass # configure --enable-nds is no longer supported. # NDS mappings #nss_map_attribute uniqueMember member # Services for UNIX 3.5 mappings #nss_map_objectclass posixAccount User #nss_map_objectclass shadowAccount User #nss_map_attribute uid msSFU30Name #nss_map_attribute uniqueMember msSFU30PosixMember #nss_map_attribute userPassword msSFU30Password #nss_map_attribute homeDirectory msSFU30HomeDirectory #nss_map_attribute homeDirectory msSFUHomeDirectory #nss_map_objectclass posixGroup Group #pam_login_attribute msSFU30Name #pam_filter objectclass=User #pam_password ad # configure --enable-mssfu-schema is no longer supported. # Services for UNIX 2.0 mappings #nss_map_objectclass posixAccount User #nss_map_objectclass shadowAccount user #nss_map_attribute uid msSFUName #nss_map_attribute uniqueMember posixMember #nss_map_attribute userPassword msSFUPassword #nss_map_attribute homeDirectory msSFUHomeDirectory #nss_map_attribute shadowLastChange pwdLastSet #nss_map_objectclass posixGroup Group #nss_map_attribute cn msSFUName #pam_login_attribute msSFUName #pam_filter objectclass=User #pam_password ad # RFC 2307 (AD) mappings #nss_map_objectclass posixAccount user #nss_map_objectclass shadowAccount user #nss_map_attribute uid sAMAccountName #nss_map_attribute homeDirectory unixHomeDirectory #nss_map_attribute shadowLastChange pwdLastSet #nss_map_objectclass posixGroup group #nss_map_attribute uniqueMember member #pam_login_attribute sAMAccountName #pam_filter objectclass=User #pam