trust_router.git
5 years agoMerge pull request #76 from painless-security/jennifer/trpc_deadlock
mrw42 [Fri, 4 May 2018 20:58:06 +0000 (16:58 -0400)]
Merge pull request #76 from painless-security/jennifer/trpc_deadlock

Eliminate deadlock in TRPC messaging queueing

5 years agoMerge pull request #72 from painless-security/jennifer/peer_label_for_updates
mrw42 [Fri, 4 May 2018 19:05:56 +0000 (15:05 -0400)]
Merge pull request #72 from painless-security/jennifer/peer_label_for_updates

Use peer labels instead of GSS names when considering updates

5 years agoMerge pull request #74 from painless-security/jennifer/set_realm_apcs
mrw42 [Fri, 4 May 2018 19:04:10 +0000 (15:04 -0400)]
Merge pull request #74 from painless-security/jennifer/set_realm_apcs

Handle APC correctly when a realm is discovered from an APC community update

5 years agoMerge pull request #73 from painless-security/jennifer/expire_utc
mrw42 [Fri, 4 May 2018 19:01:37 +0000 (15:01 -0400)]
Merge pull request #73 from painless-security/jennifer/expire_utc

Report expiration times in UTC instead of local time

5 years agoMerge pull request #61 from painless-security/jennifer/request_id
mrw42 [Fri, 4 May 2018 19:00:24 +0000 (15:00 -0400)]
Merge pull request #61 from painless-security/jennifer/request_id

Add a 'request_id' to TID requests and responses

5 years agoMerge pull request #62 from painless-security/jennifer/report_incoming_ipaddr
mrw42 [Fri, 4 May 2018 18:50:16 +0000 (14:50 -0400)]
Merge pull request #62 from painless-security/jennifer/report_incoming_ipaddr

Report incoming IP address when a connection comes in

5 years agoCorrect a comment
Jennifer Richards [Thu, 3 May 2018 21:36:30 +0000 (17:36 -0400)]
Correct a comment

5 years agoMerge remote-tracking branch 'github/milestone/monitoring' into jennifer/request_id
Jennifer Richards [Thu, 3 May 2018 21:11:19 +0000 (17:11 -0400)]
Merge remote-tracking branch 'github/milestone/monitoring' into jennifer/request_id

5 years agoMerge branch 'milestone/monitoring' into jennifer/request_id
Jennifer Richards [Thu, 3 May 2018 20:50:54 +0000 (16:50 -0400)]
Merge branch 'milestone/monitoring' into jennifer/request_id

# Conflicts:
# include/trust_router/tid.h
# tid/tidc.c
# tr/tr_tid.c

5 years agoMerge pull request #59 from painless-security/jennifer/datastructures
mrw42 [Thu, 3 May 2018 20:42:46 +0000 (16:42 -0400)]
Merge pull request #59 from painless-security/jennifer/datastructures

Replace fixed length arrays with dynamic lists

5 years agoMerge pull request #48 from painless-security/jennifer/monitoring
mrw42 [Thu, 3 May 2018 20:13:15 +0000 (16:13 -0400)]
Merge pull request #48 from painless-security/jennifer/monitoring

Monitoring interface and back end support (pull request 10)

5 years agoMerge pull request #57 from painless-security/jennifer/show_rp_clients
mrw42 [Thu, 3 May 2018 20:11:35 +0000 (16:11 -0400)]
Merge pull request #57 from painless-security/jennifer/show_rp_clients

Add show rp_clients command (pull request 9)

5 years agoMerge pull request #56 from painless-security/jennifer/show_realms
mrw42 [Thu, 3 May 2018 20:10:13 +0000 (16:10 -0400)]
Merge pull request #56 from painless-security/jennifer/show_realms

Add show realms command (pull request 8)

5 years agoMerge pull request #55 from painless-security/jennifer/show_communities
mrw42 [Thu, 3 May 2018 20:09:12 +0000 (16:09 -0400)]
Merge pull request #55 from painless-security/jennifer/show_communities

Add show communities command (pull request 7)

5 years agoMerge pull request #54 from painless-security/jennifer/show_peers
mrw42 [Thu, 3 May 2018 20:08:08 +0000 (16:08 -0400)]
Merge pull request #54 from painless-security/jennifer/show_peers

Add the show peers command (pull request 6)

