chiark / gitweb /
otter.git
3 years agootter cli: Rename --ssh-proxy-command option
Ian Jackson [Tue, 1 Jun 2021 17:00:12 +0000 (18:00 +0100)]
otter cli: Rename --ssh-proxy-command option

This is shorter and more consistent.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoapitest: Provide OTTER_APITEST_START_DIR
Ian Jackson [Tue, 1 Jun 2021 16:59:32 +0000 (17:59 +0100)]
apitest: Provide OTTER_APITEST_START_DIR

Nothing uses this yet, nor, it appears, is going to, but it may come
in useful in the future, so let's keep it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMakefile, ssh proxy: Install a symlink
Ian Jackson [Tue, 1 Jun 2021 16:30:14 +0000 (17:30 +0100)]
Makefile, ssh proxy: Install a symlink

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Shut down CookedStdout before bundle data
Ian Jackson [Tue, 1 Jun 2021 14:40:48 +0000 (15:40 +0100)]
otter cli: Shut down CookedStdout before bundle data

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Shut down CookedStdout before proxying responses
Ian Jackson [Tue, 1 Jun 2021 14:39:36 +0000 (15:39 +0100)]
otter cli: Shut down CookedStdout before proxying responses

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Tiny fixes to stdout handling
Ian Jackson [Tue, 1 Jun 2021 14:37:23 +0000 (15:37 +0100)]
otter cli: Tiny fixes to stdout handling

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter: Introduce SubCommandSubArgs
Ian Jackson [Tue, 1 Jun 2021 14:35:05 +0000 (15:35 +0100)]
otter: Introduce SubCommandSubArgs

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Completely redo stdout handling
Ian Jackson [Tue, 1 Jun 2021 14:24:15 +0000 (15:24 +0100)]
otter cli: Completely redo stdout handling

Replace all println.  Use a common stdout buffer for everything.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Switch to CookedStdout for set-link
Ian Jackson [Tue, 1 Jun 2021 13:01:02 +0000 (14:01 +0100)]
otter cli: Switch to CookedStdout for set-link

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Switch to CookedStdout for list-ssh-keys
Ian Jackson [Tue, 1 Jun 2021 12:58:02 +0000 (13:58 +0100)]
otter cli: Switch to CookedStdout for list-ssh-keys

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: mgmtchannel proxy needs to exit on server conn eof
Ian Jackson [Tue, 1 Jun 2021 12:56:49 +0000 (13:56 +0100)]
otter cli: mgmtchannel proxy needs to exit on server conn eof

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Switch to RawStdout for mgmtchannel proxy stdout
Ian Jackson [Tue, 1 Jun 2021 12:56:37 +0000 (13:56 +0100)]
otter cli: Switch to RawStdout for mgmtchannel proxy stdout

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Use copy_interactive for mgmtchannel proxy
Ian Jackson [Tue, 1 Jun 2021 12:56:24 +0000 (13:56 +0100)]
otter cli: Use copy_interactive for mgmtchannel proxy

Fixes a buffering-induced deadlock.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Switch to CookedStdout for arg parsing
Ian Jackson [Tue, 1 Jun 2021 12:54:18 +0000 (13:54 +0100)]
otter cli: Switch to CookedStdout for arg parsing

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Switch to RawStdout for bundle download to stdout
Ian Jackson [Tue, 1 Jun 2021 12:54:42 +0000 (13:54 +0100)]
otter cli: Switch to RawStdout for bundle download to stdout

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoutils: Provide CookedStdout, buffered and with die on flush fail
Ian Jackson [Tue, 1 Jun 2021 12:58:38 +0000 (13:58 +0100)]
utils: Provide CookedStdout, buffered and with die on flush fail

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoutils: Provide RawStdout and the associated SigPipeWriter
Ian Jackson [Tue, 1 Jun 2021 12:58:22 +0000 (13:58 +0100)]
utils: Provide RawStdout and the associated SigPipeWriter

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoutils: Provide io_copy_interactive
Ian Jackson [Tue, 1 Jun 2021 12:54:07 +0000 (13:54 +0100)]
utils: Provide io_copy_interactive

stdlib io::copy insists on buffering.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodebugreader: Make generic over D
Ian Jackson [Tue, 1 Jun 2021 10:30:43 +0000 (11:30 +0100)]
debugreader: Make generic over D

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannel: Insist that client connections are Debug
Ian Jackson [Tue, 1 Jun 2021 10:30:27 +0000 (11:30 +0100)]
mgmtchannel: Insist that client connections are Debug

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Do not SelectAccount when we are mgmtchannel-proxy
Ian Jackson [Tue, 1 Jun 2021 01:47:07 +0000 (02:47 +0100)]
otter cli: Do not SelectAccount when we are mgmtchannel-proxy

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Break out connect_chan
Ian Jackson [Tue, 1 Jun 2021 01:45:28 +0000 (02:45 +0100)]
otter cli: Break out connect_chan

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannel: Tiny error message improvement
Ian Jackson [Tue, 1 Jun 2021 01:27:29 +0000 (02:27 +0100)]
mgmtchannel: Tiny error message improvement

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: Rework main loop error handling
Ian Jackson [Tue, 1 Jun 2021 01:19:59 +0000 (02:19 +0100)]
cmdlistener: Rework main loop error handling

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: Display account in log messages
Ian Jackson [Tue, 1 Jun 2021 00:55:46 +0000 (01:55 +0100)]
cmdlistener: Display account in log messages

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agossh: Forbid SetRestrictedSshScope after SelectAccount
Ian Jackson [Tue, 1 Jun 2021 00:44:41 +0000 (01:44 +0100)]
ssh: Forbid SetRestrictedSshScope after SelectAccount

SelectAccount generates an Authorisation in the stream state.  We
don't want to preserve that after we drop privs.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoSlight error message tweaks
Ian Jackson [Tue, 1 Jun 2021 00:30:43 +0000 (01:30 +0100)]
Slight error message tweaks

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Implement remote ssh connection
Ian Jackson [Mon, 31 May 2021 21:20:49 +0000 (22:20 +0100)]
otter cli: Implement remote ssh connection

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoconfig: Break out some variables etc.
Ian Jackson [Mon, 31 May 2021 21:13:36 +0000 (22:13 +0100)]
config: Break out some variables etc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Rename SL::Socket from a daft long name
Ian Jackson [Mon, 31 May 2021 10:58:42 +0000 (11:58 +0100)]
otter cli: Rename SL::Socket from a daft long name

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Prep for new kind of server connection
Ian Jackson [Mon, 31 May 2021 10:55:32 +0000 (11:55 +0100)]
otter cli: Prep for new kind of server connection

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: provide set-list-keys
Ian Jackson [Mon, 31 May 2021 00:15:11 +0000 (01:15 +0100)]
otter cli: provide set-list-keys

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: provide set-ssh-keys
Ian Jackson [Sun, 30 May 2021 22:54:02 +0000 (23:54 +0100)]
otter cli: provide set-ssh-keys

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agootter cli: Provide mgmtchannel-proxy subcommand
Ian Jackson [Sun, 30 May 2021 20:20:26 +0000 (21:20 +0100)]
otter cli: Provide mgmtchannel-proxy subcommand

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoutils: error end_process: Do not print duplicate messages
Ian Jackson [Tue, 1 Jun 2021 00:26:15 +0000 (01:26 +0100)]
utils: error end_process: Do not print duplicate messages

Sometimes we use thiserror to put {0} of an inner error in our Display
impl.  If that happens, just skip the repetition.

