4.11. Fornecendo acesso seguro ao usuário
4.11.1. Autenticação do Usuário: PAM
PAM (Pluggable Authentication Modules) allows system administrators to choose how applications authenticate users. Note that PAM can do nothing unless an application is compiled with support for PAM. Most of the applications that are shipped with Debian have this support built in (Debian did not have PAM support before 2.2). The current default configuration for any PAM-enabled service is to emulate UNIX authentication (read /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
for more information on how PAM services should work in Debian).
Each application with PAM support provides a configuration file in
/etc/pam.d/
which can be used to modify its behavior:
que método é usada para autenticação.
que método é usada para sessões.
como a checagem de senha se comportará.
The following description is far from complete, for more information you might want to read the
Linux-PAM Guides as a reference. This documentation is available in the system if you install the
libpam-doc at
/usr/share/doc/libpam-doc/html/
.
PAM offers you the possibility to go through several authentication steps at once, without the user's knowledge. You could authenticate against a Berkeley database and against the normal passwd
file, and the user only logs in if the authentication succeeds in both. You can restrict a lot with PAM, just as you can open your system doors very wide. So be careful. A typical configuration line has a control field as its second element. Generally it should be set to requisite
, which returns a login failure if one module fails.
4.11.2. Password security in PAM
Review the
/etc/pam.d/common-password
, included by
/etc/pam.d/passwd
This file is included by other files in
/etc/pam.d/
to define the behaviour of password use in subsystems that grant access to services in the machine, like the console login (
login), graphical login managers (such as
gdm or
lightdm), and remote login (such as
sshd). This definition is
You have to make sure that the pam_unix.so module uses the "sha512" option to use encrypted passwords. This is the default in Debian Squeeze.
The line with the definition of the pam_unix module will look something like:
password [success=1 default=ignore] pam_unix.so nullok obscure minlen=8 sha512
This definition:
Enforces password encryption when storing passwords, using the SHA-512 hash function (option sha512),
Enables password complexity checks (option obscure) as defined in the pam_unix(8) manpage,
Imposes a minimum password length (option min) of 8.
You have to ensure that encrypted passwords are used in PAM applications, since this helps protect against dictionary cracks. Using encryption also makes it possible to use passwords longer than 8 characters.
Since this module is also used to define how passwords are changed (it is included by
chpasswd
) you can strengthen the password security in the system by installing
libpam-cracklib and introducing this definition in the
/etc/pam.d/common-password
configuration file:
# Be sure to install libpam-cracklib first or you will not be able to log in
password required pam_cracklib.so retry=3 minlen=12 difok=3
password [success=1 default=ignore] pam_unix.so obscure minlen=8 sha512 use_authok
So, what does this incantation do? The first line loads the cracklib PAM module, which provides password strength-checking, prompts for a new password with a minimum size
of 12 characters, and difference of at least 3 characters from the old password, and allows 3 retries. Cracklib depends on a wordlist package (such as
wenglish,
wspanish,
wbritish, ...), so make sure you install one that is appropriate for your language or cracklib might not be useful to you at all.
The second line (using the pam_unix.so module) is the default configuration in Debian, as described above, save for the use_authok option. The use_authok option is required if pam_unix.so is stacked after pam_cracklib.so, and is used to hand over the password from the previous module. Otherwise, the user would be prompted for the password twice.
By enabling the cracklib PAM module you setup a policy that forces uses to use strong passwords.
Alternatively, you can setup and configure PAM modules to use double factor authentication such as: libpam-barada, libpam-google-authenticator, libpam-oath, libpam-otpw, libpam-poldi, libpam-usb or libpam-yubico. The configuration of these modules would make it possible to access the system using external authentication mechanisms such as smartcards, external USB keys, or One-Time-Passwords generated by external applications running, for example, in the user's mobile phone.
Please note that these restrictions apply to all users but not to the password changes done by the root user. The root user will be able to set up any password (any length or complexity) for personal use or others regardless of the restrictions defined here.
4.11.3. User access control in PAM
To make sure that the user root can only log into the system from local terminals, the following line should be enabled in
/etc/pam.d/login
:
auth requisite pam_securetty.so
Then you should modify the list of terminals on which direct root login is allowed in
/etc/securetty
(as described in
Seção 4.7, “Restringindo o acesso de login no console”). Alternatively, you could enable the
pam_access module and modify
/etc/security/access.conf
which allows for a more general and fine-tuned access control, but (unfortunately) lacks decent log messages (logging within PAM is not standardized and is particularly unrewarding problem to deal with). We'll return to
access.conf
a little later.
4.11.4. User limits in PAM
The following line should be enabled in
/etc/pam.d/login
to set up user resource limits.
session required pam_limits.so
4.11.5. Control of su in PAM
If you want to protect
su
, so that only some people can use it to become root on your system, you need to add a new group "wheel" to your system (that is the cleanest way, since no file has such a group permission yet). Add root and the other users that should be able to
su
to the root user to this group. Then add the following line to
/etc/pam.d/su
:
auth requisite pam_wheel.so group=wheel debug
This makes sure that only people from the group "wheel" can use su
to become root. Other users will not be able to become root. In fact they will get a denied message if they try to become root.
If you want only certain users to authenticate at a PAM service, this is quite easy to achieve by using files where the users who are allowed to login (or not) are stored. Imagine you only want to allow users 'ref' to log in via
ssh
. So you put them into
/etc/sshusers-allowed
and write the following into
/etc/pam.d/ssh
:
auth required pam_listfile.so item=user sense=allow file=/etc/sshusers-allowed onerr=fail
4.11.6. Temporary directories in PAM
Since there have been a number of so called insecure tempfile vulnerabilities, thttpd is one example (see
DSA-883-1), the
libpam-tmpdir is a good package to install. All you have to do is add the following to
/etc/pam.d/common-session
:
session optional pam_tmpdir.so
4.11.7. Configuration for undefined PAM applications
Finally, but not least, create
/etc/pam.d/other
and enter the following lines:
auth required pam_securetty.so
auth required pam_unix_auth.so
auth required pam_warn.so
auth required pam_deny.so
account required pam_unix_acct.so
account required pam_warn.so
account required pam_deny.so
password required pam_unix_passwd.so
password required pam_warn.so
password required pam_deny.so
session required pam_unix_session.so
session required pam_warn.so
session required pam_deny.so
Esta linhas lhe oferecerão uma boa configuração padrão para todas as aplicações que suportam PAM (o acesso é negado por padrão).
4.11.8. Limiting resource usage: the limits.conf
file
You should really take a serious look into this file. Here you can define user resource limits. In old releases this configuration file was /etc/limits.conf
, but in newer releases (with PAM) the /etc/security/limits.conf
configuration file should be used instead.
If you do not restrict resource usage, any user with a valid shell in your system (or even an intruder who compromised the system through a service or a daemon going awry) can use up as much CPU, memory, stack, etc. as the system can provide. This resource exhaustion problem can be fixed by the use of PAM.
There is a way to add resource limits to some shells (for example, bash
has ulimit
, see bash(1)), but since not all of them provide the same limits and since the user can change shells (see chsh(1)) it is better to place the limits on the PAM modules as they will apply regardless of the shell used and will also apply to PAM modules that are not shell-oriented.
Resource limits are imposed by the kernel, but they need to be configured through the
limits.conf
and the PAM configuration of the different services need to load the appropriate PAM. You can check which services are enforcing limits by running:
$ find /etc/pam.d/ \! -name "*.dpkg*" | xargs -- grep limits |grep -v ":#"
Commonly, login
, ssh
and the graphic session managers (gdm
, kdm
or xdm
) should enforce user limits but you might want to do this in other PAM configuration files, such as cron
, to prevent system daemons from taking over all system resources.
The specific limits settings you might want to enforce depend on your system's resources, that's one of the main reasons why no limits are enforced in the default installation.
For example, the configuration example below enforces a 100 process limit for all users (to prevent fork bombs) as well as a limit of 10MB of memory per process and a limit of 10 simultaneous logins. Users in the adm
group have higher limits and can produce core files if they want to (there is only a soft limit).
* soft core 0
* hard core 0
* hard rss 1000
* hard memlock 1000
* hard nproc 100
* - maxlogins 1
* hard data 102400
* hard fsize 2048
@adm hard core 100000
@adm hard rss 100000
@adm soft nproc 2000
@adm hard nproc 3000
@adm hard fsize 100000
@adm - maxlogins 10
These would be the limits a default user (including system daemons) would have:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 102400
file size (blocks, -f) 2048
max locked memory (kbytes, -l) 10000
max memory size (kbytes, -m) 10000
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 100
virtual memory (kbytes, -v) unlimited
And these are the limits for an administrative user:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 102400
file size (blocks, -f) 100000
max locked memory (kbytes, -l) 100000
max memory size (kbytes, -m) 100000
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 2000
virtual memory (kbytes, -v) unlimited
Mais detalhes podem ser lidos em:
LASG in the
Limiting and monitoring users section.
4.11.9. Ações de login do usuário: edite o /etc/login.defs
The next step is to edit the basic configuration and action upon user login. Note that this file is not part of the PAM configuration, it's a configuration file honored by
login and
su
programs, so it doesn't make sense tuning it for cases where neither of the two programs are at least indirectly called (the
getty
program which sits on the consoles and offers the initial login prompt
does invoke
login
).
FAILLOG_ENAB yes
Se ativar esta variável, as falhas nas tentativas de login serão registradas. É importante mantê-las para pegar alguém que tente fazer um ataque brute force.
LOG_UNKFAIL_ENAB no
If you set this variable to 'yes' it will record unknown usernames if the login failed. It is best if you use 'no' (the default) since, otherwise, user passwords might be inadvertenly logged here (if a user mistypes and they enter their password as the username). If you set it to 'yes', make sure the logs have the proper permissions (640 for example, with an appropriate group setting such as adm).
SYSLOG_SU_ENAB yes
This one enables logging of
su
attempts to
syslog
. Quite important on serious machines but note that this can create privacy issues as well.
SYSLOG_SG_ENAB yes
The same as
SYSLOG_SU_ENAB
but applies to the
sg
program.
ENCRYPT_METHOD SHA512
As stated above, encrypted passwords greatly reduce the problem of dictionary attacks, since you can use longer passwords. This definition has to be consistent with the value defined in /etc/pam.d/common-password
.
4.11.10. User login actions: edit /etc/pam.d/login
You can adjust the login configuration file to implement an stricter policy. For example, you can change the default configuration and increase the delay time between login prompts. The default configuration sets a 3 seconds delay:
auth optional pam_faildelay.so delay=3000000
Increasing the delay value to a higher value to make it harder to use the terminal to log in using brute force. If a wrong password is typed in, the possible attacker (or normal user!) has to wait longer seconds to get a new login prompt, which is quite time consuming when you test passwords. For example, if you set delay=10000000, users will have to wait 10 seconds if they type a wrong password.
In this file you can also set the system to present a message to users before a user logs in. The default is disabled, as shown below:
# auth required pam_issue.so issue=/etc/issue
If required by your security policy, this file can be used to show a standard message indicating that access to the system is restricted and user acess is logged. This kind of disclaimer might be required in some environments and jurisdictions. To enable it, just include the relevant information in the
/etc/issue
file and uncomment the line enabling the pam_issue.so module in
/etc/pam.d/login
. In this file you can also enable additional features which might be relevant to apply local security policies such as:
setting rules for which users can access at which times, by enabling the pam_time.so module and configuring /etc/security/time.conf
accordingly (disabled by default),
setup login sessions to use user limits as defined in /etc/security/limits.conf
(enabled by default),
present the user with the information of previous login information (enabled by default),
print a message (/etc/motd
and /run/motd.dynamic
) to users after login in (enabled by default),
4.11.11. Restricting ftp: editing /etc/ftpusers
The /etc/ftpusers
file contains a list of users who are not allowed to log into the host using ftp. Only use this file if you really want to allow ftp (which is not recommended in general, because it uses clear-text passwords). If your daemon supports PAM, you can also use that to allow and deny users for certain services.
FIXME (BUG): Is it a bug that the default ftpusers
in Debian does not include all the administrative users (in base-passwd).
A convenient way to add all system accounts to the
/etc/ftpusers
is to run
$ awk -F : '{if ($3<1000) print $1}' /etc/passwd > /etc/ftpusers
If you really need users to become the super user on your system, e.g. for installing packages or adding users, you can use the command su
to change your identity. You should try to avoid any login as user root and instead use su
. Actually, the best solution is to remove su
and switch to the sudo
mechanism which has a broader logic and more features than su
. However, su
is more common as it is used on many other Unices.
sudo
allows the user to execute defined commands under another user's identity, even as root. If the user is added to /etc/sudoers
and authenticates correctly, the commands defined in /etc/sudoers
get enabled. Violations, such as incorrect passwords or trying to run a program you don't have permission for, are logged and mailed to root.
4.11.14. Desativação de acesso administrativo remoto
You should also modify /etc/security/access.conf
to disallow remote logins to administrative accounts. This way users need to invoke su
(or sudo
) to use any administrative powers and the appropriate audit trace will always be generated.
You need to add the following line to
/etc/security/access.conf
, the default Debian configuration file has a sample line commented out:
-:wheel:ALL EXCEPT LOCAL
Remember to enable the pam_access module for every service (or default configuration) in /etc/pam.d/
if you want your changes to /etc/security/access.conf
honored.
4.11.15. Restringindo acessos de usuários
Algumas vezes você deve pensar que precisa ter seus usuários criados em seu sistema local para oferecer acesso a um determinado serviço (serviço de mensagens pop3 ou ftp). Antes de fazer isto, primeiro lembre-se que a implementação do PAM no Debian GNU/Linux lhe permite validar usuários em uma grande variedade de serviços de diretório externos (radius, ldap, etc.) através dos pacote libpam.
If users need to be created and the system can be accessed remotely take into account that users will be able to log in to the system. You can fix this by giving users a null (/dev/null
) shell (it would need to be listed in /etc/shells
). If you want to allow users to access the system but limit their movements, you can use the /bin/rbash
, equivalent to adding the -r
option in bash
(RESTRICTED SHELL see bash(1) ). Please note that even with restricted shell, a user that access an interactive program (that might allow execution of a subshell) could be able to bypass the limits of the shell.
Debian currently provides in the unstable release (and might be included in the next stable releases) the
pam_chroot
module (in the
libpam-chroot). An alternative to it is to
chroot
the service that provides remote logging (
ssh
,
telnet
).
If you wish to restrict when users can access the system you will have to customize /etc/security/access.conf
for your needs.
4.11.16. Auditoria do usuário
Se você é realmente paranóico, pode querer adicionar uma configuração em todo o sistema para auditar o que os usuários estão fazendo no sistema. Esta seção mostra algumas dicas de utilitários diversos que poderão ser usados.
4.11.16.1. Auditoria de entrada e saída com o script
You can use the
script
command to audit both what the users run and what are the results of those commands. You cannot setup
script
as a shell (even if you add it to
/etc/shells
). But you can have the shell initialization file run the following:
umask 077
exec script -q -a "/var/log/sessions/$USER"
Of course, if you do this system wide it means that the shell would not continue reading personal initialization files (since the shell gets overwritten by script
). An alternative is to do this in the user's initialization files (but then the user could remove this, see the comments about this below)
You also need to setup the files in the audit directory (in the example /var/log/sessions/
) so that users can write to it but cannot remove the file. This could be done, for example, by creating the user session files in advance and setting them with the append-only flag using chattr
.
Uma alternativa útil para administradores de sistemas, que inclui informações sobre data, pode ser:
umask 077
exec script -q -a "/var/log/sessions/$USER-`date +%Y%m%d`"
4.11.16.2. Usando o arquivo de histórico do interpretador de comandos
If you want to review what does the user type in the shell (but not what the result of that is) you can setup a system-wide /etc/profile
that configures the environment so that all commands are saved into a history file. The system-wide configuration needs to be setup in such a way that users cannot remove audit capabilities from their shell. This is somewhat shell specific so make sure that all users are using a shell that supports this.
For example, for bash, the
/etc/profile
could be set as follows
:
HISTFILE=~/.bash_history
HISTSIZE=10000
HISTFILESIZE=999999
# Don't let the users enter commands that are ignored
# in the history file
HISTIGNORE=""
HISTCONTROL=""
readonly HISTFILE
readonly HISTSIZE
readonly HISTFILESIZE
readonly HISTIGNORE
readonly HISTCONTROL
export HISTFILE HISTSIZE HISTFILESIZE HISTIGNORE HISTCONTROL
For this to work, the user can only append information to
.bash_history
file. You need
also to set the
append-only option using
chattr
program for
.bash_history
for all users.
.
Note that you could introduce the configuration above in the user's .profile
. But then you would need to setup permissions properly in such a way that prevents the user from modifying this file. This includes: having the user's home directories not belong to the user (since the user would be able to remove the file otherwise) but at the same time allow the user to read the .profile
configuration file and write on the .bash_history
. It would be good to set the immutable flag (also using chattr
) for .profile
too if you do it this way.
4.11.16.3. Auditoria completa do usuário com ferramentas de contabilização
The previous example is a simple way to configure user auditing but might be not useful for complex systems or for those in which users do not run shells at all (or exclusively). If this is your case, you need to look at acct, the accounting utilities. These utilities will log all the commands run by users or processes in the system, at the expense of disk space.
When activating accounting, all the information on processes and users is kept under /var/account/
, more specifically in the pacct
. The accounting package includes some tools (sa
, ac
and lastcomm
) to analyse this data.
4.11.16.4. Outros métodos de auditoria do usuário
If you are completely paranoid and want to audit every user's command, you could take
bash
source code, edit it and have it send all that the user typed into another file. Or have
ttysnoop constantly monitor any new ttys
and dump the output into a file. Other useful program is
snoopy (see also
github: https://github.com/a2o/snoopy) which is a user-transparent program that hooks in as a library providing a wrapper around
execve()
calls, any command executed is logged to
syslogd
using the
authpriv
facility (usually stored at
/var/log/auth.log
).
4.11.17. Revisando perfis de usuários
If you want to see what users are actually doing when they logon to the system you can use the wtmp
database that includes all login information. This file can be processed with several utilities, amongst them sac
which can output a profile on each user showing in which timeframe they usually log on to the system.
No caso de ter a contabilização ativada, você também poderá usar as ferramentas fornecidas por ele para ser capaz de determinar quando os usuários acessam o sistema e o que eles executam.
4.11.18. Ajustando a umask dos usuários
Depending on your user policy you might want to change how information is shared between users, that is, what the default permissions of new files created by users are.
Debian's default umask
setting is 022 this means that files (and directories) can be read and accessed by the user's group and by any other users in the system. This definition is set in the standard configuration file /etc/profile
which is used by all shells.
If Debian's default value is too permissive for your system you will have to change the umask setting for all the shells. More restrictive umask settings include 027 (no access is allowed to new files for the
other group, i.e. to other users in the system) or 077 (no access is allowed to new files to the members the user's group). Debian (by default
) creates one group per user so that only the user is included in its group. Consequently 027 and 077 are equivalent as the user's group contains only the user.
This change is set by defining a proper umask
setting for all users. You can change this by introducing an umask
call in the shell configuration files: /etc/profile
(source by all Bourne-compatible shells), /etc/csh.cshrc
, /etc/csh.login
, /etc/zshrc
and probably some others (depending on the shells you have installed on your system). You can also change the UMASK
setting in /etc/login.defs
, Of all of these the last one that gets loaded by the shell takes precedence. The order is: the default system configuration for the user's shell (i.e. /etc/profile
and other system-wide configuration files) and then the user's shell (his ~/.profile
, ~/.bash_profile
, etc...). Some shells, however, can be executed with a nologin value which might skip sourcing some of those files. See your shell's manpage for additional information.
For connections that make use of login
the UMASK definition in /etc/login.defs
is used before any of the others. However, that value does not apply to user executed programs that do not use login
such as those run through su
, cron
or ssh
.
Don't forget to review and maybe modify the dotfiles under /etc/skel/
since these will be new user's defaults when created with the adduser
command. Debian default dotfiles do not include any umask
call but if there is any in the dotfiles newly created users might a different value.
Note, however that users can modify their own umask
setting if they want to, making it more permissive or more restricted, by changing their own dotfiles.
The
libpam-umask package adjusts the users' default
umask
using PAM. Add the following, after installing the package, to
/etc/pam.d/common-session
:
session optional pam_umask.so umask=077
Finally, you should consider changing root's default 022 umask (as defined in /root/.bashrc
) to a more strict umask. That will prevent the system administrator from inadvertenly dropping sensitive files when working as root to world-readable directories (such as /tmp
) and having them available for your average user.
4.11.19. Limitando o que os usuários podem ver/acessar
FIXME: Content needed. Describe the consequences of changing packages permissions when upgrading (an admin this paranoid should chroot
his users BTW) if not using dpkg-statoverride
.
If you need to grant users access to the system with a shell think about it very carefully. A user can, by default unless in a severely restricted environment (like a
chroot
jail), retrieve quite a lot of information from your system including:
O que um usuário pode ver em seu sistema? Provavelmente muitas coisas, tente isto (faça uma breve parada):
find / -type f -a -perm +006 2>/dev/null
find / -type d -a -perm +007 2>/dev/null
The output is the list of files that a user can see and the accessable directories.
4.11.19.1. Limitando acesso a outras informações de usuários
Se você ainda permite acesso a shell para os usuários você deverá querer limitar que informações eles podem ver de outros usuários. Os usuários com acesso a shell têm a tendência de criar um número de arquivos dentro do seu diretório pessoal: caixas de correio, documentos pessoais, configurações de aplicativos do X/GNOME/KDE...
In Debian each user is created with one associated group, and no two users belong to the same group. This is the default behavior: when an user account is created, a group of the same name is created too, and the user is assigned to it. This avoids the concept of a common users group which might make it more difficult for users to hide information from other users.
However, users' $HOME
directories are created with 0755 permissions (group-readable and world-readable). The group permissions is not an issue since only the user belongs to the group, however the world permissions might (or might not) be an issue depending on your local policy.
You can change this behavior so that user creation provides different $HOME
permissions. To change the behavior for new users when they get created, change DIR_MODE in the configuration file /etc/adduser.conf
to 0750 (no world-readable access).
Users can still share information, but not directly in their $HOME
directories unless they change its permissions.
Note that disabling world-readable home directories will prevent users from creating their personal web pages in the ~/public_html
directory, since the web server will not be able to read one component in the path - namely their $HOME
directory. If you want to permit users to publish HTML pages in their ~/public_html
, then change DIR_MODE to 0751. This will allow the web server to access the final public_html
directory (which itself should have a mode of 0755) and provide the content published by users. Of course, we are only talking about a default configuration here; users can generally tune modes of their own files completely to their liking, or you could keep content intended for the web in a separate location which is not a subdirectory of user's $HOME
directory.
4.11.20. Gerando senhas de usuários
There are many cases when an administrator needs to create many user accounts and provide passwords for all of them. Of course, the administrator could easily just set the password to be the same as the user's account name, but that would not be very sensitive security-wise. A better approach is to use a password generating program. Debian provides makepasswd, apg and pwgen packages which provide programs (the name is the same as the package) that can be used for this purpose. Makepasswd
will generate true random passwords with an emphasis on security over pronounceability while pwgen
will try to make meaningless but pronounceable passwords (of course this might depend on your mother language). Apg
has algorithms to provide for both (there is a client/server version for this program but it is not included in the Debian package).
Passwd
does not allow non-interactive assignation of passwords (since it uses direct tty access). If you want to change passwords when creating a large number of users you can create them using
adduser
with the
--disabled-login
option and then use
usermod
or
chpasswd
(both from the
passwd package so you already have them installed). If you want to use a file with all the information to make users as a batch process you might be better off using
newusers
.
4.11.21. Verificando senhas de usuários
User passwords can sometimes become the
weakest link in the security of a given system. This is due to some users choosing weak passwords for their accounts (and the more of them that have access to it the greater the chances of this happening). Even if you established checks with the cracklib PAM module and password limits as described in
Seção 4.11.1, “Autenticação do Usuário: PAM” users will still be able to use weak passwords. Since user access might include remote shell access (over
ssh
, hopefully) it's important to make password guessing as hard as possible for the remote attackers, especially if they were somehow able to collect important information such as usernames or even the
passwd
and
shadow
files themselves.
A system administrator must, given a big number of users, check if the passwords they have are consistent with the local security policy. How to check? Try to crack them as an attacker would if having access to the hashed passwords (the /etc/shadow
file).
An administrator can use john or crack (both are brute force password crackers) together with an appropriate wordlist to check users' passwords and take appropriate action when a weak password is detected. You can search for Debian GNU packages that contain word lists using apt-cache search wordlist
, or visit some Internet wordlist sites.
4.11.22. Logout de usuários ociosos
Usuários inativos geralmente são um risco de segurança, um usuário pode estar inativo porque saiu para comer ou porque ocorreu um problema com sua conexão remota, que não foi restabelecida. Por alguma razão, os usuários inativos podem levar a um comprometimento do sistema:
porque o console do usuário pode ser destravado e pode ser acessado por um intruso.
because an attacker might be able to re-attach to a closed network connection and send commands to the remote shell (this is fairly easy if the remote shell is not encrypted as in the case of telnet
).
Some remote systems have even been compromised through an idle (and detached) screen
.
A desconexão automática de usuários idle é geralmente parte da política local de segurança que deve ser forçada. Existem várias formas de se fazer isto:
If bash is the user shell, a system administrator can set a default TMOUT
value (see bash(1)) which will make the shell automatically log off remote idle users. Note that it must be set with the -o
option or users will be able to change (or unset) it.
Install timeoutd and configure /etc/timeouts
according to your local security policy. The daemon will watch for idle users and time out their shells accordingly.
Install autolog and configure it to remove idle users.
The timeoutd
or autolog
daemons are the preferred method since, after all, users can change their default shell or can, after running their default shell, switch to another (uncontrolled) shell.