5 years agoMerge pull request #53 from painless-security/jennifer/show_routes
mrw42 [Thu, 3 May 2018 20:07:11 +0000 (16:07 -0400)]
Merge pull request #53 from painless-security/jennifer/show_routes

Add show routes message support (pull request 5)

5 years agoMerge pull request #52 from painless-security/jennifer/subprocess_status
mrw42 [Thu, 3 May 2018 20:05:51 +0000 (16:05 -0400)]
Merge pull request #52 from painless-security/jennifer/subprocess_status

Report whether TID requests succeed and better clean up zombie TID / MON processes (pull request 4)

5 years agoMerge pull request #51 from painless-security/jennifer/monitoring_client_and_server
mrw42 [Thu, 3 May 2018 20:03:15 +0000 (16:03 -0400)]
Merge pull request #51 from painless-security/jennifer/monitoring_client_and_server

First functioning monitoring client/server (pull request 3)

5 years agoMerge pull request #50 from painless-security/jennifer/refactoring_tids
mrw42 [Thu, 3 May 2018 20:02:05 +0000 (16:02 -0400)]
Merge pull request #50 from painless-security/jennifer/refactoring_tids

TID refactoring (pull request 2)

5 years agoMerge pull request #49 from painless-security/jennifer/mon_msg_encoders
mrw42 [Thu, 3 May 2018 20:00:42 +0000 (16:00 -0400)]
Merge pull request #49 from painless-security/jennifer/mon_msg_encoders

Add encoders for monitoring messages (pull request 1)

5 years agoRemove last remnants of old trpc thread exit protocol, clear trpc queue
Jennifer Richards [Tue, 1 May 2018 19:36:33 +0000 (15:36 -0400)]
Remove last remnants of old trpc thread exit protocol, clear trpc queue

  * Remove the shutting_down status in the TRPC_INSTANCE
  * Clear the TRPC message queue after failed connections
  * Add a few comments

5 years agoEliminate deadlock in trpc message handling
Jennifer Richards [Tue, 1 May 2018 17:49:24 +0000 (13:49 -0400)]
Eliminate deadlock in trpc message handling

  * Remove notify_cb for the trpc thread's TR_MQ
  * Use trpc_mq_pop() directly in the tr_trpc_thread() instead of
    trying to empty the queue every time
  * Eliminate the complicated thread shutdown protocol needed to avoid
    invalid accesses to data allocated in tr_trpc_thread()

This eliminates a deadlock that was possible due to misuse of the
callback mutex in conjunction with the TR_MQ mutex.

5 years agoFix JSON reference counting errors
Jennifer Richards [Mon, 30 Apr 2018 17:12:41 +0000 (13:12 -0400)]
Fix JSON reference counting errors

5 years agoSet APC correctly for community updates, reject routes for non-APC comms
Jennifer Richards [Mon, 30 Apr 2018 17:07:46 +0000 (13:07 -0400)]
Set APC correctly for community updates, reject routes for non-APC comms

When an APC community update is received, the "apcs" list is empty. The
APC for any realms described by that update should be the APC community
itself.

Also, the trust router previously accepted any realm/community pairs for
routing. That should have been APC communities only.

Finally, this also prevents configuring multiple communities with the
same ID.

5 years agoUse peer_label instead of peer_gssname in community gathering
Jennifer Richards [Sun, 29 Apr 2018 18:05:56 +0000 (14:05 -0400)]
Use peer_label instead of peer_gssname in community gathering

Currently this does nothing (loop prevention is done by the TR that
receives an update)

5 years agoProperly check peer labels when finding alternate route to advertise
Jennifer Richards [Sun, 29 Apr 2018 17:52:59 +0000 (13:52 -0400)]
Properly check peer labels when finding alternate route to advertise

5 years agoConsistently use peer label to ID peers when enforcing split horizon
Jennifer Richards [Sun, 29 Apr 2018 17:23:46 +0000 (13:23 -0400)]
Consistently use peer label to ID peers when enforcing split horizon

We were incorrectly comparing the peer label (which is "hostname:port")
with the GSS name of our route's source (i.e., "credential@apc.x") when
checking whether we were about to advertise a route back to the trust
router that announced it to us. That broke split horizon enforcement.

5 years agoReplace tr_comm_memb_iter_all methods with ones that actually work
Jennifer Richards [Fri, 27 Apr 2018 20:20:14 +0000 (16:20 -0400)]
Replace tr_comm_memb_iter_all methods with ones that actually work

