Table of Contents

dcm.pl

dcm.pl is the command line interface tool to the core modules of ONA. It is intended to provide a batch interface for doing adds, modifies, deletes etc. It is essentially the code that is located here but it has been slightly modified for a few things as described below.

Download

Here is the ONA specific version: NOT ONLINE YET, get it from the original dotconf site listed above.

Download this version for now

Installation

This tool can be installed on just about any system that has perl installed. It is simply a command line interface to the modules that ONA uses to do work in the core. There are two files that need to be placed in your operating system somewhere.

Security

You should be careful as to how you configure and utilize dcm.pl. By default it grants very high level access to the ONA system and will allow you to add, delete or modify just about any record. It will also allow you to use unencrypted connections to the ONA database.

It is recommended that you configure your web server to utilize https only and that you set the “allow-http-fallback” option to 0 to disable the downgrade to http style connections. This setting only affects how dcm itself operates so having https turned on your web server is good practice anyway as it relates to the ONA web interface. For dcm to utilize https you will need the following perl modules installed on your system: Net::SSleay and IO::Socket::SSL.

I have provided an example .htaccess file that will restrict the dcm tool even further. To enable it you can simply rename the www/.htaccess.example file to www/.htaccess. By default this example file will restrict dcm to work only from the localhost IP address. This means that dcm can only be run from the same server that the ONA web interface is on. You can adjust the IP address ranges used or if you choose, you can utilize basic http auth via .htpasswd. These are a few examples of how one could lock it down via .htaccess so I will leave any advanced methods up to the user.

By default dcm will try to connect to ONA as the local unix user. If that user does not exist in the ona system then you will get an error. You can specify an alternate user to connect as using the -l option for dcm. The commands that you are allowed to execute must fall within the privileges that you have been granted in the ONA web interface. You will however be able to list (--list) all of the available commands. FIXME this part is busted right now, use .htaccess for best results

Usage

Once you have installed via the steps above, you can test that it is functioning by issuing the following command:

dcm.pl --list

This should return a large list of modules and their descriptions. If not, then you should see an error message explaining the issue.

You can also run dcm.pl on its own to get help text. The typical usage is as follows:

dcm.pl -r <modulename>

This should then display the usage information for the specified module. Lets assume you have selected “host_display” as your module. You would run dcm.pl with that module name with its required option of “host” and optional verbose flag, which would look something like this:

$ dcm.pl -r host_display host=test.example.com verbose=n
HOST RECORD (test.example.com)
  id                          23
  primary_dns_id              62
  device_id                   15
  name                        test
  fqdn                        test.example.com
  domain_id                   1                   (example.com)
  domain_fqdn                 example.com

Original code mods

The original code stripped out the last new line in a file, but this caused some issues for the config archive process. The file in the filesystem would be different than what was in the database. The proper handling of the echo command would be to use or not use the -n flag. FIXME add more detail here