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