Commit Graph

133 Commits

Author SHA1 Message Date
Andrew Bettison
d0317470c1 Fix test failure: create keyring
Was not overwriting keyring file.  Also refactored keyring structs to
replace off_t with size_t.
2015-02-23 13:24:05 +10:30
Jeremy Lakeman
6ab2cc5bb6 Only support one keyring pin per open file 2014-10-31 15:30:07 +10:30
Jeremy Lakeman
851144ea0a Refactor keyring identity iteration 2014-10-31 15:19:59 +10:30
Jeremy Lakeman
a37db8e958 Move most console commands to other files 2014-08-25 16:03:30 +09:30
Andrew Bettison
d436705e64 Fix conflict on UNUSED() macro from OpenJDK 7
The OpenJDK 7 recently introduced the UNUSED() macro in their jni_md.h
header file, which is included from <jni.h>.  This causes a
compile-error if "constants.h", which defines our own UNUSED() macro, is
included as well as <jni.h>.

The OpenJDK UNUSED() macro is unsuitable for our own use, because it
prefixes the unused identifier with "UNUSED_" whereas we depend on the
parameter name remaining unchanged.

I have reported this as a Request for Enhancement with Oracle Java,
asking them to remove the UNUSED() macro, since it is not used by any
JNI or Java extension header files.  Review ID: JI-9013689.

In the meantime, constants.h now undefines UNUSED before defining it, so
including <jni.h> before "constants.h" will avoid a compile error.
2014-07-23 11:55:55 +09:30
Andrew Bettison
bb677e50fd Refactor keyring open/seed out of server()
Now the keyring is opened and seeded before the server daemon process is
forked, and any keyring error prevents the server from starting

No longer necessary to pass a (cli_parsed*) argument to server()
2014-04-07 16:22:31 +09:30
Andrew Bettison
53c1b1c04c Filesystem Heirarchy Standard (FHS) paths
If no instance directory specified, then use paths like
/etc/serval/serval.conf
/var/cache/serval
/var/log/serval
/var/run/serval
etc. for files, instead of all in a single directory.

Log all directory creation as INFO messages.

Interpretation of log.file.directory_path has changed slightly.

Updated servald configuration tech doc.
2014-03-26 15:35:43 +10:30
Jeremy Lakeman
2480fb4a08 Migrate keyring sas commands 2014-02-19 16:37:45 +10:30
Jeremy Lakeman
487df0408d Refactor mdp packet processing to avoid using struct overlay_mdp_frame 2014-02-19 16:34:11 +10:30
Jeremy Lakeman
5f2c6e364a Refactor interface addresses to use new socket_address struct 2014-01-09 15:01:38 +10:30
Andrew Bettison
72040517e1 New enum rhizome_payload_status
Refactor a lot of Rhizome bundle storage code to use the new "enum
rhizome_payload_status" instead of mysterious int values to represent
the outcome of the operation.
2013-12-30 16:30:35 +10:30
Andrew Bettison
476a538ef7 Fix -Wsign-compare warnings in keyring: unsigned cn,in,kp 2013-12-10 16:34:35 +10:30
Andrew Bettison
5d741361ea Fix -Wsign-compare warnings: make loop counters unsigned 2013-12-10 16:21:23 +10:30
Andrew Bettison
30b2059608 Fix -Wunused-parameter warnings
New UNUSED(param) macro suppresses the warning for a specific parameter

In some cases, removed the unused parameters.  In others, used the
parameter in a DEBUGF() or assert() statement to document the intent.
2013-12-09 18:22:18 +10:30
Andrew Bettison
85448d5612 Fix bugs in keyring revealed by -Wunused-parameter 2013-12-09 18:19:58 +10:30
Andrew Bettison
9b64bb87e0 Uniform copyright notices
Added some missing copyright/license block comments
2013-12-04 17:15:36 +10:30
Andrew Bettison
42ab9aec4c Merge branch 'development' into 'naf4'
Remove two redundant calls to rhizome_retrieve_manifest() in meshms.c,
revealed by an assert() in the stricter manifest parsing code

Fix header files included by socket.h
2013-12-02 17:17:47 +10:30
Jeremy Lakeman
99d5d9fa1f Refactor dataformats into separate header 2013-11-27 13:11:42 +10:30
Jeremy Lakeman
0d5d878521 Refactor socket name and address length handling 2013-11-27 13:08:37 +10:30
Andrew Bettison
7564d529a1 Add missing copyright/license comment blocks
Update a few existing copyright notices to reflect recent work
2013-11-21 16:05:18 +10:30
Jeremy Lakeman
0b404b0260 Implement id list command 2013-11-13 12:00:46 +10:30
Jeremy Lakeman
ff1f1ff093 Allow tag primitives to be used outside of keyring entries 2013-11-13 12:00:05 +10:30
Jeremy Lakeman
9680b24f23 Add support for adding and updating tags in the keyring 2013-11-13 11:59:21 +10:30
Jeremy Lakeman
e5e95f00f8 Pass key length into unpack function 2013-11-13 11:59:18 +10:30
Jeremy Lakeman
8c03f18e5e Refactor keyring searching 2013-11-13 11:59:13 +10:30
Jeremy Lakeman
4434b1b65d Create keyring.h and move definitions there 2013-11-13 11:55:12 +10:30
Andrew Bettison
e00c945fd1 Merge branch 'naf4' into 'development'
Big refactor of Rhizome author and bundle secret handling.
2013-11-07 00:42:42 +10:30
Andrew Bettison
45442d3eb4 Rewrite bundle author authentication
Replaced 'int has_author' manifest element with new 'enum authorship'
element to record the result of author authentication, to avoid
repeating expensive crypto operations.