This is a slight bodge.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannel: Improve Display of MgmtChannelReadError
Ian Jackson [Tue, 1 Jun 2021 00:25:49 +0000 (01:25 +0100)]
mgmtchannel: Improve Display of MgmtChannelReadError

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoBreak out end_process ext method on anyhow::Error
Ian Jackson [Sun, 30 May 2021 21:44:21 +0000 (22:44 +0100)]
Break out end_process ext method on anyhow::Error

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoRework hex parsing
Ian Jackson [Sun, 30 May 2021 21:27:20 +0000 (22:27 +0100)]
Rework hex parsing

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannels: Make ClientMgmtChannel's read be Send too
Ian Jackson [Mon, 31 May 2021 21:16:21 +0000 (22:16 +0100)]
mgmtchannels: Make ClientMgmtChannel's read be Send too

We are about to need this

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Provide more traits for our types
Ian Jackson [Sun, 30 May 2021 23:46:43 +0000 (00:46 +0100)]
sshkeys: Provide more traits for our types

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make KeySpec fields pub (!)
Ian Jackson [Sun, 30 May 2021 23:46:23 +0000 (00:46 +0100)]
sshkeys: Make KeySpec fields pub (!)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make MgmtKeyReport fields pub (!)
Ian Jackson [Sun, 30 May 2021 23:41:37 +0000 (00:41 +0100)]
sshkeys: Make MgmtKeyReport fields pub (!)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Change authorized_keys command to what we are going to impl
Ian Jackson [Sun, 30 May 2021 20:20:09 +0000 (21:20 +0100)]
sshkeys: Change authorized_keys command to what we are going to impl

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide parsing for sshkey::Id and Nonce and so on
Ian Jackson [Sun, 30 May 2021 20:59:54 +0000 (21:59 +0100)]
Provide parsing for sshkey::Id and Nonce and so on

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Rename STATUS_1 from vague name
Ian Jackson [Mon, 31 May 2021 22:56:54 +0000 (23:56 +0100)]
childio: Rename STATUS_1 from vague name

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Add some dbgs to tests
Ian Jackson [Mon, 31 May 2021 22:51:43 +0000 (23:51 +0100)]
childio: Add some dbgs to tests

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Add a test case to simulate the Linux kernel race
Ian Jackson [Mon, 31 May 2021 22:39:20 +0000 (23:39 +0100)]
childio: Add a test case to simulate the Linux kernel race

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: When getting EOF when reading, wait blockingly for child
Ian Jackson [Mon, 31 May 2021 22:51:37 +0000 (23:51 +0100)]
childio: When getting EOF when reading, wait blockingly for child

The t_false read test was flaky.  It would sometimes panic at the
"unwrap_err".

This is because on Linux we can get EOF on a pipe which is being
closed by the kernel as a result of process termination, and then
still find that wait4 returns 0 meaning the child cannot be reaped.

I think this is quite undesirable, and I regard it as a kernel bug.
It is certainly untraditional.  For example, it is conventional for a
process that is coredumpting to finish dumping core before its fds
show up as closed.

However, the spec I have here does not appear to give a clear
guarentee that this sequence of events is impossible.  And whatever,
we have to live with it.  Bah.

In our situation we can generally expect that it is sensible to assume
that EOF means the child is in the process of exiting, and to reap it
blockingly.

Emprically I can no longer reproduce the race now.

The sequence of events as seen from the parent looks like this:

  pipe2([5, 6], O_CLOEXEC)                = 0

This is the stdin pipe.  We don't use it in this test.

  pipe2([7, 8], O_CLOEXEC)                = 0

This is the stdout pipe for the child.

I have verified in another strace that these descriptors are right,
since the post-fork child does this:
  23597 dup2(5, 0)                        = 0
  23597 dup2(8, 1)                        = 1

