arpa2 / tlspool

TLS daemon with PKCS #11 backend
Other
6 stars 7 forks source link

testcli / testsrv / testpeer need not have a console #110

Open vanrein opened 5 years ago

vanrein commented 5 years ago

On Windows, that is a show-stopper, but it is not necessary anymore when using the chat() functionality.

vanrein commented 5 years ago

There's a lot more work to get this going.

vanrein commented 5 years ago

The chat(8) builtin module does not work. Replacing it with a large language such as Python would be rediculously large, by chat is also a bit of a nuisance. Also, it reads a character at a time, which is not useful.

We might instead use a request/response format like this:

This language can grow with time; it can be useful to have a modern variant of chat(8) indeed!

vanrein commented 5 years ago

Will reopen the issue, to see if someone picks it up. Is it part of Windows porting?

vanrein commented 5 years ago

It may actually be fair to not rotate the buffer, since even TCP is --in practice-- message-based. The use in starttls is to bootstrap exchanges like

shell$ nc alt1.gmail-smtp-in.l.google.com 25
220 mx.google.com ESMTP r11si6374984pgm.353 - gsmtp
EHLO orvelte.nep
250-mx.google.com at your service, [83.161.146.46]
250-SIZE 157286400
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
STARTTLS 
220 2.0.0 Ready to start TLS
vanrein commented 5 years ago

I suppose the pattern would be this sequence of steps:

If the <regex> should start at the beginning of a text sent, we should prefix .* but that would be quite a style change and probably not good. The above assumes that . does not include \r or \n and that ^ and $ match inside a string with the start/end of a line. The regex(3) in libc, in the extended POSIX variant, seems to hold up with the REG_NEWLINE flag.

Update 4-4-2019: Yep, this works. Just need to do something to print \r\n properly. But at least the matches of line start/end work as predicted.

vanrein commented 5 years ago

Might need a either/or kind of construct; following SEQ, PAR, ALT in Occam; might add it to the commandline in (reverse) Polish notation, with parameters ;<count>, &<count>, ^<count>.

The runtime would keep in mind which elements are active when firing, they figure out how they impact each other and/or which new elements are added.

To complete a simulation of chat(8) we would also need a way to observe BREAK and perhaps other signals.

Occam also has loops. We might add an infinite loop to, with LOOP or a variant with a symbol, or leave that implicit; but + and * sound like they could do it.

vanrein commented 5 years ago

This might be named libpavlov and/or the pavlov command. As a library, it could be built in like we now do with chat(8).

vanrein commented 5 years ago

with ALT and SEQ planned, there is no need for an additional & if there's also a @ wait that can be followed by an exit command.

This is good, it means we can use & in &<count> as we accidentally did already.

vanrein commented 5 years ago

Implemented a few commands in 4af0d87c479d9eb9720f56b2fea9cfdd0d6d1fd5:

vanrein commented 5 years ago

If we take this really far... which we should not do right now... then we might pickup variables from patterns and unleash them elsewhere. we might in fact store them in CSV files, and thereby allow easy collection of tables from various input formats. the ALT/SEQ/PAR would enable doing this for various tables from rather unstructured input. could be a really potent UNIX tool!

vanrein commented 5 years ago
vanrein commented 5 years ago
vanrein commented 5 years ago

@hfmanson made a variant based on libuv for; this allows testcli & co to listen to sockets and file handles such as the console's.

The basic implementation of pavlov works well, also on Windows, and can be used to replace chat(8) everywhere we now rely in it. The code was a quick and dirty insertion, but can now be dropped.

vanrein commented 5 years ago

PLAATJE: tlspool-tools.pdf

This is probably a good redefinition of our tools:

vanrein commented 5 years ago

resolved (mostly) in e9c832b180d553bb12b8078977a975c11b841e5a

vanrein commented 5 years ago

The construct of ALT with a branch of SEQ of an @time and exit is useful for Windows, where this precise construct is now hacked into Pavlov to accommodate timeouts of the tools.