Commit Graph

61 Commits

Author SHA1 Message Date
Andy Green 4db2ff872b cose: keys and signing + validation
Support for COSE keys and signing / validation

 - lws_cose_key_t and import / export / generation apis for EC / RSA / SYMMETRIC

 - cose_sign1 ES256/384/512,RS256/384/512 sign + validate, passes RFC8152 WG tests sign1-tests
 - cose_sign  ES256/384/512,RS256/384/512 sign + validate, passes RFC8152 WG tests sign-tests
 - cose_mac0  HS256/HS256_64/384/512      sign + validate, passes RFC8152 WG tests hmac-examples
 - cose_mac   HS256/HS256_64/384/512             validate, passes RFC8152 WG tests hmac-examples

 - lws-crypto-cose-key commandline tool for key / key set dumping and
   creation
 - lws-crypro-cose-sign commandline tool for signing / validation

 - lws-api-test-cose - large number of test vectors and tests from RFC8152
2021-08-31 05:45:35 +01:00
Andy Green 2f9bb7a30a tls: JIT Trust
Add support for dynamically determining the CAs needed to validate server
certificates.  This allows you to avoid instantiating > 120 X.509 trusted
CA certs and have them take up heap the whole time.

Works for both openssl and mbedtls.

See READMEs/README.jit-trust.md for the documentation

You likely want the next patch for http redirect enhancements as well.
2021-06-22 15:55:29 +01:00
Andy Green 56f7007185 ctest: adapt background script 2021-01-26 07:48:10 +00:00
Andy Green a8d6ac8923 netbsdBE: enable ctest and fix test cert generation
NetBSD test server cert gen lacked a CN, add it for localhost

Enable Sai -j6 from -j4 for netbsdBE... it's slow but it is SMP

Add build in sai for secure-streams-proxy scenario
2021-01-05 10:56:38 +00:00
Andy Green 050d23f0be sai: mac m1 2020-12-06 19:06:07 +00:00
Andy Green 3216d4d087 ss: server: add foreach client cb api
Server SS maintains a list of accepted client ss, add an api allowing
iterating through the clients via a user callback.
2020-11-11 06:58:20 +00:00
Andy Green 9f1d019352 CTest: migrate and deprecate existing selftest scripts
Replace the bash selftest plumbing with CTest.

To use the selftests, build with -DLWS_WITH_MINIMAL_EXAMPLES=1
and `CTEST_OUTPUT_ON_FAILURE=1 make test` or just
`make test`.

To disable tests that require internet access, also give
-DLWS_CTEST_INTERNET_AVAILABLE=0

Remove travis and appveyor scripts on master.

Remove travis and appveyor decals on README.md.
2020-05-11 15:40:13 +01:00
Andy Green 1289b0a0ef v4.0.0 2020-03-06 10:18:46 +00:00
Andy Green 28ce32af64 client: secure streams
Secure Streams is an optional layer on top of lws that separates policy
like endpoint selection and tls cert validation into a device JSON
policy document.

Code that wants to open a client connection just specifies a streamtype name,
and no longer deals with details like the endpoint, the protocol (!) or anything
else other than payloads and optionally generic metadata; the JSON policy
contains all the details for each streamtype.  h1, h2, ws and mqtt client
connections are supported.

Logical secure streams outlive any particular connection and supports "nailed-up"
connectivity regardless of underlying connection stability.
2020-03-04 12:17:49 +00:00
Sakthi Kannan 9d099ba7be client: MQTT
Adds client support for MQTT QoS0 and QoS1, compatible with AWS IoT

Supports stream binding where independent client connections to the
same endpoint can mux on a single tcp + tls connection with topic
routing managed internally.
2020-03-04 12:17:49 +00:00
Andy Green 277d0e5e4c license: fix up last mentions of lgpl outside of the source file license grant part 2019-12-02 11:19:30 +00:00
Andy Green bca993f7ed ntpclient: update for udp adopt interface binding
https://github.com/warmcat/libwebsockets/issues/1781

Build this in travis so I could find this earlier
2019-11-28 05:23:50 +00:00
Andy Green 9d93677d7d ws pmd: deflatePending only has meaning during deflate
https://github.com/warmcat/libwebsockets/issues/1768
2019-11-23 07:44:05 +00:00
Andy Green 1f050a812c travis: disable dbus 2019-10-12 12:41:14 +01:00
Andy Green 49f78ed0d7 client: improve redirect 2019-09-22 03:07:57 -07:00
Andy Green 51cd925eff v3.2.0 2019-08-14 09:24:04 +01:00
Andy Green f89aa401cc generic-sessions update
Generic sessions has been overdue some love to align it with
the progress in the rest of lws.

1) Strict Content Security Policy
2) http2 compatibility
3) fixes and additions for use in a separate process via unix domain socket
4) work on ws and http proxying in lws
5) add minimal example
2019-05-06 10:24:51 +01:00
Andy Green 7ca8b77f2c pmd: split ebufs to track in and out 2019-05-06 07:31:32 +01:00
Andy Green eda102e397 jwe 2018-12-27 06:45:32 +08:00
Andy Green 440dacc992 JOSE: refactor and prepare for JWE
Until now the JOSE pieces only had enough support for ACME.
This patch improves the JWK parsing to prepare for more
complete support and for adding JWE, genaes and genec in
later patches.
2018-12-27 06:45:31 +08:00
Andy Green 5092350d16 autobahn: keep doing tests until we get a 500 2018-12-19 07:10:20 +08:00
Andy Green 89eedcaa94 v3.1.0 2018-11-23 11:30:56 +08:00
Andy Green 33a6034875 codacy: minor fixes 2018-10-13 08:16:27 +08:00
Andy Green 47e10ab200 dbus-ws-proxy
This builds on the new dbus role support to provide a minimal example proxy
between ws and dbus.

A client app is provided that asks the proxy to connect to libwebsockets.org
and proxy the drawing data from the mirror example there back to the dbus
client using dbus messages.
2018-10-13 08:16:27 +08:00
Andy Green 93f4fe5532 lws_return_http_status: use /error.css if possible 2018-09-17 07:26:08 +08:00
Andy Green ee250c0d83 esp32: follow idf meddlings 2018-09-12 09:38:30 +08:00
Badbaljan 90089af508 esp32: change make flash-related names to not conflict with idf 2018-08-19 06:41:59 +08:00
Steffen Vogel cfa15b4a73 rpm: add missing build-time dependencies 2018-05-26 09:20:24 +08:00
Steffen Vogel dd52dbcd86 rpm: add missing test-apps to spec file 2018-05-26 09:20:08 +08:00
Steffen Vogel d2914a21e1 rpm: fix bogus date in changelog 2018-05-26 09:20:03 +08:00
Andy Green 1ea3ef7894 travis: handle reduced max run time by splitting autobahn tests across two instances 2018-05-25 15:33:28 +08:00
Andy Green 1d3cafe179 autobahn: 12.3.1 and 12.3.2 also affected by autobahn bug 2018-05-07 13:37:25 +08:00
Andy Green 1c08a96b47 prepare for new release 2018-05-05 06:03:15 +08:00
Andy Green bce8cca042 refactor: also migrate tls to the ops struct and private.h pattern
Several new ops are planned for tls... so better to bite the bullet and
clean it out to the same level as roles + event-libs first.

Also adds a new travis target "mbedtls" and all the tests except
autobahn against mbedtls build.
2018-05-02 12:10:36 +08:00
Andy Green da0be64f68 minimal-raw-netcat
Adapt attack.sh to use it instead of OS netcat and fox various bugs that
exposed.
2018-05-02 08:46:16 +08:00
Andy Green f497562a62 refactor: change event lib minimal examples to serve as the test apps 2018-04-30 19:17:32 +08:00
Andy Green 25e27d76d1 travis: refactor the yml and add smp-specific tests 2018-04-27 14:22:58 +08:00
Andy Green ae688609a0 qa: add 6 x h2load tests 2018-04-27 11:19:09 +08:00
Andy Green 5d06f610a9 travis: h2spec integration 2018-04-26 15:27:02 +08:00
Andy Green 7b227eb333 autobahn fixes
This replaces the old test-app for echo with separate client and server
minimal versions.