So, continuing with the parent:

  prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=4*1024}) = 0
  prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=4*1024}) = 0
  prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=4*1024}) = 0
  prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=4*1024}) = 0
  mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f14d9a56000
  rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0

  clone(child_stack=0x7f14d9a5eff0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 12678

Here we fork.  The child runs in parallel, and is going to exit.

  munmap(0x7f14d9a56000, 36864)           = 0
  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
  close(5)                                = 0
  close(8)                                = 0

We close our copies of the child's ends of the pipes.

  read(7, "", 10)                         = 0

We read EOF from the child's stdout.

  write(2, "[src/childio.rs:103] self.rw.rea"..., 45) = 45

This is a dbg print I put in.

  wait4(12678, 0x7fff03c3d16c, WNOHANG, NULL) = 0

Here wait4 returns 0 meaning "child has not terminated".

  write(2, "[src/childio.rs:36] self.child.l"..., 64) = 64

  write(2, "[", 1)                        = 1
  write(2, "src/childio.rs", 14)          = 14
  write(2, ":", 1)                        = 1
  write(2, "209", 3)                      = 3
  write(2, "] ", 2)                       = 2

Again some dbg print.

  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12678, si_uid=1001, si_status=1, si_utime=0, si_stime=0} ---

Finally we get a signal about the child but it is too late.

  write(2, "r.read(&mut buf)", 16)        = 16
  write(2, " = ", 3)                      = 3
  write(2, "Ok", 2)                       = 2
  write(2, "(\n", 2)                      = 2
  write(2, "    ", 4)                     = 4
  write(2, "0", 1)                        = 1
  write(2, ",\n", 2)                      = 2
  write(2, ")", 1)                        = 1
  write(2, "\n", 1)                       = 1

Another dbg print.

  write(2, "thread '", 8)                 = 8
  write(2, "main", 4)                     = 4
  write(2, "' panicked at '", 15)         = 15
  write(2, "called `Result::unwrap_err()` on"..., 50) = 50

And here we are panicking.

