Opened 7 years ago

Closed 7 years ago

#43 closed task (fixed)

Clean up RPC setup

Reported by: Kris Deugau Owned by:
Priority: minor Milestone: 1.2
Version: Keywords:


RPC support was stubbed out and partially filled in as of r123, but has only had a handful of cosmetic fixes and labelling tweaks. It needs to be updated to match the updates to the core library, and thought given to exposing more subs.

Change History (17)

comment:1 Changed 7 years ago by Kris Deugau

(In [400]) /trunk

Normalize calling convention in loadConfig() and cfgload() to
prepare for updates in dns-rpc.cgi. (Good thing nothing else
has needed to pass any arguments to it yet.)
Extend configuration parser to support rpc* options such as rpc_iplist
to restrict which IPs can make RPC calls for which calling serivce.
See #43.

comment:2 Changed 7 years ago by Kris Deugau

(In [401]) /trunk

Begin updating dns-rpc.cgi. See #43.

Add initRPC() in This sets up the userdata needed
for logging. Prevent the pseudousers added in initRPC() from
being displayed in the user management UI. Sooner or later
this will need to be cleaned up so stale users can be deleted.
Closes #33.

Bring a bit more consistency to error messages, and eliminate
references to odd depths of the code, by adding "\n" to the end
of a few lurking die strings in, and all method-sub ones
in dns-rpc.cgi.

Clean up a handful of gross syntax and scope errors from copy-paste
work apparently never checked.

Call new loadConfig() and initRPC() on startup. Add a utility sub
to call from the method subs to check the RPC caller+IP pair against
the new config option.

Update call for delDomain to delZone. Update call to getDomRecs()
to match normalized hash-argument form from r397.

comment:3 Changed 7 years ago by Kris Deugau

(In [405]) /trunk

Clean up some more annoyances in dns-rpc.cgi. See #43.

  • Update active and stub list of subs to match current
  • Factor out common opening errorcheck actions into a separate internal sub
  • Refresh getRecCount internals since it should be almost identical to getDomRecs
  • Fix a couple of trivial copypasted comment typos

Add support to handle adding and deleting reverse zones. See #26.

  • Complete conversion of delDomain to delZone
  • Add addRDNS

comment:4 Changed 7 years ago by Kris Deugau

(In [407]) /trunk

Check and fix addGroup and delGroup in dns-rpc.cgi. See #43.

comment:5 Changed 7 years ago by Kris Deugau

(In [409]) /trunk

Chop some useless code in dns-rpc.cgi addUser, confirm it works. See #43.

comment:6 Changed 7 years ago by Kris Deugau

(In [411]) /trunk

Check and munge state in DNSDB::updateUser(), same as addUser().
Clean up copy-paste job for dns-rpc.cgi updateUser and make sure it
works. See #43.

comment:7 Changed 7 years ago by Kris Deugau

(In [412]) /trunk

Check dns-rpc.cgi delUser and clean up returns in both delUser
and updateUser to match other subs. See #43.

comment:8 Changed 7 years ago by Kris Deugau

(In [413]) /trunk

Update dns-rpc.cgi getSOA. See #43.

comment:9 Changed 7 years ago by Kris Deugau

(In [414]) /trunk

Update dns-rpc.cgi getRecLine. See #43.

May need to consider extra tweaks to handle looking up a record
by host/value info as with domain and group.

comment:10 Changed 7 years ago by Kris Deugau

(In [416]) /trunk

Fix up untested copypaste in dns-rpc.cgi getRecCount so it
actually works. See #43.

comment:11 Changed 7 years ago by Kris Deugau

(In [426]) /trunk

Fix up addRec, updateRec, and delRec in dns-rpc.cgi. See #43.

comment:12 Changed 7 years ago by Kris Deugau

(In [452]) /trunk

Continue tweaking RPC for actual usage. See #43.

  • Add and expose getRevPattern() to retrieve the narrowest template pattern applicable to a passed CIDR (netblock or IP)
  • Add and expose getZonesByCIDR() to retrieve a list of revzones and zone IDs for records within a passed CIDR block. Note the block may be larger than the zones, so we may return more than one revzone.

comment:13 Changed 7 years ago by Kris Deugau

(In [453]) /trunk

Continue extending RPC support for real usage/needs. See #43.

Add addOrUpdateRec() to RPC interface to simplify calls and reduce
multiple-call time cost (0.3-0.5s for the XML-RPC client to decode
the response on each call?!? - must fix!)

comment:14 Changed 7 years ago by Kris Deugau

(In [454]) /trunk

Tweak addOrUpdateRec for some subtle bugs. See #43.

  • handle static IP CIDRs correctly (strip the mask length)
  • make sure to check all template, composite, and bare PTR records

comment:15 Changed 7 years ago by Kris Deugau

(In [459]) /trunk

Flesh out last known subcases of record update/delete required
for IPDB RPC service. See #43.

  • Add new sub delByCIDR(). Requires new DNSDB::downconvert utility sub.
  • Use a new variable instead of overwriting $args{cidr} in addOrUpdateRevRec()
  • Catch and another special case - adding a /32 ("netblock" or static IP) at the very beginning of a larger block in addOrUpdateRevRec()

comment:16 Changed 7 years ago by Kris Deugau

(In [460]) /trunk

Edge case bugfixes and fleshing-out for deleting records by CIDR. See #43

  • use AAAA+PTR template anyway; just continue to not expand it.
  • make sure to skip non-PTR-ish records when we're working with a set
  • fix the simple-but-wrong logic for CIDR requests larger than the defined reverse zones

comment:17 Changed 7 years ago by Kris Deugau

Resolution: fixed
Status: newclosed

Closing this ticket for RPC as the RPC API is "good enough" to support most RPC uses. Requirements for the IPDB (see IPDB DNS integration ticket) have been met, and all basic add/update/delete operations on zones (forward and reverse), records, groups and users are supported.

Note: See TracTickets for help on using tickets.