The autobahn test script is made more autonomous and tests both
client and server.
2018-04-22 06:45:46 +08:00
Andy Green 8829c2f365 selftests
This converts several of the selftests to return a status in their exit code
about whether they 'worked'.

A small bash script framework is added, with a selftest.sh in the mininmal
example dirs that support it, and a ./minimal-examples/selftests.sh script
that can be run from the build dir with no args that discovers and runs all
the selftest.sh scripts underneath.

That is also integrated into travis and the enabled tests must pass now for
travis to pass.  Travis does not have a modern libuv so it can't run a
couple of tests which are nulled out if it sees it's running in travis env.
2018-04-19 16:16:48 +08:00
Andy Green d39ecd814a smp: fixes 2018-03-02 19:19:36 +08:00
Andy Green 1d9d04ff9d LWS_WITH_DISTRO_RECOMMENDED
Idea from Per Bothner
https://libwebsockets.org/pipermail/libwebsockets/2018-January/003635.html
2018-01-27 08:01:33 +08:00
Andy Green 5b74d7108b gcov: add in cmake and adapt defaults
1) Introduce LWS_WITH_GCOV to build with gcc / clang coverage instrumentation.

$ cd build
$ make clean && rm -f `find . -name "*.gcno" -o -name "*.gcda"` && make -j16 && sudo make install && sudo /usr/local/bin/libwebsockets-test-server -s
...
$ gcov `find . -name *.c.gcno | grep -v test-apps` -b | sed "/\.h.\$/,/^$/d"

The above are available in two helper scripts

 - scripts/build-gcov.sh
 - scripts/gcov.sh

2)

CMake defaults changed:

 - LWS_WITH_ZIP_FOPS: OFF
 - LWS_WITH_RANGES: OFF
 - LWS_WITHOUT_EXTENSIONS: ON
 - LWS_WITH_ZLIB: OFF

New CMake controls that default-OFF:

 - LWS_WITH_GENHASH
 - LWS_WITH_GENRSA

these are implied by LWS_WITH_JWS (which is implied by LWS_WITH_ACME)

3) rename ./lib/tls/XXX/server.c and client.c to XXX-server.c / XXX-client.c.

This is because gcov dumps its results using the .c filename part only,
the copies overwrite each other if there are different .c files in the tree
with the same filename part.

4) Add onetime test-client mode and test to ./test-apps/attack.sh

5) Add gcov howto in READMEs/README.build.md using attack.sh
2017-12-01 11:37:35 +08:00
Ben Delarre 946bfa2f18 Uses PROJECT_NAME instead of DIRNAME for binary filename 2017-12-01 11:37:35 +08:00
Ben Delarre dcf5a83ee4 esp32: move check for xxd and genromfs from CMake to esp32.mk 2017-12-01 11:37:35 +08:00
Andy Green b1934d6b64 client-certs: add related docs 2017-11-26 19:07:12 +08:00
Andy Green fcf5b2c25a v2.4.0 2017-10-17 13:21:12 +08:00
Andy Green 904a9c0920 http2: make usable
HTTP/2 support is now able to serve the test server, complete with
websockets, from a single vhost.

 - This works the same with both OpenSSL and mbedTLS.

 - POST is now wired up and works (also for file upload).

 - CGI is wired up and works.

 - Redirect is adapted and works

 - lwsws works.

 - URI urldecode, sanitation and argument parsing wired up for :path

valgrind clean (aside from openssl-style false uninit data usage in mbedtls send occasionally)

h2spec reports:

$ h2spec  -h 127.0.0.1 -p 7681 -t -k -o 1
...
145 tests, 145 passed, 0 skipped, 0 failed"

Incorporates:

 - "https://github.com/warmcat/libwebsockets/pull/1039
	Fixes issue with -Werror=unused-variable flag

 - 2c843a1395
	ssl: fix infinite loop on client cert verification failure

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>"

Caused and fixes Coverity 184887 - 184892
2017-10-16 17:13:49 +08:00
Andy Green 4f267c515e clean up top level of project 2017-09-27 08:24:05 +08:00