186 lines
3.9 KiB
HTML
186 lines
3.9 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Passwords</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Secure Programming for Linux and Unix HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Special Topics"
|
|
HREF="special.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Special Topics"
|
|
HREF="special.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Authenticating on the Web"
|
|
HREF="web-authentication.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Secure Programming for Linux and Unix HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="special.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 11. Special Topics</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="web-authentication.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="PASSWORDS"
|
|
></A
|
|
>11.1. Passwords</H1
|
|
><P
|
|
>Where possible, don't write code to handle passwords.
|
|
In particular, if the application is local,
|
|
try to depend on the normal login authentication by a user.
|
|
If the application is a CGI script, try to depend on the web server to provide
|
|
the protection as much as possible -
|
|
but see below about handling authentication in a web server.
|
|
If the application is over a network, avoid sending the password as cleartext
|
|
(where possible) since it can
|
|
be easily captured by network sniffers and reused later.
|
|
``Encrypting'' a password using some key fixed in the algorithm or using
|
|
some sort of shrouding algorithm is essentially the same as sending the
|
|
password as cleartext.</P
|
|
><P
|
|
>For networks, consider at least using digest passwords.
|
|
Digest passwords are passwords developed from hashes; typically the
|
|
server will send the client some data (e.g., date, time, name of server),
|
|
the client combines this data with the user password, the client hashes
|
|
this value (termed the ``digest pasword'')
|
|
and replies just the hashed result to the server;
|
|
the server verifies this hash value.
|
|
This works, because the password is never actually sent in any form; the
|
|
password is just used to derive the hash value.
|
|
Digest passwords aren't considered ``encryption'' in
|
|
the usual sense and are usually accepted even in countries with laws
|
|
constraining encryption for confidentiality.
|
|
Digest passwords are vulnerable to active attack threats but
|
|
protect against passive network sniffers.
|
|
One weakness is that, for digest passwords
|
|
to work, the server must have all the unhashed passwords, making the server
|
|
a very tempting target for attack.</P
|
|
><P
|
|
>If your application permits users to set their passwords, check
|
|
the passwords and permit only ``good'' passwords
|
|
(e.g., not in a dictionary, having certain minimal length, etc.).
|
|
You may want to look at information such as
|
|
<A
|
|
HREF="http://consult.cern.ch/writeup/security/security_3.html"
|
|
TARGET="_top"
|
|
>http://consult.cern.ch/writeup/security/security_3.html</A
|
|
>
|
|
on how to choose a good password.
|
|
You should use PAM if you can, because it supports pluggable password checkers.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="special.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="web-authentication.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Special Topics</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="special.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Authenticating on the Web</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |