Internet-Draft UPS management protocol July 2021
Price Expires 7 January 2022 [Page]
Workgroup:
IETF
Internet-Draft:
draft-rprice-ups-management-protocol-04
Published:
Intended Status:
Informational
Expires:
Author:
R. Price, Ed.
Network UPS Tools Project

Uninterruptible Power Supply (UPS) Management Protocol -- Commands and Responses

Abstract

This document describes the command/response protocol currently used in the management of Uninterruptible Power Supply (UPS) units and other power devices often deployed in small offices, and in IT installations subject to an erratic public power supply. The UPS units typically interface to an Attachment Daemon in the system they protect. This daemon is in turn polled by a Management Daemon which notifies users and system administrators of power supply incidents, and takes system shutdown decisions. The commands and responses described by this document are exchanged between the UPS Attachment Daemon and the Management Daemon. Current practice leads to weak security and this is addressed in the Security Considerations sections of this document.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 7 January 2022.

Table of Contents

1. Introduction

1.1. How to Read this Document

The editor recommends that you read the HTML version of this document. It renders the protocol symbols such as OL correctly without quotation marks.

To lighten the text, the term "UPS" is used when "Managed Power Device" would be more complete. The reader should understand the simple "UPS" to include other managed power devices.

The statuses and events appearing in this document are named with short text-form names, some of which are abbreviations. A full list of the statuses can be found in section Status Symbols (5.1) while the events are listed in section Events (5.2).

1.2. Current Practice

This document describes UPS management techniques and current UPS management practice published by the NUT Project (2.7) which has been operational since 1998. Appendix The Shutdown Story (B) describes the current UPS management practice for shutting down an unattended server when the utility power supply fails.

Since May 2002, the protocol described by this document has been operating on IANA port nut/3493 running over TCP.

1.3. Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].

1.4. Additional Information

Requests for further information about this protocol and related technical matters may be addressed to the mailing list [mailinglist] of the NUT Project (2.7).

2. Terminology

The following technical terms appear in this document.

2.1. Attachment Daemon

2.2. Administrative User

In current practice, the commands and other functions offered by the Attachment Daemon (2.1) to each Management Daemon (2.6) are made available to a set of Management Daemon (2.6) users. These users are not system users, they are specific to an Attachment Daemon (2.1). and are defined by a file in the Attachment Daemon (2.1) (currently upsd.users) which assigns to each of them the password, instant commands (2.5) and actions which are allowed, together with the Primary (2.8) or Secondary (2.9) status of the Management Daemon (2.6). Typically a high-level user will be able to send command FSD (4.2.3) but a low-level user might only be allowed to access the test panel. The security provisions for administrative users are discussed in section 6.5.

2.3. Driver

A Driver is that part of an Attachment Daemon which is specific to the hardware, the connection medium and the connection protocol, e.g., USB, serial. In current practice the Attachment Daemon has a driver for each hardware interface type it supports. Although this document considers the driver to be part of the Attachment Daemon, current practice is to see it as a separate software unit running as a daemon "in front of" the Attachment Daemon. The protocol for data exchange between the Driver and the Attachment Daemon is outside the scope of this document.

2.4. Event

A UPS Event occurs in the Management Daemon (2.6) when a change in UPS status (2.11) is received from the Attachment Daemon (2.1). This event is internal to the Management Daemon (2.6). See Section 5.2, Paragraph 1.

2.5. Instant Command

A command which when sent to the Attachment Daemon (2.1) causes the hardware to immediately perform a function. For example INSTCMD su700 test.panel.start . See INSTCMD (4.2.6).

2.6. Management Daemon

The Management Daemon is primarily responsible for managing the hardware and the system reaction to power loss. Using commands sent to the Attachment Daemon (2.1) it follows the status of the UPS and determines when UPS events occur. It takes decisions based on the events, such as calling for a system shutdown (B). Although the term includes the word "daemon" nothing requires that it be implemented as a detached software service. The Management Daemon may also provide administrative functions such as a graphic interface to view the hardware activity.

2.7. NUT (Network UPS Tools) Project

The primary goal of the NUT project [NUT] is to provide support for Power Devices, such as Uninterruptible Power Supplies. The Project has been in operation since 1998 with a major rework in 2003. It operates through a mailing list [mailinglist] and a web site [NUT]. See the history of the project [History].

2.8. Primary

When a power device such as a UPS unit supplies power to more than one system, the system to which the data lead is connected is known as the primary. The others are secondaries. See figure 4. Common current practice for system administrators is to consider the Management Daemon (2.6) in the primary to be the Primary Management Daemon which is in charge of the shutdown of all the systems powered by the UPS. The Primary Management Daemon sets status symbol FSD to order the secondaries to shut down.

Note: Historically, the primary was known as the "Master".

2.9. Secondary

When a hardware device such as a UPS unit supplies power to more than one system, the one to which the data lead is connected is known as the Primary (2.8). The other are secondaries. There is no Attachment Daemon (2.1) in a secondary. See figure 4. Common current practice for system administrators is to consider the Management Daemon (2.6) in a secondary to be a Secondary Management Daemon which understands status symbol FSD as an order to shut down.

Note: Historically, the secondary was known as the "Slave".

2.10. Session

The Management Daemon (2.6) may open a session with a specified device such as a UPS known to the Attachment Daemon (2.1). The session structure provides for audit and security as well as access to mission critical UPS functions. For example good practice requires a password protection for an instant command (2.5) which turns off a UPS outlet. Other than the commands and responses used, the details of session management are outside the scope of this document.

2.11. UPS Status

The status of a hardware device such as a UPS unit is a symbolic description of the state of the unit. It consists of a space separated list of symbols from the set {ALARM BOOST BYPASS CAL CHRG COMM DISCHRG FSD LB NOCOMM OB OFF OL OVER RB TEST TRIM}. The symbols TICK and TOCK are experimental additions to the statuses and are not in common current practice. See section Status Symbols (5.1) which specifies each of these symbols. The statuses LB, OB and OL are considered fundamental and are supported for all units. Other statuses depend on the feature set of the hardware.

2.12. UPS Variable

The features provided by each UPS are represented by variables giving the current value attached to that feature. The UPS variable is an abstraction of the UPS hardware configuration and activity maintained by the Attachment Daemon (2.1). See the appendix (Appendix A, Paragraph 1) which provides examples of variables. For example the variable battery.charge contains the current charge of the UPS battery as a percentage value. A full list is available in source code file docs/nut-names.txt [gitvars] which serves as the Recording Document.

3. Protocol Overview

Figure 1 shows a reference configuration in which the command/response protocol applies. The UPS shown is representative of all power devices,

                                            "The client"
           ,--------------,               ,--------------,
 ,-----,   |     UPS      | <-Commands    |     UPS      |
 | UPS |---|  Attachment  |---------------|  Management  |
 |     |===|    Daemon    |   Responses-> |    Daemon    |
 /-----\   '--------------'               '--------------'
            UPS Attachment                 UPS Management
                System        Network          System
Figure 1: Reference Configuration

The reference configuration in figure 1 shows a single UPS unit which has a power supply link (===) and a data link (---) attached to a system running an Attachment Daemon (2.1). The UPS provides power supply protection to the system running the Attachment Daemon.

In practice there may be more than one UPS unit, and a unit may provide power protection to more than one system. The figure also shows a single Management Daemon (2.6). In practice there may be more than one Management Daemon, and any one Management Daemon may manage more than one UPS Attachment Daemon.

The protocol applies to connections between the Management Daemon and the Attachment daemon. The Management Daemon is known as the client. It sends commands over TCP to the Attachment Daemon and receives responses over TCP from that daemon.

The two daemons may run in the same system, or may be connected through a local or wide area network. In simple cases, as shown in figure 2, the Attachment Daemon (2.1) and the Management Daemon (2.6) are in the same system, the one protected by the UPS. The commands and responses are exchanged through an internal loopback interface.

                                         "The client"
           ,--------------------,---------------------,
 ,-----,   |     UPS       <-Commands        UPS      |
 | UPS |---|  Attachment        |         Management  |
 |     |===|    Daemon       Responses->    Daemon    |
 /-----\   '--------------------'---------------------'
                             Internal
                             loopback
             UPS Attachment and Management System
Figure 2: Simplified single-system configuration

The reference configuration does not require any specific design. For example figure 3 shows an arrangement in which the Attachment Daemon (2.1) is closely associated with, or even included in the UPS system setup. This is becoming more prevalent with the availability of low cost processors able to run the Attachment Daemon (2.1).

                                      "The client"
 ,-----,------------,               ,--------------,
 |     |    UPS     | <-Commands    |     UPS      |
 | UPS - Attachment |---------------|  Management  |
 |     |   Daemon   |   Responses-> |    Daemon    |
 /-----'------------\               '--------------'
    UPS Attachment                   UPS Management
        System           Network          System
