RFC 2593
Script MIB Extensibility Protocol Version 1.0
Script MIB Extensibility Protocol Version 1.0 ๐
okay bestie, this is RFC 2593 and it's giving Experimental ๐งชโจ. It's from the Network Working Group and was written by J. Schoenwaelder (TU Braunschweig) and J. Quittek (NEC Europe Ltd.) in May 1999. It's labelled Category: Experimental, and the header doesn't list anything it obsoletes or updates ๐ .
Status of This Memo ๐
okay so this memo defines an Experimental Protocol for the Internet community ๐งช. It is not an Internet standard of any kind. The authors are literally asking for discussion and suggestions for improvement ๐ซถ, and distribution of this memo is unlimited ๐.
Copyright Notice ยฉ๏ธ
Copyright (C) The Internet Society (1999). All Rights Reserved. ๐
Abstract โจ
so the IETF Script MIB gives you an interface for delegating management functions, based on the Internet management framework ๐ง. A management script is a set of instructions that gets run by a language specific runtime system ๐ฅ. The Script MIB extensibility protocol (SMX) in this memo is the thing that separates those language specific runtime systems from the language independent Script MIB implementations. It's giving clean separation ๐.
Table of Contents ๐
1. Introduction ................................................ 2
2. Process Model and Communication Model ....................... 3
3. Security Profiles ........................................... 3
4. Start of Runtime Systems and Connection Establishment ....... 4
5. SMX Messages ................................................ 5
5.1 Common Definitions ......................................... 5
5.2 Commands ................................................... 7
5.3 Replies .................................................... 8
6. Elements of Procedure ....................................... 9
6.1 SMX Message Processing on the Runtime Systems .............. 9
6.1.1 Processing the `hello' Command ........................... 10
6.1.2 Processing the `start' Command ........................... 10
6.1.3 Processing the `suspend' Command ......................... 11
6.1.4 Processing the `resume' Command .......................... 12
6.1.5 Processing the `abort' Command ........................... 12
6.1.6 Processing the `status' Command .......................... 12
6.1.7 Generation of Asynchronous Notifications ................. 13
6.2 SMX Message Processing on the SNMP Agent ................... 13
6.2.1 Creating a Runtime System ................................ 13
6.2.2 Generating the `hello' Command ........................... 13
6.2.3 Generating the `start' Command ........................... 14
6.2.4 Generating the `suspend' Command ......................... 15
6.2.5 Generating the `resume' Command .......................... 16
6.2.6 Generating the `abort' Command ........................... 16
6.2.7 Generating the `status' Command .......................... 17
6.2.8 Processing Asynchronous Notifications .................... 18
7. An Example SMX Message Flow ................................. 19
8. Security Considerations ..................................... 19
9. Acknowledgments ............................................. 20
10. References ................................................. 20
11. Authors' Addresses ......................................... 21
12. Full Copyright Statement ................................... 22
1. Introduction ๐ธ
okay so the Script MIB ๐ [1] gives you a standard interface for delegating management functions, based on the Internet management framework. It's lowkey a lot, but the highlights are:
- Transferring management scripts to a distributed manager ๐ฆ.
- Starting, suspending, resuming and terminating management scripts ๐.
- Transferring arguments for management scripts ๐.
- Monitoring and controlling running management scripts ๐.
- Transferring results produced by management scripts ๐.
A management script is a set of instructions run by a language specific runtime system ๐ฅ. The Script MIB doesn't pick a specific language. Instead it lets you control scripts written in different languages that are running at the same time, which is so iconic ๐ .
The Script MIB Extensibility protocol (SMX) in this memo can be used to separate language specific runtime systems from the runtime system independent Script MIB implementations ๐ฆ. SMX is lightweight, and it lets you support different runtime systems without changing the language neutral part of a Script MIB implementation. no cap, that's the whole glow-up โจ.
Some examples considered while designing SMX are the Java virtual machine [2] and the Tool Command Language (Tcl) [3]. Other languages with comparable features should be easy to integrate as well ๐ง.
2. Process Model and Communication Model ๐ฆ
Figure 1 shows the process and communication model that SMX sits on ๐. The language and runtime system independent SNMP agent, which implements the Script MIB, talks to one or more runtime systems over the SMX protocol. A runtime system may be able to run one or multiple scripts at once (multi-threading) ๐งต. SMX supports multi-threading, but it doesn't require multi-threaded runtime systems, so no pressure ๐ซถ.
SMX uses a local storage device (usually built on top of the local file system) to move scripts from the SNMP agent over to the runtime systems ๐. The SNMP agent has read and write access to the script storage device, while the runtime systems only need read access ๐. SMX passes the location of a script in the local storage device to the runtime engines, and then it's the runtime engines' job to load the script from that location ๐ .
runtime 1
+--------------+ SMX +---------+
| |<-------------->| O O O |<-+
SNMP | Script MIB | +---------+ |
<---------->| | |
| SNMP Agent | runtime 2 |
| | SMX +---------+ |
| |<-------------->| O | |
+--------------+ +---------+ |
^ ^ |
| +---------+ | |
| | script |----------+ |
+------>| storage |------------------+
+---------+
Figure 1: SMX process and communication model
3. Security Profiles ๐
okay the security profiles are what control what a running script is allowed to do ๐ก๏ธ. It's useful to split them into two classes:
- The operating system security profile says which operating system services the OS level process running a script is allowed to use ๐ป. Under UNIX, this maps to the effective user and group identity for the running process. Lots of UNIX versions also let you set other resource limits, like the number of open files or the maximum stack sizes ๐. Another UNIX mechanism is the chroot() system call, which changes the file system root for a process ๐ณ. chroot() can be used to stop runtime systems from accessing any system files. It's suggested to use every applicable operating system security mechanism to protect the OS from malicious scripts or runtime systems ๐จ.
- Secure runtime systems give you fine grained control over which services a running script can use at a particular point during script execution ๐ฏ. A runtime security profile that does fine grained access control depends on the runtime system. For a Java virtual machine, the runtime security profile is interpreted by the SecurityManager and ClassLoader classes[4]. For Tcl, the runtime security profile maps to the interpreter's security profile [5] ๐ง .
SMX lets you run scripts under different operating system profiles and runtime system profiles ๐. Multiple operating system security profiles are realised by using multiple runtime systems, each running in an operating system process with its own security profile. Multiple runtime security profiles are supported by passing a security profile name to a runtime system when a script is invoked ๐.
The Script MIB doesn't define how operating system or runtime system security profiles get identified. This memo suggests that the smLaunchOwner gets mapped to an operating system security profile and a runtime system security profile when a script is started ๐.
4. Start of Runtime Systems and Connection Establishment ๐
The SNMP agent starts runtime systems based on the static properties of the runtime system (multi-threaded or single-threaded) and the operating system security profiles ๐ง. Starting a new runtime system means creating a process environment that matches the operating system security profile ๐ ๏ธ.
The SNMP agent first passes information to the runtime system through environment variables ๐ท. That information is needed to set up a trusted communication channel between the SNMP agent and a runtime system ๐ค.
The SNMP agent first creates a listening TCP socket that accepts connections from runtime systems ๐. It's the runtime system's responsibility to connect to this TCP socket once it's been started. The port number of the listening TCP socket is passed from the SNMP agent to the runtime system in the environment variable SMX_PORT ๐๏ธ.
the SNMP agent must make sure that only authorized runtime systems connect to the listening TCP socket ๐ซ. These are the rules it uses:
- The TCP connection must come from the local host ๐ .
- The SNMP agent asks the runtime system for a security cookie, and it closes the TCP connection if no valid response shows up within a given time interval โฐ. The security cookie is a random number that the SNMP agent generates and passes to the runtime system as part of its environment. It's found in the environment variable
SMX_COOKIE๐ช.
The security assumption here is that access to the process environment is protected by the operating system ๐.
Alternate transports (e.g. UNIX domain sockets) are possible but aren't defined yet ๐คทโโ๏ธ. TCP was picked as the transport for SMX because it's supported by all the potential runtime systems, while other transports aren't universally available ๐.
5. SMX Messages ๐
The message formats below are defined using the Augmented BNF (ABNF) from RFC 2234 [6] ๐. The definitions for ALPHA, DIGIT, HEXDIG, WSP, CRLF, CR, LF, HTAB, VCHAR and DQUOTE are imported from appendix A of RFC 2234 and aren't repeated here ๐ซถ.
that's the first part of the glow-up, bestie ๐โจ
5.1. Common Definitions โจ
okay bestie, so before we get into the actual SMX messages, we need to agree on the building blocks ๐งฑ๐ these ABNF definitions are what every later section leans on, so let's go through them ๐
Zero = %x30 ; the ASCII character '0'
AlNum = DIGIT / ALPHA / %x2D-2F
; digits, alphas plus '-', '.', '/'
QuotedString = DQUOTE *(VCHAR / WSP) DQUOTE
HexString = 1*(HEXDIG HEXDIG)
Id = 1*DIGIT ; identifier for an SMX transaction
Script = QuotedString ; script file name
RunId = 1*DIGIT ; globally unique identifier for a
; running script (note, smRunIndex
; is only unique for a smLaunchOwner,
; smLaunchName pair)
Profile = 1*AlNum ; security profile name
RunState = "1" ; smRunState `initializing'
RunState =/ "2" ; smRunState `executing'
RunState =/ "3" ; smRunState `suspending'
RunState =/ "4" ; smRunState `suspended'
RunState =/ "5" ; smRunState `resuming'
RunState =/ "6" ; smRunState `aborting'
RunState =/ "7" ; smRunState `terminated'
ExitCode = "1" ; smRunExitCode `noError'
ExitCode =/ "2" ; smRunExitCode `halted'
ExitCode =/ "3" ; smRunExitCode `lifeTimeExceeded'
ExitCode =/ "4" ; smRunExitCode `noResourcesLeft'
ExitCode =/ "5" ; smRunExitCode `languageError'
ExitCode =/ "6" ; smRunExitCode `runtimeError'
ExitCode =/ "7" ; smRunExitCode `invalidArgument'
ExitCode =/ "8" ; smRunExitCode `securityViolation'
ExitCode =/ "9" ; smRunExitCode `genericError'
Cookie = HexString ; authentication cookie
Version = "SMX/1.0" ; current version of the SMX protocol
Argument = HexString / QuotedString ; see smRunArgument
Result = HexString / QuotedString ; see smRunResult
ErrorMsg = HexString / QuotedString ; see smRunError
so the QuotedString one needs a little extra explaining ๐ซถ inside a quoted string you can have special sequences, and they all start with a backslash (%x5C) ๐ธ here's what they mean:
`\\' backslash character (`%x5C')
`\t' tab character (`HTAB')
`\n' newline character (`LF')
`\r' carriage-return character (`CR')
`\"' quote character (`DQUOTE')
and for any other case that isn't listed, the backslash just gets dropped and the character after it is treated as a normal character ๐ฆ Argument and Result are each either a QuotedString or a HexString ๐ the Script MIB says script arguments and results are arbitrary octet strings, and SMX supports both a binary form and a human readable one, because printable strings are probably going to be used a lot โจ but an implementation MUST be able to handle both formats to be compliant with the Script MIB ๐
the Cookie is a HexString with no meaning beyond being a random sequence of bytes, so it doesn't need a human readable form ๐ it's giving pure mystery ๐ฅ
5.2. Commands ๐
this section is the list of SMX commands the SNMP agent can send to a runtime system ๐
Command = "hello" WSP Id CRLF
Command =/ "start" WSP Id WSP RunId WSP Script WSP Profile
WSP Argument CRLF
Command =/ "suspend" WSP Id WSP RunId CRLF
Command =/ "resume" WSP Id WSP RunId CRLF
Command =/ "abort" WSP Id WSP RunId CRLF
Command =/ "status" WSP Id WSP RunId CRLF
hello is always the first command sent over an SMX connection ๐ it's how the runtime system gets identified and authenticated ๐ซถ start kicks off a script's execution ๐ suspend, resume and abort can change the status of a running script โจ and status is for pulling status info on a running script ๐
there's no compile command, so the SNMP agent has to do any compilation it needs before using start ๐ง there's also no SMX command to shut down a runtime system ๐ญ instead, closing the connection has to be read as a request to terminate every running script in that runtime system AND shut the runtime system down ๐
5.3. Replies ๐
every reply message starts with a three digit reply code and ends with CRLF ๐ the three digits have special meaning: the first one tells you the class of the reply ๐ฆ
1yz transient positive response
2yz permanent positive response
3yz transient negative response
4yz permanent negative response
5yz asynchronous notification
the 1yz and 3yz classes aren't used by SMX version 1.0 yet ๐ they're only defined for future SMX extensions ๐ฎ
the second digit is the specific category ๐
x0z syntax errors that don't fit any other category
x1z replies for commands targeted at the whole runtime system
x2z replies for commands targeted at scripts
x3z replies for commands targeted at running instances of scripts
and the third digit gives a finer grade of meaning inside each category ๐ here's the ABNF for every reply and code:
Reply = "211" WSP Id WSP Version WSP Cookie CRLF
; identification of the
; runtime system
Reply =/ "231" WSP Id WSP RunState CRLF
; status of a running script
Reply =/ "232" WSP Id CRLF ; abort of a running script
Reply =/ "401" WSP Id CRLF ; syntax error in command
Reply =/ "402" WSP Id CRLF ; unknown command
Reply =/ "421" WSP Id CRLF ; unknown or illegal Script
Reply =/ "431" WSP Id CRLF ; unknown or illegal RunId
Reply =/ "432" WSP Id CRLF ; unknown or illegal Profile
Reply =/ "433" WSP Id CRLF ; illegal Argument
Reply =/ "434" WSP Id CRLF ; unable to change the status of
; a running script
Reply =/ "511" WSP Zero WSP QuotedString CRLF
; an arbitrary message send from
; the runtime system
Reply =/ "531" WSP Zero WSP RunId WSP RunState CRLF
; asynchronous running script
; status change
Reply =/ "532" WSP Zero WSP RunId WSP RunState WSP Result CRLF
; intermediate script result
Reply =/ "533" WSP Zero WSP RunId WSP RunState WSP Result CRLF
; intermediate script result that
; trigger an event report
Reply =/ "534" WSP Zero WSP RunId WSP Result CRLF
; normal script termination
Reply =/ "535" WSP Zero WSP RunId WSP ExitCode WSP ErrorMsg CRLF
; abnormal script termination.
6. Elements of Procedure ๐ง
this section goes through, step by step, what the SNMP agent and the runtime system each do with the SMX protocol ๐ซถ
6.1. SMX Message Processing on the Runtime Systems ๐
this part covers how a runtime engine handles SMX command messages, and the conditions under which it generates asynchronous notifications ๐ฅ
when the runtime system gets a message, it first tries to recognize a command made of the command string and the transaction identifier ๐ if it can't pull out BOTH of those, the message gets discarded ๐ an asynchronous 511 reply MAY be generated in that case ๐ธ otherwise, the command string gets checked to be valid, meaning it has to be one of hello, start, suspend, resume, abort, or status โจ if it's invalid, a 402 reply is sent and processing of the message stops ๐
if the command IS valid, the rest of the processing depends on that command, as described below ๐
the command-specific processing describes several possible syntax errors that get their own reply messages ๐ฆ if the runtime engine finds a syntax error that isn't explicitly mentioned, or one that can't be identified uniquely, a generic 401 reply gets sent to say the command can't be executed ๐ญ
6.1.1. Processing the hello Command ๐ง
when the runtime system receives a hello command, here's what it does ๐
- the runtime system grabs the security cookie from its process environment ๐
- the runtime system sends a
211reply containing the security cookie ๐
6.1.2. Processing the start Command ๐
when the runtime system receives a start command, here's the play-by-play ๐ฌ
- the syntax of the
startcommand's arguments gets checked, and the following four checks MUST be made:- (a) the syntax of the
RunIdparameter is checked, and a431reply is sent if any syntax error shows up ๐ - (b) the syntax of the
Scriptparameter is checked, and a421reply is sent if any syntax error shows up ๐ - (c) the syntax of the
Profileparameter is checked, and a432reply is sent if any syntax error shows up ๐ - (d) if the syntax of the
Argumentparameter is checked and a433reply is sent if any syntax error shows up ๐
- (a) the syntax of the
- the runtime system checks whether the new
RunIdis already in use ๐ if yes, a431reply is sent and processing stops ๐ - the runtime system checks whether the
Scriptparameter is the name of a file on the local storage device that can be read ๐ a421reply is sent and processing stops if the file doesn't exist or isn't readable ๐ซ - the runtime system checks whether the security profile is known, and sends a
432reply and stops processing if it isn't ๐ - the runtime engine starts the script named by the script name โจ once the script has started, a
231reply is sent with the current run state ๐ฆ
processing of the start command stops when the script reaches the state running ๐ for every asynchronous state change of the running script, a 531 reply is sent ๐ processing of the start command also stops if an error happens before the state running is reached ๐ญ in that case the run is aborted and a 535 reply is generated ๐
if an abort command or a suspend command for the running script is received before processing of the start command is complete, processing of the start command MAY be stopped before the state running is reached ๐ธ in that case, the resulting status of the running script is given by the respective reply to the abort or suspend command, and NO reply with the transaction identifier of the start command gets generated ๐ซถ
6.1.3. Processing the `suspend' Command
okay so when the runtime system gets a `suspend' command, here's the exact order it goes through ๐ โจ
- if there's a syntax error in the running script identifier, or there's no running script matching the identifier, send a
431reply and stop processing the command ๐ โโ๏ธ - if the running script is already in the state
suspended, send a231reply and stop processing the command ๐ธ - if the running script is in the state
running, suspend it and send a231reply after suspending. if suspending fails, send a434reply and stop processing the command ๐ฆ - if the running script hasn't reached the state
runningyet (thestart' command is still being processed), it may reach the statesuspendedwithout ever having been in the staterunning. after it reachessuspended, send a231` reply ๐ง - if the running script is in any other state, send a
434reply ๐
6.1.4. Processing the `resume' Command
bestie, the resume' command is basically the mirror image of suspend' ๐ช๐ here's the flow:
- if there's a syntax error in the running script identifier, or there's no running script matching the identifier, send a
431reply and stop processing the command ๐ - if the running script is already in the state
running, send a231reply and stop processing the command โจ - if the running script is in the state
suspended, resume it and send a231reply after resuming. if resuming fails, send a434reply and stop processing the command ๐ฅ - if the
start' command is still being processed for the script, send a231reply once the staterunning` has been reached ๐ - if the running script is in any other state, send a
434reply ๐ญ
6.1.5. Processing the `abort' Command
when the runtime system receives an `abort' command, it's giving "shut it down" energy ๐๐
- if there's a syntax error in the running script identifier, or there's no running script matching the identifier, send a
431reply and stop processing the command ๐ โโ๏ธ - if the running script is already aborted, send a
232reply and stop processing the command ๐ท - the running script is aborted, and a
232reply is sent after aborting. if aborting fails, send a434reply and stop processing ๐
6.1.6. Processing the `status' Command
the `status' command is the chill one ๐ง when it shows up:
- if there's a syntax error in the running script identifier, or there's no running script matching the identifier, send a
431reply and stop processing the command ๐ซ - the status of the script is obtained, and a
231reply is sent ๐โจ
6.1.7. Generation of Asynchronous Notifications
okay this part is where the runtime system gets to be chatty ๐ฃ๐ without being asked, it generates (or may generate) these notifications:
- if the runtime system notices a change in the status of a running script, a
531reply is sent ๐ - a
534reply is sent if a running script terminates normally ๐ - a
535reply is sent if a running script terminates abnormally ๐ - if a script produces an intermediate result, a
532reply is sent ๐ - if a script asks for a
smScriptResult' notification to be generated, a533` reply is sent ๐ - besides the notifications above, the runtime system may generate arbitrary
511replies, which are logged or displayed by the SNMP agent ๐ฆ๐ซถ
6.2. SMX Message Processing on the SNMP Agent
this section is the SNMP agent's side of the story ๐ง๐ it covers when an SNMP agent that implements the Script MIB generates SMX commands, and how it handles the replies that come back.
6.2.1. Creating a Runtime System
new runtime systems get started by the SNMP agent while it's processing set requests for a smLaunchStart' variable ๐ first, it searches for an already running runtime systems which matches the security profiles associated with the smLaunchStart' variable. if there's no suitable runtime system available, a new one is started. that means preparing the environment, then starting the executable in a new process that conforms to the operating system security profile ๐ after that, the SNMP agent gets ready to accept a connection from the new runtime system. and the smRunState' of every script that should run in this new runtime system gets set to initializing' ๐ธ
6.2.2. Generating the `hello' Command
the hello' command is generated once a connection request from a runtime system has been accepted ๐ค the SNMP agent sends the hello' command, as defined in section 5.2, and then waits for a reply from the runtime system within a reasonable timeout interval โณ
- if the timeout expires before the SNMP agent receives a reply, the connection is closed and all data associated with it is deleted. any scripts that should be running in this runtime system are aborted, the
smRunExitCode' is set togenericError', and `smRunError' is modified to describe the error situation ๐ฑ - if the received message can not be analyzed because it does not have the required format, the connection is closed and all data associated with it is deleted. any scripts that should be running in this runtime system are aborted, the
smRunExitCode' is set togenericError', and `smRunError' is modified to describe the error situation ๐ โโ๏ธ - if the received message is a
211reply, theId' is checked to see whether it matches theId' used in thehello' command. if theId' matches, theVersion' is checked. if theVersion' matches a supported SMX protocol version, theCookie' is checked to see whether it matches the cookie passed to the runtime system. if any of these tests fails, the connection is closed and all data associated with this runtime system is deleted. any scripts that should be running in this runtime system are aborted, thesmRunExitCode' is set togenericError', andsmRunError' is modified to describe the error situation ๐จ - received messages are discarded if none of the previous rules applies ๐๏ธ
6.2.3. Generating the `start' Command
the start' command is generated while the SNMP agent processes set-requests for a smLaunchStart' variable โจ it assumes the SNMP agent has already figured out which runtime system is suitable for running the script associated with that variable. the SNMP agent sends the `start' command, as defined in section 5.2, to the selected runtime system and then waits for a reply within a reasonable timeout interval ๐ฆ
- if the timeout expires before the SNMP agent receives a reply, the SNMP agent sends an
abort' command to abort the running script, sets thesmRunState' of the running script toterminated', sets thesmRunExitCode' togenericError', andsmRunError' is modified to describe the timeout situation โฐ - if the received message can not be analyzed because it does not have the required format, the message is ignored. the SNMP agent keeps waiting for a valid reply message until the timeout expires ๐
- if the received message is a
4yz' reply and theId' matches theId' of thestart' command, the SNMP agent assumes that the script can not be started. thesmRunState' of the running script is set toterminated', thesmRunExitCode' is set togenericError', and the `smRunError' is modified to contain a message describing the error situation ๐ - if the received message is a
231' reply and theId' matches theId' of thestart' command, the `smRunState' variable of the running script is updated ๐ - received messages are discarded if none of the previous rules applies ๐๏ธ
6.2.4. Generating the `suspend' Command
the suspend' command is generated while the SNMP agent processes set-requests for the smLaunchControl' and smRunControl' variables that change the value to suspend' ๐ the SNMP agent sets the smRunState' variable to suspending', sends the `suspend' command as defined in section 5.2, and then waits for a reply from the runtime system within a reasonable timeout interval ๐ฐ๏ธ
- if the timeout expires before the SNMP agent receives a reply, the SNMP agent sends an
abort' command to abort the running script, sets thesmRunState' of the running script toterminated', sets thesmRunExitCode' togenericError', andsmRunError' is modified to describe the timeout situation ๐ต - if the received message can not be analyzed because it does not have the required format, the message is ignored. the SNMP agent keeps waiting for a valid reply message until the timeout expires ๐
- if the received message is a
401',402' or a431' reply and theId' matches theId' of thesuspend' command, the runtime systems is assumed to not provide the suspend/resume capability, and processing of the `suspend' command stops ๐ โโ๏ธ - if the received message is a
231' reply and theId' matches theId' of thesuspend' command, the `smRunState' variable of the running script is updated ๐ธ - received messages are discarded if none of the previous rules applies ๐๏ธ
6.2.5. Generating the `resume' Command
the resume' command is generated while the SNMP agent processes set-requests for the smLaunchControl' and smRunControl' variables that change the value to resume' ๐ the SNMP agent sets the smRunState' variable to resuming', sends the `resume' command as defined in section 5.2, and then waits for a reply from the runtime system within a reasonable timeout interval ๐
- if the timeout expires before the SNMP agent receives a reply, the SNMP agent sends an
abort' command to abort the running script, sets thesmRunState' of the running script toterminated', sets thesmRunExitCode' togenericError', andsmRunError' is modified to describe the timeout situation ๐ญ - if the received message can not be analyzed because it does not have the required format, the message is ignored. the SNMP agent keeps waiting for a valid reply message until the timeout expires ๐ซถ
- if the received message is a
401',402' or a431' reply and theId' matches theId' of theresume' command, the runtime systems is assumed to not provide the suspend/resume capability, and processing of the `resume' command stops ๐ - if the received message is a
231' reply and theId' matches theId' of theresume' command, the `smRunState' variable of the running script is updated ๐ - received messages are discarded if none of the previous rules applies ๐๏ธ
6.2.6. Generating the `abort' Command ๐
okay so the abort' command gets generated when you're processing set-requests for smLaunchControl' and smRunControl' that change the value to abort'. ๐
โโ๏ธ It also pops up if smRunLifeTime' hits 0, which is basically the script running out of time โฐ. The SNMP agent sends the abort' command as defined in section 5.2, and then it waits for a reply from the runtime system within a reasonable timeout interval. ๐ซถ
- ok so if the timeout expires before the SNMP agent gets a reply, the agent sets the
smRunState' of the running script toterminated', setssmRunExitCode' togenericError', and modifies `smRunError' to describe the timeout situation ๐. - if the received message can't be analyzed because it doesn't have the required format, the message gets ignored ๐. The SNMP agent keeps waiting for a valid reply until the timeout expires.
- if the received message is a
4yz' reply and theId' matches theId' of theabort' command, the SNMP agent assumes the script can not be aborted ๐ฉ. ThesmRunState' of the running script is set toterminated', thesmRunExitCode' is set togenericError', and `smRunResult' gets modified to describe the error situation. - if the received message is a
232' reply and theId' matches theId' of theabort' command, thesmRunExitCode' of the terminated script changes to eitherhalted' (when processing a set-request for thesmLaunchControl' andsmRunControl' variables) orlifeTimeExceeded' (if theabort' command was generated becausesmRunLifeTime' reached the value 0) โจ. ThesmRunState' variable is changed to `terminated'. ya win ๐ - received messages are discarded if none of the previous rules applies ๐๏ธ.
6.2.7. Generating the `status' Command ๐
the status' command is generated either periodically or on demand by the SNMP agent, and its whole job is to pull status info from running scripts ๐ง. The SNMP agent sends the status' command as defined in 5.2 and then waits for a reply from the runtime system within a reasonable timeout interval.
- if the timeout expires before the SNMP agent gets a reply, the agent sends an
abort' command to abort the running script ๐. It also sets thesmRunState' of the running script toterminated', thesmRunExitCode' togenericError', and modifiessmRunError' to describe the timeout situation. - if the received message can't be analyzed because it doesn't have the required format, the message gets ignored ๐. The SNMP agent keeps waiting for a valid reply until the timeout expires.
- if the received message is a
4yz' reply and theId' matches theId' of thestatus' command, the SNMP agent assumes the script status can not be read ๐ฑ. That's a fatal error condition, so the agent sends anabort' command to abort the running script. ThesmRunState' of the running script is set toterminated', thesmRunExitCode' is set togenericError', andsmRunError' is modified to describe the error situation. - if the received message is a
231' reply and theId' matches theId' of thestatus' command, then the `smRunState' variable of the running script gets updated ๐. - received messages are discarded if none of the previous rules applies ๐๏ธ.
6.2.8. Processing Asynchronous Notifications ๐
the runtime system can send asynchronous status change notifications, which are the `5yz' replies, and these get processed like this ๐ :
- if the received message is a `511' reply, the message is displayed or logged appropriately and processing stops ๐.
- if the received message is a
531' reply, the SNMP agent checks whether a running script with the givenRunId' exists in the runtime system. If there's no running script with thatRunId', processing of the notification stops. Otherwise, thesmRunState' gets updated. - if the received message is a
532' reply, the SNMP agent checks whether a running script with the givenRunId' exists in the runtime system. No script with thatRunId' means processing of the notification stops. Otherwise,smRunState' and `smRunResult' get updated. - if the received message is a
533' reply, the SNMP agent checks whether a running script with the givenRunId' exists in the runtime system. If not, processing of the notification stops ๐. Otherwise,smRunState' andsmRunResult' get updated and the `smScriptResult' notification is generated ๐. - if the received message is a
534' reply, the SNMP agent checks whether a running script with the givenRunId' exists in the runtime system. If there isn't one, processing stops. Otherwise,smExitCode' is set tonoError',smRunState' is set toterminated', and `smRunResult' gets updated ๐ฅณ. - if the received message is a
535' reply, the SNMP agent checks whether a running script with the givenRunId' exists in the runtime system. No match means processing stops. Otherwise,smRunState' is set toterminated' andsmExitCode' andsmRunError' get updated ๐.
7. An Example SMX Message Flow ๐ฌ
okay this is the part where we watch the whole thing happen ๐ฟ. The messages sent from the SNMP agent are marked with >', and the replies from the runtime system are marked with <'. The line terminators (`CRLF') are not shown so the example is easier to read ๐ซถ.
> hello 1
< 211 1 SMX/1.0 0AF0BAED6F877FBC
> start 2 42 "/var/snmp/scripts/foo.jar" untrusted ""
> start 5 44 "/var/snmp/scripts/bar.jar" trusted "www.ietf.org"
< 231 2 2
> start 12 48 "/var/snmp/scripts/foo.jar" funny ""
< 231 5 2
< 532 0 44 2 "waiting for response"
> status 18 42
> status 19 44
< 432 12
< 231 19 2
< 231 18 2
> hello 578
< 211 578 SMX/1.0 0AF0BAED6F877FBC
> suspend 581 42
< 231 581 4
< 534 0 44 "test completed"
> abort 611 42
< 232 611
8. Security Considerations ๐
this part is serious, bestie, so pay attention ๐ง. The SMX protocol runs on top of a local TCP connection, and protocol messages never leave the local system. So it's not possible to attack the message exchanges, as long as the underlying operating system protects local TCP connections from other users on the same machine ๐ก๏ธ.
The only critical situation is the connection establishment phase ๐ฌ. The rules defined in section 4 make sure that only local connections are accepted, and that a runtime system has to identify itself with a security cookie. That cookie is generated by the SNMP agent and passed to the runtime system process as part of its environment. This rule makes sure scripts only run on authorized runtime systems โ . The scheme relies on the operating system protecting process environments, and well maintained UNIX operating systems have this property ๐ง.
The SMX protocol lets you execute scripts under different operating system and runtime system security profiles ๐ญ. The memo suggests mapping the smLaunchOwner value to an operating system and a runtime system security profile. The operating system security profile is enforced by the operating system, which sets up a proper process environment. The runtime security profile is enforced by a secure runtime system, like the Java virtual machine or a safe Tcl interpreter [7] ๐.
9. Acknowledgments ๐ซถ
the protocol in this memo is the result of a joint project between the Technical University of Braunschweig and C&C Research Laboratories of NEC Europe Ltd. in Berlin ๐. These project members get a big thank you for their contributions to the initial design and implementation:
M. Bolz (TU Braunschweig)
C. Kappler (NEC Europe Ltd.)
A. Kind (NEC Europe Ltd.)
S. Mertens (TU Braunschweig)
J. Nicklisch (NEC Europe Ltd.)
10. References ๐
- [1] Levi, D. and J. Schoenwaelder, "Definitions of Managed Objects for the Delegation of Management Scripts", RFC 2592, May 1999.
- [2] Lindholm, T., and F. Yellin, "The Java Virtual Machine Specification", Addison Wesley, 1997.
- [3] J.K. Ousterhout, "Tcl and the Tk Toolkit", Addison Wesley, 1994.
- [4] Fritzinger, J.S., and M. Mueller, "Java Security", White Paper, Sun Microsystems, Inc., 1996.
- [5] Levy, J.Y., Demailly, L., Ousterhout, J.K., and B. Welch, "The Safe-Tcl Security Model", Proc. USENIX Annual Technical Conference, June 1998.
- [6] Crocker, D., and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, Internet Mail Consortium, Demon Internet Ltd., November 1997.
- [7] Schoenwaelder, J., and J. Quittek, "Secure Management by Delegation within the Internet Management", Proc. IFIP/IEEE International Symposium on Integrated Network Management '99, May 1999.
11. Authors' Addresses ๐ฎ
Juergen Schoenwaelder
TU Braunschweig
Bueltenweg 74/75
38106 Braunschweig
Germany
Phone: +49 531 391-3283
EMail: schoenw@ibr.cs.tu-bs.de
Juergen Quittek
NEC Europe Ltd.
C&C Research Laboratories
Hardenbergplatz 2
10623 Berlin
Germany
Phone: +49 30 254230-19
EMail: quittek@ccrle.nec.de
12. Full Copyright Statement โ๏ธ
Copyright (C) The Internet Society (1999). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement ๐ธ
Funding for the RFC Editor function is currently provided by the Internet Society ๐.
๐ฆ where this page comes from
- ietf: rfc2593 1999-05
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms