RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Bounties →

TCP/IP bounty beta release

Subscribe to TCP/IP bounty beta release 274 posts, 33 voices

Posts per page:

Pages: 1 2 3 4 5 6 7 8 9 10 11

 
Oct 13, 2018 7:46pm
Avatar Chris Mahoney (1684) 2016 posts

Is there some magic required with RMEnsure/RMLoad to get everything working correctly? I’ve been trying to figure out why my test app was intermittently failing to show the “unverified certificate” window (instead, it times out after 30 seconds). I’m calling the URL SWIs and am not touching AcornSSL or AcornHTTP directly.

I’ve found that if I RMEnsure/RMLoad the modules then I don’t get the certificate window. However, if I manually open up !System and double-click on the three modules individually then everything works as expected.

If I RMLoad

RMEnsure AcornHTTP 0.98 RMLoad System:Modules.Network.URL.AcornHTTP
RMEnsure URL_Fetcher 0.00 RMLoad System:Modules.Network.URL.URL
RMEnsure AcornSSL 1.00 RMLoad System:Modules.Network.URL.AcornSSL

*Help Modules confirms that the modules are running so I’m a bit lost! Any suggestions?

Edit: Naturally I figured it out right after posting. It’s great how describing a problem can make you see it more clearly. The trick is to RMRun AcornSSL, not RMLoad it.

Edit 2: It ate part of the text above, but the main points are still there :)

 
Oct 15, 2018 9:58am
Avatar Martin Avison (27) 1337 posts

If it is the case that AcornSSL requires a RMrun rather than RMLoad, it shoul be included in the documentation. Certainly RMRun starts up the AcornSSL task that RMLoad does not – I had always assumed that it would be started only when required.

Are there any suggested URLs to test with which result in the various different certificate errors?

 
Oct 18, 2018 3:28pm
Avatar Martin Avison (27) 1337 posts

I found a site https://badssl.com which seemed to have a collection of bad certificates. The ones I have tried work or fail as expected on Netsurf and other browsers.

However, when I changed the example HTTP_Client host$ and path$ to use the site, I noticed that even the base badssl.com certificate was queried, and all certificate details given were identical regardless of the variation. Which confused me!

Two example logs from HTTP_Client are:

Got session handle 554593652
DNS record for badssl.com is 104.154.89.105
Connected to host on port 443
Requesting page ...
An attempt to make a secure connection has been stopped because the security check was unsuccessful:
 ⇓
 Subject: C=US, ST=California, L=San Francisco, O=BadSSL Fallback. Unknown subdomain or no SNI., CN=badssl-fallback-unknown-subdomain-or-no-sni
 Issuer: C=US, ST=California, L=San Francisco, O=BadSSL, CN=BadSSL Intermediate Certificate Authority
 Version: 3
 Serial number: CD:BC:5A:4A:EC:97:67:B1
 Signature: RSA with SHA-256
 Valid from: Fri Jul  8 21:17:05 2016
 Valid to: Sun Jul  8 21:17:05 2018
It is inadvisable to continue. Reject or accept the connection (R/A) ? ......Rejected
Got session handle 554593652
DNS record for expired.badssl.com is 104.154.89.105
Connected to host on port 443
Requesting page ...
An attempt to make a secure connection has been stopped because the security check was unsuccessful:
 ⇓
 Subject: C=US, ST=California, L=San Francisco, O=BadSSL Fallback. Unknown subdomain or no SNI., CN=badssl-fallback-unknown-subdomain-or-no-sni
 Issuer: C=US, ST=California, L=San Francisco, O=BadSSL, CN=BadSSL Intermediate Certificate Authority
 Version: 3
 Serial number: CD:BC:5A:4A:EC:97:67:B1
 Signature: RSA with SHA-256
 Valid from: Fri Jul  8 21:17:05 2016
 Valid to: Sun Jul  8 21:17:05 2018
It is inadvisable to continue. Reject or accept the connection (R/A) ? .....Rejected

The dialogue box displays the same data – albeit rather truncated. The View button just displays the encrypted certificate – which does not seem much use.

According to Chrome the validity dates should be
badssl.com 18 Mar 2017 to 25 Mar 2020.
expired.badssl.com 9 Apr 2015 to 13 Apr 2015

Please can anyone either verify my findings, or explain them?

 
Oct 18, 2018 4:44pm
Avatar Rick Murray (539) 12392 posts

I think the error may be telling you… badssl-fallback-unknown-subdomain-or-no-sni

There’s a newish SWI to tell AcornSSL the name of the remote host. Has the client example program been updated to use it? Does it even send valid requests yet? ;-)

 
Oct 18, 2018 5:33pm
Avatar Martin Avison (27) 1337 posts

Thanks Rick – adding AcornSSL_SetSessionHost does seem to have fixed it. The dialog box only showed "back-unknown-subdomain-or-no-sn" – I only could see the full message when I ran from a command line to copy for posting, and did not realise the significance. Another knowledge gap filled!

 
Oct 18, 2018 7:20pm
Avatar Martin Avison (27) 1337 posts

In case others have not noticed, there is a subtle facility of the ‘Unverified certificate chain’ dialogue. When there are higher-level certificates in the chain, the ‘issued by’ icon at the top has a raised instead of sunken border, and when the raised icon is clicked another dislogue box opens with the next certificate up in the chain. Only the highest level displayed has Input Focus and the Accept button enabled.

Can/should SetSessionHost be used for all connections in case SNI is used?

 
Oct 22, 2018 1:45pm
Avatar Steve Revill (20) 1361 posts

Beta4 is now available from the usual place.

  • An extra button on the confirm dialogue allows the user to “always accept” a particular untrusted certificate; if that certificate is encountered again in future it will be accepted without further prompts (at your own risk)
  • Module moved to 350 directory because it uses dynamic areas not available on RISC OS 3.10
  • SWI 50F8E has been renamed to ConfigureSession, sub reason code 0 is directly equivalent to the former SetSessionHost SWI, to allow other parameters to be configured in future
  • Added documentation on the classes of errors that may be seen
 
Oct 22, 2018 9:44pm
Avatar Chris Mahoney (1684) 2016 posts

Thanks! I can confirm that it’ll now “silently” talk to a Hue bridge in HTTPS mode and can therefore be called by a timer. Excellent.

I see that the certificate exceptions go into Choices so they’ll survive !Boot updates. Also good news :)

 
Oct 23, 2018 11:35am
Avatar Martin Avison (27) 1337 posts

Should AcornSSL_ConfigureSession,0 to SetSessionHost be used for all HTTPS sockets in case it is required?
If not, then is there a way to discover if a site requires SNI or not?

I ask because I have had cases where Error=&813F27 Handshake error (state 30,592) seems to be returned from non-SNI sites.

Or is this an error to be ignored?

Which leads to the next observation: the new Beta4 information about the range of AcornSSL specific errors is useful … but a list of the meanings of the errors would be even more useful!

[edited 25/10/2018 to correct typo]

 
Oct 24, 2018 8:39pm
Avatar Sprow (202) 1040 posts

Should SetSessionHost be used for all HTTPS sockets in case it is required? If not, then is there a way to discover if a site requires SNI or not?

Assuming Wikipedia is truthful, SNI is an optional extension that happens right at the start of the secure handshake, so no, there wouldn’t be a way to find out because it’s the first thing that happens. Therefore, you might as well speculatively call SetSessionHost since the worst that could happen is it might not get used.

Which leads to the next observation: the new Beta4 information about the range of AcornSSL specific errors is useful … but a list of the meanings of the errors would be even more useful!

Open ResourceFS and look at the AcornSSL messages file if you want a list of errors. Even 3 classes is excessive; really there’s Unix errors or RISC OS errors, that’s yer lot.

 
Oct 25, 2018 8:37am
Avatar Matthew Phillips (473) 629 posts

Should AcornSSL_ConfigureSesion,0 …

Hope that’s just Martin’s typo rather than something in the module.

 
Oct 25, 2018 10:10am
Avatar Martin Avison (27) 1337 posts

Martin’s typo

Ooops – now corrected.

 
Oct 25, 2018 10:16am
Avatar Martin Avison (27) 1337 posts

look at the AcornSSL messages file if you want a list of errors

If we assume E00 to E09 message tokens map to &813F20 – &813F29 it may be a start.
But where are the explanations of reason, code and state that appear in those messages?

 
Nov 6, 2018 11:04pm
Avatar Alan Wrigley (6066) 1 post

Well Beta4 is helping me make progress with Hermes at last. But a couple of questions: firstly, does anyone else use MSG_PEEK? It’s supposed to work in this version but I can’t get it to do so. It just behaves like a normal read – i.e. it reads the data and then removes it from the socket, whereas what it should do is leave it there for a subsequent read.

Secondly, has anyone yet come up with a definitive list of which of the cryptic error messages can safely be ignored? (And if ROOL don’t think that “Socket error (code 76)” is cryptic then I must be on a different planet). I’m getting quite a few &813F26 (with the above error) which as far as I can see is an alternative to EWOULDBLOCK and there appear to be no side-effects from ignoring it.

One little thing I’ve found: if you use Socket_Creat followed by AcornSSL_CreateSession (in order to use SocketWatch as detailed elsewhere by Martin), then to get the socket to be non-blocking you have to call Socket_Ioctl before CreateSession, rather than AcornSSL_Ioctl after it, otherwise it blocks horribly.

 
Nov 27, 2018 2:00pm
Avatar Steve Revill (20) 1361 posts

Beta5 is now available from the usual place.

  • SWI ConfigureSession removed; for changing aspects of the session, use Setsockopt. This API has the advantage that there is a way to read back values (through Getsockopt) in addition to setting them.
  • Setting the session hostname is now done through SO_ACORNSSL_HOSTNAME, so from BASIC you’d do:
    • SYS "AcornSSL_Setsockopt",opaque%,SOL_SOCKET,SO_ACORNSSL_HOSTNAME,"www.expectedhostname.com",4
  • A new option, SO_ACORNSSL_PROMPTTIME, has been added to allow the time that the certificate prompt is displayed for to be set. A value of 0 means it will never be shown (for headless scenarios), so if the certificate chain is flagged as bad it will return immediately with an error code.
  • Updated to use the latest mbedTLS 2.14.0 from Arm
 
Nov 27, 2018 5:00pm
Avatar Martin Avison (27) 1337 posts

Thanks for beta5 – I notice the module version is now v1.01 which is useful.

SYS “AcornSSL_Setsockopt”,opaque%,SOL_SOCKET,SO_ACORNSSL_HOSTNAME,“www.expectedhostname.com”,4

If I just want to change the hostname, what value should SOL_SOCKET be?
I would also have expected r4 to be LEN “www.expectedhostname.com” not 4. Edit: but I now see it should be 4 – the size of the pointer!

 
Nov 27, 2018 5:36pm
Avatar Rick Murray (539) 12392 posts

value of 0 means it will never be shown

That sounds like a good compromise.

 
Nov 29, 2018 3:50pm
Avatar Martin Avison (27) 1337 posts

what value should SOL_SOCKET be?

I eventually found the value in AcornC/C++.Export.APCS-32.Lib.TCPIPLibs.sys.h.socket
and it is &FFFF

 
Dec 3, 2018 2:56am
Avatar Chris Mahoney (1684) 2016 posts

Wonderful.

Fortunately it seems that mbed TLS upgrades are easy to drop in!

 
Dec 4, 2018 10:02am
Avatar Martin Avison (27) 1337 posts

What is the best way to RMEnsure AcornSSL in an Obey file?
The normal
RMEnsure AcornSSL 1.01 RMLoad System:Modules.Network.URL.AcornSSL
appears to work … but does not start the AcornSSL task, and I do not think the task is started automatically if/when the module needs it.

RMEnsure AcornSSL 1.01 RMRun System:Modules.Network.URL.AcornSSL
works and starts the task … but stops the Obey file from executing further, and leaves it open.

RMEnsure AcornSSL 1.01 WimpTask RMRun System:Modules.Network.URL.AcornSSL
works fine, as does…
RMEnsure AcornSSL 1.01 RMLoad System:Modules.Network.URL.AcornSSL
WimpTask Desktop_AcornSSL

Which should be used? Or any other suggestions?

 
Dec 4, 2018 10:19am
Avatar Jon Abbott (1421) 2372 posts

any other suggestions?

RMLoad it before the desktop starts?

 
Dec 4, 2018 10:43am
Avatar Frank de Bruijn (160) 216 posts

RMEnsure AcornSSL 1.01 RMRun System:Modules.Network.URL.AcornSSL
works and starts the task … but stops the Obey file from executing further, and leaves it open.

Hmmmm… Hadn’t noticed that.

RMEnsure AcornSSL 1.01 WimpTask RMRun System:Modules.Network.URL.AcornSSL
works fine,

But it makes the desktop ‘flash’. I think I’ll use
RMEnsure AcornSSL 1.01 StartDesktopTask RMRun System:Modules.Network.URL.AcornSSL

 
Dec 4, 2018 10:48am
Avatar Rick Murray (539) 12392 posts

…and ask the module’s author to please sort this out.

If there’s a desktop component to the module, it should be the responsibility of the module to start that, not every application author.

See here: https://www.riscosopen.org/forum/forums/11/topics/12341#posts-84315

 
Dec 4, 2018 1:06pm
Avatar Martin Avison (27) 1337 posts

RMLoad it before the desktop starts?

But it is normal for apps to do RMEnsures in their !Run files to determine if the correct version of a module for the app is available, and to load it if necessary, giving an error if not available. That is what I am trying to resolve.

 
Dec 4, 2018 4:47pm
Avatar Steve Pampling (1551) 7409 posts

If there’s a desktop component to the module, it should be the responsibility of the module to start that, not every application author.

I’m with Rick on this one. In essence the module is currently broken.
It does not operate correctly and users / application authors are having to concoct workarounds.

Next page

Pages: 1 2 3 4 5 6 7 8 9 10 11

Reply

To post replies, please first log in.

Forums → Bounties →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Discussion of items in the bounty list.

Voices

  • Chris Mahoney (1684)
  • Martin Avison (27)
  • Rick Murray (539)
  • Steve Revill (20)
  • Sprow (202)
  • Matthew Phillips (473)
  • Alan Wrigley (6066)
  • Jon Abbott (1421)
  • Frank de Bruijn (160)
  • Steve Pampling (1551)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys