-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhostdb.sql
102 lines (94 loc) · 2.71 KB
/
hostdb.sql
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
# $Id$
#
# The tables associated with hosts and DNS zone generation
#
CREATE TABLE host (
id INT AUTO_INCREMENT NOT NULL,
dhcpmode ENUM ('DYNAMIC', 'STATIC') DEFAULT 'STATIC' NOT NULL,
dhcpstatus ENUM ('ENABLED', 'DISABLED') DEFAULT 'DISABLED' NOT NULL,
mac CHAR(17),
dnsmode ENUM ('A_AND_PTR', 'A') DEFAULT 'A_AND_PTR' NOT NULL,
dnsstatus ENUM ('ENABLED', 'DISABLED') DEFAULT 'ENABLED' NOT NULL,
hostname VARCHAR(255),
dnszone VARCHAR(255),
manual_dnszone ENUM ('Y', 'N') NOT NULL DEFAULT 'N',
ip CHAR(15) NOT NULL,
n_ip INT UNSIGNED NOT NULL,
owner VARCHAR(255) NOT NULL,
ttl INT,
comment VARCHAR(255),
partof INT,
mac_address_ts DATETIME,
client_id VARCHAR(255),
options MEDIUMBLOB,
profile VARCHAR(25) DEFAULT 'default' NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE zone (
id INT AUTO_INCREMENT NOT NULL,
zonename VARCHAR(255) NOT NULL,
delegated ENUM ('Y', 'N') NOT NULL DEFAULT 'N',
default_ttl INT,
ttl INT,
serial INT NOT NULL,
mname VARCHAR(255),
rname VARCHAR(255),
refresh INT,
retry INT,
expiry INT,
minimum INT,
owner VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
# the use of unsigned int for n_netaddr and n_netmask is not enough for IPv6.
# ipver in this table is only to think ahead - don\'t think this database and
# scripts associated with it works with IPv6.
CREATE TABLE subnet (
id INT AUTO_INCREMENT NOT NULL,
ipver TINYINT UNSIGNED NOT NULL,
netaddr CHAR(20) NOT NULL,
slashnotation TINYINT UNSIGNED NOT NULL,
netmask CHAR(20) NOT NULL,
broadcast CHAR(20) NOT NULL,
addresses INT NOT NULL,
description VARCHAR(255),
short_description VARCHAR(255),
n_netaddr INT UNSIGNED NOT NULL,
n_netmask INT UNSIGNED NOT NULL,
n_broadcast INT UNSIGNED NOT NULL,
htmlcolor CHAR(20),
dhcpconfig MEDIUMBLOB,
owner VARCHAR(255) NOT NULL,
profilelist VARCHAR(255) DEFAULT 'default' NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE hostattribute (
id INT AUTO_INCREMENT NOT NULL,
hostid INT NOT NULL,
v_key VARCHAR(250) NOT NULL,
v_section VARCHAR(128) NOT NULL,
v_type ENUM("string", "int", "blob") NOT NULL,
v_string VARCHAR(255),
v_int BIGINT,
v_blob MEDIUMBLOB,
lastmodified DATETIME,
lastupdated DATETIME,
PRIMARY KEY (id),
UNIQUE (hostid, v_key, v_section)
);
CREATE TABLE hostalias (
id INT AUTO_INCREMENT NOT NULL,
hostid INT NOT NULL,
aliasname VARCHAR(255) NOT NULL,
ttl INT,
dnszone VARCHAR(255),
dnsstatus ENUM ('ENABLED', 'DISABLED') DEFAULT 'ENABLED' NOT NULL,
lastmodified DATETIME,
lastupdated DATETIME,
comment VARCHAR(255),
PRIMARY KEY (id)
);
# this is an EXAMPLE grant command, you need to replace $database, $user, example.org and $password
GRANT select, insert, update, delete ON $database.* TO "$user"@"%.example.org" IDENTIFIED BY '$password';
# don\'t forget...
flush privileges;