Package dak ::
Module manage_external_signature_requests
|
|
1
2
3 """Manage external signature requests
4
5 @contact: Debian FTPMaster <ftpmaster@debian.org>
6 @copyright: 2018, Ansgar Burchardt <ansgar@debian.org>
7
8 """
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 import apt_pkg
27 import sys
28
29 from daklib import daklog
30 from daklib.dbconn import *
31 from daklib.config import Config
32 from daklib.externalsignature import *
33
34
35
36 Options = None
37 Logger = None
38
39
40
41
43 print("""Usage: dak manage-external-signature-requests [OPTIONS]
44 Manage external signature requests such as requests to sign EFI binaries or
45 kernel modules.
46
47 -h, --help show this help and exit""")
48
49 sys.exit(exit_code)
50
51
52
53
55 global Options, Logger
56
57 cnf = Config()
58
59 for i in ["Help"]:
60 key = "Manage-External-Signature-Requests::Options::{}".format(i)
61 if key not in cnf:
62 cnf[key] = ""
63
64 Arguments = [('h', "help", "Manage-External-Signature-Requests::Options::Help")]
65
66 apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
67 Options = cnf.subtree("Manage-External-Signature-Requests::Options")
68
69 if Options["Help"]:
70 usage()
71
72 Logger = daklog.Logger('manage-external-signature-requests')
73
74 if 'External-Signature-Requests' not in cnf:
75 print("DAK not configured to handle external signature requests")
76 return
77
78 config = cnf.subtree('External-Signature-Requests')
79
80 session = DBConn().session()
81
82 export_external_signature_requests(session, config['Export'])
83
84 if 'ExportSigningKeys' in config:
85 args = {
86 'pubring': cnf.get('Dinstall::SigningPubKeyring') or None,
87 'secring': cnf.get('Dinstall::SigningKeyring') or None,
88 'homedir': cnf.get('Dinstall::SigningHomedir') or None,
89 'passphrase_file': cnf.get('Dinstall::SigningPassphraseFile') or None,
90 }
91 sign_external_signature_requests(session, config['Export'], config.value_list('ExportSigningKeys'), args)
92
93 session.close()
94
95 Logger.close()
96
97
98
99
100 if __name__ == '__main__':
101 main()
102