(NB that source code line numbers here and debug output are different
because this strace was not made with the exact code you find in this
commit's parent.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Break out assert_is_status_1
Ian Jackson [Mon, 31 May 2021 22:39:13 +0000 (23:39 +0100)]
childio: Break out assert_is_status_1

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agopacketframe: Provide methods for (partial) disassembly
Ian Jackson [Sun, 30 May 2021 20:19:36 +0000 (21:19 +0100)]
packetframe: Provide methods for (partial) disassembly

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannels: Change type of ClientMgmtChannel
Ian Jackson [Mon, 31 May 2021 20:37:44 +0000 (21:37 +0100)]
mgmtchannels: Change type of ClientMgmtChannel

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannels: Break out new()
Ian Jackson [Mon, 31 May 2021 20:29:40 +0000 (21:29 +0100)]
mgmtchannels: Break out new()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agomgmtchannels: Genericise again
Ian Jackson [Mon, 31 May 2021 20:24:54 +0000 (21:24 +0100)]
mgmtchannels: Genericise again

Client wants to be Box<dyn Read> etc. so it can be ssh pipes.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agotimefd: Make Timed a trait
Ian Jackson [Mon, 31 May 2021 14:35:28 +0000 (15:35 +0100)]
timefd: Make Timed a trait

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: tests: Properly indent mod test
Ian Jackson [Mon, 31 May 2021 13:56:04 +0000 (14:56 +0100)]
childio: tests: Properly indent mod test

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: t_cat: Test leak
Ian Jackson [Mon, 31 May 2021 13:44:00 +0000 (14:44 +0100)]
childio: t_cat: Test leak

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Fix spurious error from leak drop when SIGTERMed
Ian Jackson [Mon, 31 May 2021 13:43:42 +0000 (14:43 +0100)]
childio: Fix spurious error from leak drop when SIGTERMed

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: tests: Test leaked false
Ian Jackson [Mon, 31 May 2021 13:38:11 +0000 (14:38 +0100)]
childio: tests: Test leaked false

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: tests: Break out ENDING
Ian Jackson [Mon, 31 May 2021 13:38:03 +0000 (14:38 +0100)]
childio: tests: Break out ENDING

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: tests: Provide warning capture machinery
Ian Jackson [Mon, 31 May 2021 13:37:41 +0000 (14:37 +0100)]
childio: tests: Provide warning capture machinery

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: tests: refactoring
Ian Jackson [Mon, 31 May 2021 13:15:35 +0000 (14:15 +0100)]
childio: tests: refactoring

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: t_false: use type aliases
Ian Jackson [Mon, 31 May 2021 13:10:21 +0000 (14:10 +0100)]
childio: t_false: use type aliases

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: t_false: break out setup
Ian Jackson [Mon, 31 May 2021 13:06:11 +0000 (14:06 +0100)]
childio: t_false: break out setup

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: Some type aliases
Ian Jackson [Mon, 31 May 2021 13:08:33 +0000 (14:08 +0100)]
childio: Some type aliases

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: t_false test case, test writing
Ian Jackson [Mon, 31 May 2021 13:04:39 +0000 (14:04 +0100)]
childio: t_false test case, test writing

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: t_false test case, introduce one()
Ian Jackson [Mon, 31 May 2021 12:58:55 +0000 (13:58 +0100)]
childio: t_false test case, introduce one()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: test cases
Ian Jackson [Mon, 31 May 2021 12:47:49 +0000 (13:47 +0100)]
childio: test cases

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agochildio: new facility, will be used for ssh child
Ian Jackson [Mon, 31 May 2021 12:03:07 +0000 (13:03 +0100)]
childio: new facility, will be used for ssh child

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make MgktKeyReport contain Nonce via KeySpec
Ian Jackson [Sun, 30 May 2021 22:56:02 +0000 (23:56 +0100)]
sshkeys: Make MgktKeyReport contain Nonce via KeySpec

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Provide MC::ThisConnAuthBy
Ian Jackson [Sun, 30 May 2021 19:57:43 +0000 (20:57 +0100)]
sshkeys: Provide MC::ThisConnAuthBy

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Rename MR::SshKeyAdded
Ian Jackson [Sun, 30 May 2021 19:57:27 +0000 (20:57 +0100)]
sshkeys: Rename MR::SshKeyAdded

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoauthproofs: Rename methods with proof obligation to "promise"
Ian Jackson [Sun, 30 May 2021 19:34:08 +0000 (20:34 +0100)]
authproofs: Rename methods with proof obligation to "promise"

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Introduce KeySpec
Ian Jackson [Sun, 30 May 2021 19:18:18 +0000 (20:18 +0100)]
sshkeys: Introduce KeySpec

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Add key management commands
Ian Jackson [Sun, 30 May 2021 13:13:29 +0000 (14:13 +0100)]
sshkeys: Add key management commands

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Add AccountScope and AuthState variants
Ian Jackson [Sun, 30 May 2021 13:13:01 +0000 (14:13 +0100)]
sshkeys: Add AccountScope and AuthState variants

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: Make space AuthState::Ssh variant
Ian Jackson [Sat, 29 May 2021 21:56:35 +0000 (22:56 +0100)]
cmdlistener: Make space AuthState::Ssh variant

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Fix Authorisation handling etc. in PerScope.check()
Ian Jackson [Sun, 30 May 2021 12:40:53 +0000 (13:40 +0100)]
sshkeys: Fix Authorisation handling etc. in PerScope.check()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: Pass AccountsGuard into authorise_scope_*
Ian Jackson [Sun, 30 May 2021 12:29:47 +0000 (13:29 +0100)]
cmdlistener: Pass AccountsGuard into authorise_scope_*

ssh key check is going to need it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoauthproofs: Add some inline annotations
Ian Jackson [Sun, 30 May 2021 12:27:14 +0000 (13:27 +0100)]
authproofs: Add some inline annotations

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: authorise_by_account
Ian Jackson [Sun, 30 May 2021 12:24:30 +0000 (13:24 +0100)]
cmdlistener: authorise_by_account

Do not re-authorise the account.  Instead, check what we got from
previous SelectAccount.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoauthproofs: Make map generic rather than taking fn
Ian Jackson [Sun, 30 May 2021 12:23:21 +0000 (13:23 +0100)]
authproofs: Make map generic rather than taking fn

This will lets us feed context into the mapper.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Fix name of sshkeys_remove
Ian Jackson [Sun, 30 May 2021 11:55:03 +0000 (12:55 +0100)]
sshkeys: Fix name of sshkeys_remove

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Notes about checking for non-ssh: accounts
Ian Jackson [Sun, 30 May 2021 11:52:32 +0000 (12:52 +0100)]
sshkeys: Notes about checking for non-ssh: accounts

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make the access/update functions take an Authorisation
Ian Jackson [Sun, 30 May 2021 11:31:48 +0000 (12:31 +0100)]
sshkeys: Make the access/update functions take an Authorisation

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocmdlistener: Tidy up MC::SetSuperusr slightly
Ian Jackson [Sun, 30 May 2021 11:29:06 +0000 (12:29 +0100)]
cmdlistener: Tidy up MC::SetSuperusr slightly

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Rework calling conventions of sshkeys
Ian Jackson [Sun, 30 May 2021 11:19:30 +0000 (12:19 +0100)]
sshkeys: Rework calling conventions of sshkeys

We can't pass this &mut AccountsGuard and &mut PerScope since the
latter is inside the former.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make module sub-module of accounts
Ian Jackson [Sun, 30 May 2021 11:00:40 +0000 (12:00 +0100)]
sshkeys: Make module sub-module of accounts

This will let it deal with the data structures directly.

This is good because it avoids lifetime problems with borrowing the
whole of Accounts and it is OK because sshkeys takes care over save
orderig, etc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: Make methods methods on AccountsGuard
Ian Jackson [Sat, 29 May 2021 22:11:03 +0000 (23:11 +0100)]
sshkeys: Make methods methods on AccountsGuard

More global things first seems best.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosshkeys: module for trackng auth keys, still unfinished
Ian Jackson [Sat, 29 May 2021 21:56:58 +0000 (22:56 +0100)]
sshkeys: module for trackng auth keys, still unfinished

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoutils: Break out format_by_fmt_hex
Ian Jackson [Sat, 29 May 2021 21:21:32 +0000 (22:21 +0100)]
utils: Break out format_by_fmt_hex

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoconfig: Rename in_libexec and reformat
Ian Jackson [Sat, 29 May 2021 19:38:18 +0000 (20:38 +0100)]
config: Rename in_libexec and reformat

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoconfig: Break out libexec closure
Ian Jackson [Sat, 29 May 2021 19:36:41 +0000 (20:36 +0100)]
config: Break out libexec closure

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAdd openssh-keys as a dependency, prep for ssh key auth
Ian Jackson [Sat, 29 May 2021 16:03:29 +0000 (17:03 +0100)]
Add openssh-keys as a dependency, prep for ssh key auth

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoaccounts: Break out pct closure
Ian Jackson [Sun, 23 May 2021 23:28:20 +0000 (00:28 +0100)]
accounts: Break out pct closure

We're going to want to reuse it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoauthorisation: Move euid info into AuthState
Ian Jackson [Sun, 23 May 2021 23:23:27 +0000 (00:23 +0100)]
authorisation: Move euid info into AuthState

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoauthorisation: Introduce AuthState
Ian Jackson [Sun, 23 May 2021 22:56:49 +0000 (23:56 +0100)]
authorisation: Introduce AuthState

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoConnectionEuidDiscoverError: Fix typo in type name
Ian Jackson [Sun, 23 May 2021 22:38:38 +0000 (23:38 +0100)]
ConnectionEuidDiscoverError: Fix typo in type name

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoCHANGELOG: Start a new section
Ian Jackson [Sun, 23 May 2021 18:27:29 +0000 (19:27 +0100)]
CHANGELOG: Start a new section

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodocs: Expand on penultima game description
Ian Jackson [Sun, 23 May 2021 18:20:11 +0000 (19:20 +0100)]
docs: Expand on penultima game description

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodocs/bundles.rst: fix typos and copy-paste-os.
Simon Tatham [Sun, 23 May 2021 17:32:47 +0000 (18:32 +0100)]
docs/bundles.rst: fix typos and copy-paste-os.

Signed-off-by: Simon Tatham <anakin@pobox.com>