diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/openssh/README | 4 | ||||
-rw-r--r-- | crypto/openssh/atomicio.c | 7 | ||||
-rw-r--r-- | crypto/openssh/auth-rh-rsa.c | 40 | ||||
-rw-r--r-- | crypto/openssh/channels.c | 6 | ||||
-rw-r--r-- | crypto/openssh/compress.c | 12 | ||||
-rw-r--r-- | crypto/openssh/hostfile.c | 193 | ||||
-rw-r--r-- | crypto/openssh/hostfile.h | 22 | ||||
-rw-r--r-- | crypto/openssh/key.c | 290 | ||||
-rw-r--r-- | crypto/openssh/key.h | 23 | ||||
-rw-r--r-- | crypto/openssh/lib/Makefile | 5 | ||||
-rw-r--r-- | crypto/openssh/log-client.c | 6 | ||||
-rw-r--r-- | crypto/openssh/log-server.c | 8 | ||||
-rw-r--r-- | crypto/openssh/match.c | 61 | ||||
-rw-r--r-- | crypto/openssh/match.h | 18 | ||||
-rw-r--r-- | crypto/openssh/radix.c | 4 | ||||
-rw-r--r-- | crypto/openssh/scp.1 | 29 | ||||
-rw-r--r-- | crypto/openssh/scp.c | 8 | ||||
-rw-r--r-- | crypto/openssh/ssh-add.1 | 33 | ||||
-rw-r--r-- | crypto/openssh/ssh-agent.1 | 52 | ||||
-rw-r--r-- | crypto/openssh/ssh-keygen.1 | 62 | ||||
-rw-r--r-- | crypto/openssh/ssh-keygen.c | 5 | ||||
-rw-r--r-- | crypto/openssh/ssh/Makefile | 2 | ||||
-rw-r--r-- | crypto/openssh/sshd/Makefile | 8 | ||||
-rw-r--r-- | crypto/openssh/version.h | 2 |
24 files changed, 628 insertions, 272 deletions
diff --git a/crypto/openssh/README b/crypto/openssh/README index 04c733c..70dd612 100644 --- a/crypto/openssh/README +++ b/crypto/openssh/README @@ -1,3 +1,7 @@ + +[ Please note that this file has not been updated for OpenSSH and + covers the ssh-1.2.12 release from Dec 1995 only. ] + Ssh (Secure Shell) is a program to log into another computer over a network, to execute commands in a remote machine, and to move files from one machine to another. It provides strong authentication and diff --git a/crypto/openssh/atomicio.c b/crypto/openssh/atomicio.c index 01c1f62..668d490 100644 --- a/crypto/openssh/atomicio.c +++ b/crypto/openssh/atomicio.c @@ -24,7 +24,7 @@ */ #include "includes.h" -RCSID("$Id: atomicio.c,v 1.2 2000/02/01 22:32:53 d Exp $"); +RCSID("$Id: atomicio.c,v 1.3 2000/03/16 20:56:13 markus Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -33,12 +33,13 @@ RCSID("$Id: atomicio.c,v 1.2 2000/02/01 22:32:53 d Exp $"); * ensure all of data on socket comes through. f==read || f==write */ ssize_t -atomicio(f, fd, s, n) +atomicio(f, fd, _s, n) ssize_t (*f) (); int fd; - void *s; + void *_s; size_t n; { + char *s = _s; ssize_t res, pos = 0; while (n > pos) { diff --git a/crypto/openssh/auth-rh-rsa.c b/crypto/openssh/auth-rh-rsa.c index a9195f0..b7adab7b 100644 --- a/crypto/openssh/auth-rh-rsa.c +++ b/crypto/openssh/auth-rh-rsa.c @@ -15,7 +15,7 @@ */ #include "includes.h" -RCSID("$Id: auth-rh-rsa.c,v 1.10 1999/11/24 19:53:43 markus Exp $"); +RCSID("$Id: auth-rh-rsa.c,v 1.11 2000/03/23 22:15:33 markus Exp $"); #include "packet.h" #include "ssh.h" @@ -23,37 +23,46 @@ RCSID("$Id: auth-rh-rsa.c,v 1.10 1999/11/24 19:53:43 markus Exp $"); #include "uidswap.h" #include "servconf.h" +#include <ssl/rsa.h> +#include <ssl/dsa.h> +#include "key.h" +#include "hostfile.h" + /* * Tries to authenticate the user using the .rhosts file and the host using * its host key. Returns true if authentication succeeds. */ int -auth_rhosts_rsa(struct passwd *pw, const char *client_user, - BIGNUM *client_host_key_e, BIGNUM *client_host_key_n) +auth_rhosts_rsa(struct passwd *pw, const char *client_user, RSA *client_host_key) { extern ServerOptions options; const char *canonical_hostname; HostStatus host_status; - BIGNUM *ke, *kn; + Key *client_key, *found; debug("Trying rhosts with RSA host authentication for %.100s", client_user); + if (client_host_key == NULL) + return 0; + /* Check if we would accept it using rhosts authentication. */ if (!auth_rhosts(pw, client_user)) return 0; canonical_hostname = get_canonical_hostname(); - debug("Rhosts RSA authentication: canonical host %.900s", - canonical_hostname); + debug("Rhosts RSA authentication: canonical host %.900s", canonical_hostname); + + /* wrap the RSA key into a 'generic' key */ + client_key = key_new(KEY_RSA); + BN_copy(client_key->rsa->e, client_host_key->e); + BN_copy(client_key->rsa->n, client_host_key->n); + found = key_new(KEY_RSA); /* Check if we know the host and its host key. */ - ke = BN_new(); - kn = BN_new(); host_status = check_host_in_hostfile(SSH_SYSTEM_HOSTFILE, canonical_hostname, - client_host_key_e, client_host_key_n, - ke, kn); + client_key, found); /* Check user host file unless ignored. */ if (host_status != HOST_OK && !options.ignore_user_known_hosts) { @@ -73,14 +82,13 @@ auth_rhosts_rsa(struct passwd *pw, const char *client_user, /* XXX race between stat and the following open() */ temporarily_use_uid(pw->pw_uid); host_status = check_host_in_hostfile(user_hostfile, canonical_hostname, - client_host_key_e, client_host_key_n, - ke, kn); + client_key, found); restore_uid(); } xfree(user_hostfile); } - BN_free(ke); - BN_free(kn); + key_free(client_key); + key_free(found); if (host_status != HOST_OK) { debug("Rhosts with RSA host authentication denied: unknown or invalid host key"); @@ -90,7 +98,7 @@ auth_rhosts_rsa(struct passwd *pw, const char *client_user, /* A matching host key was found and is known. */ /* Perform the challenge-response dialog with the client for the host key. */ - if (!auth_rsa_challenge_dialog(client_host_key_e, client_host_key_n)) { + if (!auth_rsa_challenge_dialog(client_host_key)) { log("Client on %.800s failed to respond correctly to host authentication.", canonical_hostname); return 0; @@ -101,7 +109,7 @@ auth_rhosts_rsa(struct passwd *pw, const char *client_user, */ verbose("Rhosts with RSA host authentication accepted for %.100s, %.100s on %.700s.", - pw->pw_name, client_user, canonical_hostname); + pw->pw_name, client_user, canonical_hostname); packet_send_debug("Rhosts with RSA host authentication accepted."); return 1; } diff --git a/crypto/openssh/channels.c b/crypto/openssh/channels.c index b40e965..62b6a22 100644 --- a/crypto/openssh/channels.c +++ b/crypto/openssh/channels.c @@ -16,7 +16,7 @@ */ #include "includes.h" -RCSID("$Id: channels.c,v 1.38 2000/01/24 20:37:29 markus Exp $"); +RCSID("$Id: channels.c,v 1.39 2000/03/16 20:56:14 markus Exp $"); #include "ssh.h" #include "packet.h" @@ -1037,7 +1037,7 @@ channel_input_port_open(int payload_len) int remote_channel, sock = 0, newch, i; u_short host_port; char *host, *originator_string; - int host_len, originator_len; + unsigned int host_len, originator_len; struct addrinfo hints, *ai, *aitop; char ntop[NI_MAXHOST], strport[NI_MAXSERV]; int gaierr; @@ -1284,7 +1284,7 @@ x11_input_open(int payload_len) int remote_channel, display_number, sock = 0, newch; const char *display; char buf[1024], *cp, *remote_host; - int remote_len; + unsigned int remote_len; struct addrinfo hints, *ai, *aitop; char strport[NI_MAXSERV]; int gaierr; diff --git a/crypto/openssh/compress.c b/crypto/openssh/compress.c index f4a8785..03e5081 100644 --- a/crypto/openssh/compress.c +++ b/crypto/openssh/compress.c @@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$Id: compress.c,v 1.4 1999/11/24 19:53:46 markus Exp $"); +RCSID("$Id: compress.c,v 1.5 2000/03/16 20:56:14 markus Exp $"); #include "ssh.h" #include "buffer.h" @@ -75,13 +75,13 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer) return; /* Input is the contents of the input buffer. */ - outgoing_stream.next_in = buffer_ptr(input_buffer); + outgoing_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); outgoing_stream.avail_in = buffer_len(input_buffer); /* Loop compressing until deflate() returns with avail_out != 0. */ do { /* Set up fixed-size output buffer. */ - outgoing_stream.next_out = buf; + outgoing_stream.next_out = (unsigned char *)buf; outgoing_stream.avail_out = sizeof(buf); /* Compress as much data into the buffer as possible. */ @@ -124,10 +124,10 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) char buf[4096]; int status; - incoming_stream.next_in = buffer_ptr(input_buffer); + incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); incoming_stream.avail_in = buffer_len(input_buffer); - incoming_stream.next_out = buf; + incoming_stream.next_out = (unsigned char *) buf; incoming_stream.avail_out = sizeof(buf); for (;;) { @@ -136,7 +136,7 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) case Z_OK: buffer_append(output_buffer, buf, sizeof(buf) - incoming_stream.avail_out); - incoming_stream.next_out = buf; + incoming_stream.next_out = (unsigned char *) buf; incoming_stream.avail_out = sizeof(buf); break; case Z_STREAM_END: diff --git a/crypto/openssh/hostfile.c b/crypto/openssh/hostfile.c index ea92fa0..eca68da 100644 --- a/crypto/openssh/hostfile.c +++ b/crypto/openssh/hostfile.c @@ -14,63 +14,23 @@ */ #include "includes.h" -RCSID("$OpenBSD: hostfile.c,v 1.13 2000/02/18 10:20:20 markus Exp $"); +RCSID("$OpenBSD: hostfile.c,v 1.14 2000/03/23 22:15:33 markus Exp $"); #include "packet.h" +#include "match.h" #include "ssh.h" +#include <ssl/rsa.h> +#include <ssl/dsa.h> +#include "key.h" +#include "hostfile.h" /* - * Reads a multiple-precision integer in decimal from the buffer, and advances - * the pointer. The integer must already be initialized. This function is - * permitted to modify the buffer. This leaves *cpp to point just beyond the - * last processed (and maybe modified) character. Note that this may modify - * the buffer containing the number. + * Parses an RSA (number of bits, e, n) or DSA key from a string. Moves the + * pointer over the key. Skips any whitespace at the beginning and at end. */ int -auth_rsa_read_bignum(char **cpp, BIGNUM * value) -{ - char *cp = *cpp; - int old; - - /* Skip any leading whitespace. */ - for (; *cp == ' ' || *cp == '\t'; cp++) - ; - - /* Check that it begins with a decimal digit. */ - if (*cp < '0' || *cp > '9') - return 0; - - /* Save starting position. */ - *cpp = cp; - - /* Move forward until all decimal digits skipped. */ - for (; *cp >= '0' && *cp <= '9'; cp++) - ; - - /* Save the old terminating character, and replace it by \0. */ - old = *cp; - *cp = 0; - - /* Parse the number. */ - if (BN_dec2bn(&value, *cpp) == 0) - return 0; - - /* Restore old terminating character. */ - *cp = old; - - /* Move beyond the number and return success. */ - *cpp = cp; - return 1; -} - -/* - * Parses an RSA key (number of bits, e, n) from a string. Moves the pointer - * over the key. Skips any whitespace at the beginning and at end. - */ - -int -auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n) +hostfile_read_key(char **cpp, unsigned int *bitsp, Key *ret) { unsigned int bits; char *cp; @@ -85,12 +45,7 @@ auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n) for (bits = 0; *cp >= '0' && *cp <= '9'; cp++) bits = 10 * bits + *cp - '0'; - /* Get public exponent. */ - if (!auth_rsa_read_bignum(&cp, e)) - return 0; - - /* Get public modulus. */ - if (!auth_rsa_read_bignum(&cp, n)) + if (!key_read(ret, bits, &cp)) return 0; /* Skip trailing whitespace. */ @@ -103,63 +58,30 @@ auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n) return 1; } -/* - * Tries to match the host name (which must be in all lowercase) against the - * comma-separated sequence of subpatterns (each possibly preceded by ! to - * indicate negation). Returns true if there is a positive match; zero - * otherwise. - */ - int -match_hostname(const char *host, const char *pattern, unsigned int len) +auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n) { - char sub[1024]; - int negated; - int got_positive; - unsigned int i, subi; - - got_positive = 0; - for (i = 0; i < len;) { - /* Check if the subpattern is negated. */ - if (pattern[i] == '!') { - negated = 1; - i++; - } else - negated = 0; - - /* - * Extract the subpattern up to a comma or end. Convert the - * subpattern to lowercase. - */ - for (subi = 0; - i < len && subi < sizeof(sub) - 1 && pattern[i] != ','; - subi++, i++) - sub[subi] = isupper(pattern[i]) ? tolower(pattern[i]) : pattern[i]; - /* If subpattern too long, return failure (no match). */ - if (subi >= sizeof(sub) - 1) - return 0; - - /* If the subpattern was terminated by a comma, skip the comma. */ - if (i < len && pattern[i] == ',') - i++; - - /* Null-terminate the subpattern. */ - sub[subi] = '\0'; + Key *k = key_new(KEY_RSA); + int ret = hostfile_read_key(cpp, bitsp, k); + BN_copy(e, k->rsa->e); + BN_copy(n, k->rsa->n); + key_free(k); + return ret; +} - /* Try to match the subpattern against the host name. */ - if (match_pattern(host, sub)) { - if (negated) - return 0; /* Fail */ - else - got_positive = 1; - } +int +hostfile_check_key(int bits, Key *key, const char *host, const char *filename, int linenum) +{ + if (key == NULL || key->type != KEY_RSA || key->rsa == NULL) + return 1; + if (bits != BN_num_bits(key->rsa->n)) { + error("Warning: %s, line %d: keysize mismatch for host %s: " + "actual %d vs. announced %d.", + filename, linenum, host, BN_num_bits(key->rsa->n), bits); + error("Warning: replace %d with %d in %s, line %d.", + bits, BN_num_bits(key->rsa->n), filename, linenum); } - - /* - * Return success if got a positive match. If there was a negative - * match, we have already returned zero and never get here. - */ - return got_positive; + return 1; } /* @@ -170,8 +92,7 @@ match_hostname(const char *host, const char *pattern, unsigned int len) */ HostStatus -check_host_in_hostfile(const char *filename, const char *host, - BIGNUM * e, BIGNUM * n, BIGNUM * ke, BIGNUM * kn) +check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found) { FILE *f; char line[8192]; @@ -180,6 +101,8 @@ check_host_in_hostfile(const char *filename, const char *host, char *cp, *cp2; HostStatus end_return; + if (key == NULL) + fatal("no key to look up"); /* Open the file containing the list of known hosts. */ f = fopen(filename, "r"); if (!f) @@ -221,18 +144,13 @@ check_host_in_hostfile(const char *filename, const char *host, * Extract the key from the line. This will skip any leading * whitespace. Ignore badly formatted lines. */ - if (!auth_rsa_read_key(&cp, &kbits, ke, kn)) + if (!hostfile_read_key(&cp, &kbits, found)) + continue; + if (!hostfile_check_key(kbits, found, host, filename, linenum)) continue; - if (kbits != BN_num_bits(kn)) { - error("Warning: %s, line %d: keysize mismatch for host %s: " - "actual %d vs. announced %d.", - filename, linenum, host, BN_num_bits(kn), kbits); - error("Warning: replace %d with %d in %s, line %d.", - kbits, BN_num_bits(kn), filename, linenum); - } /* Check if the current key is the same as the given key. */ - if (BN_cmp(ke, e) == 0 && BN_cmp(kn, n) == 0) { + if (key_equal(key, found)) { /* Ok, they match. */ fclose(f); return HOST_OK; @@ -260,41 +178,28 @@ check_host_in_hostfile(const char *filename, const char *host, */ int -add_host_to_hostfile(const char *filename, const char *host, - BIGNUM * e, BIGNUM * n) +add_host_to_hostfile(const char *filename, const char *host, Key *key) { FILE *f; - char *buf; - unsigned int bits; + int success = 0; + + if (key == NULL) + return 1; /* Open the file for appending. */ f = fopen(filename, "a"); if (!f) return 0; - /* size of modulus 'n' */ - bits = BN_num_bits(n); - - /* Print the host name and key to the file. */ - fprintf(f, "%s %u ", host, bits); - buf = BN_bn2dec(e); - if (buf == NULL) { - error("add_host_to_hostfile: BN_bn2dec(e) failed"); - fclose(f); - return 0; + fprintf(f, "%s ", host); + if (key_write(key, f)) { + fprintf(f, "\n"); + success = 1; + } else { + error("add_host_to_hostfile: saving key failed"); } - fprintf(f, "%s ", buf); - free(buf); - buf = BN_bn2dec(n); - if (buf == NULL) { - error("add_host_to_hostfile: BN_bn2dec(n) failed"); - fclose(f); - return 0; - } - fprintf(f, "%s\n", buf); - free(buf); /* Close the file. */ fclose(f); - return 1; + return success; } diff --git a/crypto/openssh/hostfile.h b/crypto/openssh/hostfile.h new file mode 100644 index 0000000..64fe185 --- /dev/null +++ b/crypto/openssh/hostfile.h @@ -0,0 +1,22 @@ +#ifndef HOSTFILE_H +#define HOSTFILE_H + +/* + * Checks whether the given host is already in the list of our known hosts. + * Returns HOST_OK if the host is known and has the specified key, HOST_NEW + * if the host is not known, and HOST_CHANGED if the host is known but used + * to have a different host key. The host must be in all lowercase. + */ +typedef enum { + HOST_OK, HOST_NEW, HOST_CHANGED +} HostStatus; +HostStatus +check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found); + +/* + * Appends an entry to the host file. Returns false if the entry could not + * be appended. + */ +int add_host_to_hostfile(const char *filename, const char *host, Key *key); + +#endif diff --git a/crypto/openssh/key.c b/crypto/openssh/key.c new file mode 100644 index 0000000..6ad35cb --- /dev/null +++ b/crypto/openssh/key.c @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2000 Markus Friedl. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Markus Friedl. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * read_bignum(): + * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland + */ + +#include "includes.h" +#include "ssh.h" +#include <ssl/rsa.h> +#include <ssl/dsa.h> +#include <ssl/evp.h> +#include "xmalloc.h" +#include "key.h" + +Key * +key_new(int type) +{ + Key *k; + RSA *rsa; + DSA *dsa; + k = xmalloc(sizeof(*k)); + k->type = type; + switch (k->type) { + case KEY_RSA: + rsa = RSA_new(); + rsa->n = BN_new(); + rsa->e = BN_new(); + k->rsa = rsa; + break; + case KEY_DSA: + dsa = DSA_new(); + dsa->p = BN_new(); + dsa->q = BN_new(); + dsa->g = BN_new(); + dsa->pub_key = BN_new(); + k->dsa = dsa; + break; + case KEY_EMPTY: + k->dsa = NULL; + k->rsa = NULL; + break; + default: + fatal("key_new: bad key type %d", k->type); + break; + } + return k; +} +void +key_free(Key *k) +{ + switch (k->type) { + case KEY_RSA: + if (k->rsa != NULL) + RSA_free(k->rsa); + k->rsa = NULL; + break; + case KEY_DSA: + if (k->dsa != NULL) + DSA_free(k->dsa); + k->dsa = NULL; + break; + default: + fatal("key_free: bad key type %d", k->type); + break; + } + xfree(k); +} +int +key_equal(Key *a, Key *b) +{ + if (a == NULL || b == NULL || a->type != b->type) + return 0; + switch (a->type) { + case KEY_RSA: + return a->rsa != NULL && b->rsa != NULL && + BN_cmp(a->rsa->e, b->rsa->e) == 0 && + BN_cmp(a->rsa->n, b->rsa->n) == 0; + break; + case KEY_DSA: + return a->dsa != NULL && b->dsa != NULL && + BN_cmp(a->dsa->p, b->dsa->p) == 0 && + BN_cmp(a->dsa->q, b->dsa->q) == 0 && + BN_cmp(a->dsa->g, b->dsa->g) == 0 && + BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0; + break; + default: + fatal("key_free: bad key type %d", a->type); + break; + } + return 0; +} + +#define FPRINT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" + +/* + * Generate key fingerprint in ascii format. + * Based on ideas and code from Bjoern Groenvall <bg@sics.se> + */ +char * +key_fingerprint(Key *k) +{ + static char retval[80]; + unsigned char *buf = NULL; + int len = 0; + int nlen, elen, plen, qlen, glen, publen; + + switch (k->type) { + case KEY_RSA: + nlen = BN_num_bytes(k->rsa->n); + elen = BN_num_bytes(k->rsa->e); + len = nlen + elen; + buf = xmalloc(len); + BN_bn2bin(k->rsa->n, buf); + BN_bn2bin(k->rsa->e, buf + nlen); + break; + case KEY_DSA: + plen = BN_num_bytes(k->dsa->p); + qlen = BN_num_bytes(k->dsa->q); + glen = BN_num_bytes(k->dsa->g); + publen = BN_num_bytes(k->dsa->pub_key); + len = qlen + qlen + glen + publen; + buf = xmalloc(len); + BN_bn2bin(k->dsa->p, buf); + BN_bn2bin(k->dsa->q, buf + plen); + BN_bn2bin(k->dsa->g, buf + plen + qlen); + BN_bn2bin(k->dsa->pub_key , buf + plen + qlen + glen); + break; + default: + fatal("key_fingerprint: bad key type %d", k->type); + break; + } + if (buf != NULL) { + unsigned char d[16]; + EVP_MD_CTX md; + EVP_DigestInit(&md, EVP_md5()); + EVP_DigestUpdate(&md, buf, len); + EVP_DigestFinal(&md, d, NULL); + snprintf(retval, sizeof(retval), FPRINT, + d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], + d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); + memset(buf, 0, len); + xfree(buf); + } + return retval; +} + +/* + * Reads a multiple-precision integer in decimal from the buffer, and advances + * the pointer. The integer must already be initialized. This function is + * permitted to modify the buffer. This leaves *cpp to point just beyond the + * last processed (and maybe modified) character. Note that this may modify + * the buffer containing the number. + */ +int +read_bignum(char **cpp, BIGNUM * value) +{ + char *cp = *cpp; + int old; + + /* Skip any leading whitespace. */ + for (; *cp == ' ' || *cp == '\t'; cp++) + ; + + /* Check that it begins with a decimal digit. */ + if (*cp < '0' || *cp > '9') + return 0; + + /* Save starting position. */ + *cpp = cp; + + /* Move forward until all decimal digits skipped. */ + for (; *cp >= '0' && *cp <= '9'; cp++) + ; + + /* Save the old terminating character, and replace it by \0. */ + old = *cp; + *cp = 0; + + /* Parse the number. */ + if (BN_dec2bn(&value, *cpp) == 0) + return 0; + + /* Restore old terminating character. */ + *cp = old; + + /* Move beyond the number and return success. */ + *cpp = cp; + return 1; +} +int +write_bignum(FILE *f, BIGNUM *num) +{ + char *buf = BN_bn2dec(num); + if (buf == NULL) { + error("write_bignum: BN_bn2dec() failed"); + return 0; + } + fprintf(f, " %s", buf); + free(buf); + return 1; +} +int +key_read(Key *ret, unsigned int bits, char **cpp) +{ + switch(ret->type) { + case KEY_RSA: + if (bits == 0) + return 0; + /* Get public exponent, public modulus. */ + if (!read_bignum(cpp, ret->rsa->e)) + return 0; + if (!read_bignum(cpp, ret->rsa->n)) + return 0; + break; + case KEY_DSA: + if (bits != 0) + return 0; + if (!read_bignum(cpp, ret->dsa->p)) + return 0; + if (!read_bignum(cpp, ret->dsa->q)) + return 0; + if (!read_bignum(cpp, ret->dsa->g)) + return 0; + if (!read_bignum(cpp, ret->dsa->pub_key)) + return 0; + break; + default: + fatal("bad key type: %d", ret->type); + break; + } + return 1; +} +int +key_write(Key *key, FILE *f) +{ + int success = 0; + unsigned int bits = 0; + + if (key->type == KEY_RSA && key->rsa != NULL) { + /* size of modulus 'n' */ + bits = BN_num_bits(key->rsa->n); + fprintf(f, "%u", bits); + if (write_bignum(f, key->rsa->e) && + write_bignum(f, key->rsa->n)) { + success = 1; + } else { + error("key_write: failed for RSA key"); + } + } else if (key->type == KEY_DSA && key->dsa != NULL) { + /* bits == 0 means DSA key */ + bits = 0; + fprintf(f, "%u", bits); + if (write_bignum(f, key->dsa->p) && + write_bignum(f, key->dsa->q) && + write_bignum(f, key->dsa->g) && + write_bignum(f, key->dsa->pub_key)) { + success = 1; + } else { + error("key_write: failed for DSA key"); + } + } + return success; +} diff --git a/crypto/openssh/key.h b/crypto/openssh/key.h new file mode 100644 index 0000000..70f0c51 --- /dev/null +++ b/crypto/openssh/key.h @@ -0,0 +1,23 @@ +#ifndef KEY_H +#define KEY_H + +typedef struct Key Key; +enum types { + KEY_RSA, + KEY_DSA, + KEY_EMPTY +}; +struct Key { + int type; + RSA *rsa; + DSA *dsa; +}; + +Key *key_new(int type); +void key_free(Key *k); +int key_equal(Key *a, Key *b); +char *key_fingerprint(Key *k); +int key_write(Key *key, FILE *f); +int key_read(Key *key, unsigned int bits, char **cpp); + +#endif diff --git a/crypto/openssh/lib/Makefile b/crypto/openssh/lib/Makefile index 8f7e4f7..4a9ce1c 100644 --- a/crypto/openssh/lib/Makefile +++ b/crypto/openssh/lib/Makefile @@ -4,7 +4,8 @@ LIB= ssh SRCS= authfd.c authfile.c bufaux.c buffer.c canohost.c channels.c \ cipher.c compat.c compress.c crc32.c deattack.c fingerprint.c \ hostfile.c log.c match.c mpaux.c nchan.c packet.c readpass.c \ - rsa.c tildexpand.c ttymodes.c uidswap.c xmalloc.c atomicio.c + rsa.c tildexpand.c ttymodes.c uidswap.c xmalloc.c atomicio.c \ + key.c NOPROFILE= yes NOPIC= yes @@ -15,7 +16,7 @@ install: .include <bsd.own.mk> .if (${KERBEROS} == "yes") -CFLAGS+= -DKRB4 -I/usr/include/kerberosIV +CFLAGS+= -DKRB4 -I${DESTDIR}/usr/include/kerberosIV .if (${AFS} == "yes") CFLAGS+= -DAFS SRCS+= radix.c diff --git a/crypto/openssh/log-client.c b/crypto/openssh/log-client.c index 62709d9..9e20a31 100644 --- a/crypto/openssh/log-client.c +++ b/crypto/openssh/log-client.c @@ -15,7 +15,7 @@ */ #include "includes.h" -RCSID("$Id: log-client.c,v 1.6 1999/11/24 00:26:02 deraadt Exp $"); +RCSID("$Id: log-client.c,v 1.7 2000/02/27 18:50:09 deraadt Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -45,12 +45,12 @@ log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2) } } -#define MSGBUFSIZE 1024 +#define MSGBUFSIZ 1024 void do_log(LogLevel level, const char *fmt, va_list args) { - char msgbuf[MSGBUFSIZE]; + char msgbuf[MSGBUFSIZ]; if (level > log_level) return; diff --git a/crypto/openssh/log-server.c b/crypto/openssh/log-server.c index 52f56a3..124d7fe 100644 --- a/crypto/openssh/log-server.c +++ b/crypto/openssh/log-server.c @@ -15,7 +15,7 @@ */ #include "includes.h" -RCSID("$Id: log-server.c,v 1.11 1999/11/24 00:26:02 deraadt Exp $"); +RCSID("$Id: log-server.c,v 1.12 2000/02/27 18:50:09 deraadt Exp $"); #include <syslog.h> #include "packet.h" @@ -91,13 +91,13 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) log_on_stderr = on_stderr; } -#define MSGBUFSIZE 1024 +#define MSGBUFSIZ 1024 void do_log(LogLevel level, const char *fmt, va_list args) { - char msgbuf[MSGBUFSIZE]; - char fmtbuf[MSGBUFSIZE]; + char msgbuf[MSGBUFSIZ]; + char fmtbuf[MSGBUFSIZ]; char *txt = NULL; int pri = LOG_INFO; extern char *__progname; diff --git a/crypto/openssh/match.c b/crypto/openssh/match.c index 7a63be6..aadcfd6 100644 --- a/crypto/openssh/match.c +++ b/crypto/openssh/match.c @@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$Id: match.c,v 1.4 1999/11/24 19:53:48 markus Exp $"); +RCSID("$Id: match.c,v 1.5 2000/03/23 22:15:33 markus Exp $"); #include "ssh.h" @@ -80,3 +80,62 @@ match_pattern(const char *s, const char *pattern) } /* NOTREACHED */ } + +/* + * Tries to match the host name (which must be in all lowercase) against the + * comma-separated sequence of subpatterns (each possibly preceded by ! to + * indicate negation). Returns true if there is a positive match; zero + * otherwise. + */ + +int +match_hostname(const char *host, const char *pattern, unsigned int len) +{ + char sub[1024]; + int negated; + int got_positive; + unsigned int i, subi; + + got_positive = 0; + for (i = 0; i < len;) { + /* Check if the subpattern is negated. */ + if (pattern[i] == '!') { + negated = 1; + i++; + } else + negated = 0; + + /* + * Extract the subpattern up to a comma or end. Convert the + * subpattern to lowercase. + */ + for (subi = 0; + i < len && subi < sizeof(sub) - 1 && pattern[i] != ','; + subi++, i++) + sub[subi] = isupper(pattern[i]) ? tolower(pattern[i]) : pattern[i]; + /* If subpattern too long, return failure (no match). */ + if (subi >= sizeof(sub) - 1) + return 0; + + /* If the subpattern was terminated by a comma, skip the comma. */ + if (i < len && pattern[i] == ',') + i++; + + /* Null-terminate the subpattern. */ + sub[subi] = '\0'; + + /* Try to match the subpattern against the host name. */ + if (match_pattern(host, sub)) { + if (negated) + return 0; /* Fail */ + else + got_positive = 1; + } + } + + /* + * Return success if got a positive match. If there was a negative + * match, we have already returned zero and never get here. + */ + return got_positive; +} diff --git a/crypto/openssh/match.h b/crypto/openssh/match.h new file mode 100644 index 0000000..4625d97 --- /dev/null +++ b/crypto/openssh/match.h @@ -0,0 +1,18 @@ +#ifndef MATCH_H +#define MATCH_H + +/* + * Returns true if the given string matches the pattern (which may contain ? + * and * as wildcards), and zero if it does not match. + */ +int match_pattern(const char *s, const char *pattern); + +/* + * Tries to match the host name (which must be in all lowercase) against the + * comma-separated sequence of subpatterns (each possibly preceded by ! to + * indicate negation). Returns true if there is a positive match; zero + * otherwise. + */ +int match_hostname(const char *host, const char *pattern, unsigned int len); + +#endif diff --git a/crypto/openssh/radix.c b/crypto/openssh/radix.c index c87dd2d..ea7f5ba 100644 --- a/crypto/openssh/radix.c +++ b/crypto/openssh/radix.c @@ -213,7 +213,7 @@ creds_to_radix(CREDENTIALS *creds, unsigned char *buf) p += creds->ticket_st.length; len = p - temp; - return (uuencode(temp, len, buf)); + return (uuencode((unsigned char *)temp, len, (char *)buf)); } int @@ -225,7 +225,7 @@ radix_to_creds(const char *buf, CREDENTIALS *creds) char version; char temp[2048]; - if (!(len = uudecode(buf, temp, sizeof(temp)))) + if (!(len = uudecode(buf, (unsigned char *)temp, sizeof(temp)))) return 0; p = temp; diff --git a/crypto/openssh/scp.1 b/crypto/openssh/scp.1 index d4c374e..8e93e23 100644 --- a/crypto/openssh/scp.1 +++ b/crypto/openssh/scp.1 @@ -9,7 +9,7 @@ .\" .\" Created: Sun May 7 00:14:37 1995 ylo .\" -.\" $Id: scp.1,v 1.5 2000/01/04 16:57:16 markus Exp $ +.\" $Id: scp.1,v 1.6 2000/03/23 21:10:09 aaron Exp $ .\" .Dd September 25, 1999 .Dt SCP 1 @@ -38,7 +38,8 @@ .Sm on .Sh DESCRIPTION .Nm -copies files between hosts on a network. It uses +copies files between hosts on a network. +It uses .Xr ssh 1 for data transfer, and uses the same authentication and provides the same security as @@ -50,18 +51,19 @@ will ask for passwords or passphrases if they are needed for authentication. .Pp Any file name may contain a host and user specification to indicate -that the file is to be copied to/from that host. Copies between two -remote hosts are permitted. +that the file is to be copied to/from that host. +Copies between two remote hosts are permitted. .Pp The options are as follows: .Bl -tag -width Ds .It Fl c Ar cipher -Selects the cipher to use for encrypting the data transfer. This -option is directly passed to +Selects the cipher to use for encrypting the data transfer. +This option is directly passed to .Xr ssh 1 . .It Fl i Ar identity_file Selects the file from which the identity (private key) for RSA -authentication is read. This option is directly passed to +authentication is read. +This option is directly passed to .Xr ssh 1 . .It Fl p Preserves modification times, access times, and modes from the @@ -69,25 +71,28 @@ original file. .It Fl r Recursively copy entire directories. .It Fl v -Verbose mode. Causes +Verbose mode. +Causes .Nm and .Xr ssh 1 -to print debugging messages about their progress. This is helpful in +to print debugging messages about their progress. +This is helpful in debugging connection, authentication, and configuration problems. .It Fl B Selects batch mode (prevents asking for passwords or passphrases). .It Fl q Disables the progress meter. .It Fl C -Compression enable. Passes the +Compression enable. +Passes the .Fl C flag to .Xr ssh 1 to enable compression. .It Fl P Ar port -Specifies the port to connect to on the remote host. Note that this -option is written with a capital +Specifies the port to connect to on the remote host. +Note that this option is written with a capital .Sq P , because .Fl p diff --git a/crypto/openssh/scp.c b/crypto/openssh/scp.c index 16ac0eb..915ef97 100644 --- a/crypto/openssh/scp.c +++ b/crypto/openssh/scp.c @@ -45,7 +45,7 @@ */ #include "includes.h" -RCSID("$Id: scp.c,v 1.25 2000/01/24 22:11:20 markus Exp $"); +RCSID("$Id: scp.c,v 1.26 2000/03/16 20:56:14 markus Exp $"); #include "ssh.h" #include "xmalloc.h" @@ -1006,7 +1006,7 @@ run_err(const char *fmt,...) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scp.c,v 1.25 2000/01/24 22:11:20 markus Exp $ + * $Id: scp.c,v 1.26 2000/03/16 20:56:14 markus Exp $ */ char * @@ -1118,7 +1118,7 @@ alarmtimer(int wait) } void -updateprogressmeter(void) +updateprogressmeter(int ignore) { int save_errno = errno; @@ -1224,7 +1224,7 @@ progressmeter(int flag) atomicio(write, fileno(stdout), buf, strlen(buf)); if (flag == -1) { - signal(SIGALRM, (void *) updateprogressmeter); + signal(SIGALRM, updateprogressmeter); alarmtimer(1); } else if (flag == 1) { alarmtimer(0); diff --git a/crypto/openssh/ssh-add.1 b/crypto/openssh/ssh-add.1 index 8872e71..8d1486b 100644 --- a/crypto/openssh/ssh-add.1 +++ b/crypto/openssh/ssh-add.1 @@ -9,7 +9,7 @@ .\" .\" Created: Sat Apr 22 23:55:14 1995 ylo .\" -.\" $Id: ssh-add.1,v 1.10 2000/01/22 02:17:50 aaron Exp $ +.\" $Id: ssh-add.1,v 1.11 2000/03/23 21:11:38 aaron Exp $ .\" .Dd September 25, 1999 .Dt SSH-ADD 1 @@ -27,11 +27,11 @@ adds identities to the authentication agent, .Xr ssh-agent 1 . When run without arguments, it adds the file .Pa $HOME/.ssh/identity . -Alternative file names can be given on the -command line. If any file requires a passphrase, +Alternative file names can be given on the command line. +If any file requires a passphrase, .Nm asks for the passphrase from the user. -The Passphrase it is read from the user's tty. +The Passphrase it is read from the user's tty. .Pp The authentication agent must be running and must be an ancestor of the current process for @@ -52,15 +52,15 @@ Deletes all identities from the agent. .Sh FILES .Bl -tag -width Ds .It Pa $HOME/.ssh/identity -Contains the RSA authentication identity of the user. This file -should not be readable by anyone but the user. +Contains the RSA authentication identity of the user. +This file should not be readable by anyone but the user. Note that .Nm ignores this file if it is accessible by others. It is possible to specify a passphrase when generating the key; that passphrase will be -used to encrypt the private part of this file. This is the -default file added by +used to encrypt the private part of this file. +This is the default file added by .Nm when no other files have been specified. .Pp @@ -70,7 +70,8 @@ when no other files have been specified. If .Nm needs a passphrase, it will read the passphrase from the current -terminal if it was run from a terminal. If +terminal if it was run from a terminal. +If .Nm does not have a terminal associated with it but .Ev DISPLAY @@ -78,12 +79,13 @@ and .Ev SSH_ASKPASS are set, it will execute the program specified by .Ev SSH_ASKPASS -and open an X11 window to read the passphrase. This is particularly -useful when calling +and open an X11 window to read the passphrase. +This is particularly useful when calling .Nm from a .Pa .Xsession -or related script. (Note that on some machines it +or related script. +(Note that on some machines it may be necessary to redirect the input from .Pa /dev/null to make this work.) @@ -92,9 +94,10 @@ Tatu Ylonen <ylo@cs.hut.fi> .Pp OpenSSH is a derivative of the original (free) ssh 1.2.12 release, but with bugs -removed and newer features re-added. Rapidly after the 1.2.12 release, -newer versions bore successively more restrictive licenses. This version -of OpenSSH +removed and newer features re-added. +Rapidly after the 1.2.12 release, +newer versions bore successively more restrictive licenses. +This version of OpenSSH .Bl -bullet .It has all components of a restrictive nature (i.e., patents, see diff --git a/crypto/openssh/ssh-agent.1 b/crypto/openssh/ssh-agent.1 index b98775d..7029b60 100644 --- a/crypto/openssh/ssh-agent.1 +++ b/crypto/openssh/ssh-agent.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ssh-agent.1,v 1.9 2000/01/22 02:17:50 aaron Exp $ +.\" $OpenBSD: ssh-agent.1,v 1.10 2000/03/23 21:10:10 aaron Exp $ .\" .\" -*- nroff -*- .\" @@ -27,12 +27,13 @@ .Oc .Sh DESCRIPTION .Nm -is a program to hold authentication private keys. The -idea is that +is a program to hold authentication private keys. +The idea is that .Nm is started in the beginning of an X-session or a login session, and all other windows or programs are started as clients to the ssh-agent -program. Through use of environment variables the agent can be located +program. +Through use of environment variables the agent can be located and automatically used for RSA authentication when logging in to other machines using .Xr ssh 1 . @@ -60,30 +61,34 @@ environment variable). If a commandline is given, this is executed as a subprocess of the agent. When the command dies, so does the agent. .Pp -The agent initially does not have any private keys. Keys are added -using +The agent initially does not have any private keys. +Keys are added using .Xr ssh-add 1 . When executed without arguments, .Xr ssh-add 1 adds the .Pa $HOME/.ssh/identity -file. If the identity has a passphrase, +file. +If the identity has a passphrase, .Xr ssh-add 1 asks for the passphrase (using a small X11 application if running -under X11, or from the terminal if running without X). It then sends -the identity to the agent. Several identities can be stored in the +under X11, or from the terminal if running without X). +It then sends the identity to the agent. +Several identities can be stored in the agent; the agent can automatically use any of these identities. .Ic ssh-add -l displays the identities currently held by the agent. .Pp The idea is that the agent is run in the user's local PC, laptop, or -terminal. Authentication data need not be stored on any other +terminal. +Authentication data need not be stored on any other machine, and authentication passphrases never go over the network. However, the connection to the agent is forwarded over SSH remote logins, and the user can thus use the privileges given by the identities anywhere in the network in a secure way. .Pp -There are two main ways to get an agent setup: Either you let the agent +There are two main ways to get an agent setup: +Either you let the agent start a new subcommand into which some environment variables are exported, or you let the agent print the needed shell commands (either .Xr sh 1 @@ -99,7 +104,8 @@ A unix-domain socket is created and the name of this socket is stored in the .Ev SSH_AUTH_SOCK environment -variable. The socket is made accessible only to the current user. +variable. +The socket is made accessible only to the current user. This method is easily abused by root or another instance of the same user. .Pp @@ -112,28 +118,30 @@ line terminates. .Sh FILES .Bl -tag -width Ds .It Pa $HOME/.ssh/identity -Contains the RSA authentication identity of the user. This file -should not be readable by anyone but the user. It is possible to +Contains the RSA authentication identity of the user. +This file should not be readable by anyone but the user. +It is possible to specify a passphrase when generating the key; that passphrase will be -used to encrypt the private part of this file. This file -is not used by +used to encrypt the private part of this file. +This file is not used by .Nm but is normally added to the agent using .Xr ssh-add 1 at login time. .It Pa /tmp/ssh-XXXX/agent.<pid> , Unix-domain sockets used to contain the connection to the -authentication agent. These sockets should only be readable by the -owner. The sockets should get automatically removed when the agent -exits. +authentication agent. +These sockets should only be readable by the owner. +The sockets should get automatically removed when the agent exits. .Sh AUTHOR Tatu Ylonen <ylo@cs.hut.fi> .Pp OpenSSH is a derivative of the original (free) ssh 1.2.12 release, but with bugs -removed and newer features re-added. Rapidly after the 1.2.12 release, -newer versions bore successively more restrictive licenses. This version -of OpenSSH +removed and newer features re-added. +Rapidly after the 1.2.12 release, +newer versions bore successively more restrictive licenses. +This version of OpenSSH .Bl -bullet .It has all components of a restrictive nature (i.e., patents, see diff --git a/crypto/openssh/ssh-keygen.1 b/crypto/openssh/ssh-keygen.1 index e7c837c..9036164 100644 --- a/crypto/openssh/ssh-keygen.1 +++ b/crypto/openssh/ssh-keygen.1 @@ -9,7 +9,7 @@ .\" .\" Created: Sat Apr 22 23:55:14 1995 ylo .\" -.\" $Id: ssh-keygen.1,v 1.11 2000/01/22 02:17:50 aaron Exp $ +.\" $Id: ssh-keygen.1,v 1.12 2000/03/23 21:10:10 aaron Exp $ .\" .Dd September 25, 1999 .Dt SSH-KEYGEN 1 @@ -48,27 +48,31 @@ key in Additionally, the system administrator may use this to generate host keys. .Pp Normally this program generates the key and asks for a file in which -to store the private key. The public key is stored in a file with the -same name but +to store the private key. +The public key is stored in a file with the same name but .Dq .pub -appended. The program also asks for a -passphrase. The passphrase may be empty to indicate no passphrase +appended. +The program also asks for a passphrase. +The passphrase may be empty to indicate no passphrase (host keys must have empty passphrase), or it may be a string of -arbitrary length. Good passphrases are 10-30 characters long and are +arbitrary length. +Good passphrases are 10-30 characters long and are not simple sentences or otherwise easily guessable (English prose has only 1-2 bits of entropy per word, and provides very bad -passphrases). The passphrase can be changed later by using the +passphrases). +The passphrase can be changed later by using the .Fl p option. .Pp -There is no way to recover a lost passphrase. If the passphrase is +There is no way to recover a lost passphrase. +If the passphrase is lost or forgotten, you will have to generate a new key and copy the corresponding public key to other machines. .Pp There is also a comment field in the key file that is only for -convenience to the user to help identify the key. The comment can -tell what the key is for, or whatever is useful. The comment is -initialized to +convenience to the user to help identify the key. +The comment can tell what the key is for, or whatever is useful. +The comment is initialized to .Dq user@host when the key is created, but can be changed using the .Fl c @@ -77,10 +81,11 @@ option. The options are as follows: .Bl -tag -width Ds .It Fl b Ar bits -Specifies the number of bits in the key to create. Minimum is 512 -bits. Generally 1024 bits is considered sufficient, and key sizes -above that no longer improve security but make things slower. The -default is 1024 bits. +Specifies the number of bits in the key to create. +Minimum is 512 bits. +Generally 1024 bits is considered sufficient, and key sizes +above that no longer improve security but make things slower. +The default is 1024 bits. .It Fl c Requests changing the comment in the private and public key files. The program will prompt for the file containing the private keys, for @@ -91,7 +96,8 @@ Specifies the filename of the key file. Show fingerprint of specified private or public key file. .It Fl p Requests changing the passphrase of a private key file instead of -creating a new private key. The program will prompt for the file +creating a new private key. +The program will prompt for the file containing the private key, for the old passphrase, and twice for the new passphrase. .It Fl q @@ -110,28 +116,30 @@ Provides the (old) passphrase. .Sh FILES .Bl -tag -width Ds .It Pa $HOME/.ssh/identity -Contains the RSA authentication identity of the user. This file -should not be readable by anyone but the user. It is possible to +Contains the RSA authentication identity of the user. +This file should not be readable by anyone but the user. +It is possible to specify a passphrase when generating the key; that passphrase will be -used to encrypt the private part of this file using 3DES. This file -is not automatically accessed by +used to encrypt the private part of this file using 3DES. +This file is not automatically accessed by .Nm but it is offered as the default file for the private key. .It Pa $HOME/.ssh/identity.pub -Contains the public key for authentication. The contents of this file -should be added to +Contains the public key for authentication. +The contents of this file should be added to .Pa $HOME/.ssh/authorized_keys on all machines -where you wish to log in using RSA authentication. There is no -need to keep the contents of this file secret. +where you wish to log in using RSA authentication. +There is no need to keep the contents of this file secret. .Sh AUTHOR Tatu Ylonen <ylo@cs.hut.fi> .Pp OpenSSH is a derivative of the original (free) ssh 1.2.12 release, but with bugs -removed and newer features re-added. Rapidly after the 1.2.12 release, -newer versions bore successively more restrictive licenses. This version -of OpenSSH +removed and newer features re-added. +Rapidly after the 1.2.12 release, +newer versions bore successively more restrictive licenses. +This version of OpenSSH .Bl -bullet .It has all components of a restrictive nature (i.e., patents, see diff --git a/crypto/openssh/ssh-keygen.c b/crypto/openssh/ssh-keygen.c index 93ae2da..29a967d 100644 --- a/crypto/openssh/ssh-keygen.c +++ b/crypto/openssh/ssh-keygen.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$Id: ssh-keygen.c,v 1.16 2000/02/04 14:34:09 markus Exp $"); +RCSID("$Id: ssh-keygen.c,v 1.17 2000/03/16 20:56:14 markus Exp $"); #include "rsa.h" #include "ssh.h" @@ -81,6 +81,7 @@ do_fingerprint(struct passwd *pw) RSA *public_key; char *comment = NULL, *cp, *ep, line[16*1024]; int i, skip = 0, num = 1, invalid = 1; + unsigned int ignore; struct stat st; if (!have_identity) @@ -138,7 +139,7 @@ do_fingerprint(struct passwd *pw) *cp++ = '\0'; } ep = cp; - if (auth_rsa_read_key(&cp, &i, e, n)) { + if (auth_rsa_read_key(&cp, &ignore, e, n)) { invalid = 0; comment = *cp ? cp : comment; printf("%d %s %s\n", BN_num_bits(n), diff --git a/crypto/openssh/ssh/Makefile b/crypto/openssh/ssh/Makefile index 61a38ad..b214455 100644 --- a/crypto/openssh/ssh/Makefile +++ b/crypto/openssh/ssh/Makefile @@ -20,7 +20,7 @@ SRCS= ssh.c sshconnect.c log-client.c readconf.c clientloop.c .include <bsd.own.mk> # for AFS .if (${KERBEROS} == "yes") -CFLAGS+= -DKRB4 -I/usr/include/kerberosIV +CFLAGS+= -DKRB4 -I${DESTDIR}/usr/include/kerberosIV LDADD+= -lkrb DPADD+= ${LIBKRB} .if (${AFS} == "yes") diff --git a/crypto/openssh/sshd/Makefile b/crypto/openssh/sshd/Makefile index 15d6eec..3815b5a 100644 --- a/crypto/openssh/sshd/Makefile +++ b/crypto/openssh/sshd/Makefile @@ -12,15 +12,15 @@ SRCS= sshd.c auth-rhosts.c auth-passwd.c auth-rsa.c auth-rh-rsa.c \ .include <bsd.own.mk> # for KERBEROS and AFS .if (${KERBEROS} == "yes") -CFLAGS+= -DKRB4 -I/usr/include/kerberosIV -SRCS+= auth-krb4.c -LDADD+= -lkrb -DPADD+= ${LIBKRB} .if (${AFS} == "yes") CFLAGS+= -DAFS LDADD+= -lkafs DPADD+= ${LIBKRBAFS} .endif # AFS +CFLAGS+= -DKRB4 -I${DESTDIR}/usr/include/kerberosIV +SRCS+= auth-krb4.c +LDADD+= -lkrb +DPADD+= ${LIBKRB} .endif # KERBEROS .if (${SKEY} == "yes") diff --git a/crypto/openssh/version.h b/crypto/openssh/version.h index c2ef9ff..fe2e876 100644 --- a/crypto/openssh/version.h +++ b/crypto/openssh/version.h @@ -1 +1 @@ -#define SSH_VERSION "OpenSSH-1.2.2" +#define SSH_VERSION "OpenSSH-1.2.3" |