The old iterator was completely broken, which was causing incomplete
cleanup of realms that should have been expired. This may have been
leaving the community membership table in an inconsistent state.

5 years agoAdd some comments, a bit of code clean up
Jennifer Richards [Fri, 27 Apr 2018 02:09:24 +0000 (22:09 -0400)]
Add some comments, a bit of code clean up

5 years agoFix race condition on exit of trpc threads
Jennifer Richards [Fri, 27 Apr 2018 01:46:36 +0000 (21:46 -0400)]
Fix race condition on exit of trpc threads

The messaging between the main thread and the trpc (outgoing connection)
threads allowed the trpc data to be cleaned up before the message queue
was empty, causing incorrect mutex behavior and seg faults.

This is (I hope!) solved adding an additional shutdown phase in which
the main thread indicates that it has recognized that the trpc thread
is done and that the trpc thread can safely exit.

So far, I have not seen a failure of the system to handle a peer
disconnecting. Prior to these changes, it failed every time with my
current setup.

5 years agoDon't display "last_connection_attempt" if there is not one
Jennifer Richards [Thu, 26 Apr 2018 23:33:01 +0000 (19:33 -0400)]
Don't display "last_connection_attempt" if there is not one

5 years agoCorrectly display RP realms in the 'show communities' response
Jennifer Richards [Thu, 26 Apr 2018 20:51:33 +0000 (16:51 -0400)]
Correctly display RP realms in the 'show communities' response

5 years agoReport community / route expiration times in UTC
Jennifer Richards [Thu, 26 Apr 2018 19:56:10 +0000 (15:56 -0400)]
Report community / route expiration times in UTC

  * add utility methods for timespec math
  * add method to convert between CLOCK_*

5 years agoLog incoming IP address when accepting a connection
Jennifer Richards [Thu, 26 Apr 2018 16:05:15 +0000 (12:05 -0400)]
Log incoming IP address when accepting a connection

5 years agoAdd a 'request_id' to TID requests and responses
Jennifer Richards [Thu, 26 Apr 2018 01:02:06 +0000 (21:02 -0400)]
Add a 'request_id' to TID requests and responses

This adds a random hex string ID to each TID request. This is
propagated as the request is forwarded, then included in the response.
The field is not required, and is mostly an aid for debugging.

Adds two methods (tid_req_get_request_id and tid_resp_get_request_id)
to the public library interface.

5 years agoChange -v/--validate-config to -C/--config-validate
Jennifer Richards [Wed, 25 Apr 2018 17:13:03 +0000 (13:13 -0400)]
Change -v/--validate-config to -C/--config-validate

There are enough things that use v, we'll accept Adam Bishop's hint and
copy FreeRADIUS's '-C' choice.

5 years agoMerge pull request #60 from painless-security/jennifer/validate_config
Jennifer Richards [Wed, 25 Apr 2018 17:08:06 +0000 (13:08 -0400)]
Merge pull request #60 from painless-security/jennifer/validate_config

Validate config with -v or --validate-config options

5 years agoValidate config with -v or --validate-config options
Jennifer Richards [Wed, 25 Apr 2018 17:05:30 +0000 (13:05 -0400)]
Validate config with -v or --validate-config options

Removes the -v short form for --version

5 years agoUse TR_LIST for TR_GSS_NAMES
Jennifer Richards [Wed, 25 Apr 2018 16:47:19 +0000 (12:47 -0400)]
Use TR_LIST for TR_GSS_NAMES

5 years agoChange most while loops over TR_LISTs to for loops
Jennifer Richards [Wed, 25 Apr 2018 16:04:37 +0000 (12:04 -0400)]
Change most while loops over TR_LISTs to for loops

The while loop patter (i = first(); while(i){blah; i = next()}) pattern
was error-prone -- too easy to overlook or forget the next() call.
Changed most of these to for loops to make the iteration more apparent.
Added a few comments. No intentional functional changes.

5 years agoAdd a few comments
Jennifer Richards [Wed, 25 Apr 2018 15:43:35 +0000 (11:43 -0400)]
Add a few comments

5 years agoAdd missing %.*s so debug message includes GSS name
Jennifer Richards [Tue, 24 Apr 2018 21:21:43 +0000 (17:21 -0400)]
Add missing %.*s so debug message includes GSS name

