From ce893c517d7d6257f61bb19b6822dae19e66908e Mon Sep 17 00:00:00 2001
From: cameronrich \n \n"
+ "Directory listing of %s://%s%s
\n", cn->is_ssl ? "https" : "http", cn->virtualhostreq, cn->filereq);
+ snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\nContent-Type: text/html\n\n"
+ "\nDirectory listing of %s://%s%s
\n",
+ cn->is_ssl ? "https" : "http", cn->virtualhostreq, cn->filereq);
special_write(cn, buf, strlen(buf));
cn->state = STATE_DOING_DIR;
}
@@ -179,14 +183,14 @@ void procdodir(struct connstruct *cn)
#ifdef WIN32
if (!FindNextFile(cn->dirp, &cn->file_data))
#else
- if ((dp = readdir(cn->dirp)) == NULL)
+ if ((dp = readdir(cn->dirp)) == NULL)
#endif
- {
- snprintf(buf, sizeof(buf), "\n");
- special_write(cn, buf, strlen(buf));
- removeconnection(cn);
- return;
- }
+ {
+ snprintf(buf, sizeof(buf), "\n");
+ special_write(cn, buf, strlen(buf));
+ removeconnection(cn);
+ return;
+ }
#ifdef WIN32
file = cn->file_data.cFileName;
@@ -199,31 +203,45 @@ void procdodir(struct connstruct *cn)
snprintf(buf, sizeof(buf), "%s%s", cn->actualfile, file);
putslash = isdir(buf);
-
urlencode(file, encbuf);
snprintf(buf, sizeof(buf), "%s%s
\n",
encbuf, putslash ? "/" : "", file, putslash ? "/" : "");
special_write(cn, buf, strlen(buf));
+ } while (issockwriteable(cn->networkdesc));
+}
- }
- while (issockwriteable(cn->networkdesc));
+static int issockwriteable(int sd)
+{
+ fd_set wfds;
+ struct timeval tv;
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+
+ FD_ZERO(&wfds);
+ FD_SET(sd, &wfds);
+
+ select(FD_SETSIZE, NULL, &wfds, NULL, &tv);
+ return FD_ISSET(sd, &wfds);
}
/* Encode funny chars -> %xx in newly allocated storage */
/* (preserves '/' !) */
-static void urlencode(unsigned char *s, unsigned char *t)
+static void urlencode(const uint8_t *s, uint8_t *t)
{
- uint8_t *p, *tp;
+ const uint8_t *p = s;
+ uint8_t *tp;
- tp =t ;
+ tp = t;
- for (p=s; *p; p++)
+ for (; *p; p++)
{
if ((*p > 0x00 && *p < ',') ||
(*p > '9' && *p < 'A') ||
(*p > 'Z' && *p < '_') ||
(*p > '_' && *p < 'a') ||
- (*p > 'z' && *p < 0xA1)) {
+ (*p > 'z' && *p < 0xA1))
+ {
sprintf((char *)tp, "%%%02X", *p);
tp += 3;
}
@@ -245,24 +263,23 @@ void procreadhead(struct connstruct *cn)
int rv;
rv = special_read(cn, buf, sizeof(buf)-1);
- if (rv <= 0) {
- if (rv < 0)
+ if (rv <= 0)
+ {
+ if (rv < 0) // really dead?
removeconnection(cn);
return;
}
buf[rv] = '\0';
-
next = tp = buf;
// Split up lines and send to procheadelem()
- while(*next != '\0')
+ while (*next != '\0')
{
// If we have a blank line, advance to next stage!
if (*next == '\r' || *next == '\n')
{
buildactualfile(cn);
-
cn->state = STATE_WANT_TO_SEND_HEAD;
return;
}
@@ -273,7 +290,7 @@ void procreadhead(struct connstruct *cn)
if (*next == '\r')
{
*next = '\0';
- next+=2;
+ next += 2;
}
else if (*next == '\n')
*next++ = '\0';
@@ -295,8 +312,8 @@ void procsendhead(struct connstruct *cn)
struct stat stbuf;
time_t now = cn->timeout - CONFIG_HTTP_TIMEOUT;
char date[32];
- strcpy(date, ctime(&now));
+ strcpy(date, ctime(&now));
strcpy(actualfile, cn->actualfile);
#ifdef WIN32
@@ -309,8 +326,9 @@ void procsendhead(struct connstruct *cn)
{
#if defined(CONFIG_HTTP_HAS_CGI)
if (trycgi_withpathinfo(cn) == 0)
- { // We Try To Find A CGI
- proccgi(cn,1);
+ {
+ // We Try To Find A CGI
+ proccgi(cn, 1);
return;
}
#endif
@@ -321,7 +339,7 @@ void procsendhead(struct connstruct *cn)
}
#if defined(CONFIG_HTTP_HAS_CGI)
- if (iscgi(cn->actualfile))
+ if (iscgi(cn->actualfile))
{
#ifndef WIN32
// Set up CGI script
@@ -333,7 +351,7 @@ void procsendhead(struct connstruct *cn)
}
#endif
- proccgi(cn,0);
+ proccgi(cn, 0);
return;
}
#endif
@@ -362,7 +380,7 @@ void procsendhead(struct connstruct *cn)
#if defined(CONFIG_HTTP_HAS_CGI)
// If the index is a CGI file, handle it like any other CGI
- if (iscgi(cn->actualfile))
+ if (iscgi(cn->actualfile))
{
// Set up CGI script
if ((stbuf.st_mode & S_IEXEC) == 0 || isdir(cn->actualfile))
@@ -372,45 +390,7 @@ void procsendhead(struct connstruct *cn)
return;
}
- proccgi(cn,0);
- return;
- }
-#endif
- // If the index isn't a CGI, we continue on with the index file
- }
-
- if ((stbuf.st_mode & S_IFMT) == S_IFDIR)
- {
- if (cn->filereq[strlen(cn->filereq)-1] != '/')
- {
- send301(cn);
- removeconnection(cn);
- return;
- }
-
- // Check to see if this dir has an index file
- if (procindex(cn, &stbuf) == 0)
- {
-#if defined(CONFIG_HTTP_DIRECTORIES)
- // If not, we do a directory listing of it
- procdirlisting(cn);
-#endif
- return;
- }
-
-#if defined(CONFIG_HTTP_HAS_CGI)
- // If the index is a CGI file, handle it like any other CGI
- if (iscgi(cn->actualfile))
- {
- // Set up CGI script
- if ((stbuf.st_mode & S_IEXEC) == 0 || isdir(cn->actualfile))
- {
- send404(cn);
- removeconnection(cn);
- return;
- }
-
- proccgi(cn,0);
+ proccgi(cn, 0);
return;
}
#endif
@@ -419,7 +399,8 @@ void procsendhead(struct connstruct *cn)
if (cn->modified_since)
{
- snprintf(buf, sizeof(buf), "HTTP/1.1 304 Not Modified\nServer: axhttpd V%s\nDate: %s\n", VERSION, date);
+ snprintf(buf, sizeof(buf), "HTTP/1.1 304 Not Modified\nServer: "
+ "axhttpd V%s\nDate: %s\n", VERSION, date);
special_write(cn, buf, strlen(buf));
cn->modified_since = 0;
cn->state = STATE_WANT_TO_READ_HEAD;
@@ -433,12 +414,11 @@ void procsendhead(struct connstruct *cn)
TTY_FLUSH();
#endif
- snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\nServer: axhttpd V%s\nContent-Type: %s\nContent-Length: %ld\nDate: %sLast-Modified: %s\n",
- VERSION,
- getmimetype(cn->actualfile),
- (long) stbuf.st_size,
- date,
- ctime(&(stbuf.st_mtime))); // ctime() has a \n on the end
+ snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\nServer: axhttpd V%s\n"
+ "Content-Type: %s\nContent-Length: %ld\n"
+ "Date: %sLast-Modified: %s\n", VERSION,
+ getmimetype(cn->actualfile), (long) stbuf.st_size,
+ date, ctime(&(stbuf.st_mtime))); // ctime() has a \n on the end
}
special_write(cn, buf, strlen(buf));
@@ -478,7 +458,6 @@ void procsendhead(struct connstruct *cn)
#else
cn->state = STATE_WANT_TO_READ_FILE;
#endif
- return;
}
}
@@ -490,10 +469,11 @@ void procreadfile(struct connstruct *cn)
{
close(cn->filedesc);
cn->filedesc = -1;
- if (cn->close_when_done) /* close immediately */
+
+ if (cn->close_when_done) /* close immediately */
removeconnection(cn);
else
- { /* keep socket open - HTTP 1.1 */
+ { /* keep socket open - HTTP 1.1 */
cn->state = STATE_WANT_TO_READ_HEAD;
cn->numbytes = 0;
}
@@ -514,7 +494,9 @@ void procsendfile(struct connstruct *cn)
else if (rv == cn->numbytes)
cn->state = STATE_WANT_TO_READ_FILE;
else if (rv == 0)
- { /* Do nothing */ }
+ {
+ /* Do nothing */
+ }
else
{
memmove(cn->databuf, cn->databuf + rv, cn->numbytes - rv);
@@ -522,24 +504,16 @@ void procsendfile(struct connstruct *cn)
}
}
-int special_write(struct connstruct *cn, const uint8_t *buf, size_t count)
+static int special_write(struct connstruct *cn,
+ const uint8_t *buf, size_t count)
{
- int res;
-
if (cn->is_ssl)
{
SSL *ssl = ssl_find(servers->ssl_ctx, cn->networkdesc);
- if (ssl)
- {
- res = ssl_write(ssl, (unsigned char *)buf, count);
- }
- else
- return -1;
+ return ssl ? ssl_write(ssl, (uint8_t *)buf, count) : -1;
}
else
- res = SOCKET_WRITE(cn->networkdesc, buf, count);
-
- return res;
+ return SOCKET_WRITE(cn->networkdesc, buf, count);
}
static int special_read(struct connstruct *cn, void *buf, size_t count)
@@ -549,7 +523,7 @@ static int special_read(struct connstruct *cn, void *buf, size_t count)
if (cn->is_ssl)
{
SSL *ssl = ssl_find(servers->ssl_ctx, cn->networkdesc);
- unsigned char *read_buf;
+ uint8_t *read_buf;
if ((res = ssl_read(ssl, &read_buf)) > SSL_OK)
memcpy(buf, read_buf, res > (int)count ? count : res);
@@ -566,26 +540,12 @@ static int special_read(struct connstruct *cn, void *buf, size_t count)
static int procindex(struct connstruct *cn, struct stat *stp)
{
char tbuf[MAXREQUESTLENGTH];
- struct indexstruct *tp;
- tp = indexlist;
-
- while(tp != NULL) {
- sprintf(tbuf, "%s%s%s", cn->actualfile,
-#ifdef WIN32
- "\\",
-#else
- "/",
-#endif
- tp->name);
-
- if (stat(tbuf, stp) != -1)
- {
- my_strncpy(cn->actualfile, tbuf, MAXREQUESTLENGTH);
- return 1;
- }
-
- tp = tp->next;
+ sprintf(tbuf, "%s%s", cn->actualfile, "index.html");
+ if (stat(tbuf, stp) != -1)
+ {
+ my_strncpy(cn->actualfile, tbuf, MAXREQUESTLENGTH);
+ return 1;
}
return 0;
@@ -599,8 +559,6 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
char buf[MAXREQUESTLENGTH];
#ifdef WIN32
int tmp_stdout;
-#else
- int fv;
#endif
snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\nServer: axhttpd V%s\n%s",
@@ -614,28 +572,15 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
}
#ifndef WIN32
- if (pipe(tpipe) == -1)
- {
- removeconnection(cn);
- return;
- }
+ pipe(tpipe);
- fv = fork();
-
- if (fv == -1)
- {
- close(tpipe[0]);
- close(tpipe[1]);
- removeconnection(cn);
- return;
- }
-
- if (fv != 0)
+ if (fork() > 0) // parent
{
// Close the write descriptor
close(tpipe[1]);
cn->filedesc = tpipe[0];
cn->state = STATE_WANT_TO_READ_FILE;
+ cn->close_when_done = 1;
return;
}
@@ -653,7 +598,6 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
close(tpipe[0]);
close(tpipe[1]);
-
myargs[0] = cn->actualfile;
myargs[1] = cn->cgiargs;
myargs[2] = NULL;
@@ -666,11 +610,7 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
execv(cn->actualfile, myargs);
#else /* WIN32 */
- if (_pipe(tpipe, 4096, O_BINARY| O_NOINHERIT) == -1)
- {
- removeconnection(cn);
- return;
- }
+ _pipe(tpipe, 4096, O_BINARY| O_NOINHERIT);
myargs[0] = "sh";
myargs[1] = "-c";
@@ -703,6 +643,7 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
close(tmp_stdout);
cn->filedesc = tpipe[0];
cn->state = STATE_WANT_TO_READ_FILE;
+ cn->close_when_done = 1;
for (;;)
{
@@ -716,6 +657,97 @@ static void proccgi(struct connstruct *cn, int has_pathinfo)
}
#endif
}
+
+static int trycgi_withpathinfo(struct connstruct *cn)
+{
+ char tpfile[MAXREQUESTLENGTH];
+ char fr_str[MAXREQUESTLENGTH];
+ char *fr_rs[MAXCGIARGS]; // filereq splitted
+ int i = 0, offset;
+
+ my_strncpy(fr_str, cn->filereq, MAXREQUESTLENGTH);
+ split(fr_str, fr_rs, MAXCGIARGS, '/');
+
+ while (fr_rs[i] != NULL)
+ {
+ snprintf(tpfile, sizeof(tpfile), "%s/%s%s",
+ webroot, cn->virtualhostreq, fr_str);
+
+ if (iscgi(tpfile) && isdir(tpfile) == 0)
+ {
+ /* We've found our CGI file! */
+ my_strncpy(cn->actualfile, tpfile, MAXREQUESTLENGTH);
+ my_strncpy(cn->cgiscriptinfo, fr_str, MAXREQUESTLENGTH);
+
+ offset = (fr_rs[i] + strlen(fr_rs[i])) - fr_str;
+ my_strncpy(cn->cgipathinfo, cn->filereq+offset, MAXREQUESTLENGTH);
+
+ return 0;
+ }
+
+ *(fr_rs[i]+strlen(fr_rs[i])) = '/';
+ i++;
+ }
+
+ /* Couldn't find any CGIs :( */
+ *(cn->cgiscriptinfo) = '\0';
+ *(cn->cgipathinfo) = '\0';
+ return -1;
+}
+
+static int iscgi(const char *fn)
+{
+ struct cgiextstruct *tp;
+ int fnlen, extlen;
+
+ fnlen = strlen(fn);
+ tp = cgiexts;
+
+ while (tp != NULL)
+ {
+ extlen = strlen(tp->ext);
+
+ if (strcasecmp(fn+(fnlen-extlen), tp->ext) == 0)
+ return 1;
+
+ tp = tp->next;
+ }
+
+ return 0;
+}
+
+static void split(char *tp, char *sp[], int maxwords, char sc)
+{
+ int i = 0;
+
+ while(1)
+ {
+ /* Skip leading whitespace */
+ while (*tp == sc) tp++;
+
+ if (*tp == '\0')
+ {
+ sp[i] = NULL;
+ break;
+ }
+
+ if (i==maxwords-2)
+ {
+ sp[maxwords-2] = NULL;
+ break;
+ }
+
+ sp[i] = tp;
+
+ while(*tp != sc && *tp != '\0')
+ tp++;
+
+ if (*tp == sc)
+ *tp++ = '\0';
+
+ i++;
+ }
+}
#endif /* CONFIG_HTTP_HAS_CGI */
/* Decode string %xx -> char (in place) */
@@ -730,26 +762,28 @@ static void urldecode(char *buf)
{
v = 0;
- if (*p=='%')
+ if (*p == '%')
{
s = p;
s++;
if (isxdigit((int) s[0]) && isxdigit((int) s[1]))
{
- v = hexit(s[0])*16+hexit(s[1]);
+ v = hexit(s[0])*16 + hexit(s[1]);
+
if (v)
- { /* do not decode %00 to null char */
- *w=(char)v;
- p=&s[1];
+ {
+ /* do not decode %00 to null char */
+ *w = (char)v;
+ p = &s[1];
}
}
}
- if (!v)
- *w=*p;
- p++; w++;
+ if (!v) *w=*p;
+ p++;
+ w++;
}
*w='\0';
@@ -757,27 +791,98 @@ static void urldecode(char *buf)
static int hexit(char c)
{
- if ( c >= '0' && c <= '9' )
+ if (c >= '0' && c <= '9')
return c - '0';
- if ( c >= 'a' && c <= 'f' )
+ else if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
- if ( c >= 'A' && c <= 'F' )
+ else if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
-
- return 0;
+ else
+ return 0;
}
static void send301(struct connstruct *cn)
{
char buf[2048];
- snprintf(buf, sizeof(buf), "HTTP/1.1 301 Moved Permanently\nLocation: %s/\n\n\n\nMoved Permanently
\nThe document has moved here.
\n\n", cn->filereq, cn->filereq);
+ snprintf(buf, sizeof(buf),
+ "HTTP/1.1 301 Moved Permanently\nLocation: %s/\n\n"
+ "\n"
+ "\nMoved Permanently
\n"
+ "The document has moved here.
\n\n", cn->filereq, cn->filereq);
special_write(cn, buf, strlen(buf));
}
static void send404(struct connstruct *cn)
{
char buf[1024];
- sprintf(buf, "HTTP/1.0 404 Not Found\nContent-Type: text/html\n\n\nIt ain't there my friend. (404 Not Found)
\n\n");
+ strcpy(buf, "HTTP/1.0 404 Not Found\nContent-Type: text/html\n\n"
+ "\n"
+ "404 Not Found
\n\n");
special_write(cn, buf, strlen(buf));
}
+static void buildactualfile(struct connstruct *cn)
+{
+ snprintf(cn->actualfile, MAXREQUESTLENGTH, "%s%s", webroot, cn->filereq);
+
+ /* Add directory slash if not there */
+ if (isdir(cn->actualfile) &&
+ cn->actualfile[strlen(cn->actualfile)-1] != '/')
+ strcat(cn->actualfile, "/");
+
+#ifdef WIN32
+ /* convert all the forward slashes to back slashes */
+ {
+ char *t = cn->actualfile;
+ while ((t = strchr(t, '/')))
+ {
+ *t++ = '\\';
+ }
+ }
+#endif
+}
+
+static int sanitizefile(const char *buf)
+{
+ int len, i;
+
+ // Don't accept anything not starting with a /
+ if (*buf != '/')
+ return 0;
+
+ len = strlen(buf);
+ for (i = 0; i < len; i++)
+ {
+ // Check for "/." : In other words, don't send files starting with a .
+ // Notice, GOBBLES, that this includes ".."
+ if (buf[i] == '/' && buf[i+1] == '.')
+ return 0;
+ }
+
+ return 1;
+}
+
+static int sanitizehost(char *buf)
+{
+ while (*buf != '\0')
+ {
+ // Handle the port
+ if (*buf == ':')
+ {
+ *buf = '\0';
+ return 1;
+ }
+
+ // Enforce some basic URL rules...
+ if (isalnum(*buf)==0 && *buf != '-' && *buf != '.') return 0;
+ if (*buf == '.' && *(buf+1) == '.') return 0;
+ if (*buf == '.' && *(buf+1) == '-') return 0;
+ if (*buf == '-' && *(buf+1) == '.') return 0;
+ buf++;
+ }
+
+ return 1;
+}
+
diff --git a/www/index.html b/www/index.html
index 86133dd77..5a391a34c 100644
--- a/www/index.html
+++ b/www/index.html
@@ -1,7 +1,7 @@
@@ -12,7 +12,7 @@ An Overview of Cryptography
Gary C. Kessler
May 1998
-(26 September 2005)
+(1 August 2006)
@@ -193,7 +193,7 @@ algorithms that will be discussed are (Figure 1):
@@ -366,7 +366,7 @@ Telegraph and Telephone (NTT) Corp. and Mitsubishi Electric Corporation
and suitability for both software and hardware implementations on
common 32-bit processors as well as 8-bit processors (e.g., smart
cards, cryptographic hardware, and embedded systems). Also described in
- RFC 3713.
-
+
FIGURE 1: Three types of cryptography: secret-key, public key, and hash function.
MISTY1: Developed at Mitsubishi Electric Corp., a block cipher using a 128-bit key and 64-bit blocks, and a variable number of @@ -385,7 +385,7 @@ signaling data for emerging mobile communications systems.
SEED: A block cipher using 128-bit blocks and 128-bit keys. Developed by the Korea Information Security Agency (KISA) and adopted as a national -standard encryption algorithm in South Korea. Also described in RFC 4009.
Skipjack: SKC scheme proposed for Capstone. Although the details of the algorithm @@ -463,11 +463,16 @@ large prime numbers. In fact, large prime numbers, like small prime numbers, only have two factors!) The ability for computers to factor large numbers, and therefore attack schemes such as RSA, is rapidly improving and systems today can find the prime factors of numbers with -more than 140 digits. The presumed protection of RSA, however, is that -users can easily increase the key size to always stay ahead of the -computer processing curve. As an aside, the patent for RSA expired in -September 2000 which does not appear to have affected RSA's popularity -one way or the other. A detailed example of RSA is presented below in Section 5.3.
Diffie-Hellman: After the RSA algorithm was published, Diffie and Hellman came up with @@ -590,17 +595,7 @@ recovered. Hash algorithms are typically used to provide a digital fingerprin of a file's contents, often used to ensure that the file has not been altered by an intruder or virus. Hash functions are also commonly employed by many operating systems to encrypt passwords. Hash -functions, then, help preserve the integrity of a file.
--Hash functions are sometimes misunderstood and some -sources claim that no two files can have the same hash value. This -isn't true, strictly speaking. Consider a hash function that provides a -128-bit hash value. There are, obviously, 2128 possible hash values. But there are a lot more than 2128 possible -files. Therefore, there have to be multiple files — in fact, there have -to be an infinite number of files! — that can have the same 128-bit -hash value. The difficulty is finding two files with the same -hash! What is, indeed, very hard to do is to try to create a file that -has a given hash value so as to force a hash value collision.
+functions, then, provide a measure of the integrity of a file.Hash algorithms that are in common use today include:
@@ -616,27 +611,60 @@ manipulation is made to the original data. MD5 has been implemented in a large number of products although several weaknesses in the algorithm were demonstrated by German cryptographer Hans Dobbertin in 1996.Secure Hash Algorithm (SHA): Algorithm for NIST's Secure Hash Standard (SHS). SHA-1 produces a 160-bit hash value and was -originally published as FIPS 180-1 and RFC 3174. FIPS 180-2 +originally published as FIPS 180-1 and RFC 3174. FIPS 180-2 describes five algorithms in the SHS: SHA-1 plus SHA-224, SHA-256, SHA-384, and SHA-512 which can produce hash values that are 224, 256, -384, or 512 bits in length, respectively.
RIPEMD: A series of message digests that initially came from the RIPE (RACE Integrity Primitives Evaluation) project. RIPEMD-160 was designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel, and optimized for 32-bit processors to replace the then-current 128-bit hash functions. Other versions include RIPEMD-256, RIPEMD-320, and RIPEMD-128.
HAVAL (HAsh of VAriable Length): Designed by Y. Zheng, J. Pieprzyk and J. Seberry, a hash algorithm with many levels of security. HAVAL can create hash values that are 128, 160, 192, 224, or 256 bits in length.
Whirlpool: A relatively new hash function, designed by V. Rijmen and P.S.L.M. Barreto. Whirlpool operates on messages less than 2256 +bits in length, and produces a message digest of 512 bits. The design +of this has function is very different than that of MD5 and SHA-1, +making it immune to the same attacks as on those hashes (see below).
-For additional information, see David Hopwood's MessageDigest Algorithms page.
+Hash functions are sometimes misunderstood and some +sources claim that no two files can have the same hash value. This is, +in fact, not correct. Consider a hash function that provides a 128-bit +hash value. There are, obviously, 2128 possible hash values. But there are a lot more than 2128 possible +files. Therefore, there have to be multiple files — in fact, there have +to be an infinite number of files! — that can have the same 128-bit +hash value. ++The difficulty is finding two files with the same +hash! What is, indeed, very hard to do is to try to create a file that +has a given hash value so as to force a hash value collision — which is +the reason that hash functions are used extensively for information +security and computer forensics applications. Alas, researchers in 2004 +found that practical collision attacks could be launched on +MD5, SHA-1, and other hash algorithms. At this time, there is no +obvious successor to MD5 and SHA-1 that could be put into use quickly; +there are so many products using these hash functions that it could +take many years to flush out all use of 128- and 160-bit hashes. +Readers interested in this problem should read the following:
+ ++An excellent review of the situation with hash collisions can be found in RFC 4270 (by P. Hoffman and B. Schneier, November 2005). And for additional information on hash functions, see David Hopwood's MessageDigest Algorithms page.
@@ -663,7 +691,7 @@ public-key cryptography.
-![]() ![]() FIGURE 2: Sample application of the three cryptographic techniques for secure communication. |
-![]() ![]() FIGURE 3: Kerberos architecture. |
-![]() ![]() FIGURE 4: GTE Cybertrust Global Root-issued certificate as viewed
|
It has been common practice on the Internet to permit anonymous +access to various services, employing a plain-text password using a +user name of "anonymous" and a password of an email address or some +other identifying information. New IETF protocols disallow plain-text +logins. The Anonymous SASL Mechanism (RFC 4505) provides a method for anonymous logins within the SASL framework. + +
-Although other block ciphers will replace DES, it is -still interesting to see how DES encryption is performed. Not only is -it sort of interesting, but DES remains in many products and we will -continue to see DES for some years to come.
+NIST finally declared DES obsolete in 2004, and withdrew FIPS 46-3, 74, and 81 (Federal Register, July 26, 2004, 69(142), 44509-44510). +Although other block ciphers will replace DES, it is still interesting +to see how DES encryption is performed; not only is it sort of neat, +but DES was the first crypto scheme commonly seen in non-govermental +applications and was the catalyst for modern "public" cryptography. DES +remains in many products — and cryptography students and cryptographers +will continue to study DES for years to come.DES Operational Overview
@@ -1756,7 +1817,7 @@ of randomness, or entropy).
-![]() ![]() FIGURE 6: DES enciphering algorithm. |
-As shown in Table 3, IPsec is described in nearly a dozen RFCs. RFC 2401, in particular, describes the overall IP security architecture and RFC 2411 provides an overview of the IPsec protocol suite and the documents describing it.
+As shown in Table 3, IPsec is described in nearly a dozen RFCs. RFC 4301, in particular, describes the overall IP security architecture and RFC 2411 provides an overview of the IPsec protocol suite and the documents describing it.IPsec can provide either message authentication and/or encryption. The latter requires more processing than the former, but @@ -2173,7 +2234,7 @@ endpoints requires the establishment of two SAs (one in each direction).<
-The IP Authentication Header (AH), described in RFC 2402, provides a mechanism for data integrity and data origin authentication for IP packets using HMAC with MD5 (RFC 2403), HMAC with SHA-1 (RFC 2404), or HMAC with RIPEMD (RFC 2857).
+The IP Authentication Header (AH), described in RFC 4302, provides a mechanism for data integrity and data origin authentication for IP packets using HMAC with MD5 (RFC 2403), HMAC with SHA-1 (RFC 2404), or HMAC with RIPEMD (RFC 2857). See also RFC 4305.-
-The IP Encapsulating Security Payload (ESP), described in RFC 2406, +The IP Encapsulating Security Payload (ESP), described in RFC 4303, provides message integrity and privacy mechanisms in addition to authentication. As in AH, ESP uses HMAC with MD5, SHA-1, or RIPEMD -authentication (RFC 2403/RFC 2404/RFC 2857); privacy is provided using DES-CBC encryption (RFC 2405), NULL encryption (RFC 2410), other CBC-mode algorithms (RFC 2451), or AES (RFC 3686).
+authentication (RFC 2403/RFC 2404/RFC 2857); privacy is provided using DES-CBC encryption (RFC 2405), NULL encryption (RFC 2410), other CBC-mode algorithms (RFC 2451), or AES (RFC 3686). See also RFC 4305 and RFC 4308.+ |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Security Parameters Index (SPI) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Sequence Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Payload Data (variable) | - ~ ~ - | | - + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | Padding (0-255 bytes) | - +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | Pad Length | Next Header | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Authentication Data (variable) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ---- + | Security Parameters Index (SPI) | ^Int. + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- + | Sequence Number | |ered + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ---- + | Payload Data* (variable) | | ^ + ~ ~ | | + | | |Conf. + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- + | | Padding (0-255 bytes) | |ered* + +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + | | Pad Length | Next Header | v v + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ------ + | Integrity Check Value-ICV (variable) | ~ ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + * If included in the Payload field, cryptographic synchronization + data, e.g., an Initialization Vector (IV), usually is not + encrypted per se, although it often is referred to as being + being part of the ciphertext. + - FIGURE 11: IPsec Encapsulating Security Payload format. (From RFC 2406)+FIGURE 11: IPsec Encapsulating Security Payload format. (From RFC 4303) |
+ |
- ORIGINAL PACKET BEFORE APPLYING AH + ORIGINAL PACKET BEFORE APPLYING AH - ---------------------------- - IPv4 |orig IP hdr | | | - |(any options)| TCP | Data | - ---------------------------- + ---------------------------- + IPv4 |orig IP hdr | | | + |(any options)| TCP | Data | + ---------------------------- - --------------------------------------- - IPv6 | | ext hdrs | | | - | orig IP hdr |if present| TCP | Data | - --------------------------------------- + --------------------------------------- + IPv6 | | ext hdrs | | | + | orig IP hdr |if present| TCP | Data | + --------------------------------------- + + AFTER APPLYING AH (TRANSPORT MODE) + + ------------------------------------------------------- + IPv4 |original IP hdr (any options) | AH | TCP | Data | + ------------------------------------------------------- + |<- mutable field processing ->|<- immutable fields ->| + |<----- authenticated except for mutable fields ----->| + + ------------------------------------------------------------ + IPv6 | |hop-by-hop, dest*, | | dest | | | + |orig IP hdr |routing, fragment. | AH | opt* | TCP | Data | + ------------------------------------------------------------ + |<--- mutable field processing -->|<-- immutable fields -->| + |<---- authenticated except for mutable fields ----------->| + + * = if present, could be before AH, after AH, or both - AFTER APPLYING AH (TRANSPORT MODE) + AFTER APPLYING AH (TUNNEL MODE) - --------------------------------- - IPv4 |orig IP hdr | | | | - |(any options)| AH | TCP | Data | - --------------------------------- - |<------- authenticated ------->| - except for mutable fields + ---------------------------------------------------------------- + IPv4 | | | orig IP hdr* | | | + |new IP header * (any options) | AH | (any options) |TCP| Data | + ---------------------------------------------------------------- + |<- mutable field processing ->|<------ immutable fields ----->| + |<- authenticated except for mutable fields in the new IP hdr->| - ------------------------------------------------------------ - IPv6 | |hop-by-hop, dest*, | | dest | | | - |orig IP hdr |routing, fragment. | AH | opt* | TCP | Data | - ------------------------------------------------------------ - |<---- authenticated except for mutable fields ----------->| + -------------------------------------------------------------- + IPv6 | | ext hdrs*| | | ext hdrs*| | | + |new IP hdr*|if present| AH |orig IP hdr*|if present|TCP|Data| + -------------------------------------------------------------- + |<--- mutable field -->|<--------- immutable fields -------->| + | processing | + |<-- authenticated except for mutable fields in new IP hdr ->| - * = if present, could be before AH, after AH, or both + * = if present, construction of outer IP hdr/extensions and + modification of inner IP hdr/extensions is discussed in + the Security Architecture document. - - AFTER APPLYING AH (TUNNEL MODE) - - ------------------------------------------------ - IPv4 | new IP hdr* | | orig IP hdr* | | | - |(any options)| AH | (any options) |TCP | Data | - ------------------------------------------------ - |<- authenticated except for mutable fields -->| - - | in the new IP hdr | - - -------------------------------------------------------------- - IPv6 | | ext hdrs*| | | ext hdrs*| | | - |new IP hdr*|if present| AH |orig IP hdr*|if present|TCP|Data| - -------------------------------------------------------------- - |<-- authenticated except for mutable fields in new IP hdr ->| - - * = construction of outer IP hdr/extensions and modification - of inner IP hdr/extensions is discussed below. - FIGURE 12: IPsec tunnel and transport modes for AH. (Adapted from RFC 2402)+FIGURE 12: IPsec tunnel and transport modes for AH. (Adapted from RFC 4302) |
+ |
ORIGINAL PACKET BEFORE APPLYING ESP @@ -2416,17 +2485,17 @@ Note, in particular, that the address fields are not mutable. ------------------------------------------------- IPv4 |orig IP hdr | ESP | | | ESP | ESP| - |(any options)| Hdr | TCP | Data | Trailer |Auth| + |(any options)| Hdr | TCP | Data | Trailer | ICV| ------------------------------------------------- - |<----- encrypted ---->| - |<------ authenticated ----->| + |<---- encryption ---->| + |<-------- integrity ------->| --------------------------------------------------------- - IPv6 | orig |hop-by-hop,dest*,|ESP|dest| | | ESP | ESP| - |IP hdr|routing,fragment.|hdr|opt*|TCP|Data|Trailer|Auth| + IPv6 | orig |hop-by-hop,dest*,| |dest| | | ESP | ESP| + |IP hdr|routing,fragment.|ESP|opt*|TCP|Data|Trailer| ICV| --------------------------------------------------------- - |<---- encrypted ---->| - |<---- authenticated ---->| + |<--- encryption ---->| + |<------ integrity ------>| * = if present, could be before ESP, after ESP, or both @@ -2434,24 +2503,27 @@ Note, in particular, that the address fields are not mutable. AFTER APPLYING ESP (TUNNEL MODE) ----------------------------------------------------------- - IPv4 | new IP hdr | ESP | orig IP hdr | | | ESP | ESP| - |(any options)| hdr | (any options) |TCP|Data|Trailer|Auth| + IPv4 | new IP hdr+ | | orig IP hdr+ | | | ESP | ESP| + |(any options)| ESP | (any options) |TCP|Data|Trailer| ICV| ----------------------------------------------------------- - |<--------- encrypted ---------->| - |<----------- authenticated ---------->| + |<--------- encryption --------->| + |<------------- integrity ------------>| ------------------------------------------------------------ - IPv6 | new+ |new ext |ESP| orig+|orig ext | | | ESP | ESP| - |IP hdr| hdrs+ |hdr|IP hdr| hdrs+ |TCP|Data|Trailer|Auth| + IPv6 | new+ |new ext | | orig+|orig ext | | | ESP | ESP| + |IP hdr| hdrs+ |ESP|IP hdr| hdrs+ |TCP|Data|Trailer| ICV| ------------------------------------------------------------ - |<--------- encrypted ----------->| - |<---------- authenticated ---------->| + |<--------- encryption ---------->| + |<------------ integrity ------------>| + + + = if present, construction of outer IP hdr/extensions and + modification of inner IP hdr/extensions is discussed in + the Security Architecture document. - + = if present - FIGURE 13: IPsec tunnel and transport modes for ESP. (Adapted from RFC 2406)+FIGURE 13: IPsec tunnel and transport modes for ESP. (Adapted from RFC 4303) |
-![]() ![]() FIGURE 14: SSL v3 configuration screen (Netscape Navigator). |
@@ -2773,7 +2844,7 @@ changes the shape of the curve, and small changes in these parameters
can result in major changes in the set of (x,y) solutions.
diff --git a/www/test_dir/health.sh b/www/test_dir/health.sh index 0784c7e3a..1697e2d09 100755 --- a/www/test_dir/health.sh +++ b/www/test_dir/health.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo "Content-type: text/html" +echo "Content-Type: text/html" echo echo " System Health for '`hostname`'" |