From: Guus Sliepen Date: Mon, 29 Dec 2008 21:21:38 +0000 (+0100) Subject: Start of fides. X-Git-Url: https://www.tinc-vpn.org/git/browse?p=fides;a=commitdiff_plain;h=671e09247b53a6819d8f3c4ad1378997572356e6 Start of fides. --- 671e09247b53a6819d8f3c4ad1378997572356e6 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a712e4e --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +fides: fides.o + $(CC) -o $@ $< + +%.o: %.c + $(CC) -c -o $@ $< diff --git a/fides.c b/fides.c new file mode 100644 index 0000000..70c8d3e --- /dev/null +++ b/fides.c @@ -0,0 +1,127 @@ +#include +#include + +void help(FILE *out, const char *argv0) { + fprintf(out, "Usage: %s [arguments]\n\n", argv0); + fprintf(out, "Available commands are:\n"); + fprintf(out, " init Initialise fides, generate a public/private keypair.\n"); + fprintf(out, " version Show version and copyright information.\n"); + fprintf(out, " help Show this help message.\n"); + fprintf(out, " trust \n"); + fprintf(out, " Trust allow/deny packets signed by the specified key.\n"); + fprintf(out, " distrust \n"); + fprintf(out, " Distrust allow/deny packets signed by the specified key.\n"); + fprintf(out, " allow \n"); + fprintf(out, " Allow the entity identified by keyid some stuff.\n"); + fprintf(out, " deny \n"); + fprintf(out, " Deny the entity identified by keyid some stuff.\n"); + fprintf(out, " import [filename]\n"); + fprintf(out, " Import trust packets from file, or stdin if unspecified.\n"); + fprintf(out, " export [filename]\n"); + fprintf(out, " Export trust packets to file, or stdout if unspecified.\n"); + fprintf(out, " test \n"); + fprintf(out, " Tell whether stuff is allowed or not, and why.\n"); + fprintf(out, " fsck Verify the signature on all information collected.\n"); +} + +int version() { + fprintf(stdout, "fides version 0.1\n"); + fprintf(stdout, "Copyright (c) 2008 Guus Sliepen \n\n"); + fprintf(stdout, "This program is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation; either version 2 of the License, or\n" + "(at your option) any later version.\n"); + + return 0; +} + +int init() { + // Generate a public/private keypair if it does not already exist + return 0; +} + +int trust(int argc, char *argv[]) { + // Trust another key + return 0; +} + +int distrust(int argc, char *argv[]) { + // Distrust another key + return 0; +} + +int allow(int argc, char *argv[]) { + // Generate a certficate allowing something + return 0; +} + +int deny(int argc, char *argv[]) { + // Generate a certificate denying something + return 0; +} + +int import(int argc, char *argv[]) { + // Import certificates + return 0; +} + +int export(int argc, char *argv[]) { + // Export certificates + return 0; +} + +int test(int argc, char *argv[]) { + // Test something against all certificates + return 0; +} + +int fsck() { + // Verify the integrity of all certificates + return 0; +} + +main(int argc, char *argv[]) { + if(argc < 2) { + help(stderr, argv[0]); + return EX_USAGE; + } + + if(!strcmp(argv[1], "help")) { + help(stdout, argv[0]); + return 0; + } + + if(!strcmp(argv[1], "version")) + return version(); + + if(!strcmp(argv[1], "init")) + return init(); + + if(!strcmp(argv[1], "trust")) + return trust(argc - 2, argv + 2); + + if(!strcmp(argv[1], "distrust")) + return distrust(argc - 2, argv + 2); + + if(!strcmp(argv[1], "allow")) + return allow(argc - 2, argv + 2); + + if(!strcmp(argv[1], "deny")) + return deny(argc - 2, argv + 2); + + if(!strcmp(argv[1], "import")) + return import(argc - 2, argv + 2); + + if(!strcmp(argv[1], "export")) + return export(argc - 2, argv + 2); + + if(!strcmp(argv[1], "test")) + return test(argc - 2, argv + 2); + + if(!strcmp(argv[1], "fsck")) + return fsck(); + + fprintf(stderr, "Unknown command '%s'\n", argv[1]); + return EX_USAGE; +} +