Opened 8 months ago

Closed 7 months ago

#5187 closed defect (fixed)

write-config command issues

Reported by: wlodekwencel Owned by: tomek
Priority: medium Milestone: Kea1.2-final
Component: management API Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 1
Total Hours: 10 Internal?: no

Description

There are couple issues with config-write command:
1.
Kea Users Guide states:

The config-write command instructs Kea server to write its current configuration to a file on disk. It takes one optional argument called filename that specifies the name of the file to write configuration to. If not specified, the name used when starting Kea (passed as -c argument) will be used. Note that the filename specified must not contain .. or backslashes. Kea should be able to write its files only in the directory it is running and any attempts to step out of that directory will be rejected.

That does not describe how kea saves files. Kea saves files relative to current directory not where it is running/installed.

2.
User guide states that command syntax use 'parameters':

{
    "command": "config-write",
    "parameters": {
        "filename": "config-modified-2017-03-15.json"
    }
}

when is fact it using 'arguments' as different commands

  1. When keactrl will be configured with absolute paths, or when we start single kea server with -c /abslute/path you can't use config-write without any argument "filename"
  1. write config saves detailed config file and it turns out that when it was configured with logger it saves "flush": true into file which prevent kea to start with that config.
    DHCP6_INIT_FAIL failed to initialize Kea server: configuration error using file '/home/test/installed/git/etc/kea/kea.conf': /home/test/installed/git/etc/kea/kea.conf:87.13-19: syntax error, unexpected constant string, expecting output
    

similar error occurs with key words:

  • maxsize in logger configuration section
  • maxver in logger configuration section

look like those key-words were omitted during parser reconfiguration?

Subtickets

Change History (7)

comment:1 Changed 8 months ago by hschempf

  • Milestone changed from Kea-proposed to Kea1.2-final

Per Kea team meeting Mar 30, accept 1.2-final

comment:2 Changed 7 months ago by tomek

  • Priority changed from high to medium

Discussed on 2017-04-13 meeting, decision was to remove absolute path restrictions.

comment:3 Changed 7 months ago by tomek

  • Owner set to tomek
  • Status changed from new to assigned

comment:4 Changed 7 months ago by tomek

  • Add Hours to Ticket changed from 0 to 9
  • Component changed from Unclassified to management API
  • Owner changed from tomek to Unassigned
  • Total Hours changed from 0 to 9

Ok, the code is now ready for review.

This solution covers two things: removing the restrictions (I consider this a functionality improvement) and fixing the parsers to allow parameters that we missed (that's a bugfix).

It was a lot more work than I initially thought it will be. I have removed path restrictions (the easy part) and updated DHCPv4, DHCPv6, D2 and Agent parsers to accept flush, maxsize and maxver parameters (the tedious part).

Proposed changelog:

12XX.	[func,bug]	tomek
	Restrictions in filename argument in config-write command have
	been removed. It is now possible to use absolute paths.
	DHCPv4, DHCPv6, D2 and Agent parsers did not handle flush,
	maxsize or maxver parameters in logger configuration correctly.
	This is now fixed.
	(Trac #5187, git tbd)

comment:5 Changed 7 months ago by tomek

  • Status changed from assigned to reviewing

comment:6 Changed 7 months ago by fdupont

  • Owner changed from Unassigned to tomek

Changes are good but incomplete: there are still path restrictions in DControllerBase::configWriteHandler. Note as the update is trivial it doesn't need to come back for a review.

comment:7 Changed 7 months ago by tomek

  • Add Hours to Ticket changed from 9 to 1
  • Resolution set to fixed
  • Status changed from reviewing to closed
  • Total Hours changed from 9 to 10

Oops. Checks in DControllerBase::configWriteHandler removed.

Thanks for the review.

Code merged. Closing ticket.

Note: See TracTickets for help on using tickets.