Figure 3: UPS and Attachment Daemon integration

As the power requirements for processors decrease, it is becoming increasingly common to use a single UPS to protect multiple systems as shown in figure 4. However there is only one data line (---) from the UPS to the Primary (2.8) system. The others have only power connections (===) to the UPS, and are known as Secondaries (2.9). A Secondary (2.9) does not run an Attachment Daemon (2.1), it connects over a network to the Attachment Daemon (2.1) in the primary. Figure 4 shows the Attachment Daemon (2.1) and the primary Management Daemon (2.6) in the same system. This is common practice but it is not a technical requirement.

                                      "The client"
           ,--------------------,---------------------,
 ,-----,   |     UPS       <-Commands      Primary    |
 |     |---|  Attachment        |         Management  |   Primary
 |     |===|    Daemon       Responses->    Daemon    |
 |     |   '--------------------'---------------------'
 | UPS |            ^
 |     |            '<-Commands---Responses->,
 |     |                                     v
 |     |            ,--------------,-----------------,
 |     |============|              |     Secondary   |
 /-----\            |              |     Management  |   Secondary
                    |              |       Daemon    |
                    '--------------'-----------------'
Figure 4: UPS protects multiple systems

4. Protocol Specification

This specification includes only the commands and their responses. An implementation of the Attachment Daemon (2.1) has an internal state machine, and some complex implementations of the Management Daemon (2.6) include an internal state machine; for example to assist the system shutdown of a complex installation. The Management Daemon (2.6) is required to remember the previous ups.status value it received from the Attachment Daemon (2.1) and compare it with the next. Other than that the management protocol used between them is effectively stateless.

See for example table (5.2) which maps the new ups.status response and the previous ups.status response to an Event (5.2) which is taken as the basis for Management Daemon (2.6) action.

4.1. Notation Used in this Specification

The character set used for commands and responses is UTF-8 but current practice is to limit the character set used to the single byte UTF-8 characters 0-127.

Multi-word elements are contained within U+0022 QUOTATION MARK characters for easier parsing. E.g., "UPS on fire". Embedded quotation marks are escaped with U+005C REVERSE SOLIDUS \ often known as backslashes. Embedded backslashes are also escaped by representing them as \\.

Commands and responses have no leading or trailing whitespace, and are terminated with a single new line character U+000A LINE FEED (LF).

White space within commands and responses is reduced to one U+0020 SPACE (SP).

4.2. Commands

The commands address the UPS to which they apply by <upsname> where

Examples: myups, UPS-97B@bigserver.example.com

Note: Experimental Management Daemons (2.6) use an extended form of <upsname> in configuration files and in program parameters, where

Examples: ups-1@example.com:3493, HB:heartbeat1@example.com:3493

4.2.1. ATTACH

In a configuration such as Figure 4 in which a UPS protects more than one system, the Primary (2.8) Management Daemon (2.6) needs to know how many Secondaries (2.9) are currently "active", i.e., powered by the UPS, either on wall or battery power. The Attachment Daemon (2.1) supports this by keeping a count of all the "active" systems powered by a UPS. The count is initialised, one secondary at a time by the ATTACH command, which should be understood as "count this secondary as active". ATTACH is one of a trio of commands for Secondary (2.9) counting: command DETACH (4.2.2) decrements the count and a Management Daemon (2.6) may read the count at any time using command NUMATTACH (4.2.4.3).

The ATTACH command is also sent to the Attachment Daemon (2.1) for the Primary (2.8) so during normal, fully protected operation, the count is 1 (the Primary (2.8)) + the number of Secondaries (2.9). During a full system shutdown, the count drops as each Secondary (2.9) Management Daemon (2.6) executes command DETACH (4.2.2) during its own shutdown. When the count drops to 1, only the Primary (2.8) is "active" and it knows that all the Secondaries (2.9) have shut down.

Command: ATTACH <upsname>

If the command succeeds, the response is OK, otherwise see the error responses (4.3.2).

Note: Historically, this command was known as LOGIN. Since that LOGIN was not the conventional user access to a shell or program the name was changed to avoid confusion.

4.2.2. DETACH

This companion command to ATTACH (4.2.1) reduces the count of "active" Secondaries (2.9). It should be understood as "this secondary is no longer active", and is usually used during system shutdown to decrement a count of how many Secondaries (2.9) are still "active".

Command: DETACH

If the command succeeds, the response is OK Goodbye, otherwise see the error responses (4.3.2).

Note: Historically, this command was known as LOGOUT.

4.2.3. FSD

A Management Daemon (2.6) which is Primary (2.8) and has the required authority, uses this command to set status symbol FSD in the Attachment Daemon (2.1). In current practice the Primary (2.8) Management Daemon (2.6) uses the symbol to tell the Secondaries (2.9) to shut down. Symbol FSD has the same value as the pair of status symbols OB LB.

Command: FSD <upsname>

If the command succeeds, the response is OK FSD-SET, otherwise see the error responses (4.3.2).

In current practice, commands such as FSD are made available only to a high-level administrative user (2.2) authorized to send such a mission critical command. The security provisions for administrative users are discussed in section 6.5.

4.2.4. GET

Retrieve a single response from the Attachment Daemon (2.1). The possible sub-commands are:

4.2.4.1. CMDDESC

Retrieve a text description of a command.

Command: GET CMDDESC <upsname> <cmdname>

Response: CMDDESC <upsname> <cmdname> "<description>"

For example: GET CMDDESC su700 load.on and response CMDDESC su700 load.on "Turn on the load immediately"

This is like DESC (4.2.4.2), but it applies to an instant command (2.5).

4.2.4.2. DESC

Retrieve a text description of a variable.

Command: GET DESC <upsname> <varname>

Response: DESC <upsname> <varname> "<description>"

where <description> is a string that gives a brief explanation of the named variable. The Attachment Daemon (2.1) may return "Unavailable" if the file which provides this description is not installed.

For example command GET DESC su700 ups.status and response DESC su700 ups.status "UPS status"

4.2.4.3. NUMATTACH

Retrieve the count kept by the Attachment Daemon (2.1) of all the "active" systems protected by this UPS.

Command: GET NUMATTACH <upsname>

Response: NUMATTACH <upsname> <value>

where <value> is a count of the Primary (2.8) and the number of Secondaries (2.9) currently powered by this UPS.

For example command GET ATTACH su700 and response NUMATTACH su700 1

This information is needed by the Management Daemon (2.6) to determine how many Secondaries (2.9) are still connected during the system shutdown process.

Note: Historically, this sub-command was known as NUMLOGINS. Since LOGIN was not the conventional user access to a shell or program the name was changed to avoid confusion.

4.2.4.4. TYPE

Retrieve the type of a UPS variable (2.12).

Command: GET TYPE <upsname> <varname>

Response: TYPE <upsname> <varname> <type>...

where <type> can be one or more of the following tokens. Multiple types may be returned.

For example command GET TYPE su700 input.transfer.low and response TYPE su700 input.transfer.low ENUM

Table 1: Variable Types
    Type     Meaning
RW This is a read/write variable. It may be read with command GET VAR (4.2.4.6) and set to a different value with command SET (4.2.11)
ENUM An enumerated type, which supports specific predetermined values
STRING:n This is a string of maximum length n
RANGE

This is a number, either integer or float, comprised in the range which may be seen with the command LIST RANGE (4.2.7.4)

NUMBER This is a single numeric value, either integer or float

Notes:

  • ENUM, STRING:n and RANGE are usually associated with RW, but not always. The default <type>, when omitted, is numeric, so either integer or float. Each Driver (2.3) is then responsible for handling values as either integer or float.
  • Current practice is to represent floating point values using locale C.utf8 which is a decimal (base 10) US English-based representation. Hexadecimal, exponents, and comma for thousands separator are not allowed. For example: "1200.20" is valid, while "1,200.20" and "1200,20" are not valid.
4.2.4.5. UPSDESC

Retrieve a text description of a UPS.

Command: GET UPSDESC <upsname>

Response: UPSDESC <upsname> "<description>"

where <description> is defined by the Attachment Daemon (2.1) configuration. If it is not set, current practice is for the Attachment Daemon (2.1) to return "Unavailable".

For example command GET UPSDESC su700 and response UPSDESC su700 "Development box"

This can be used to provide human-readable descriptions instead of a cryptic ups@hostname string.

4.2.4.6. VAR

Retrieve the value of a UPS variable (2.12).

Command: GET VAR <upsname> <varname>

Response: VAR <upsname> <varname> "<value>"

For example command GET VAR su700 ups.status and response VAR su700 ups.status "OB LB"

4.2.5. HELP