5 years agoUse TR_LIST for domain/realm constraint matches
Jennifer Richards [Tue, 24 Apr 2018 15:48:27 +0000 (11:48 -0400)]
Use TR_LIST for domain/realm constraint matches

5 years agoUse TR_LIST for TR_FILTER's 'flines' member
Jennifer Richards [Tue, 24 Apr 2018 01:48:34 +0000 (21:48 -0400)]
Use TR_LIST for TR_FILTER's 'flines' member

5 years agoUse TR_LIST for TR_FLINE's 'fspec' member
Jennifer Richards [Tue, 24 Apr 2018 01:42:42 +0000 (21:42 -0400)]
Use TR_LIST for TR_FLINE's 'fspec' member

  * Replace custom iterators with generic iterator
  * Add 'steal' option to steal (or not) an item's talloc context when
    adding it to a TR_LIST
  * Add tr_list_foreach() function to iterate over a TR_LIST

5 years agoAdd a generic TR_LIST type, use for TR_FILTER's 'lines' member
Jennifer Richards [Mon, 23 Apr 2018 15:01:55 +0000 (11:01 -0400)]
Add a generic TR_LIST type, use for TR_FILTER's 'lines' member

5 years agoRefactor TR_FLINE using GPtrArray
Jennifer Richards [Sat, 21 Apr 2018 06:04:27 +0000 (02:04 -0400)]
Refactor TR_FLINE using GPtrArray

5 years agoRefactor TR_FSPEC using GPtrArray
Jennifer Richards [Sat, 21 Apr 2018 05:34:27 +0000 (01:34 -0400)]
Refactor TR_FSPEC using GPtrArray

5 years agoRefactor TR_FILTER using a GPtrArray of filter lines
Jennifer Richards [Sat, 21 Apr 2018 05:04:36 +0000 (01:04 -0400)]
Refactor TR_FILTER using a GPtrArray of filter lines

5 years agoReimplement TR_GSS_NAMES using GPtrArray
Jennifer Richards [Sat, 21 Apr 2018 04:17:35 +0000 (00:17 -0400)]
Reimplement TR_GSS_NAMES using GPtrArray

5 years agoAdd const modifier to TR_NAME functions
Jennifer Richards [Sat, 21 Apr 2018 04:17:04 +0000 (00:17 -0400)]
Add const modifier to TR_NAME functions

This should be backward compatible.

5 years agoBump versions to 3.4.0~1 (did not update ABI version yet)
Jennifer Richards [Sat, 21 Apr 2018 00:48:25 +0000 (20:48 -0400)]
Bump versions to 3.4.0~1 (did not update ABI version yet)

5 years agoMerge remote-tracking branch 'origin/v3.3.0' into jennifer/monitoring
Jennifer Richards [Sat, 21 Apr 2018 00:44:11 +0000 (20:44 -0400)]
Merge remote-tracking branch 'origin/v3.3.0' into jennifer/monitoring

# Conflicts:
# tr/tr_tid.c
# tr/tr_trp.c

5 years agoFix lines that were swapped accidentally v3.3.0
Jennifer Richards [Sat, 21 Apr 2018 00:00:27 +0000 (20:00 -0400)]
Fix lines that were swapped accidentally

5 years agoCheck in changes that were accidentally omitted
Jennifer Richards [Fri, 20 Apr 2018 23:50:49 +0000 (19:50 -0400)]
Check in changes that were accidentally omitted

5 years agoClean up monitoring format/naming
Jennifer Richards [Fri, 20 Apr 2018 23:17:04 +0000 (19:17 -0400)]
Clean up monitoring format/naming

  * change show "serial" to "config_files" to reflect its function
  * suppress display of empty strings for unset / irrelevant values when
    returning routes / communities

5 years agoRename acceptor_realm/name to _hostname/service, add some debug output
Jennifer Richards [Fri, 20 Apr 2018 22:38:59 +0000 (18:38 -0400)]
Rename acceptor_realm/name to _hostname/service, add some debug output

5 years agoRead GSS credentials for monitoring service
Jennifer Richards [Fri, 20 Apr 2018 22:32:38 +0000 (18:32 -0400)]
Read GSS credentials for monitoring service

Some refactoring here and there, too.

5 years agoBump version number (but not shared library version yet). Now 3.3.1~1
Jennifer Richards [Fri, 20 Apr 2018 21:03:22 +0000 (17:03 -0400)]
Bump version number (but not shared library version yet). Now 3.3.1~1

