Debian Codegraph @

doc/TODO

raw
1 EXCEPTIONS
2
3 When using exceptions in commands like do_request_service, when should
4 we use the passed in exception handler, and when should we use the
5 handler in the connection struct? Perhaps we should not have any
6 connection->e handler at all?
7
8
9 S-EXPRESSIONS
10
11 Change the format used for encrypted private key to include the public
12 key as well. This way, the private key can be decrypted on-demand.
13 This seems cleaner than having the client read both identity and
14 identity.pub.
15
16 After retiring the complex "streamed" parser, sexp-conv can no longer
17 handle arbitrarily large files. That should be fixed some time.
18 Perhaps sexp-conv could use a parser of it's own, as that is the only
19 program for which it would make sense to understand all features of
20 the "advanced" syntax.
21
22
23 USERS
24
25 Use real ACL:s instead of the authorized keys hack. Implement a
26 general user-database abstraction. Also have a look at 'Pluggable Non
27 Interactive Authentication Modules' at
28 http://www.msu.ru/pniam/pniam.html.
29
30 Log a message if user authentication fails because root is not allowed
31 to log in.
32
33 Create an --telnet-mode/--auth-by-login option to lshd, which will
34 accept a none-authentication, but instead of forking a login shell for
35 the user, it should fork a /bin/login running as root with options to
36 make it display a password prompt.
37
38
39 CHARSETS
40
41 The conversion from UTF8->unicode->latin1 doesn't handle accented
42 characters properly. Probably needs a complete rewrite.
43
44 Check out GNU libidn.
45
46
47 CONFIGURATION
48
49 Figure out what configuration files we need.
50
51
52 LOGGING
53
54 Use syslog to log server startup, shutdown, and user authentication.
55
56
57 SERVER ISSUES
58
59 For compatibility with other sshd:s and bash, lshd should set some
60 more environment variables when starting user processes.
61
62 SSH_CLIENT=<client-ip> <client-port> <server-port>
63 SSH_TTY=<tty-name> (if a pty was allocated)
64 SSH_ORIGINAL_COMMAND
65
66 bash looks at SSH_CLIENT, and reads .bashrc if it is set.
67
68 The lshd server should register a signal handler, probably for
69 SIGTERM, that causes it to close it's listening socket, and exit after
70 current connections are gone (or after a timeout).
71
72
73 ALLOCATION
74
75 Have the allocator initialize all objects automatically.
76
77 Consider adding reference counts to strings.
78
79 Unify the debug malloc system to add a magic number to every block
80 header, with distinct values for space, strings, objects and lists.
81
82
83 OBJECT SYSTEM
84
85 Better typechecking of non-heap objects. To do this one would also
86 need valid isa-pointers in classes (as classes are statically
87 allocated). If this is done properly, the meta feature could also be
88 cleaned up a little.
89
90 Consider adding "const" methods. One such method to use that for is
91 ALIST_GET.
92
93 Make sure that the first (self) argument to the method-like macros
94 never have side effects.
95
96
97 CHANNELS
98
99 Implement window-change requests on the server side.
100
101 Look at client_session.c:do_client_session_eof() and
102 server_session.c:do_eof() and see if they can be unified or perhaps
103 even deleted.
104
105 The CHANNEL_CLOSE_AT_EOF should be enabled by default. It is the
106 correct behaviour for all channels except the server side of sessions.
107
108 The following bug should be eliminated: I use lshg to get a large
109 file,
110
111 src/lshg -v --trace --debug >lsh-test.log.gz sture.lysator.liu.se
112 cat 'incoming/lsh-test.log.gz' 2>lshg.log
113
114 The file is 0x614ef9 bytes, but only 0x610000 bytes gets through.
115 Looking at the lshg log, the final SSH_MSG_DATA packet(s) is missing,
116 so the data is lost either in lsh, or in the remote opensshd.
117
118
119 CONTROL LANGUAGE
120
121 Improve the tail recursiveness of builtin functions.
122
123
124 FORWARDING
125
126 Generalize the -L and -R options to
127 [<source-ip>:]<source-port>:<target-ip>:<target-port>
128 where the first component is optional.
129
130 Implement other types of forwarding; ssh-agent, UDP, etc.
131
132 Review the naming of functions in tcpforward.c; it appears a little
133 inconsistent.
134
135 There's one known bug in lshd's X11 forwarding: It will start sending
136 data on the session before the reply to the client's "shell" or "exec"
137 request.
138
139
140 RANDOMNESS
141
142 Look at prngd,
143 http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html
144 (recommended by Oystein Viggen <[email protected]>), and perhaps
145 also at egd.
146
147
148 SPKI ISSUES
149
150 Use the name "rsa-pkcs1" consistently for all keys, and perhaps
151 include the name of the hash function in the signature objects.
152
153 Encryption of private keys seems broken, decryption gives the error
154
155 lsh: Unknown encryption algorithm for pkcs5v2.
156 lsh: Decrypting private key failed.
157
158
159 DENIAL OF SERVICE
160
161 Implement some limit on the amount of data that may be buffered for
162 write on a connection. When the limit is exceeded, the connection
163 should be dropped. The problem: if a client connects and sends a lot
164 of packets, without ever reading anything from its socket, the server
165 will eventually run out of memory.
166
167
168 BUILD ISSUES
169
170 Have autoconf automatically add -I $prefix/include and -L $prefix/lib ?
171
172 Remaking Makefile.am from subdirectories probably cd:s to the wrong
173 place, when building outside of the source tree.
174
175 Building outside of the source tree creates machine independent
176 automatically generated files in the wrong directory (they should be
177 in the source tree).
178
179 The definition of SBINDIR is broken, in gets the value
180 "${exec_prefix}/sbin".
181
182 Use separate version.h.in and version.h files, to avoid rebuilding
183 everything when the version number is increased.
184
185
186 PROTOCOL ISSUES
187
188 Update the signal-related messages to conform to
189 draft-ietf-secsh-connect-08.txt.
190
191 Some SSH Inc sshd server sends USERAUTH_FAILURE messages with a
192 trailing ",", like "publickey,password,". Consider hacking
193 parse.c:parse_next_atom to allow that.
194
195 The server currently allows the client to send random banner text
196 before its version string. Such text is not allowed by the protocol
197 spec.
198
199 Add a timeout, to drop connections that hasn't older than (say) five
200 minutes without having authenticated properly.
201
202
203 USER INTERFACE ISSUES
204
205 Hack do_spki_decrypt() in spki_commands.c to ask again if the provided
206 password is incorrect.
207
208 Implement an escape char, like ~ with rsh.
209
210 The --interface option to lshd can only handle numeric ip addresses.
211
212
213 I/O ISSUES
214
215 How should we handle POLLERR in io_iter()?
216
217 Add a descriptive string to the lsh_fd struct, to aid debugging.
218
219
220 TESTING
221
222 The testsuite is far from complete. Some parts that it misses are
223
224 * Sending and receiving of SSH_MSG_REQUEST_FAILURE and
225 SSH_MSG_CHANNEL_FAILURE, and handling of the corresponding
226 exceptions.
227
228 * Same for SSH_MSG_CHANNEL_OPEN_FAILURE.
229
230 * All SSH_MSG_CHANNEL_EXTENDED_DATA (i.e. stderr data)
231
232 * i/o exceptions on channels.
233
234 * Failed key exchanges. SRP key exchange.
235
236 * PTY allocation, requests, etc.
237
238 * Userauth banner, failures, passwords,kerberos password helper.
239
240 * connection_handle_pending(), connection_ignore_handler,
241 connection_fail_handler, connection_unimplemented_handler,
242 connection_forward_handler.
243
244 * Gatewayed channel requests and global requests.
245
246 * lsh-export-key.
247
248 * sexp-conv with options --select, --*-hash.
249
250 * sexp display types.
251
252 * spki, tag prefix and tag any.
253
254 * Encrypted provate keys.
255
256 * TCP forwarding: cancel-tcpip-forward, various exception.
257
258 * utmp logging.
259
260
261 MISC
262
263 Try to find out why read() sometimes returns -1 and sets errno==EPIPE,
264 on sparc-linux, 2.0.33, redhat-5.1, glibc.
265 Note: Debian's sparc port uses glibc2.1, rather than 2.0; maybe Red Hat does
266 too? Quite a lot of things have changed between 2.0 and 2.1; this might well
267 be a documented feature of 2.1.
268
269 "lsh" is already used as the name of a shell (included in Debian;
270 Description: Baby Shell for Novices with DOS compatible commands). Perhaps
271 we need to change our name?
272
273 Make it cleaner wrt. more gcc warnings.
274
275 Fix desTest.c to use proper declarations of its function pointers, and
276 have autoconf check for rusage().
277
278 It seems that it is a little difficult to detect that an asyncronous
279 connect() failed; poll() indicates that both reading and writing is
280 possible, but write failes (with EPIPE/SIGPIPE) later. Perhaps a
281 linux-problem?
282
283 Perhaps some of the dh-code in publickey_crypto should be moved to
284 keyexchange.c?
285
286 Fix the src/symmetric/desTest program. It doesn't complain if the
287 desCode is compiled with empty keymap.h, parity.h and rotors.h files.
288
289 About POLLHUP:
290
291 I've found something that can either be an io.c or a linux kernel bug.
292 This time it is the poll() system call, which causes troubles. If an
293 AF_UNIX connection is closed by the client, the kernel doesn't set
294 POLLIN in revents, instead it sets only POLLHUP. (and therefore the io
295 backend doesn't read the last zero length packet) The following patch
296 solves the problem for me:
297
298 - if (fds[i].revents & POLLIN)
299 - READ_FD(fd);
300 + if (fds[i].revents & (POLLIN | POLLHUP))
301 + READ_FD(fd);
302
303 jpoll.h doesn't define POLLHUP, so I added a
304
305 #define POLLHUP 0
306
307 line there. I seldom use poll() so I don't know what the correct
308 behaviour should be, but I am afraid this is a kernel bug again.
309
310 --
311 Bazsi
312
313 Find out why opening /dev/ptmx failes occasionally (errno = 19, no
314 such device).
315
316 Add some workaround for the poll()-bug in linux/glibc-2.07 reported by
317 Bazsi. Hmm, this is probably not a bug. I have to find out what the
318 right way is to handle the poll conditions POLLERR, POLLHUP and
319 POLLERR.
320
321 Consider removing the write-attribute from ssh_channel.
322
323 Let init_channel take enough arguments to initialize the window- and
324 packet-size fields properly. It's too easy to forget them.
325
326 Add const to arguments of type struct exception_handler *?
327
328 Do something reasonable in do_buffered_read() if want_read is cleared.
329
330 The supplied argp is compiled even if it isn't used.
331
332 Move miscellaneous lsh_string-functions from format.c to a separate
333 file.
334
335 Consider moving SPKI tuple-related functions to a separate file.
336
337 With SPKI, consider whether or not we should require any specific
338 order of subexpressions. The most central function for this is
339 sexp_get_un.
340
341 Extend the GABA: (expr ...) constructions with a single parameter
342 could be used directly as a command_simple. Extend gaba.scm to do that
343 automatically. Extend the (exp ...) construction to take a return
344 type, and automatically cast the result to that type.
345
346 Add -f, to fork and exit when userauthentication is done and any
347 tunneling is set up.
348
349 Consider using dynamically allocated strings for exception messages.
350 Without this, it is impossible to use non-constant messages, for
351 instance messages supplied by the peer.
352
353 Try to unify the handling of queued channel requests and global
354 requests.
355
356 Get rid of the double close loop in io_iter. Perhaps start using a
357 doubly linked list for fds? Add a backend-pointer to fd:s? Use an
358 extra stack of fds that should be closed?
359
360 If we add the backend field to lsh_fd objects, the code for listen
361 could also be simplified, and perhaps we can get rid of the backend
362 pointer in some other places as well.
363
364 Exceptions from listen are handled badly in several places.
365
366 Should lsh fail if some port forwardings fails? In particular,
367
368 $ lsh -R... -N
369
370 is pretty useless if the server doesn't let us bind the remote port.
371
372 Add reasonable limits to all calls to parse_bignum(), sexp2bignum_u()
373 and sexp_get_un().
374
375 There are dsa-specific details in many places, lsh.c
376 server_publickey.c, server_authorization.c, server_keyexchange.c. Try
377 to write more generic functions that can deal with both dsa and rsa.
378
379 Review the default algorithm preference list in
380 algorithms.c:default_crypto_algorithms(). Perhaps make the list more
381 conservative, and add a "pseudo-algorithm" all to include all
382 supported algorithms in the list?
383
384 Use static objects for crypto algorithms with fixed key sizes and
385 other parameters.
386
387 Replace most defines with enums, for improved type checking.
388
389 Write more testcases for rsa.
390
391 Perhaps change the LOOKUP_VERIFIER method to return an spki_subject?
392
393 Make connection_unlock install a callout that calls
394 connection_handle_pending().
395
396 Consider how much we really need to differentiate between
397 rsa-pkcs1-sha1 / rsa-pkcs1-md5 and between spki-sign-rsa /
398 spki-sign-dss.
399
400 Building fails if srp support is disabled. The building of srp-gen
401 must be conditionalized.
402
403 lshg -L doesn't work. The lsh process dies on the first connection to
404 the forwarded port. Hmm. Or rather, it seems that the remote server
405 (opensshd) disconnects.
406
407 A successful tcp-forwarding (set up using lsh -L... -N):
408
409 DEBUG: Sent CHANNEL_OPEN (size 72 = 0x48)
410 00000000: 5a0000000c6469726563742d74637069 Z....direct-tcpi
411 00000010: 70000000000000271000007f9c000000 p......'........
412 00000020: 126b6f6d2e6c797361746f722e6c6975 .kom.lysator.liu
413 00000030: 2e73650000131e000000093132372e30 .se........127.0
414 00000040: 2e302e3100000dc8 .0.1....
415
416 When using lsh -G -N; lshg -L... -n:
417
418 DEBUG: gateway received CHANNEL_OPEN (size 72 = 0x48)
419 00000000: 5a0000000c6469726563742d74637069 Z....direct-tcpi
420 00000010: 70000000000000271000007f9c000000 p......'........
421 00000020: 126b6f6d2e6c797361746f722e6c6975 .kom.lysator.liu
422 00000030: 2e73650000131e000000093132372e30 .se........127.0
423 00000040: 2e302e3100000dc3 .0.1....
424
425 handle_connection: Received packet of type 90 (CHANNEL_OPEN)
426 Allocated local channel number 0
427 Allocated local channel number 0
428 Registering local channel 0.
429 DEBUG: Sent CHANNEL_OPEN (size 29 = 0x1d)
430 00000000: 5a0000000c6469726563742d74637069 Z....direct-tcpi
431 00000010: 70000000000000271000007f9c p......'.....
432
433
434
435 make_char_classes seems not to work with guile-1.3.4. Bug in guile?
436
437 : ERROR: Two copies of (leaf #f (#\377)) (leaf #f (#\377))
438 : make[1]: *** [sexp_table.h] Error 2
439
440 or
441
442 : ERROR: Stack overflow
443 : make: *** [sexp_table.h] Error 2
444
445 Figure out whether or not to make --cvs-workaround the default.
446 According to Neil Jarram, "lsh-1.1.2 with --cvs-workaround=oe always
447 succeeds." Update: According to rms, --cvs-workaround=e works, and
448 --cvs-workaround=o doesn't, so it seems that it's stderr that causes
449 problems. So we need to avoid setting stderr into non-blocking mode.
450
451 Add a keep-alive option, which sends SSH_MSG_IGNORE at regular
452 intervals.
453
454 The lshd --daemonic option doesn't work with the
455 RANDOM_POLL_BACKGROUND.
456
457 : [email protected] writes:
458 :
459 : > When I run
460 : >
461 : > lshd --daemonic --ssh1-fallback=/usr/sbin/sshd
462 : >
463 : > It dies on first connection and says :
464 : >
465 : > Apr 25 04:49:02 subversions lshd[25773]: Background randomness poll failed.
466 : > Apr 25 04:49:02 subversions lshd[25773]: lshd: Could not get enough entropy from the environment.
467 :
468 : Strange. A guess on what's happening:
469 :
470 : 1. lshd starts a background process for collecting randomness,
471 :
472 : 2. next it forks and exits to get into the background,
473 :
474 : 3. it tries to waitpid the process created in 1, but it's no longer
475 : the parent of that process, so waiting fails.
476
477 When a forwarding created with lshg -L ... goes down (at the local
478 end, I think), the channel is not taken down properly, and there are a
479 lot of "lsh: write_buffer: Attempt to write data to closed buffer."
480 warnings by lsh:
481
482 : bash-2.03$ lshg: Exiting: Connection reset by peer
483 : lsh: write_buffer: Attempt to write data to closed buffer.
484 : lsh: write_buffer: Attempt to write data to closed buffer.
485
486 To fix this, we must put some resources on the lsh's
487 gateway-connection's resource list, that closes the chained
488 connections.
489
490 According to rms, lsh is significantly slower than ssh when logging in
491 over a slow connection. Figure out why.