Return a list of the commands supported by the Attachment Daemon (2.1). This command is intended for human as well as program use.

Command HELP

For example, the following command line sequence executed on an Attachment Daemon (2.1):

netcat localhost 3493
HELP
Commands: HELP VER GET LIST SET INSTCMD ATTACH DETACH
          USERNAME PASSWORD STARTTLS

Note: Historically, this command also returned LOGIN and LOGOUT. Since LOGIN was not the conventional user access to a shell or program, the command names were changed to ATTACH and DETACH avoid confusion.

4.2.6. INSTCMD

Send an instant command (2.5) to the UPS.

Command: INSTCMD <upsname> <cmdname>

where <upsname> is the name of the UPS and <cmdname> is the instant command (2.5) to be issued to that UPS.

If the command succeeds, the response is OK, otherwise see the error responses (4.3.2).

For example the command: INSTCMD su700 test.panel.start and the response OK

4.2.7. LIST

The LIST commands all produce a response with a common container format. The response will begin with BEGIN LIST and then repeat the initial query. A list then follows, with as many lines as are necessary. The response ends with END LIST followed by the initial query.

The formatting may seem a bit redundant, but it makes a different form of client possible. A client can send a LIST (4.2.7) query and then go off and wait for the response. When it arrives, the Management Daemon (2.6) doesn't need a complicated state machine to remember which list is which.

Note: The current NUT Project (2.7) implementation of the Attachment Daemon (2.1), upsd, sends back the response to a LIST (4.2.7) command as a sequence of messages. The Management Daemon (2.6) should continue reading these messages until it receives the line beginning END LIST.

The possible subcommands are:

4.2.7.1. CLIENT

The command calls for the Attachment Daemon (2.1) to report all the current Management Daemon (2.6) clients of a given UPS.

Command: LIST CLIENT <upsname>

The response is

BEGIN LIST CLIENT <upsname>
CLIENT <upsname> <client_IP_address>
...
END LIST CLIENT <upsname>

For example, the command LIST CLIENT ups1 and the response:

BEGIN LIST CLIENT ups1
CLIENT ups1 ::1
CLIENT ups1 198.51.100.2
END LIST CLIENT ups1

4.2.7.2. CMD

The command calls for the Attachment Daemon (2.1) to report a list of the instant commands (2.5) which the Management Daemon (2.6) may send to the Attachment Daemon (2.1). This instant command (2.5) list is the abstracted view of the UPS hardware capabilities. An economical UPS will support few or no instant commands (2.5) but a professional model should support more.

Command: LIST CMD <upsname>

The response is:

BEGIN LIST CMD <upsname>
CMD <upsname> <cmdname>
...
END LIST CMD <cmdname>

where <upsname> is the name of the UPS, and <cmdname> is the name of the command which may be issued to the UPS.

For example the command: LIST CMD su700 and the response:

BEGIN LIST CMD su700
CMD su700 load.on
CMD su700 test.panel.start
...
END LIST CMD su700

4.2.7.3. ENUM

The command calls for the Attachment Daemon (2.1) to report the set of possible values of a UPS variable (2.12) which has predetermined values.

Command: LIST ENUM <upsname> <varname>

The response is:

BEGIN LIST ENUM <upsname> <varname>
ENUM <upsname> <varname> "<value>"
...
END LIST ENUM <upsname> <varname>

where <upsname> is the name of the UPS, <varname> is the UPS variable (2.12) and <value> is one of the possible values of that UPS variable (2.12). Note that in current practice the output is an unordered list. Note also that the U+0022 QUOTATION MARK characters are part of the response.

For example the command: LIST ENUM su700 input.transfer.low and the response:

BEGIN LIST ENUM su700 input.transfer.low
 ENUM su700 input.transfer.low "103"
 ENUM su700 input.transfer.low "100"
 ...
 END LIST ENUM su700 input.transfer.low

4.2.7.4. RANGE

The command calls for the Attachment Daemon (2.1) to report the interval in which valid values of UPS variable (2.12) lie.

Command: LIST RANGE <upsname> <varname>

The response is:

BEGIN LIST RANGE <upsname> <varname>
RANGE <upsname> <varname> "<min>" "<max>"
...
END LIST RANGE <upsname> <varname>

where <upsname> is the name of the UPS, <varname> is the UPS variable (2.12) and {<min>,<max>} is the interval of valid values of that UPS variable (2.12). Note that the U+0022 QUOTATION MARK characters are part of the response.

For example, the command LIST RANGE su700 input.transfer.low and the response:

BEGIN LIST RANGE su700 input.transfer.low
RANGE su700 input.transfer.low "90" "105"
END LIST RANGE su700 input.transfer.low

4.2.7.5. RW

The command calls for the Attachment Daemon (2.1) to report a list of the UPS variables (2.12) associated with a given UPS which may be read and written by the Management Daemon (2.6). These variables are the abstracted view of the UPS hardware capabilities. An economical UPS may support few variables but a professional model should support at least the variables which are needed for an automatic shutdown and restart (B).

Command: LIST RW <upsname>

The response is:

BEGIN LIST RW <upsname>
RW <upsname> <varname> "<value>"
...
END LIST RW <upsname>

where <upsname> is the name of the UPS, <varname> is the UPS variable (2.12) and <value> is the value of that UPS variable (2.12). Note that the U+0022 QUOTATION MARK characters are part of the response.

For example the command: LIST RW su700 and the response:

BEGIN LIST RW su700
RW su700 output.voltage.nominal "115"
RW su700 ups.delay.shutdown "020"
...
END LIST RW su700

4.2.7.6. UPS

The command calls for the Attachment Daemon (2.1) to report a list of the UPS units to which it is attached.

Command: LIST UPS

The response is:

BEGIN LIST UPS
UPS <upsname> "<description>"
...
END LIST UPS

where <upsname> is the name of a UPS, and <description> is the description maintained by the Attachment Daemon (2.1) if available. It is set to "Unavailable" otherwise. Note that the U+0022 QUOTATION MARK characters are part of the response.

This command can also be used to determine what values of <upsname> are valid before calling other functions on the server. This is also a good way to handle situations where a single Attachment Daemon (2.1) supports multiple UPS's. It is also useful for clients which perform a UPS discovery process.

For example, the response:

BEGIN LIST UPS
UPS su700 "Development box"
END LIST UPS

4.2.7.7. VAR

The command calls for the Attachment Daemon (2.1) to report a list of all the UPS variables (2.12) which it maintains for a given UPS, and the values of those variables.

Command: LIST VAR <upsname>

The response is:

BEGIN LIST VAR <upsname>
VAR <upsname> <varname> "<value>"
...
END LIST VAR <upsname>

where <upsname> is the name of the UPS, <varname> is the UPS variable (2.12) and <value> is the value of that variable. Note that the U+0022 QUOTATION MARK characters are part of the response.

The response to this command lists the UPS variables (2.12) available for this UPS and their current values. For example the command LIST VAR su700 and the response:

BEGIN LIST VAR su700
VAR su700 ups.mfr "Example Mfg"
VAR su700 ups.mfr.date "10/17/96"
...
END LIST VAR su700

4.2.8. PASSWORD

This command is a companion to USERNAME (4.2.13), and is used by a Management Daemon (2.6) to specify the password required to enter a Session (2.10) with the Attachment Daemon (2.1).

Command: PASSWORD <password>

If the command succeeds, the response is OK, otherwise see the error responses (4.3.2).

For examples of the use of commands USERNAME (4.2.13) and PASSWORD by administrative users (2.2) see Section 6.5.2, Paragraph 1.

4.2.9. PRIMARY

In current practice, an administrative user (2.2) is recorded by the Attachment Daemon (2.1) in local file upsd.users as being a Primary (2.8). See Management of Administrative Users (6.5.1) for an example. When a Management Daemon (2.6) starts up and opens a Session (2.10) with the Attachment Daemon (2.1), it lays claim to being a Primary (2.8) by sending command PRIMARY to the Attachment Daemon (2.1), thus claiming that it has the required authority to perform such critical actions as setting status symbol FSD.

Command: PRIMARY <upsname>

where <upsname> is the name of the UPS.

If the Attachment Daemon (2.1) has the authority, the response is OK, otherwise see the error responses (4.3.2).

Note: Historically, this command was known as MASTER.

4.2.10. PROTVER

Return the implementation version of the command/response protocol used by the Attachment Daemon (2.1). This command is intended for human as well as program use.

Command PROTVER

For example, the following command line sequence in the Attachment Daemon (2.1):

netcat localhost 3493
PROTVER
1.2

Note: There are no U+0022 QUOTATION MARK characters in the response.

Note: Historically, this command was known as NETVER and current practice is to use NETVER instead of PROTVER (4.2.10)

4.2.11. SET