5 years agoBump version number (but not shared library version yet). Now 3.3.1~1
Jennifer Richards [Fri, 20 Apr 2018 20:41:40 +0000 (16:41 -0400)]
Bump version number (but not shared library version yet). Now 3.3.1~1

5 years agoBreak tr_config.c into smaller chunks
Jennifer Richards [Fri, 20 Apr 2018 19:17:36 +0000 (15:17 -0400)]
Break tr_config.c into smaller chunks

No functional changes

5 years agoSupport 'show serial' monitoring request
Jennifer Richards [Fri, 20 Apr 2018 18:47:12 +0000 (14:47 -0400)]
Support 'show serial' monitoring request

5 years agoFix CoI to APC mapping
Jennifer Richards [Fri, 20 Apr 2018 17:27:38 +0000 (13:27 -0400)]
Fix CoI to APC mapping

  * Route forwarded request based on mapped APC, not the original COI
  * Refactor COI/APC mapping code out of tr_tids_req_handler(), which
    remains in desperate need of refactoring for clarity
  * Use accessors instead of direct reference to structure elements in a
    few places (still more to convert)
  * Don't assume TR_NAME buf is null-terminated (it always is AFAIK, but
    is not required by the data structure). Still more of these to fix
  * Rename tid_req_set_rp_orig_coi() to _set_orig_coi(). It's not exported
    as part of the public API and was not used in our code. I think this
    was originally a copy/paste error.

This resolves https://bugs.launchpad.net/moonshot-tr/+bug/1765681

5 years agoUpdate tids->hostname after configuration reload
Jennifer Richards [Fri, 20 Apr 2018 15:07:10 +0000 (11:07 -0400)]
Update tids->hostname after configuration reload

This was also done in 3b59db3c5565b707e745d58f7ec1df1bdc7c1895.

Fixes https://bugs.launchpad.net/moonshot-tr/+bug/1765633

6 years agoAdd encoders for tr_filters, include in peer and rp_client encoders
Jennifer Richards [Thu, 19 Apr 2018 23:35:20 +0000 (19:35 -0400)]
Add encoders for tr_filters, include in peer and rp_client encoders

6 years agoAdd support for "show rp_clients" monitoring request
Jennifer Richards [Thu, 19 Apr 2018 21:43:00 +0000 (17:43 -0400)]
Add support for "show rp_clients" monitoring request

6 years agoSeparate tr_rp and tr_rp_client into separate modules
Jennifer Richards [Thu, 19 Apr 2018 21:27:17 +0000 (17:27 -0400)]
Separate tr_rp and tr_rp_client into separate modules

No functional changes

6 years agoAdd support for "show realms" monitoring request
Jennifer Richards [Thu, 19 Apr 2018 21:01:13 +0000 (17:01 -0400)]
Add support for "show realms" monitoring request

6 years agoImprove structure of realm listings in 'show communities' response
Jennifer Richards [Thu, 19 Apr 2018 19:55:49 +0000 (15:55 -0400)]
Improve structure of realm listings in 'show communities' response

6 years agoAdd support for show communities monitoring request
Jennifer Richards [Thu, 19 Apr 2018 18:54:39 +0000 (14:54 -0400)]
Add support for show communities monitoring request

6 years agoAdd support for show peers monitoring request
Jennifer Richards [Thu, 19 Apr 2018 16:58:10 +0000 (12:58 -0400)]
Add support for show peers monitoring request

6 years agoRefactor trp_route_encoders for better style
Jennifer Richards [Thu, 19 Apr 2018 16:57:42 +0000 (12:57 -0400)]
Refactor trp_route_encoders for better style

6 years agoSplit trp_ptable into trp_ptable, trp_peer, and _encoders modules
Jennifer Richards [Thu, 19 Apr 2018 16:14:18 +0000 (12:14 -0400)]
Split trp_ptable into trp_ptable, trp_peer, and _encoders modules

No functional changes

6 years agoSupport "show routes" monitoring request
Jennifer Richards [Thu, 19 Apr 2018 15:51:28 +0000 (11:51 -0400)]
Support "show routes" monitoring request

  * Separate _to_string and _to_json functions into _encoders.c files
    for trp_rtable and trp_route
  * Add monitoring handler to call trp_rtable_to_json()

