| 1 |
#!/usr/bin/perl -wT |
| 2 |
|
| 3 |
# Monkeysphere Validation Agent, Perl version |
| 4 |
# Copyright © 2010 Daniel Kahn Gillmor <[email protected]> |
| 5 |
# |
| 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. |
| 10 |
# |
| 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. |
| 15 |
# |
| 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/>. |
| 18 |
|
| 19 |
use warnings; |
| 20 |
use strict; |
| 21 |
|
| 22 |
use Crypt::Monkeysphere::MSVA; |
| 23 |
|
| 24 |
my $server = Crypt::Monkeysphere::MSVA->new(); |
| 25 |
$server->run(host=>'127.0.0.1', |
| 26 |
log_level=> $server->logger->get_log_level(), |
| 27 |
user => POSIX::geteuid(), # explicitly choose regular user and group (avoids spew) |
| 28 |
group => POSIX::getegid(), |
| 29 |
msva=>$server); |
| 30 |
__END__ |
| 31 |
|
| 32 |
=encoding utf8 |
| 33 |
|
| 34 |
=head1 NAME |
| 35 |
|
| 36 |
msva-perl - Perl implementation of a Monkeysphere Validation Agent |
| 37 |
|
| 38 |
=head1 SYNOPSIS |
| 39 |
|
| 40 |
msva-perl [ COMMAND [ ARGS ... ] ] |
| 41 |
|
| 42 |
=head1 ABSTRACT |
| 43 |
|
| 44 |
msva-perl provides a Perl implementation of the Monkeysphere |
| 45 |
Validation Agent, a certificate validation service. |
| 46 |
|
| 47 |
=head1 INTRODUCTION |
| 48 |
|
| 49 |
The Monkeysphere Validation Agent offers a local service for tools to |
| 50 |
validate certificates (both X.509 and OpenPGP) and other public keys. |
| 51 |
|
| 52 |
Clients of the validation agent query it with a public key carrier (a |
| 53 |
raw public key, or some flavor of certificate), the supposed name of |
| 54 |
the remote peer offering the pubkey, and the context in which the |
| 55 |
validation check is relevant (e.g. ssh, https, etc). |
| 56 |
|
| 57 |
The validation agent then tells the client whether it was able to |
| 58 |
successfully validate the peer's use of the public key in the given |
| 59 |
context. |
| 60 |
|
| 61 |
=head1 USAGE |
| 62 |
|
| 63 |
Launched with no arguments, msva-perl simply runs and listens forever. |
| 64 |
|
| 65 |
Launched with arguments, it sets up a listener, spawns a subprocess |
| 66 |
using the supplied command and arguments, but with the |
| 67 |
MONKEYSPHERE_VALIDATION_AGENT_SOCKET environment variable set to refer |
| 68 |
to its listener. When the subprocess terminates, msva-perl tears down |
| 69 |
the listener and exits as well, returning the same value as the |
| 70 |
subprocess. |
| 71 |
|
| 72 |
This is a similar invocation pattern to that of ssh-agent(1). |
| 73 |
|
| 74 |
=head1 ENVIRONMENT VARIABLES |
| 75 |
|
| 76 |
msva-perl is configured by means of environment variables. |
| 77 |
|
| 78 |
=over 4 |
| 79 |
|
| 80 |
=item MSVA_LOG_LEVEL |
| 81 |
|
| 82 |
msva-perl logs messages about its operation to stderr. MSVA_LOG_LEVEL |
| 83 |
controls its verbosity, and should be one of (in increasing |
| 84 |
verbosity): silent, quiet, fatal, error, info, verbose, debug, debug1, |
| 85 |
debug2, debug3. Default is 'error'. |
| 86 |
|
| 87 |
=item MSVA_ALLOWED_USERS |
| 88 |
|
| 89 |
If your system is capable of it, msva-perl tries to figure out the |
| 90 |
owner of the connecting client. If MSVA_ALLOWED_USERS is unset, |
| 91 |
msva-perl will only permit connections from the user msva is running |
| 92 |
as. If you set MSVA_ALLOWED_USERS, msva-perl will treat it as a list |
| 93 |
of local users (by name or user ID) who are allowed to connect. |
| 94 |
|
| 95 |
=item MSVA_PORT |
| 96 |
|
| 97 |
msva-perl listens on a local TCP socket to facilitate access. You can |
| 98 |
choose what port to bind to by setting MSVA_PORT. Default is to bind |
| 99 |
on an arbitrary open port. |
| 100 |
|
| 101 |
=item MSVA_KEYSERVER |
| 102 |
|
| 103 |
msva-perl will request information from OpenPGP keyservers. Set |
| 104 |
MSVA_KEYSERVER to declare the keyserver you want it to check with. If |
| 105 |
this variable is blank or unset, and your gpg.conf contains a |
| 106 |
keyserver declaration, it will use the GnuPG configuration. Failing |
| 107 |
that, the default is 'hkp://pool.sks-keyservers.net'. |
| 108 |
|
| 109 |
=item MSVA_KEYSERVER_POLICY |
| 110 |
|
| 111 |
msva-perl must decide when to check with keyservers (for new keys, |
| 112 |
revocation certificates, new certifications, etc). There are three |
| 113 |
possible options: 'always' means to check with the keyserver on every |
| 114 |
query it receives. 'never' means to never check with a |
| 115 |
keyserver. 'unlessvalid' will only check with the keyserver on a |
| 116 |
specific query if no keys are already locally known to be valid for |
| 117 |
the requested peer. Default is 'unlessvalid'. |
| 118 |
|
| 119 |
=item MSVA_MONITOR_CHANGES |
| 120 |
|
| 121 |
Under graphical environments such as X11, msva-perl is capable of |
| 122 |
monitoring for changes in its underlying code and can prompt the user |
| 123 |
to restart the daemon when some of the underlying code changes. |
| 124 |
Setting this environmnt variable to 'true' enables this monitoring and |
| 125 |
prompting behavior. Default is 'false'. |
| 126 |
|
| 127 |
=back |
| 128 |
|
| 129 |
=head1 COMMUNICATION PROTOCOL DETAILS |
| 130 |
|
| 131 |
Communications with the Monkeysphere Validation Agent are in the form |
| 132 |
of JSON requests over plain HTTP. Responses from the agent are also |
| 133 |
JSON objects. For details on the structure of the requests and |
| 134 |
responses, please see |
| 135 |
http://web.monkeysphere.info/validation-agent/protocol |
| 136 |
|
| 137 |
=head1 SECURITY CONSIDERATIONS |
| 138 |
|
| 139 |
msva-perl deliberately binds to the IPv4 loopback (on 127.0.0.1) so |
| 140 |
that remote users do not get access to the daemon. On systems (like |
| 141 |
Linux) which report ownership of TCP sockets in /proc/net/tcp, |
| 142 |
msva-perl will refuse access from random users (see MSVA_ALLOWED_USERS |
| 143 |
above). |
| 144 |
|
| 145 |
=head1 SEE ALSO |
| 146 |
|
| 147 |
monkeysphere(1), monkeysphere(7), ssh-agent(1) |
| 148 |
|
| 149 |
=head1 BUGS AND FEEDBACK |
| 150 |
|
| 151 |
Bugs or feature requests for msva-perl should be filed with the |
| 152 |
Monkeysphere project's bug tracker at |
| 153 |
https://labs.riseup.net/code/projects/monkeysphere/issues/ |
| 154 |
|
| 155 |
=head1 AUTHORS AND CONTRIBUTORS |
| 156 |
|
| 157 |
Daniel Kahn Gillmor E<lt>[email protected]<gt> |
| 158 |
|
| 159 |
The Monkeysphere Team http://web.monkeysphere.info/ |
| 160 |
|
| 161 |
=head1 COPYRIGHT AND LICENSE |
| 162 |
|
| 163 |
Copyright © Daniel Kahn Gillmor and others from the Monkeysphere team. |
| 164 |
msva-perl is free software, distributed under the GNU Public License, |
| 165 |
version 3 or later. |
| 166 |
|