The command calls for the Attachment Daemon (2.1) to set a UPS variable (2.12) to a given value. Whether this has an effect on the UPS hardware is specific to the Driver (2.3) and the UPS model.

Command: SET VAR <upsname> <varname> "<value>"

where <upsname> is the name of the UPS, <varname> is the UPS variable (2.12) and <value> is the value to be assigned to that variable. Note that the U+0022 QUOTATION MARK characters are part of the command.

If the command succeeds, the response is OK, otherwise see the error responses (4.3.2).

For example the command: SET VAR su700 ups.id "My UPS" and the response OK

4.2.12. STARTTLS

The client tells the Attachment Daemon (2.1) to switch to TLS encrypted communication. When the client receives OK it also switches to TLS encryption. The choice of TLS version is a matter for site security policy and is not specified in this document.

Command: STARTTLS

If the command succeeds, the response is OK STARTTLS, otherwise see the error responses (4.3.2).

4.2.13. USERNAME

The Attachment Daemon (2.1) provides facilities to limit access to the UPS unit(s) to which it is attached. A Management Daemon (2.6) program or script uses command USERNAME and its companion command PASSWORD (4.2.8) to open a Session (2.10) for an administrative user (2.2) with the Attachment Daemon (2.1), Note that this command is for program or script use and is not the familiar login command typed on a command line to gain access to a shell.

Command: USERNAME <username>

If the command succeeds, the response is OK, otherwise see the error responses (4.3.2).

For examples of the use of commands USERNAME and PASSWORD (4.2.8) by administrative users (2.2) see Section 6.5.2, Paragraph 1.

4.2.14. VER

Return the implementation version of the Attachment Daemon (2.1). This command is intended for human as well as program use.

Command VER

For example, the following command line sequence:

netcat localhost 3493
VER
Network UPS Tools upsd 2.7.4 - http://www.networkupstools.org/

Note: There are no U+0022 QUOTATION MARK characters in the response.

4.3. Summary of Responses

4.3.1. Response when Command Succeeds

If the command succeeds, the response has the following command-dependent form:

Table 2: Response if command succeeds
Command Response Note
ATTACH (4.2.1) OK Was LOGIN
DETACH (4.2.2) OK Goodbye Was LOGOUT
FSD (4.2.3) OK FSD-SET
GET (4.2.4) Sub command specific
HELP (4.2.5) List of commands
INSTCMD (4.2.6) OK
LIST (4.2.7) Sub command specific
PASSWORD (4.2.8) OK
PRIMARY (4.2.9) OK
PROTVER (4.2.10) Protocol version Was NETVER
SET (4.2.11) OK
STARTTLS (4.2.12) OK STARTTLS
USERNAME (4.2.13) OK
VER (4.2.14) Program version

4.3.2. Error Responses

Error responses have the following format:

ERR <error-name> [<extra>]

where <error-name> is a single word token taken from the 27 characters A-Z and U+002D HYPHEN-MINUS. Implementations may if needed add an additional optional <extra>. Current practice does not make use of this possibility.

The <error-name> may have one of the following values:

Table 3: Error responses
    The error name token    
<error-name>
Meaning
ACCESS-DENIED The client's host and/or authentication details (username, password) are not sufficient to execute the requested command.
ALREADY-ATTACHED

The client has already sent a successful ATTACH (4.2.1) command for a given UPS and can't do it again.

Note: Historically, this error response was ALREADY-LOGGED-IN.

ALREADY-SET-PASSWORD The client has already supplied a PASSWORD and is attempting to repeat the command in the same Session (2.10).
ALREADY-SET-USERNAME The client has already supplied a USERNAME, and is attempting to repeat the command within the same Session (2.10).
CMD-NOT-SUPPORTED The specified UPS doesn't support the instant command (2.5) command.
DATA-STALE

The Attachment Daemon (2.1) is connected to the Driver (2.3) for the UPS, but that driver isn't providing regular updates or has specifically marked the data as stale. Current practice is for the Attachment Daemon (2.1) to refuse to provide the Management Daemon (2.6) with variables on stale units to avoid false readings.

This generally means that the Driver (2.3) is running, but it has lost communication with the hardware. Check the physical connection to the equipment.

DRIVER-NOT-CONNECTED The Attachment Daemon (2.1) can't perform the requested command, since the Driver (2.3) for that UPS is not connected. This usually means that the driver is not running, or if it is, is misconfigured.
FEATURE-NOT-CONFIGURED This instance of the Attachment Daemon (2.1) hasn't been configured properly to allow the requested feature to operate. In current practice this error response is possible only for command STARTTLS (4.2.12).
FEATURE-NOT-SUPPORTED This instance of Attachment Daemon (2.1) does not support the requested feature. In current practice this error response is possible only for command STARTTLS (4.2.12).
INSTCMD-FAILED The Attachment Daemon (2.1) failed to deliver the instant command (2.5) request to the Driver (2.3). No further information is available to the client. This typically indicates a dead or broken driver.
INVALID-ARGUMENT The client sent an argument to a command which is not recognized or is otherwise not valid in this context. This is typically caused by sending a valid command such as GET (4.2.4) with a subcommand which is not valid.
INVALID-PASSWORD The client sent a non valid password.
INVALID-USERNAME The client sent an non valid username.
INVALID-VALUE The value specified in the request is not valid. This usually applies to a SET (4.2.11) of an ENUM type which is using a value not in the list of allowed values.
PASSWORD-REQUIRED The command requires a password for authentication, but the client hasn't provided one.
READONLY The requested variable in a SET (4.2.11) command is not writable.
SET-FAILED The Attachment Daemon (2.1) failed to deliver the set request to the Driver (2.3). This is similar to INSTCMD-FAILED.
TLS-ALREADY-ENABLED

TLS mode is already enabled on this connection, so the Attachment Daemon (2.1) can't start it again.

Note: Historically, this message was ALREADY-SSL-MODE.

TLS-NOT-ENABLED

TLS mode has not yet been enabled on this connection, so the Attachment Daemon (2.1) can't send commands.

Note: This message is experimental and not in current common use.

TOO-LONG The requested value in a SET (4.2.11) command is too long.
UNKNOWN-COMMAND The Attachment Daemon (2.1) doesn't recognize the command.
UNKNOWN-UPS The UPS specified in the request is not known to the Attachment Daemon (2.1). This usually means that it didn't match anything in the Attachment Daemon (2.1) configuration.
USERNAME-REQUIRED The command requires a username for authentication, but the client hasn't provided one.
VAR-NOT-SUPPORTED The specified UPS doesn't support the UPS variable (2.12) in the command.

5. Statuses and Events

5.1. Status Symbols

These symbols resume the abstracted view of the UPS hardware maintained by the Attachment Daemon (2.1). The variable ups.status contains one or more space-separated status symbols which together describe the UPS state at that instant. In current practice the Management Daemon (2.6) will poll variable ups.status every 5 seconds with a command such as GET VAR su700 ups.status and response VAR su700 ups.status "OB LB" to discover changes in the UPS status. These changes will indicate UPS events.

Table 4: UPS Status Symbols
Status Symbol Meaning
ALARM The UPS reports that it requires intervention.
BOOST The UPS has determined that the voltage level of the public supply is too low, and is boosting it to the required level. The UPS continues to supply the protected system from the public supply.
BYPASS The UPS is feeding current directly from the public supply to the protected system. The backup facilities are disconnected. This state allows maintenance personnel to change the batteries without interrupting the protected system.
CAL The UPS is calibrating itself, for example to determine at what charge the LB status is raised or lowered.
CHRG

The UPS battery is charging. This usually implies that the UPS also has status OL, but may not be the case if the UPS also has status OFF.

Note: OL does not imply CHRG if the battery is floating.

COMM The Attachment Daemon (2.1) has effective contact with the UPS.
DISCHRG

The UPS battery is discharging. This usually implies that the UPS also has status OB, but may not be the case if the UPS also has status OFF.

Note: OB does not imply DISCHRG if the battery is floating.

FSD This "Forced Shut Down" status signals that the final shutdown sequence has begun.
LB Low Battery. The battery level of the UPS is below a chosen limit. The UPS may be in status OL or OB.
NOCOMM The Attachment Daemon (2.1) has no effective contact with the UPS.
OB On Battery. The UPS is offline, taking energy from it's battery. The battery is discharging. A UPS must have status OB or OL, otherwise it is deemed dead.
OFF The UPS is in state "Off". It does not react to failure in the public power supply. The exact meaning depends on the model.
OL Online. The UPS is online, receiving energy from the public supply. The battery is charging. A UPS must have status OB or OL, otherwise it is deemed dead.
OVER Overloaded. The UPS reports that the load on it is beyond it's normal operating maximum.
RB Replace battery. The UPS reports that it's battery/batteries should be replaced.
TEST Under test. The UPS is currently undergoing a test, which may have been called for manually or internally.
TICK Heartbeat. A software UPS in the Attachment Daemon (2.1) provides a regular signal monitored by the Management Daemon (2.6) as a way of verifying effective end-to-end management. TICK and TOCK are companions, they are considered experimental.
TOCK Heartbeat. See TICK
TRIM The UPS has determined that the voltage level of the public supply is too high, and is reducing it to the required level. The UPS continues to supply the protected system from the public supply.