6 years agoSeparate trp_route and trp_rtable, move timespec_to_str to tr_util.c
Jennifer Richards [Thu, 19 Apr 2018 14:55:02 +0000 (10:55 -0400)]
Separate trp_route and trp_rtable, move timespec_to_str to tr_util.c

No functional changes

6 years agoMake trmon into a usable command-line interface
Jennifer Richards [Thu, 19 Apr 2018 03:18:24 +0000 (23:18 -0400)]
Make trmon into a usable command-line interface

  * accept monitoring request command/options on the command line
  * display response JSON to stdout
  * remove extraneous stdout output

6 years agoPeriodically call tids_sweep_procs() during trust router operation
Jennifer Richards [Thu, 19 Apr 2018 02:39:44 +0000 (22:39 -0400)]
Periodically call tids_sweep_procs() during trust router operation

6 years agoAdd better error checking for waitpid in tids_sweep_procs
Jennifer Richards [Thu, 19 Apr 2018 01:59:03 +0000 (21:59 -0400)]
Add better error checking for waitpid in tids_sweep_procs

6 years agoUse pipe instead of exit status to determine whether TID req succeeded
Jennifer Richards [Thu, 19 Apr 2018 00:20:29 +0000 (20:20 -0400)]
Use pipe instead of exit status to determine whether TID req succeeded

The exit status of the TID process is not reliable --- with some
versions of moonshot-gss-eap, a segfault occurs during tear-down and
contaminates the process status returned by waitpid.

6 years agoTrack and clean up monitoring processes by pid, fix some debug msgs
Jennifer Richards [Wed, 18 Apr 2018 17:45:21 +0000 (13:45 -0400)]
Track and clean up monitoring processes by pid, fix some debug msgs

6 years agoTrack TID processes and add TID req counts for success/error/pending
Jennifer Richards [Wed, 18 Apr 2018 17:34:26 +0000 (13:34 -0400)]
Track TID processes and add TID req counts for success/error/pending

  * Track TID processes by pid
  * Add handlers for the TID req counts

Still only check for terminated TID processes after the next one comes
in, should either periodically sweep or check this after a child
terminates and sends SIGCHLD

6 years agoAdd TID_REQ_COUNT handler
Jennifer Richards [Wed, 18 Apr 2018 15:41:06 +0000 (11:41 -0400)]
Add TID_REQ_COUNT handler

  * Add a separate source file for TID-related monitoring handlers
  * Increment tids->req_count in the main process, otherwise it will
    always seem to be zero. This does mean any connection to the TID
    port is counted as a tid request, which is not perfect.
  *

6 years agoCollect return codes from monitoring handlers and indicate errors
Jennifer Richards [Wed, 18 Apr 2018 15:16:42 +0000 (11:16 -0400)]
Collect return codes from monitoring handlers and indicate errors

6 years agoGet rid of CLion warnings about undefined PACKAGE_* macros
Jennifer Richards [Wed, 18 Apr 2018 14:09:10 +0000 (10:09 -0400)]
Get rid of CLion warnings about undefined PACKAGE_* macros

6 years agoReplace static monitor handler tables with dynamic handler registry
Jennifer Richards [Wed, 18 Apr 2018 03:38:27 +0000 (23:38 -0400)]
Replace static monitor handler tables with dynamic handler registry

  * Keep a list of handlers as part of MONS_INSTANCE
    - each handles a command/opt_type pair
    - registered via mons_register_handler()
  * Scan the list of handlers when servicing a monitoring request
  * Add handlers for version and uptime, registered through tr_main.c
    (probably need to move these, but this works as a demo)

6 years agoFirst functional monitoring server - can return the trust router version
Jennifer Richards [Tue, 17 Apr 2018 18:15:53 +0000 (14:15 -0400)]
First functional monitoring server - can return the trust router version

6 years agoFirst steps toward actually handling monitoring requests
Jennifer Richards [Tue, 17 Apr 2018 16:58:44 +0000 (12:58 -0400)]
First steps toward actually handling monitoring requests

6 years agoUse TR_MSG instead of encoded strings in GSS request handler interface
Jennifer Richards [Tue, 17 Apr 2018 16:27:15 +0000 (12:27 -0400)]
Use TR_MSG instead of encoded strings in GSS request handler interface

Also some further cleanup of header files and data types.

