[667] in Moira

home help back first fref pref prev next nref lref last post

Hosttable in Moira

daemon@ATHENA.MIT.EDU (Mark Rosenstein)
Tue Oct 19 15:15:46 1993

Date: Tue, 19 Oct 93 15:15:14 EDT
From: Mark Rosenstein <mar@MIT.EDU>
To: moiradev@MIT.EDU, ops@MIT.EDU, network@MIT.EDU

Here's what we are planning on doing.  Please let me know in the next
couple of days if you have any comments about this before I start
implementing it.
					-Mark



			  HOSTTABLE in MOIRA

Here's my proposal for how to put the hosttable into moira.  There are
actually two goals to this project: to have moira handle the MIT
hosttable (i.e. name to IP address mappings) and to add a workstation
type flag to every workstation which can be used later to control
access to licensed software.

Rather than create a lot of new tables, I propose creating just one
new table for subnets and folding most of the information into a
single hosts table.  This means that the same table that is used to
enter the IP address is used for hesiod mappings.  Since hesiod
mappings generally aren't entered before the hosts are named and given
addresses, this should not be a problem.

First, we create a new table for subnets:

create table subnet
(
	name		CHAR(8) 	NOT NULL WITH DEFAULT,
	snet_id		INTEGER		NOT NULL WITH DEFAULT,
	description	VARCHAR(32) 	NOT NULL WITH DEFAULT,
	address		INTEGER		NOT NULL WITH DEFAULT,
	mask		INTEGER 	NOT NULL WITH DEFAULT,
	low		INTEGER 	NOT NULL WITH DEFAULT,
	high		INTEGER 	NOT NULL WITH DEFAULT,
	owner_type	CHAR(8) 	NOT NULL WITH DEFAULT,
	owner_id	INTEGER 	NOT NULL WITH DEFAULT,
	modtime		DATE 		NOT NULL WITH DEFAULT,
	modby		INTEGER 	NOT NULL WITH DEFAULT,
	modwith		CHAR(8) 	NOT NULL WITH DEFAULT
);

The name is an uppercase string, the snet_id a moira internal ID, the
description is freeform but will probably have the location, the
address and mask are the network address and netmask as long integers,
low and high are subnet addresses marking the range in which moira may
assign addresses on this subnet, the owner_type and _id name an ACL
which may be a USER, LIST, KERBEROS, etc.  Finally, the usual 3 mod*
fields are present as well.  For example:

	"E40-3", 73, "E40-3rd staff machines", 0x12ac0000, 0xffff0000,
	10, 0x1fc, "LIST", 1783, "Tue Aug  3 18:06:09 EDT 1993", 7783, "moira"

We would have get, add, update, and delete queries for subnets in the
obvious manner.  These queries would be restricted to dbadmin (system
operators).  We would enforce uniqueness on the name and address
fields.

get_subnet(name) => name, description, address, mask, low, high,
owner_type, owner_name, modtime, modby, modwith
	The name argument may contain wildcards.

add_subnet(name, description, address, mask, low, high, owner_type,
owner_name)
	Name and address each must be unique among subnets.  Owner_type
is typechecked as an ace_type, one of USER, KERBEROS, LIST, or NONE.
Owner_name must name a corresponding item (users or lists must exist).

update_subnet(name, newname, description, address, mask, low, high,
owner_type, owner_name)
	Newname and address each must be unique among subnets.  Owner_type
is typechecked as an ace_type, one of USER, KERBEROS, LIST, or NONE.
Owner_name must name a corresponding item (users or lists must exist).

delete_subnet(name)
	There must be no hosts currently assigned to this subnet
before it can be removed.



Next, the machine table is greatly expanded.  The current type field
in this table goes away, in favor of the more specific vendor and
model fields.  A number of new fields are added:

create table machine
(
	name		VARCHAR(32) 	NOT NULL WITH DEFAULT,
	mach_id		INTEGER 	NOT NULL WITH DEFAULT,
	vendor		CHAR(16) 	NOT NULL WITH DEFAULT,
	model		CHAR(24) 	NOT NULL WITH DEFAULT,
	os		CHAR(16) 	NOT NULL WITH DEFAULT,
	location	CHAR(16) 	NOT NULL WITH DEFAULT,
	contact		CHAR(32) 	NOT NULL WITH DEFAULT,
	use		INTEGER2	NOT NULL WITH DEFAULT,
	status		INTEGER1	NOT NULL WITH DEFAULT,
	statuschange	DATE    	NOT NULL WITH DEFAULT,
	snet_id		INTEGER 	NOT NULL WITH DEFAULT,
	address		CHAR(16)	NOT NULL WITH DEFAULT,
	owner_type	CHAR(8) 	NOT NULL WITH DEFAULT,
	owner_id	INTEGER 	NOT NULL WITH DEFAULT,
	acomment	INTEGER 	NOT NULL WITH DEFAULT,
	ocomment	INTEGER 	NOT NULL WITH DEFAULT,
	created		DATE 		NOT NULL WITH DEFAULT,
	creator		INTEGER 	NOT NULL WITH DEFAULT,
	inuse		DATE		NOT NULL WITH DEFAULT,
	modtime		DATE    	NOT NULL WITH DEFAULT,
	modby		INTEGER 	NOT NULL WITH DEFAULT,
	modwith		CHAR(8) 	NOT NULL WITH DEFAULT
);

The name, vendor, model, os, and location fields are forced to
uppercase when stored.  The name and mach_id fields are guarenteed
unique across all machines (and machine alias names).  The address
field is guarenteed to be the special token "unassigned" or unique
across all machines (although a special "unique" token may be stored
here, which causes a new address to be assigned).  The use field is a
bitfield, contents defined later by the UI and extraction routines for
licensing purposes.  The inuse field stores the date that this machine
was last known to be in use on the net.  The statuschange field is
maintained by the server, and notes when the status field last
changed.  The created/creator fields are set once by the server just
like the modtime/modby fields.  The two comment fields are both
pointers into the strings table.

The name, vendor, model, os, location, and inuse fields may be
modified by the machine owner.  The owner of the subnet which the
machine is assigned to may also change the contact, status, owner, and
acomment fields.  Only someone on the query ACL may change the use,
address, or ocomment fields.

New get, add, update, and delete_host queries will replace the
*machine queries and allow access to all of the new fields.  For
backwards compatibility, the old get_machine query will still work,
returning the name & vendor.

add_host(name, vendor, model, os, location, contact, use, status, subnet,
address, owner_type, owner_name, admincomment, opcomment)
	Name will be upcased and must be unique among hosts and host
aliases.  They also must meet the following sanity check: must start
with a letter, remaining chars letter, numbers, and hyphen, must not
end with a hyphen.  Vendor, model, os, and location will be upcased.
Use is an integer whose values are determined by the client (if entity
performing the query is not on the query ACL, the use field must be
zero).  Status must be 1 (active) or 3 (reserved).  Address must be
unique among hosts, or "unqiue" or "unassigned".  Subnet must name an
existing subnet.  The owner_type must be USER, LIST, KERBEROS, or
NONE, and the owner_name must name a valid instance of that type.
Statuschange, created, and modtime will be set to the current time.
Creator and modby will be set to the user.

get_host(name, address, location, contact) => name, vendor, model, os,
location, contact, use, status, statuschanged, subnet, address,
owner_type, owner_name, admin_comment, op_comment, created, creator,
inuse modtime, modby, modwith
	any of the arguments may contain wildcards.

update_host(name, newname, vendor, model, os, location, contact, use,
status, subnet, address, owner_type, owner_name, acomment, ocomment, inuse)
	newname must either match the old name, or be unique among
hosts and host aliases.  use may not be changed except by someone on
the query ACL.  status may be set to 1 (active), 3 (reserved) or 4
(deleted).  address may only be changed to "unassigned" or "unique"
(which assigns a unique address).  If status changes, statuschange
will be set to the current date.  All other fields are as in add_host.

delete_host(name)
	name must match exactly one entry.  If the status on that
entry is 4 (deleted), then the entry will be deleted.



We will also add a special table for hostname aliases.  We do not use
the standard alias table so that name uniqueness can be enforced.

create table hostalias
(
	name		VARCHAR(32) 	NOT NULL WITH DEFAULT,
	mach_id		INTEGER	 	NOT NULL WITH DEFAULT
);

Each alias name goes through the same sanity check as the hostnames,
described above.  If you are on the query ACL, you may assign any
number of aliases to a host.  If you are only on the host ACL or the
subnet ACL of the subnet containing the host, then you may give the
host no more than 2 aliases.

get_hostalias(alias, host) => alias, host
	Either of the arguments may contain wildcards.

add_hostalias(alias, host)
	Assigns a new alias to host.  Updates the modtime on the host.

delete_hostalias(alias, host)
	Removes an alias from a host.  Updates the modtime on the
host.

home help back first fref pref prev next nref lref last post