5.2. Events

A Management Daemon (2.6) deduces the occurrence of a UPS Event from a change in the UPS status (2.11) received from the Attachment Daemon (2.1). The following table summarizes the process. A status of "none" means that the status symbol is not present in the variable ups.status.

The Management Daemon (2.6) should retrieve the variable ups.status from the Attachment Daemon (2.1) at regular intervals. If the interval is too short, valuable resources will be wasted, but if the interval is too large, the Management Daemon (2.6) will not have up-to-date information about the UPS status.

A default value of 5 seconds is recommended, but an implementation may make this value configurable. By default the "old" status is therefore the previous value retrieved 5 seconds ago.

Current practice is for the Management Daemon (2.6) to assign names to certain events. These is shown in the table in parentheses.

Table 5: Event deduction from status changes
Old status New status Event      Old status New status Event
none ALARM Alarm on      ALARM none Alarm off
none BOOST Boosting voltage      BOOST none Not boosting
none BYPASS Bypass on      BYPASS none Bypass off
none CAL Calibrating      CAL none Not calibrating
none CHRG Charging      CHRG none Not charging
none COMM UPS communicating
(COMMOK)
     COMM none See note 4
none DISCHRG Discharging      DISCHRG none Not discharging
none FSD System shutdown
(FSD) (SHUTDOWN)
     FSD none Shutdown abandoned. See note 1
none LB Low battery. See note 2
(LOWBATT)
     LB none Battery not low
none NOCOMM UPS dead? See note 4
(COMMBAD) (NOCOMM)
     NOCOMM none See note 4
none OFF UPS turned off      OFF none UPS not turned off
OB OL Receiving wall power
(ONLINE)
     OL OB Wall power lost
(ONBATT)
none OVER UPS overloaded      OVER none Overload gone
none RB Replace battery
(REPLBATT)
     RB none Replacement canceled
none TEST Test starts      TEST none Test finished
none TICK Heartbeat event. See note 3      TICK none No heartbeat. See note 3
none TOCK Heartbeat event. See note 3      TOCK none No heartbeat. See note 3
none TRIM Trimming voltage      TRIM none Not trimming

Notes

  1. Current practice does not include this event.
  2. If the status OB is present, current practice takes Management Daemon (2.6) reception of LB as an order to perform an emergency system shutdown.
  3. The use of a software defined UPS to provide a heartbeat is experimental and is not part of common current practice.
  4. Current practice is: if the UPS has not responded for 15 seconds, the Management Daemon (2.6) assumes that the UPS is "dead" (NOCOMM), and if the last known OL/OB status was OB a system shutdown (FSD) is called for.

6. Security Considerations

The security issues raised by UPS management are those of the power industry in general: they are addressed in detail in Technical Specification IEC 62351-1 [IEC62351-1]. In addition to equipment security, cyber security is now an essential consideration.

Quoting from IEC 62351-1 clause 5.2.3.5 [IEC62351-1]:

With the computer systems for power operations presumably kept isolated from the Internet, many utility personnel do not see any reason for adding security measures to these systems. However, as clearly seen from these Subclauses, this may not be true anymore as networking becomes more prevalent and additional information access requirements grow.

Clause 5.3.5 [IEC62351-1] lists the typical security attacks:

Eavesdropping, Masquerade, Man-in-the-Middle, Replay, Resource Exhaustion

Additionally the UPS management protocol provides means for a Management Daemon (2.6) to shut down a working system and it's power supply as described in The Shutdown Story (B). A malicious client acting as a Management Daemon (2.6) could turn off the UPS power outlets causing the system to fail.

Most of these issues are well known IT issues concerning system protection and disaster recovery, and are beyond the scope of this document, however the protocol itself has security considerations:

  1. It should not be possible for non-authorized agents to open sessions and send mission-critical commands such as FSD (4.2.3) to the Attachment Daemon (2.1).
  2. It should not be possible to intercept the traffic between the Attachment Daemon (2.1) and the Management Daemon (2.6).

Let's look more closely at these requirements.

6.1. Agent Verification

The protocol provides commands USERNAME (4.2.13) and PASSWORD (4.2.8) which allow an administrative user (2.2) in a Management Daemon (2.6) to authenticate itself to the Attachment Daemon (2.1). The administrative user (2.2) name and password need protection from sniffing: this is done by encrypting the traffic.

6.2. Current Encryption Practice

The protocol provides command STARTTLS (4.2.12) which calls on the Attachment Daemon (2.1) to support TLS encryption of the communication. If this command is accepted, the Management Daemon (2.6) also encrypts.

In current NUT Project (2.7) practice, the use of TLS is optional and to enforce it the system administator must set declarations FORCESSL to 1 and CERTVERIFY to 1 in the Management Daemon (2.6) configuration file.

At present the command STARTTLS (4.2.12) is too frequently refused, and traffic proceeds unencrypted, with plain text transmission of passwords and status values.

A further weakness is that the FORCESSL and CERTVERIFY declarations are in the Management Daemon (2.6) configuration file and not in the Attachment Daemon (2.1). Secure practice requires enforcement by the Attachment Daemon (2.1) rather than a possibly rogue Management Daemon (2.6) out on the Internet.

6.2.1. Secure Tunnels

Some system administrators currently use techniques such as stunnel [stunnel] to encrypt the commands and responses, but the NUT Project (2.7) has no procedure to enforce this on sites.

6.3. Current General Security Practice

Experience over the last 20 years shows that new UPS management software releases are not frequent, and when installed, stay unmodified for some years. This is probably because UPS management is a mature hardware dependent activity. A limited number of system administrators have access to the UPS hardware and software and tend to assume a certain "security by obscurity" since many installations have a configuration as shown in figure 5 which uses port nut/3493 between the two daemons running in the same system. The traffic is often not encrypted, and when encrypted uses deprecated early versions of SSL/TLS.

 ,-----,   ,--------------------,---------------------,
 | UPS |---|  Attachment   <-Commands     Management  |
 |     |===|    Daemon       Responses->    Daemon    |
 /-----\   '--------------------'---------------------'
              Listens on
             port nut/3493
             for localhost
Figure 5: Common single-system configuration

This situation is now changing as low cost processors become available, costing significantly less than a UPS unit. This evolution makes it interesting to shift to a configuration as shown in figure 6, but it also exacerbates the security weakness of figure 5 since the traffic between the daemons is now over an exposed network.

 ,-----,------------,               ,--------------,
 | UPS - Attachment | <-Commands    |  Management  |
 |     |   Daemon   |   Responses-> |    Daemon    |
 /-----'------------\               '--------------'
         Listens on
        port nut/3493
Figure 6: Integration of UPS and Attachment Daemon

6.4. Security Needs

UPS management needs to move to a more secure practice in which all traffic is encrypted, but this cannot be imposed by a wave of the hand. The ideal would be an easy-to-follow migration plan which provides the required encryption but tolerates the slow moving updates of the UPS software.

Here are two examples of possible temporary solutions.

6.4.1. Shims

A possible technique introduces shims between the Attachment Daemon (2.1) and the network, and between the network and the Management Daemon (2.6) as shown in figure 7. These shims provide TLS support [RFC8446], allowing the Attachment Daemon (2.1) and Management Daemon (2.6) to continue temporarily without native TLS. The technique has been successfully tested, but the principal difficulty is that the shims make use of a second port which is not currently available.

              TLS shim listens     TLS shim listens
                 on port TBD1        on port 3493
 ,-----,------------,----,               ,----,--------------,
 | UPS - Attachment |TLS | <-STARTTLS    | TLS|  Management  |
 |     |   Daemon   |shim|         OK--> |shim|    Daemon    |
 /-----'------------'----\               '----'--------------'
         Listens on
       port nut/3493
Figure 7: Shims provide TLS support during migration
6.4.1.1. Attachment Daemon Shim

The shim in front of the Attachment Daemon (2.1) listens to incoming traffic on a port to be specified. When it receives the command STARTTLS (4.2.12) it

  1. Returns OK to the client and sets up TLS encapsulation.
  2. Does not send STARTTLS (4.2.12) to the Attachment Daemon (2.1) port nut/3493.

All other commands and responses are passed through.

6.4.1.2. Management Daemon Shim

