3 # Monkeysphere Validation Agent Client, Perl version
4 # Copyright © 2010 Jameson Greaf Rollins <jrollins@finestructure.net>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 use Crypt::Monkeysphere::MSVA::Client;
25 if ($context eq '--help') {
26 printf STDERR "Usage: msva-query-agent CONTEXT PEER PKC_TYPE [PEER_TYPE] <PKC_DATA\n";
33 # load raw pkc data from stdin
39 my $client = Crypt::Monkeysphere::MSVA::Client->new(
40 socket => $ENV{MONKEYSPHERE_VALIDATION_AGENT_SOCKET},
41 log_level => $ENV{MSVA_LOG_LEVEL},
44 my ($status,$ret) = $client->query_agent($context,$peer,$peertype,$pkctype,$pkcdata);
46 $client->log('info', "status: %s\n", $status);
48 $client->log('info', "valid: %s\n", $ret->{valid});
49 $client->log('info', "server: %s\n", $ret->{server});
50 printf("%s\n", $ret->{message});
60 msva-query-agent - query a Monkeysphere Validation Agent
64 msva-query-agent CONTEXT PEER PKC_TYPE [PEER_TYPE] < /path/to/public_key_carrier
68 msva-query-agent validates certificates for a given use by querying a
69 running Monkeysphere Validation Agent.
73 msva-query-agent reads a certificate from standard input, and posts it
74 to the running Monkeysphere Validation Agent. The return code
75 indicates the validity (as determined by the agent) of the certificate
76 for the specified purpose. The agent's return message (if any) is
79 The first three command-line arguments are all required, supplied in
86 Context in which the certificate is being validated (e.g. 'https',
91 The name of the intended peer. When validating a certificate for a
92 service, supply the host's full DNS name (e.g. 'foo.example.net')
96 The format of public key carrier data provided on standard input
97 (e.g. 'x509der', 'x509pem', 'opensshpubkey', 'rfc4716')
101 The fourth argument is optional:
107 The type of peer we are inquiring about (e.g. 'client', 'server')
113 If the certificate is valid for the requested peer in the given
114 context, the return code is 0. Otherwise, the return code is 1.
116 =head1 ENVIRONMENT VARIABLES
118 msva-query-agent's behavior is controlled by environment variables:
122 =item MONKEYSPHERE_VALIDATION_AGENT_SOCKET
124 Socket over which to query the validation agent. If unset, the
125 default value is 'http://localhost:8901'.
129 Log messages about its operation to stderr. MSVA_LOG_LEVEL controls
130 its verbosity, and should be one of (in increasing verbosity): silent,
131 quiet, fatal, error, info, verbose, debug, debug1, debug2, debug3.
136 =head1 COMMUNICATION PROTOCOL DETAILS
138 Communications with the Monkeysphere Validation Agent are in the form
139 of JSON requests over plain HTTP. Responses from the agent are also
140 JSON objects. For details on the structure of the requests and
141 responses, please see
142 http://web.monkeysphere.info/validation-agent/protocol
146 msva-perl(1), monkeysphere(1), monkeysphere(7)
148 =head1 BUGS AND FEEDBACK
150 Bugs or feature requests for msva-perl and associated tools should be
151 filed with the Monkeysphere project's bug tracker at
152 https://labs.riseup.net/code/projects/monkeysphere/issues/
154 =head1 AUTHORS AND CONTRIBUTORS
156 Jameson Graef Rollins E<lt>jrollins@finestructure.net<gt>
157 Daniel Kahn Gillmor E<lt>dkg@fifthhorseman.net<gt>
159 The Monkeysphere Team http://web.monkeysphere.info/
161 =head1 COPYRIGHT AND LICENSE
163 Copyright © 2010, Jameson Graef Rollins and others from the Monkeysphere
164 team. msva-query-agent is free software, distributed under the GNU
165 Public License, version 3 or later.