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