The shim in front of the Management Daemon (2.6) listens for incoming traffic on port nut/3493. When it receives the command STARTTLS (4.2.12) it

  1. Returns FEATURE-NOT-CONFIGURED to the client.
  2. Sends STARTTLS (4.2.12) to the Attachment Daemon (2.1) on a port to be specified.

All other commands and responses are passed through.

6.4.2. SSH Tunnels

Another possible technique is the use of SSH tunnels, using a software such as stunnel [stunnel] which adds OpenSSL-based TLS support without modifying the Attachment Daemon (2.1) or Management Daemon (2.6).

6.4.3. Long Term: Enforced Secure Communication

In the long term, enforcing secure communication requires tightening up the Attachment Daemon (2.1) to require the use of command STARTTLS (4.2.12) for commands sent over the global Internet. In such a situation an Attachment Daemon (2.1) listening for traffic other than from the localhost:

  1. SHOULD require and accept command STARTTLS (4.2.12),
  2. MUST encrypt all communication with a Management Daemon (2.6),
  3. SHALL refuse all non-encrypted commands except an initial STARTTLS (4.2.12).

Notes:

  • The "SHOULD" rather than "MUST" in 1 above allows system administrators to enforce secure communication using other techniques which do not involve the STARTTLS (4.2.12) command.
  • If an Attachment Daemon (2.1) requires that all commands be encrypted as required by the "MUST" in 2 above, then automatically each Management Daemon (2.6) must encrypt as well, since it has to do so in order to gain access.
  • The "SHALL" in 3 above applies to traffic from the global Internet. An Attachment Daemon (2.1) MAY accept unencrypted commands from localhost if the local installation's security practices allow it, for example in a dedicated appliance.
  • Note that the separate management of strongly secure traffic from the global Internet and weakly secure traffic from localhost can be achieved by using two ports: nut/3493 for the current weakly secure traffic from localhost, and some other port, perhaps ups/TBD1, for enforced secure communication, much in the manner of http and https.

6.5. Administrative Security

Administrative commands such as FSD (4.2.3), INSTCMD (4.2.6) and SET (4.2.11) are powerful and can have a deep effect on system integrity, For example, the command FSD (4.2.3) is involved in mission critical system shutdown decisions. Access to them needs to be managed and restricted. This clause presents the current practice.

6.5.1. Management of Administrative Users

The Attachment Daemon (2.1) maintains a file (currently upsd.users) defining each administrative user (2.2). Note that these users are independent of those recorded in file /etc/passwd. Each administrative user gets its own section in file upsd.users. The declarations in that section set the parameters which define that user's privileges. The section begins with the name of the user enclosed in square brackets, U+005B LEFT SQUARE BRACKET [ and U+005D RIGHT SQUARE BRACKET ], and continues until the next user name in brackets or EOF.

For example the following file declares two administrative users (2.2) admin and pfy:

   [admin]
       password = sekret
       upsmon master
       actions = SET
       instcmds = ALL
   [pfy]
       password = sekret
       instcmds = test.panel.start
       instcmds = test.panel.stop

Within each section the administrative user (2.2) declarations are:

Table 6: Administrative user declarations
Declaration Meaning
actions

Allow the user to do certain things in the Attachment Daemon (2.1). To specify multiple actions, use multiple instances of the declaration. Valid actions are:

instcmds Let a user initiate specific instant commands. See section INSTCMD (4.2.6). Use value ALL to grant all commands automatically. To specify multiple commands, use multiple instances of the instcmds field. For the full list of what a given UPS supports, use client upscmd -l supplied by the NUT Project (2.7).
password Set the password for this user. Your password should be more secure than the examples shown.
upsmon Add the necessary actions for a Management Daemon (2.6) to process a system shutdown. In current practice the value is still master or slave. Note that there is no U+003D EQUALS SIGN =.

6.5.2. An Administrative User of a Client Management Daemon

The following examples show the current security practices for administrative users (2.2) of a client Management Daemon (2.6) They also illustrate the command pair USERNAME (4.2.13) and PASSWORD (4.2.8).

6.5.2.1. An Administrative User Logs into a Short Session

In this simple example of current practice, the system administrator sets the battery level at which an Attachment Daemon (2.1) will raise the status LB, represented by variable battery.charge.low, to 35% of full charge. A system administrator types the following command to call the client upsrw supplied by the NUT Project (2.7).

upsrw -s battery.charge.low=35 -u admin -p sekret UPS-1@example.com

The USERNAME (4.2.13) and PASSWORD (4.2.8) commands are issued within the client upsrw and the Session (2.10) is of short duration.

6.5.2.2. An Administrative User Logs into a Long Session

In this second example of current practice, the long-running Attachment Daemon (2.1) upsmon which is responsible for initiating system shutdowns and which is provided by the NUT Project (2.7) issues commands USERNAME (4.2.13) and PASSWORD (4.2.8) when it starts up. The data needed for the USERNAME (4.2.13) and PASSWORD (4.2.8) is provided by a configuration file upsmon.conf which contains the line

MONITOR UPS-1@example.com 1 admin secret master

This says that the UPS to be monitored is UPS-1@example.com, it provides 1 single power supply, the administrative user (2.2) is admin with password secret. The Management Daemon (2.6) acts as a Primary (2.8), although current practice uses the term master.

The USERNAME (4.2.13) and PASSWORD (4.2.8) commands are contained within the client upsmon and the Session (2.10) is of long duration.

7. Codepoint Management

This document raises five matters of codepoint management:

  1. The namespaces occupied by the protocol commands (4.2) described in this document.
  2. The namespaces occupied by the protocol responses (4.3.2) described in this document.
  3. The namespace occupied by UPS status (2.11) names,
  4. The namespace occupied by UPS variable (2.12) names,
  5. The port name and port number used to manage UPS units.

7.1. Namespaces used by Command, Responses, Statuses and Variables

Current NUT Project (2.7) experience after more than 20 years is that the UPS management area advances slowly, and that there are few requests to modify or extend the Commands, Responses, Statuses and Variables. When this does occur, the NUT Project (2.7) has been able to settle the matter without difficulty in the project mailing list. It is therefore proposed to not burden IANA with this namespace management and to continue with the current process in which the project in its mailing list acts as a Working Group.

The Commands, Responses, Statuses and Variables are currently recorded as follows:

Table 7: Project records of namespace allocation
Namespace Recording document Reference
Commands and Responses This document Commands (4.2), Responses (4.3)
(Idem, historical record) Project Developer Guide Ch 9 Developer Guide [devguide]
Statuses This document Statuses (5.1)
(Idem, historical record) Source code clients/status.h GitHub repository [gitstats]
Variables Source code file docs/nut-names.txt GitHub repository [gitvars]

7.2. Port Name and Number used to Manage UPS Units

See the IANA Registry [Registry] for the latest situation.

7.2.1. Port nut/3493

In 2002 IANA assigned port nut/3493 to project lead Russell Kroll, and updated the assignment to the NUT Project (2.7) itself in 2020.

7.2.2. Port ups/401

In 2008 IANA assigned ups/401 "Uninterruptible Power Supply" to Mr. Charles Bennett as both assignee and contact. We have been unable to find any protocol document or other published activity report for this port other than the One Windows Trojan. Mr. Bennett himself died in 2015, see obituary [Bennett]. Since his email address was registered by IANA as bennettc@ohio.edu it is possible that the University of Ohio is a successor in interest. The editor tried to contact the IT support department of the university by email and telephone but was rejected. Ed: My non-contact was Mr. Keith Brock, IT Support Senior Specialist, brock@ohio.edu +1 740 597 2136

7.2.3. NUT Project Requirement

The NUT Project (2.7) needs to address the current weak security (6.3) of UPS management deployments, for example

The project needs a second registered port. Since ports are a limited resource, it would be better to re-use an existing port rather than request a new one, and the project is interested in using existing port ups/TBD1. Let's look more closely at this:

  • The port name "ups" satisfies the Principle of Least Surprise. It is not surprising for a port called "ups" to be used to manage UPSs. It is unlikely to be used for anything else.
  • There are no other known users of this port and no other published protocols or usage reports.
  • The currently assigned port number 401 is for a system port. The project has no imperative need for such a port; a user port, TBD1, would be sufficient. The Attachment Daemon (2.1) is a system activity, but it can be launched by root and dropped to a non-privileged user perfectly well on a user port.
  • System ports are more likely to attract malicious scans than user ports.
  • The project does not need to be assigned this port. The need is to be able to use port "ups".

8. IANA Considerations

8.1. Port Name ups: Reference to this Document

The NUT Project (2.7) has a requirement to use a second port (7.2.3), and would like to use port name ups as well as port nut. The project requests that IANA authorise such use, perhaps by updating the Service Name and Transport Protocol Port Number Registry [Registry] for ports ups and nut/3493 to include a reference to this document.

