summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-07-22 19:32:00 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-07-22 19:32:00 +0000
commitd9e0824b437bb4d65c1ae564b049e35c93e31010 (patch)
treebb68047190d2a301312cb928956f1e354ae1915f
parent5d629cb65344e14642264a33c9f4019ad609c266 (diff)
- (bal) Starting the Unicossmk merger. File merged TODO, configure.in,
myproposal.h, ssh_prng_cmds.in, and openbsd-compat/Makefile.in. Added openbsd-compat/bsd-cray.c. Rest will be merged after approval. Selective patches from William L. Jones <jones@mail.utexas.edu>
-rw-r--r--ChangeLog9
-rw-r--r--TODO4
-rw-r--r--configure.in10
-rw-r--r--myproposal.h6
-rw-r--r--openbsd-compat/Makefile.in4
-rw-r--r--openbsd-compat/bsd-cray.c223
-rw-r--r--ssh_prng_cmds.in10
7 files changed, 260 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 30937b751..c3501fae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
120010722
2 - (bal) Starting the Unicossmk merger. File merged TODO, configure.in,
3 myproposal.h, ssh_prng_cmds.in, and openbsd-compat/Makefile.in.
4 Added openbsd-compat/bsd-cray.c. Rest will be merged after
5 approval. Selective patches from William L. Jones
6 <jones@mail.utexas.edu>
7
120010719 820010719
2 - (tim) [configure.in] put inet_aton back in AC_CHECK_FUNCS. 9 - (tim) [configure.in] put inet_aton back in AC_CHECK_FUNCS.
3 report from Mark Miller <markm@swoon.net> 10 report from Mark Miller <markm@swoon.net>
@@ -6070,4 +6077,4 @@
6070 - Wrote replacements for strlcpy and mkdtemp 6077 - Wrote replacements for strlcpy and mkdtemp
6071 - Released 1.0pre1 6078 - Released 1.0pre1
6072 6079
6073$Id: ChangeLog,v 1.1415 2001/07/20 03:33:46 tim Exp $ 6080$Id: ChangeLog,v 1.1416 2001/07/22 19:32:00 mouring Exp $
diff --git a/TODO b/TODO
index d314ec090..4d92acec4 100644
--- a/TODO
+++ b/TODO
@@ -55,6 +55,8 @@ Programming:
55 - utmp/wtmp get corrupted (something in loginrec?) 55 - utmp/wtmp get corrupted (something in loginrec?)
56 - can't build with PAM (no 64-bit libpam yet) 56 - can't build with PAM (no 64-bit libpam yet)
57 57
58- Modify rijndael to support Cray 64bit machines.
59
58Documentation: 60Documentation:
59- More and better 61- More and better
60 62
@@ -87,4 +89,4 @@ Packaging:
87- HP-UX: Provide DEPOT package scripts. 89- HP-UX: Provide DEPOT package scripts.
88 (gilbert.r.loomis@saic.com) 90 (gilbert.r.loomis@saic.com)
89 91
90$Id: TODO,v 1.41 2001/06/15 04:23:13 stevesk Exp $ 92$Id: TODO,v 1.42 2001/07/22 19:32:01 mouring Exp $
diff --git a/configure.in b/configure.in
index df71da46f..f6aa04608 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
1# $Id: configure.in,v 1.302 2001/07/20 03:33:47 tim Exp $ 1# $Id: configure.in,v 1.303 2001/07/22 19:32:01 mouring Exp $
2 2
3AC_INIT(ssh.c) 3AC_INIT(ssh.c)
4 4
@@ -241,6 +241,13 @@ mips-sony-bsd|mips-sony-newsos4)
241 AC_CHECK_FUNCS(getluid setluid) 241 AC_CHECK_FUNCS(getluid setluid)
242 MANTYPE=man 242 MANTYPE=man
243 ;; 243 ;;
244*-*-unicos*)
245 no_libsocket=1
246 no_libnsl=1
247 AC_DEFINE(USE_PIPES)
248 LDFLAGS="$LDFLAGS -L/usr/local/lib"
249 LIBS="$LIBS -lgen -lrsc"
250 ;;
244*-dec-osf*) 251*-dec-osf*)
245 AC_MSG_CHECKING(for Digital Unix SIA) 252 AC_MSG_CHECKING(for Digital Unix SIA)
246 no_osfsia="" 253 no_osfsia=""
@@ -1444,6 +1451,7 @@ if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1444 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat) 1451 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1445 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp) 1452 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1446 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig) 1453 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1454 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1447 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps) 1455 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1448 OSSH_PATH_ENTROPY_PROG(PROG_W, w) 1456 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1449 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who) 1457 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
diff --git a/myproposal.h b/myproposal.h
index 4a9a36370..2f1cd97ce 100644
--- a/myproposal.h
+++ b/myproposal.h
@@ -25,11 +25,17 @@
25 */ 25 */
26#define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1" 26#define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1"
27#define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss" 27#define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss"
28#ifdef _CRAY
29/*Temporary hack until rijndael is ported to CRAY word addressable machines */
30#define KEX_DEFAULT_ENCRYPT \
31 "3des-cbc,blowfish-cbc,cast128-cbc,arcfour"
32#else
28#define KEX_DEFAULT_ENCRYPT \ 33#define KEX_DEFAULT_ENCRYPT \
29 "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour," \ 34 "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour," \
30 "aes192-cbc,aes256-cbc," \ 35 "aes192-cbc,aes256-cbc," \
31 "rijndael128-cbc,rijndael192-cbc,rijndael256-cbc," \ 36 "rijndael128-cbc,rijndael192-cbc,rijndael256-cbc," \
32 "rijndael-cbc@lysator.liu.se" 37 "rijndael-cbc@lysator.liu.se"
38#endif
33#define KEX_DEFAULT_MAC \ 39#define KEX_DEFAULT_MAC \
34 "hmac-md5,hmac-sha1,hmac-ripemd160," \ 40 "hmac-md5,hmac-sha1,hmac-ripemd160," \
35 "hmac-ripemd160@openssh.com," \ 41 "hmac-ripemd160@openssh.com," \
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index d20bfb817..8ce35e531 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.16 2001/07/16 02:07:51 tim Exp $ 1# $Id: Makefile.in,v 1.17 2001/07/22 19:32:01 mouring Exp $
2 2
3sysconfdir=@sysconfdir@ 3sysconfdir=@sysconfdir@
4piddir=@piddir@ 4piddir=@piddir@
@@ -18,7 +18,7 @@ LDFLAGS=-L. @LDFLAGS@
18 18
19OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o 19OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o
20 20
21COMPAT=bsd-arc4random.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o 21COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o
22 22
23.c.o: 23.c.o:
24 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< 24 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
diff --git a/openbsd-compat/bsd-cray.c b/openbsd-compat/bsd-cray.c
new file mode 100644
index 000000000..c887322cb
--- /dev/null
+++ b/openbsd-compat/bsd-cray.c
@@ -0,0 +1,223 @@
1/*
2 * The modules contains code to support cray t3e and sv1 computers.
3 * It is here to minimize the modifcations to the openssh base code.
4 */
5
6#ifdef _CRAY
7
8#include <udb.h>
9#include <tmpdir.h>
10#include <unistd.h>
11#include <sys/category.h>
12#include <utmp.h>
13#include <sys/jtab.h>
14#include <signal.h>
15#include <sys/stat.h>
16#include <stdlib.h>
17#include <pwd.h>
18#include <fcntl.h>
19#include <errno.h>
20
21char cray_tmpdir[TPATHSIZ+1]; /* job TMPDIR path */
22
23/*
24 * Functions.
25 */
26int cray_setup(uid_t, char *);
27void cray_retain_utmp(struct utmp *, int);
28void cray_create_tmpdir(int, uid_t, gid_t);
29void cray_delete_tmpdir(char *, int , uid_t);
30void cray_job_termination_handler (int);
31void cray_init_job(struct passwd *);
32void cray_set_tmpdir(struct utmp *);
33
34/*
35 * Orignal written by:
36 * Wayne Schroeder
37 * San Diego Supercomputer Center
38 * schroeder@sdsc.edu
39*/
40int
41cray_setup(uid_t uid, char *username)
42{
43 struct udb *p;
44 extern struct udb *getudb();
45 extern char *setlimits();
46 int i, j;
47 int accts[MAXVIDS];
48 int naccts;
49 int err;
50 char *sr;
51 int pid;
52 struct jtab jbuf;
53 int jid;
54
55 if ((jid = getjtab (&jbuf)) < 0) {
56 debug("getjtab");
57 return -1;
58 }
59
60 /* Find all of the accounts for a particular user */
61 err = setudb(); /* open and rewind the Cray User DataBase */
62 if(err != 0) {
63 debug("UDB open failure");
64 return -1;
65 }
66 naccts = 0;
67 while ((p = getudb()) != UDB_NULL) {
68 if (p->ue_uid == -1) break;
69 if(uid == p->ue_uid) {
70 for(j = 0; p->ue_acids[j] != -1 && j < MAXVIDS; j++) {
71 accts[naccts] = p->ue_acids[j];
72 naccts++;
73 }
74 }
75 }
76 endudb(); /* close the udb */
77 if (naccts == 0 || accts[0] == 0) {
78 debug("No Cray accounts found");
79 return -1;
80 }
81
82 /* Perhaps someday we'll prompt users who have multiple accounts
83 to let them pick one (like CRI's login does), but for now just set
84 the account to the first entry. */
85 if (acctid(0, accts[0]) < 0) {
86 debug("System call acctid failed, accts[0]=%d",accts[0]);
87 return -1;
88 }
89
90 /* Now set limits, including CPU time for the (interactive) job and process,
91 and set up permissions (for chown etc), etc. This is via an internal CRI
92 routine, setlimits, used by CRI's login. */
93
94 pid = getpid();
95 sr = setlimits(username, C_PROC, pid, UDBRC_INTER);
96 if (sr != NULL) {
97 debug("%.200s", sr);
98 return -1;
99 }
100 sr = setlimits(username, C_JOB, jid, UDBRC_INTER);
101 if (sr != NULL) {
102 debug("%.200s", sr);
103 return -1;
104 }
105
106 return 0;
107}
108
109
110/*
111 * Retain utmp/wtmp information - used by cray accounting.
112 */
113void
114cray_retain_utmp(struct utmp *ut, int pid)
115{
116 int fd;
117 struct utmp utmp;
118
119 if ((fd = open(UTMP_FILE, O_RDONLY)) >= 0) {
120 while (read(fd, (char *)&utmp, sizeof(utmp)) == sizeof(utmp)) {
121 if (pid == utmp.ut_pid) {
122 ut->ut_jid = utmp.ut_jid;
123 strncpy(ut->ut_tpath, utmp.ut_tpath, TPATHSIZ);
124 strncpy(ut->ut_host, utmp.ut_host, strlen(utmp.ut_host));
125 strncpy(ut->ut_name, utmp.ut_name, strlen(utmp.ut_name));
126 break;
127 }
128 }
129 close(fd);
130 }
131}
132
133/*
134 * tmpdir support.
135 */
136
137/*
138 * find and delete jobs tmpdir.
139 */
140void
141cray_delete_tmpdir(char *login, int jid, uid_t uid)
142{
143 int child;
144 static char jtmp[TPATHSIZ];
145 struct stat statbuf;
146 int c;
147 int wstat;
148
149 for (c = 'a'; c <= 'z'; c++) {
150 snprintf(jtmp, TPATHSIZ, "%s/jtmp.%06d%c", JTMPDIR, jid, c);
151 if (stat(jtmp, &statbuf) == 0 && statbuf.st_uid == uid) break;
152 }
153
154 if (c > 'z') return;
155
156 if ((child = fork()) == 0) {
157 execl(CLEANTMPCMD, CLEANTMPCMD, login, jtmp, 0);
158 fatal("ssh_cray_rmtmpdir: execl of CLEANTMPCMD failed");
159 }
160
161 while (waitpid (child, &wstat, 0) == -1 && errno == EINTR);
162}
163
164/*
165 * Remove tmpdir on job termination.
166 */
167void
168cray_job_termination_handler (int sig)
169{
170 int jid;
171 char *login = NULL;
172 struct jtab jtab;
173
174 debug("Received SIG JOB.");
175
176 if ((jid = waitjob(&jtab)) == -1 ||
177 (login = uid2nam(jtab.j_uid)) == NULL) return;
178
179 cray_delete_tmpdir(login, jid, jtab.j_uid);
180}
181
182
183/*
184 * Set job id and create tmpdir directory.
185 */
186void
187cray_init_job(struct passwd *pw)
188{
189 int jid;
190 int c;
191
192 jid = setjob(pw->pw_uid, WJSIGNAL);
193 if (jid < 0) fatal("System call setjob failure");
194
195 for (c = 'a'; c <= 'z'; c++) {
196 snprintf(cray_tmpdir, TPATHSIZ, "%s/jtmp.%06d%c", JTMPDIR, jid, c);
197 if (mkdir(cray_tmpdir, JTMPMODE) != 0) continue;
198 if (chown(cray_tmpdir, pw->pw_uid, pw->pw_gid) != 0) {
199 rmdir(cray_tmpdir);
200 continue;
201 }
202 break;
203 }
204
205 if (c > 'z') cray_tmpdir[0] = '\0';
206}
207
208void
209cray_set_tmpdir(struct utmp *ut)
210{
211 int jid;
212 struct jtab jbuf;
213
214 if ((jid = getjtab (&jbuf)) < 0) return;
215
216 /*
217 * Set jid and tmpdir in utmp record.
218 */
219 ut->ut_jid = jid;
220 strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ);
221}
222
223#endif
diff --git a/ssh_prng_cmds.in b/ssh_prng_cmds.in
index 684a4f428..03fa5408e 100644
--- a/ssh_prng_cmds.in
+++ b/ssh_prng_cmds.in
@@ -5,12 +5,15 @@
5# The "rate" represents the number of bits of usuable entropy per 5# The "rate" represents the number of bits of usuable entropy per
6# byte of command output. Be conservative. 6# byte of command output. Be conservative.
7# 7#
8# $Id: ssh_prng_cmds.in,v 1.6 2001/02/09 01:55:36 djm Exp $ 8# $Id: ssh_prng_cmds.in,v 1.7 2001/07/22 19:32:01 mouring Exp $
9 9
10"ls -alni /var/log" @PROG_LS@ 0.02 10"ls -alni /var/log" @PROG_LS@ 0.02
11"ls -alni /var/adm" @PROG_LS@ 0.02 11"ls -alni /var/adm" @PROG_LS@ 0.02
12"ls -alni /usr/adm" @PROG_LS@ 0.02
12"ls -alni /var/mail" @PROG_LS@ 0.02 13"ls -alni /var/mail" @PROG_LS@ 0.02
14"ls -alni /usr/mail" @PROG_LS@ 0.02
13"ls -alni /var/adm/syslog" @PROG_LS@ 0.02 15"ls -alni /var/adm/syslog" @PROG_LS@ 0.02
16"ls -alni /usr/adm/syslog" @PROG_LS@ 0.02
14"ls -alni /var/spool/mail" @PROG_LS@ 0.02 17"ls -alni /var/spool/mail" @PROG_LS@ 0.02
15"ls -alni /proc" @PROG_LS@ 0.02 18"ls -alni /proc" @PROG_LS@ 0.02
16"ls -alni /tmp" @PROG_LS@ 0.02 19"ls -alni /tmp" @PROG_LS@ 0.02
@@ -30,7 +33,9 @@
30"netstat -in" @PROG_NETSTAT@ 0.05 33"netstat -in" @PROG_NETSTAT@ 0.05
31"netstat -rn" @PROG_NETSTAT@ 0.02 34"netstat -rn" @PROG_NETSTAT@ 0.02
32"netstat -pn" @PROG_NETSTAT@ 0.02 35"netstat -pn" @PROG_NETSTAT@ 0.02
36"netstat -ia" @PROG_NETSTAT@ 0.05
33"netstat -s" @PROG_NETSTAT@ 0.02 37"netstat -s" @PROG_NETSTAT@ 0.02
38"netstat -is" @PROG_NETSTAT@ 0.07
34 39
35"arp -a -n" @PROG_ARP@ 0.02 40"arp -a -n" @PROG_ARP@ 0.02
36 41
@@ -39,6 +44,7 @@
39"ps laxww" @PROG_PS@ 0.03 44"ps laxww" @PROG_PS@ 0.03
40"ps -al" @PROG_PS@ 0.03 45"ps -al" @PROG_PS@ 0.03
41"ps -efl" @PROG_PS@ 0.03 46"ps -efl" @PROG_PS@ 0.03
47"jstat" @PROG_JSTAT@ 0.07
42 48
43"w" @PROG_W@ 0.05 49"w" @PROG_W@ 0.05
44 50
@@ -51,6 +57,8 @@
51"df" @PROG_DF@ 0.01 57"df" @PROG_DF@ 0.01
52"df -i" @PROG_DF@ 0.01 58"df -i" @PROG_DF@ 0.01
53 59
60"sar -d" @PROG_SAR@ 0.04
61
54"vmstat" @PROG_VMSTAT@ 0.01 62"vmstat" @PROG_VMSTAT@ 0.01
55"uptime" @PROG_UPTIME@ 0.01 63"uptime" @PROG_UPTIME@ 0.01
56 64