6 years agoClean up TR_MSG, hopefully getting talloc context handling right
Jennifer Richards [Tue, 17 Apr 2018 16:07:56 +0000 (12:07 -0400)]
Clean up TR_MSG, hopefully getting talloc context handling right

I had assumed in a few places that TR_MSGs and the various message
payload types were always allocated dynamically via talloc(). This is
not a safe assumption - in a few places, we use stack-allocated TR_MSGs
and these are all used outside our code via the libtr_tid library.
We now use talloc when we can (i.e., when we have encoded or decoded
a message and know we used talloc), but otherwise leave it to the calling
code to properly manage memory.

6 years agoFix makefile, full make now succeeds
Jennifer Richards [Mon, 16 Apr 2018 21:50:13 +0000 (17:50 -0400)]
Fix makefile, full make now succeeds

6 years agoRefactor tidc/monc to better share code
Jennifer Richards [Mon, 16 Apr 2018 21:32:01 +0000 (17:32 -0400)]
Refactor tidc/monc to better share code

  * Implement minimal decoding of monitoring responses
  * Add tr_gss_client.[ch] to house GSS req/resp message exchange
  * Always use 'payload' as the key for MON_RESP payload, don't name it
    after the command that it is responding to
  * Use better reference count behavior for MON_RESP payload
  * Move typedefs out of mon_internal.h to mon.h to avoid cyclic header
    dependencies
  * Fix some minor integer type mismatches in option parser
  * Update various test programs to use extra argument to
    tr_msg_(en/de)code methods

6 years agoMake better use of talloc for TR_MSG handling
Jennifer Richards [Mon, 16 Apr 2018 17:08:00 +0000 (13:08 -0400)]
Make better use of talloc for TR_MSG handling

6 years agoEnclose macro arguments in parentheses
Jennifer Richards [Mon, 16 Apr 2018 16:31:34 +0000 (12:31 -0400)]
Enclose macro arguments in parentheses

6 years agoFirst pass at a trmon command-line interface; fix a few bugs
Jennifer Richards [Fri, 13 Apr 2018 21:02:18 +0000 (17:02 -0400)]
First pass at a trmon command-line interface; fix a few bugs

At this point, if you hack tr_mons_auth_handler() to always return 0
(success), then trmon can connect to the trust router's monitoring port
and retrieve a test message. That counts as first contact, I guess.
Actual functionality is still to come.

  * Create basic trmon utility based closely on tidc
  * Temporarily use void pointers for trps/tids handles in the MON_INSTANCE
    structure - there is a header file cycle that prevents compliation.
    Need to sort that out, but this works for the moment.
  * Fill in tr_msg handlers for monitoring message encoders/decoders
  * Revert to the monitoring msg decoder working from json, not a string,
    since that is what we need. This breaks the test programs for now.

6 years agoFurther work on tids and monitoring, tids appears to work again
Jennifer Richards [Fri, 13 Apr 2018 20:03:52 +0000 (16:03 -0400)]
Further work on tids and monitoring, tids appears to work again

  * Actually encode the TID response!
  * Do not directly send responses from tids_req_handler(), set the
    properties in the response and return with an error code
  * Add hostname to MONS_INSTANCE
  * Update tids hostname after configuration change
  * Add a tid_resp_cpy() function to duplicate a TID_RESP into a struct
    that already exists

6 years agoParse monitoring port from internal configuration
Jennifer Richards [Fri, 13 Apr 2018 16:43:25 +0000 (12:43 -0400)]
Parse monitoring port from internal configuration

6 years agoRefactor to eliminate repeated code in tr_cfg_parse_internal()
Jennifer Richards [Fri, 13 Apr 2018 16:28:23 +0000 (12:28 -0400)]
Refactor to eliminate repeated code in tr_cfg_parse_internal()

6 years agoMove internal config parser to a separate file
Jennifer Richards [Fri, 13 Apr 2018 15:37:03 +0000 (11:37 -0400)]
Move internal config parser to a separate file

6 years agoAdd stub of handler for monitoring requests
Jennifer Richards [Fri, 13 Apr 2018 15:01:32 +0000 (11:01 -0400)]
Add stub of handler for monitoring requests

Trust router now builds and opens monitoring port

6 years agoRemove several unused parameters and clean up some lint warnings
Jennifer Richards [Fri, 13 Apr 2018 14:31:24 +0000 (10:31 -0400)]
Remove several unused parameters and clean up some lint warnings