UPS management does not need a system port (7.2.3). If port number 401 were freed and the name ups assigned to user port TBD1, that would be equally effective.

The document shepherd is requested to replace the port number TBD1 by any number that IANA assigns to port name ups.

8.2. Change of Registrant

The NUT Project (2.7) advises IANA that port ups/401 has no effective registrant (7.2.2). The project does not have an imperative need to be the registrant but accepts to become the registrant if IANA deems such change desirable. Such a change in registrant could be accompanied by an allocation of a user port number TBD1.

9. Implementation Status

This section presents a very short report on the status of the Network UPS tools project

For a much more detailed history of the NUT Project (2.7) see the User Manual, Appendix J [History]

9.1. An Implementation of the Attachment Daemon

The NUT Project (2.7) implemented an Attachment Daemon (2.1) as program upsd and a set of hardware specific drivers, all written in K&R C. upsd supported all of the protocol commands and responses defined by this document.

An experimental program written in Python3 provided a TLS 1.3 [RFC8446] shim daemon as shown in figure (7) which ran in front of upsd, making it appear that upsd supported TLS 1.3.

9.2. An Implementations of the Management Daemon

There are several examples of a Management Daemon (2.6): the NUT Project (2.7) provided upsmon which takes the system shutdown decision when utility power fails. Further configuration options such as timers were provided by helper program upssched.

Other programs representing the Management Daemon (2.6):

9.3. Inclusion in Software Distributions

The programs upsd, upsmon, upssched, upsc, upscmd and upsrw have been included in the package known as "nut" in the package systems of many distributions: all the major Linux distributions, and Unix distributions such as OpenBSD and OpenSolaris. A Microsoft Windows version has been developed but was not maintained.

10. Acknowledgments

This document is based on the NUT Project (2.7) documentation [devguide]. The editor acknowledges the work of Charles Lepple, Arjen de Korte, Arnaud Quette, Jim Klimov, Russell Kroll, Manuel Wolfshant, Mark Hansen and many others who contribute to the nut-upsuser mailing list [mailinglist].

The source for this document is marked up using an SGML DTD [SGML] and an XML meta-DTD as defined by HyTime Annex A [HyTimeA]. The sgmlnorm [sgmlnorm] program generates XML which program xml2rfc [RFC7991] uses to prepare the HTML and text renderings. The editor acknowledges the help received from Carsten Bormann and Julian Reschke in the xml2rfc mailing list.

The editor thanks Adrian Farrel for advice received during the preparation of this document.

11. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.

12. Informative References

[Bennett]
"Charles Bennett Obituary", Publisher: Jagers and Sons Funeral Home, 24 Morris Ave., Athens OH, <https://www.legacy.com/obituaries/name/charles-bennett-obituary?pid=174356861>.
[devguide]
"Network UPS Tools (NUT) Project Developer Guide", <https://networkupstools.org/docs/developer-guide.chunked/ar01s09.html>.
[gitstats]
"GitHub Network UPS Tools code repository, status names", <https://github.com/networkupstools/nut/blob/master/clients/status.h>.
[gitvars]
"GitHub Network UPS Tools code repository, variable names", <https://github.com/networkupstools/nut/blob/master/docs/nut-names.txt>.
[History]
"Network UPS Tools User Manual, Appendix J Project history", <https://networkupstools.org/docs/user-manual.pdf>.
[HyTimeA]
"International Standard ISO/IEC 10744 -- Hypermedia/Time-based Structuring Language, Annex A, SGML Extended Facilities", ISO/IEC JTC 1/SC 34 Document description and processing languages, .
[IEC62351-1]
"IEC TS 62351-1 Power systems management and associated information exchange -- Data and communications security. Part 1: Communication network and system security -- Introduction to security issues", IEC Technical Specification Reference number IEC/TS 62351-1:2007(E), 35 pages, CHF 205, Technical Committee TC 57 - Power systems management and associated information exchange, , <https://nanopdf.com/download/technical-iec-specification-ts-62351-1_pdf>.
[Library]
"GitHub Network UPS Tools, Devices Dumps Library", <https://networkupstools.org/ddl/>.
[mailinglist]
"Network UPS Tools (NUT) Project Mailing List", <https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser>.
[NUT]
"Network UPS Tools (NUT) Project", <https://www.networkupstools.org>.
[Registry]
"Service Name and Transport Protocol Port Number Registry", Publisher: IANA, <https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml>.
[RFC7942]
Sheffer, Y. and A. Farrel, "Improving Awareness of Running Code: The Implementation Status Section", BCP 205, RFC 7942, DOI 10.17487/RFC7942, , <https://www.rfc-editor.org/info/rfc7942>.
[RFC7991]
Hoffman, P., "The "xml2rfc" Version 3 Vocabulary", RFC 7991, , <https://www.rfc-editor.org/info/rfc7991>.
[RFC8446]
Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, , <https://www.rfc-editor.org/info/rfc8446>.
[SGML]
Goldfarb, Charles F., "The SGML Handbook", ISBN 0-19-853737-9, .
[sgmlnorm]
Clark, James., "SGMLNORM An SGML System Conforming to International Standard ISO 8879 -- Standard Generalized Markup Language", <http://www.jclark.com/sp/sgmlnorm.htm>.
[stunnel]
Trojnara, Michal., "Stunnel proxy adds TLS encryption functionality to existing clients and servers", <https://www.stunnel.org/>.

Appendix A. Variables

The UPS variables (2.12) represent the abstracted state of the UPS unit. Certain variables represent not only the state of some hardware feature, but also provide tunable values and instant commands (2.5). The full set of variables is recorded in the reference document for variable names [gitvars].

The number of variables used in a given deployment depends on the sophistication of the UPS product: this annex shows a typical example of the subset of variables used for a reasonably complete "domestic" UPS. The NUT Project (2.7) maintains a large library of the variable subsets [Library] used by different UPS models.

Note that successive versions of a given product may add or delete features causing a change in the subset of variables used. An example is the removal of ups.delay.start from a "domestic" UPS. The manufacturer reserves the feature for the "professional" product.

An implementation of a Management Daemon (2.6) acting as a utility program may provide a listing of the variables available for a given product, for example utility program upsc as included in the NUT package (9.2).

The following sections illustrate the use of variables by taking the values associated with a typical product example of a 1600Va 1000W UPS.

A.1. Typical UPS Variables

Table 8: Typical UPS Variables
Variable Typical value Default description
battery.charge 100 "Battery charge (percent of full)"
battery.charge.low 20 "Remaining battery level when UPS switches to LB (percent)"
battery.runtime 1481 "Battery runtime (seconds)"
battery.type PbAc "Battery chemistry"
device.mfr Example Mfg ""
device.model Economy 1600 ""
device.serial 1234567890 ""
device.type ups ""
driver.name usbhid-ups "Driver name"
driver.parameter.lowbatt 37 "Driver parameter: <name>"
driver.parameter.offdelay 30 "Driver parameter: <name>"
driver.parameter.ondelay 40 "Driver parameter: <name>"
driver.parameter.pollfreq 30 "Driver parameter: <name>"
driver.parameter.pollinterval 2 "Driver parameter: <name>"
driver.parameter.port auto "Driver parameter: <name>"
driver.parameter.synchronous no "Driver parameter: <name>"
driver.parameter.vendorid 0999 "Driver parameter: <name>"
driver.version 2.7.4 "Driver version - NUT release"
driver.version.data HID 1.39 ""
driver.version.internal 0.41 "Internal driver version"
input.transfer.high 264 "High voltage transfer point (V)"
input.transfer.low 184 "Low voltage transfer point (V)"
outlet.1.desc PowerShare Outlet 1 "Outlet description"
outlet.1.id 2 "Outlet system identifier"
outlet.1.status on "Outlet switch status"
outlet.1.switchable no "Outlet switch ability"
outlet.2.desc PowerShare Outlet 2 "Outlet description"
outlet.2.id 3 "Outlet system identifier"
outlet.2.status on "Outlet switch status"
outlet.2.switchable no "Outlet switch ability"
outlet.desc Main Outlet "Outlet description"
outlet.id 1 "Outlet system identifier"
outlet.power 25 ""
outlet.switchable no "Outlet switch ability"
output.frequency.nominal 50 "Nominal output frequency (Hz)"
output.voltage 230.0 "Output voltage (V)"
output.voltage.nominal 230 "Nominal output voltage (V)"
ups.beeper.status enabled "UPS beeper status"
ups.delay.shutdown 20 "Interval to wait after shutdown with delay command (seconds)"
ups.delay.start 30 "Interval to wait before (re)starting the load (seconds)"
ups.firmware 02 "UPS firmware"
ups.load 20 "Load on UPS (percent of full)"
ups.mfr Example Mfg "UPS manufacturer"
ups.model Economy 1600 "UPS model"
ups.power.nominal 1600 "UPS power rating (VA)"
ups.productid ffff "Product ID for USB devices"
ups.serial 000000000 "UPS serial number"
ups.status OL "UPS status"
ups.timer.shutdown 0 "Time before the load will be shutdown (seconds)"
ups.timer.start 0 "Time before the load will be started (seconds)"
ups.vendorid 0999 "Vendor ID for USB devices"

