415
fprintf(stderr, "Attempting to use OpenPGP certificate %s"
416
" and keyfile %s as GnuTLS credentials\n", pubkeyfilename,
415
fprintf(stderr, "Attempting to use OpenPGP public key %s and"
416
" secret key %s as GnuTLS credentials\n", pubkeyfilename,
604
603
fprintf(stderr, "Establishing TLS session with %s\n", ip);
607
606
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) tcp_sd);
610
609
ret = gnutls_handshake (session);
611
610
} while(ret == GNUTLS_E_AGAIN or ret == GNUTLS_E_INTERRUPTED);
828
827
const char *pubkey = PATHDIR "/" PUBKEY;
830
829
mandos_context mc = { .simple_poll = NULL, .server = NULL,
831
.dh_bits = 1024, .priority = "SECURE256"};
830
.dh_bits = 1024, .priority = "SECURE256"
831
":!CTYPE-X.509:+CTYPE-OPENPGP" };
832
832
bool gnutls_initalized = false;
833
833
bool pgpme_initalized = false;
837
837
{ .name = "debug", .key = 128,
838
838
.doc = "Debug mode", .group = 3 },
839
839
{ .name = "connect", .key = 'c',
841
.doc = "Connect directly to a sepcified mandos server",
840
.arg = "ADDRESS:PORT",
841
.doc = "Connect directly to a specific Mandos server",
843
843
{ .name = "interface", .key = 'i',
845
.doc = "Interface that Avahi will conntect through",
845
.doc = "Interface that will be used to search for Mandos"
847
848
{ .name = "seckey", .key = 's',
849
.doc = "Secret openpgp key for gnutls authentication",
850
.doc = "OpenPGP secret key file base name",
851
852
{ .name = "pubkey", .key = 'p',
853
.doc = "Public openpgp key for gnutls authentication",
854
.doc = "OpenPGP public key file base name",
855
856
{ .name = "dh-bits", .key = 129,
857
.doc = "dh-bits to use in gnutls communication",
858
.doc = "Bit length of the prime number used in the"
859
" Diffie-Hellman key exchange",
859
861
{ .name = "priority", .key = 130,
861
.doc = "GNUTLS priority", .group = 1 },
863
.doc = "GnuTLS priority string for the TLS handshake",
866
868
error_t parse_opt (int key, char *arg,
867
869
struct argp_state *state) {
868
870
/* Get the INPUT argument from `argp_parse', which we know is
869
871
a pointer to our plugin list pointer. */
873
case 128: /* --debug */
876
case 'c': /* --connect */
875
877
connect_to = arg;
879
case 'i': /* --interface */
882
case 's': /* --seckey */
885
case 'p': /* --pubkey */
888
case 129: /* --dh-bits */
888
890
mc.dh_bits = (unsigned int) strtol(arg, NULL, 10);
907
909
struct argp argp = { .options = options, .parser = parse_opt,
909
911
.doc = "Mandos client -- Get and decrypt"
910
" passwords from mandos server" };
912
" passwords from a Mandos server" };
911
913
ret = argp_parse (&argp, argc, argv, 0, 0, NULL);
912
914
if (ret == ARGP_ERR_UNKNOWN){
913
915
fprintf(stderr, "Unknown error while parsing arguments\n");
1039
1041
config.publish_addresses = 0;
1040
1042
config.publish_workstation = 0;
1041
1043
config.publish_domain = 0;
1043
1045
/* Allocate a new server */
1044
1046
mc.server = avahi_server_new(avahi_simple_poll_get
1045
1047
(mc.simple_poll), &config, NULL,
1048
1050
/* Free the Avahi configuration data */
1049
1051
avahi_server_config_free(&config);