-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcks.sql
More file actions
235 lines (205 loc) · 8.06 KB
/
cks.sql
File metadata and controls
235 lines (205 loc) · 8.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
-- cks.sql - SQL code for database schema establishment
-- Copyright (C) 2001-2004 CryptNET, V. Alex Brennen (VAB)
--
-- This file is part of the CryptNET openPGP Public Key Server (cks).
--
-- cks is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- cks is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
--
drop table cks_keyid_table;
drop table cks_key_info_table;
drop table cks_fp_key_table;
drop table cks_uid_table;
drop table cks_puid_table;
drop table cks_pending_sync;
drop table cks_other_servers;
drop table cks_rejected_keys;
create table cks_keyid_table
(
key_id char(8) NOT NULL,
fkey_id char(16) NOT NULL,
fp varchar(40) NOT NULL,
PRIMARY KEY(fp)
);
create index cks_keyid_table_keyid_idx on cks_keyid_table(key_id);
create index cks_keyid_table_fkeyid_idx on cks_keyid_table(fkey_id);
create table cks_key_info_table
(
fp varchar(40) NOT NULL,
key_id char(8) NOT NULL,
pgp_vrsn int2 NOT NULL,
algorithm int2 NOT NULL,
size int4 NOT NULL,
c_time int4 NOT NULL,
e_time int4 NOT NULL,
revoked int2 NOT NULL,
PRIMARY KEY(fp)
);
create index cks_key_info_table_idx on cks_key_info_table(key_id,fp);
create index cks_key_info_table_fp_idx on cks_key_info_table(fp);
create table cks_fp_key_table
(
fp varchar(40) NOT NULL,
ecsum char(4) NOT NULL,
pgp_key oid NOT NULL,
PRIMARY KEY(fp)
);
create table cks_uid_table
(
fkey_id varchar(16) NOT NULL,
p_uid int2 NOT NULL,
fp varchar(40) NOT NULL,
uid varchar(6000) NOT NULL
);
create index cks_uid_table_idx on cks_uid_table(fkey_id,p_uid);
create index cks_uid_table_uid_idx on cks_uid_table(uid);
create index cks_uid_table_fp_idx on cks_uid_table(fp);
create index cks_uid_table_fkey_id_idx on cks_uid_table(fkey_id);
-- The puid table is used for displaying sigs during searches
create table cks_puid_table
(
fkeyid varchar(16) NOT NULL,
fp varchar(40) NOT NULL,
uid varchar(8000) NOT NULL
);
create index cks_puid_table_idx on cks_puid_table(fkeyid);
create index cks_puid_table_fp_idx on cks_puid_table(fp);
create table cks_pending_sync
(
fp varchar(40) NOT NULL,
PRIMARY KEY(fp)
);
create index cks_pending_sync_idx on cks_pending_sync(fp);
-- server_type cks (http sync) 1
-- server_type horowits (http sync) 2
-- server_type cks-bin (binary sync) 3
create table cks_other_servers
(
server varchar(300) NOT NULL,
server_type int2 NOT NULL,
sync_priority int2 NOT NULL,
PRIMARY KEY(server)
);
create table cks_rejected_keys
(
fp varchar(40) NOT NULL,
PRIMARY KEY(fp)
);
-- The userid that your websever runs under.
-- If you are using a different userid, change
-- to that userid. You should not use nobody.
create user "httpd";
grant select on cks_keyid_table to "httpd";
grant insert on cks_keyid_table to "httpd";
grant update on cks_keyid_table to "httpd";
grant delete on cks_keyid_table to "httpd";
grant select on cks_key_info_table to "httpd";
grant insert on cks_key_info_table to "httpd";
grant update on cks_key_info_table to "httpd";
grant delete on cks_key_info_table to "httpd";
grant select on cks_fp_key_table to "httpd";
grant insert on cks_fp_key_table to "httpd";
grant update on cks_fp_key_table to "httpd";
grant delete on cks_fp_key_table to "httpd";
grant select on cks_uid_table to "httpd";
grant insert on cks_uid_table to "httpd";
grant update on cks_uid_table to "httpd";
grant delete on cks_uid_table to "httpd";
grant select on cks_puid_table to "httpd";
grant insert on cks_puid_table to "httpd";
grant update on cks_puid_table to "httpd";
grant delete on cks_puid_table to "httpd";
grant select on cks_pending_sync to "httpd";
grant insert on cks_pending_sync to "httpd";
grant update on cks_pending_sync to "httpd";
grant delete on cks_pending_sync to "httpd";
grant select on cks_other_servers to "httpd";
grant insert on cks_other_servers to "httpd";
grant update on cks_other_servers to "httpd";
grant delete on cks_other_servers to "httpd";
grant select on cks_rejected_keys to "httpd";
grant insert on cks_rejected_keys to "httpd";
grant update on cks_rejected_keys to "httpd";
grant delete on cks_rejected_keys to "httpd";
-- The Keyserver user which you can run cksd under.
-- If you use a different userid, change keyserver
-- to that account name.
create user "keyserver";
grant select on cks_keyid_table to "keyserver";
grant insert on cks_keyid_table to "keyserver";
grant update on cks_keyid_table to "keyserver";
grant delete on cks_keyid_table to "keyserver";
grant select on cks_key_info_table to "keyserver";
grant insert on cks_key_info_table to "keyserver";
grant update on cks_key_info_table to "keyserver";
grant delete on cks_key_info_table to "keyserver";
grant select on cks_fp_key_table to "keyserver";
grant insert on cks_fp_key_table to "keyserver";
grant update on cks_fp_key_table to "keyserver";
grant delete on cks_fp_key_table to "keyserver";
grant select on cks_uid_table to "keyserver";
grant insert on cks_uid_table to "keyserver";
grant update on cks_uid_table to "keyserver";
grant delete on cks_uid_table to "keyserver";
grant select on cks_puid_table to "keyserver";
grant insert on cks_puid_table to "keyserver";
grant update on cks_puid_table to "keyserver";
grant delete on cks_puid_table to "keyserver";
grant select on cks_pending_sync to "keyserver";
grant insert on cks_pending_sync to "keyserver";
grant update on cks_pending_sync to "keyserver";
grant delete on cks_pending_sync to "keyserver";
grant select on cks_other_servers to "keyserver";
grant insert on cks_other_servers to "keyserver";
grant update on cks_other_servers to "keyserver";
grant delete on cks_other_servers to "keyserver";
grant select on cks_rejected_keys to "keyserver";
grant insert on cks_rejected_keys to "keyserver";
grant update on cks_rejected_keys to "keyserver";
grant delete on cks_rejected_keys to "keyserver";
-- Your own userid for testing.
-- change "vab" to your username.
create user "vab";
grant select on cks_keyid_table to "vab";
grant insert on cks_keyid_table to "vab";
grant update on cks_keyid_table to "vab";
grant delete on cks_keyid_table to "vab";
grant select on cks_key_info_table to "vab";
grant insert on cks_key_info_table to "vab";
grant update on cks_key_info_table to "vab";
grant delete on cks_key_info_table to "vab";
grant select on cks_fp_key_table to "vab";
grant insert on cks_fp_key_table to "vab";
grant update on cks_fp_key_table to "vab";
grant delete on cks_fp_key_table to "vab";
grant select on cks_uid_table to "vab";
grant insert on cks_uid_table to "vab";
grant update on cks_uid_table to "vab";
grant delete on cks_uid_table to "vab";
grant select on cks_puid_table to "vab";
grant insert on cks_puid_table to "vab";
grant update on cks_puid_table to "vab";
grant delete on cks_puid_table to "vab";
grant select on cks_pending_sync to "vab";
grant insert on cks_pending_sync to "vab";
grant update on cks_pending_sync to "vab";
grant delete on cks_pending_sync to "vab";
grant select on cks_other_servers to "vab";
grant insert on cks_other_servers to "vab";
grant update on cks_other_servers to "vab";
grant delete on cks_other_servers to "vab";
grant select on cks_rejected_keys to "vab";
grant insert on cks_rejected_keys to "vab";
grant update on cks_rejected_keys to "vab";
grant delete on cks_rejected_keys to "vab";