A.2. Typical UPS Readable and Writable Variables

Some of the features of a UPS are represented by variables which may be tuned by the user. The following variables are typical of such tunable features. The precise list depends on the model of UPS. An implementation of a Management Daemon (2.6) acting as a utility program may provide a listing of the variables available, as well as acting on them, for example utility program upsrw as included in the NUT package (9.2).

Table 9: Typical readable and writable UPS Variables
Variable Typical value Default description provided as response to the command GET DESC
battery.charge.low 20 "Remaining battery level when UPS switches to LB (percent)"
input.transfer.high 264 "High voltage transfer point (V)"
input.transfer.low 184 "Low voltage transfer point (V)"
outlet.1.desc PowerShare Outlet 1 "Outlet description"
outlet.2.desc PowerShare Outlet 2 "Outlet description"
outlet.2.switchable no "Outlet switch ability"
outlet.desc Main Outlet "Outlet description"
outlet.power 25 "Description unavailable"
output.voltage.nominal 230 "Nominal output voltage (V)"
ups.delay.shutdown 20 "Interval to wait after shutdown with delay command (seconds)"
ups.delay.start 30 "Interval to wait before (re)starting the load (seconds)"

A.3. Typical UPS Instant Commands

Some of the features of a UPS are actions known as instant commands (2.5) which may be ordered by the user. The following variables represent such instant commands. The precise list depends on the model of UPS. An implementation of a Management Daemon (2.6) acting as a utility program may provide a listing of the variables available, as well as acting on them, for example utility program upscmd as included in the NUT package (9.2).

Table 10: Typical Instant Commands
Command Meaning
beeper.disable Disable the UPS beeper
beeper.enable Enable the UPS beeper
beeper.mute Temporarily mute the UPS beeper
load.off Turn off the load immediately
load.off.delay Turn off the load with a delay (seconds)
load.on Turn on the load immediately
load.on.delay Turn on the load with a delay (seconds)
shutdown.return Turn off the load and return when power is back
shutdown.stayoff Turn off the load and remain off
shutdown.stop Stop a shutdown in progress

Appendix B. The Shutdown Story for System and UPS

This appendix provides background material helpful for a general understanding of the relation between system and UPS. It does not define any feature of the command-response protocol.

We consider the steps involved in the shutdown and restart of a long-running unattended server protected by a single UPS. The Management Daemon (2.6) runs in the server as shown in figure Figure 8.

           ,------------------SERVER------------------,
           |                    |                     |
 ,-----,   |     UPS       <-Commands        UPS      |
 | UPS |---|  Attachment        |         Management  |
 |     |===|    Daemon       Responses->    Daemon    |
 /-----\   '--------------------'---------------------'
                             Internal
                             loopback
Figure 8: Long-running unattended server
  1. Wall power on -- The system runs normally. Every 5 seconds, variable ups.status reports OL. -- Days, weeks, months go by...
  2. Winter storm. Tree falls on power lines. Wall power fails -- The server remains operational running on the UPS battery. The Management Daemon (2.6) polls the Attachment Daemon (2.1), and detects status change OL->OB.
  3. The Management Daemon (2.6) logs warning messages. The server is still operational running on the UPS battery. -- Minutes go by...
  4. The battery discharges below the level specified by variable battery.charge.low. The server remains operational, but the UPS battery will not last much longer. The Management Daemon (2.6) polls the Attachment Daemon (2.1), and detects status change OB->OB+LB.
  5. The Management Daemon (2.6) logs the low battery event.
  6. The Management Daemon (2.6) decides to call for a system shutdown and issues the system shutdown command.
  7. The operating system's shutdown process takes over. During the system shutdown, a NUT Project (2.7) specific script or an equivalent systemd service unit runs the command upsdrvctl shutdown. This tells the UPS that it is to shut down N seconds later where the default is N=20. Note that the "shut down" of a UPS does not turn the UPS off completely. It disconnects the outlet sockets. Such a delayed shutdown is audible since the characteristic beeping of a UPS stops.
  8. The system shuts down and powers down, hopefully before the N=20 seconds have passed.
  9. N seconds after item 7 -- The UPS shuts down, i.e., it turns off its outlet sockets when N=20 seconds have passed. With some UPS units, there is an audible "clunk". The absence of AC power to the protected system for a sufficient time has the effect of resetting the server's BIOS options, and in particular the option "Restore power on AC return". This BIOS option will be needed to restart the box. How long is a sufficient time for the BIOS to reset? This depends very much on the box. Some need more than 10 seconds. What if wall power returns before the "sufficient time" has elapsed? The UPS unit should be able to wait a configurable time with default 30 seconds. These two timers start from the moment the UPS receives the upsdrvctl shutdown command. -- Minutes, hours, days go by...
  10. Some time later, maybe much later, wall power returns -- The UPS reconnects it's outlets to send power to the protected system.
  11. The system BIOS option "Restore power on AC return" has hopefully been selected and the system powers up. The bootstrap process of the operating system begins.
  12. The operating system starts the Attachment Daemon (2.1) and the Management Daemon (2.6). The Attachment Daemon (2.1) starts the Driver (2.3) and scans the UPS. The UPS status becomes OL+LB.
  13. After some time, the battery charges above the battery.charge.low threshold and the Attachment Daemon (2.1) declares the status change OL+LB->OL. We are now back in the same situation as 1 above.

Appendix C. Technical Terms: Historical Differences

This appendix lists the major differences between the technical terms used in this document and those used in version 2.7.4 of the NUT Project (2.7).

Table 11
Term in NUT 2.7.4 Term in this document
ALREADY-LOGGED-IN ALREADY-ATTACHED (Table 3)
ALREADY-SSL-MODE TLS-ALREADY-ENABLED (Table 3)
LOGIN ATTACH (4.2.1)
LOGOUT DETACH (4.2.2)
Master Primary (2.8)
NETVER PROTVER (4.2.10)
NUMLOGINS NUMATTACH (4.2.4.3)
Slave Secondary (2.9)

Appendix D. Change Log

This section is to be removed before publishing as an RFC.

Ed: To be removed on publication.

D.1. Changes in Version 01

  1. There is exactly one newline (4.1) at the end of commands and responses.
  2. Added descriptions to variables in Annex (A).
  3. Added clause Events (5.2).

D.2. Changes in Version 02

  1. Extended acknowledgments.
  2. Added reference to possible use of RFC1628 between driver and Attachment Daemon (2.1).
  3. Clarified response to command LIST CLIENT.

D.3. Changes in Version 03

  1. Clarified description of Attachment Daemon (2.1).
  2. Added Implementation status section as recommended by RFC 7942 [RFC7942].
  3. Rewrote Section 7.2.3, Paragraph 1.
  4. Clarified Appendix A, Paragraph 1 as being merely an example of variables used for a specific UPS product.
  5. Added definition of <upsname> in Section 4.2, Paragraph 1.

D.4. Changes in Version 04

There are many changes in this version following the ISE review. See reply to ISE review: http://rogerprice.org/NUT/ISE-comments-2021-06-14.reply.html Among other changes are:

  1. Section (7) becomes "Codepoint Management".
  2. Editorial cleanup. All <aside> elements labelled as notes.
  3. Added implementation note to Section 4.2.7, Paragraph 1.
  4. Error message ALREADY-SSL-MODE becomes ALREADY-TSL-ENABLED.
  5. Added error message TSL-NOT-ENABLED.
  6. Typo in clause UPS status (Section 2.11, Paragraph 1).
  7. Removed all reference to use of RFC1628 between driver and Attachment Daemon (2.1).
  8. In Section 4.2, Paragraph 1 field [:<port>] is always available in <upsname>
  9. Added technical term administrative user (2.2).
  10. Added appendix Technical terms: Historical differences (C)
  11. Added table of "successful" responses: Response when command succeeds (4.3.1)
  12. Three commands change name LOGIN -> ATTACH (4.2.1), LOGOUT -> DETACH (4.2.2) and NUMLOGINS -> NUMATTACH (4.2.4.3).
  13. Error message ALREADY-LOGGED-IN becomes ALREADY-ATTACHED.

Author's Address

Roger Price (editor)
Network UPS Tools Project
France