Separated the handling of bundle secret arguments from author lookup and
authentication.  The new rhizome_apply_bundle_secret(m,bsk) is now
called at the top level to set the manifest secret key (if it
validates), and thereafter there is no need to pass the 'bsk' argument
to any other functions, as they can simply check the 'haveSecret' field
of the manifest.

Removed rhizome_extract_privatekey() which combined author lookup and
bundle secret validation, and replaced it with functions that only deal
with the author: rhizome_lookup_author() and rhizome_authenticate_author().

Renamed other functions to make their purpose and effect clearer.

Formalised the semantics of only storing AUTHENTICATED author SIDs in
the 'author' column of the MANIFESTS table, which necessitated a change
to a 'rhizomeops' test case: when adding a file using a BK-less
manifest, the author column is set to null, so the Rhizome list output
does not show the bundle as ".fromhere" and does not give an author for
that bundle.
2013-11-06 23:58:17 +10:30
Dan Staples
f1d817463e fixed keyring-related memory leaks 2013-11-06 14:30:35 +10:30
Andrew Bettison
05d4215752 Add 'strlen' argument to strn_fromprint() 2013-10-25 00:19:58 +10:30
Jeremy Lakeman
b8ec568711 Send 3-way request to stop routing an identity 2013-10-14 14:40:19 +10:30
Jeremy Lakeman
ef7351bddc Unload identities from a running daemon 2013-10-10 14:27:00 +10:30
Andrew Bettison
a95ef79139 Use sid_t everywhere
Remove stowSid() at last

Change API of tohex() and strbuf_tohex(), to pass string length instead of
binary byte count.  This allows odd numbers of hex digits to be produced.

Remove alloca_tohex_sid(); replace with alloca_tohex_sid_t()

New alloca_tohex_sid_t_trunc() macro
2013-10-09 18:54:21 +10:30
Andrew Bettison
e8ab8477be Get rid of worse-than-useless keyring debug 2013-09-10 13:28:27 +09:30
Andrew Bettison
7add45214c Add [keyring-pin] arg to keyring load command 2013-09-10 11:28:55 +09:30
Andrew Bettison
d177512746 Add test for server start with --keyring-pin option 2013-09-09 14:47:02 +09:30
Jeremy Lakeman
d1234cb0f9 Use consistent integer types and formats 2013-09-09 12:09:40 +09:30
Andrew Bettison
18e2916cec Add more keyring load tests, fix duplicate identity bugs 2013-09-07 04:03:28 +09:30
Andrew Bettison
8a300c2520 Get new keyring dump command and test working 2013-09-05 16:34:01 +09:30
Andrew Bettison
f95e41374b Implement keyring load command, not working yet
Write new keyring test, fails with ERROR because assertGrep -F option is
not supported.
2013-09-04 23:47:17 +09:30
Andrew Bettison
08c02e0e20 More progress towards keyring load command 2013-09-03 17:31:10 +09:30
Andrew Bettison
425aa1005c Start work on "keyring load" command 2013-09-02 17:33:52 +09:30
Andrew Bettison
aa20fd1a9b Improve keyring environment variables
Rename to SERVALD_...

Interpret SERVALD_KEYRING_PATH relative to instance dir unless absolute.

Explicitly unset them in setup_servald() test defs function
2013-08-30 11:20:19 +09:30
Andrew Bettison
3b1ae5cbb0 Env vars SERVAL_KEYRING_PATH and SERVAL_KEYRING_READONLY
To support release signing operations without having to copy the release
keyring from its USB stick (into an instance directory), and reducing
the risk of corrupting the release keyring file while using it in-place.
2013-08-30 11:20:19 +09:30
Jeremy Lakeman
81afc42d8b Major refactor to packet queuing and delivery in preparation for unicast link tracking.
Unicast tests broken
2013-08-09 09:37:08 +09:30
Jeremy Lakeman
3855ff35c4 Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
Andrew Bettison
e5bcc07193 Change comment to reduce confusion 2013-06-06 16:03:35 +09:30
Andrew Bettison
1f10f05302 Add "keyring dump" command 2013-04-30 17:29:06 +09:30
Andrew Bettison
e6438d74d3 Improve keyring pack code 2013-04-29 16:00:58 +09:30
Andrew Bettison
6fd49099cb Rewrite keyring pack/unpack for extensibility
Use new rotbuf primitives to handle rotated buffers
2013-04-29 14:31:50 +09:30