| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/** |
| 2 |
|
|
* This file is part of the CernVM File System |
| 3 |
|
|
* |
| 4 |
|
|
* This tool signs a CernVM-FS manifest with an X.509 certificate. |
| 5 |
|
|
*/ |
| 6 |
|
|
|
| 7 |
|
|
#include "swissknife_sign.h" |
| 8 |
|
|
|
| 9 |
|
|
#include <dirent.h> |
| 10 |
|
|
#include <sys/stat.h> |
| 11 |
|
|
#include <sys/types.h> |
| 12 |
|
|
#include <termios.h> |
| 13 |
|
|
#include <unistd.h> |
| 14 |
|
|
|
| 15 |
|
|
#include <cstdio> |
| 16 |
|
|
#include <cstdlib> |
| 17 |
|
|
#include <set> |
| 18 |
|
|
#include <string> |
| 19 |
|
|
#include <vector> |
| 20 |
|
|
|
| 21 |
|
|
#include "compression/compression.h" |
| 22 |
|
|
#include "crypto/hash.h" |
| 23 |
|
|
#include "crypto/signature.h" |
| 24 |
|
|
#include "manifest.h" |
| 25 |
|
|
#include "object_fetcher.h" |
| 26 |
|
|
#include "reflog.h" |
| 27 |
|
|
#include "signing_tool.h" |
| 28 |
|
|
#include "upload.h" |
| 29 |
|
|
#include "util/logging.h" |
| 30 |
|
|
#include "util/posix.h" |
| 31 |
|
|
#include "util/smalloc.h" |
| 32 |
|
|
|
| 33 |
|
|
using namespace std; // NOLINT |
| 34 |
|
|
|
| 35 |
|
|
typedef HttpObjectFetcher<> ObjectFetcher; |
| 36 |
|
|
|
| 37 |
|
✗ |
int swissknife::CommandSign::Main(const swissknife::ArgumentList &args) { |
| 38 |
|
✗ |
const string manifest_path = *args.find('m')->second; |
| 39 |
|
✗ |
const string repo_url = *args.find('u')->second; |
| 40 |
|
✗ |
const string spooler_definition = *args.find('r')->second; |
| 41 |
|
✗ |
const string temp_dir = *args.find('t')->second; |
| 42 |
|
|
|
| 43 |
|
✗ |
string certificate = ""; |
| 44 |
|
✗ |
if (args.find('c') != args.end()) |
| 45 |
|
✗ |
certificate = *args.find('c')->second; |
| 46 |
|
✗ |
string priv_key = ""; |
| 47 |
|
✗ |
if (args.find('k') != args.end()) |
| 48 |
|
✗ |
priv_key = *args.find('k')->second; |
| 49 |
|
✗ |
string repo_name = ""; |
| 50 |
|
✗ |
if (args.find('n') != args.end()) |
| 51 |
|
✗ |
repo_name = *args.find('n')->second; |
| 52 |
|
✗ |
string pwd = ""; |
| 53 |
|
✗ |
if (args.find('s') != args.end()) |
| 54 |
|
✗ |
pwd = *args.find('s')->second; |
| 55 |
|
✗ |
string meta_info = ""; |
| 56 |
|
✗ |
if (args.find('M') != args.end()) |
| 57 |
|
✗ |
meta_info = *args.find('M')->second; |
| 58 |
|
✗ |
string proxy = ""; |
| 59 |
|
✗ |
if (args.find('@') != args.end()) |
| 60 |
|
✗ |
proxy = *args.find('@')->second; |
| 61 |
|
✗ |
const bool garbage_collectable = (args.count('g') > 0); |
| 62 |
|
✗ |
const bool bootstrap_shortcuts = (args.count('A') > 0); |
| 63 |
|
✗ |
const bool return_early = (args.count('e') > 0); |
| 64 |
|
|
|
| 65 |
|
✗ |
string reflog_chksum_path; |
| 66 |
|
✗ |
const shash::Any reflog_hash; |
| 67 |
|
✗ |
if (args.find('R') != args.end()) { |
| 68 |
|
✗ |
reflog_chksum_path = *args.find('R')->second; |
| 69 |
|
|
} |
| 70 |
|
|
|
| 71 |
|
✗ |
SigningTool signing_tool(this); |
| 72 |
|
✗ |
return signing_tool.Run(manifest_path, repo_url, spooler_definition, temp_dir, |
| 73 |
|
|
certificate, priv_key, repo_name, pwd, meta_info, |
| 74 |
|
|
reflog_chksum_path, proxy, garbage_collectable, |
| 75 |
|
✗ |
bootstrap_shortcuts, return_early); |
| 76 |
|
|
} |
| 77 |
|
|
|