RCON: Difference between revisions

From Eco - English Wiki
[unchecked revision][checked revision]
Fixed formatting error
No edit summary
Tag: 2017 source edit
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Eco RCON Protocol ==
== Eco RCON (Remote Console) Protocol ==
The Eco RCON Protocol is a TCP based communication protocol loosely based on the Source RCON Protocol standard. It allows admin commands to be issued to the server via a "remote console". The most common use of RCON is to allow server owners to control their game servers without being in game for easy administration or automated processes.
The Eco RCON Protocol is a TCP based communication protocol loosely based on the Source RCON Protocol standard. It allows admin commands to be issued to the server via a "remote console". The most common use of RCON is to allow server owners to control their game servers without being in game for easy administration or automated processes.
== Using Eco RCON ==
== Server Owner/Admin Documentation ==
By default, Eco's RCON implementation listens on TCP port 3002. This setting can be changed inside the Network plugin configuration options as well as the IP/host address the RCON server binds to. To use RCON a valid password must be set inside the Network plugin configuration. Servers without a valid password will reject all incoming authentication requests.
=== Using Eco RCON ===
By default, Eco's RCON implementation listens on TCP port 3002. This setting can be changed inside the network configuration options as well as the IP/host address the RCON server binds to. To use RCON a valid password must be set inside the [[Server Configuration|Network plugin configuration]]. Servers without a valid password will reject all incoming authentication requests.


[[File:RCON Settings in Network Config.png|frame|none|rcon settings in network config]]


Most standard tools/libraries for communicating with standard RCON will work with Eco RCON. A short list of known working tools and libraries can be found below
 
When executing a command through ECO RCON you do not need to supply the forward slash like you would in game. Below is an example of remote command execution to ban a using the mcrcon tool linked in the tool section below.
 
[[File:2021-04-30 22-04-51.mp4|800px]]
 
A complete list of commands that can be used with RCON or in game can be found [[Chat_Commands|here]].
===Public Tools and Libraries===
Most standard tools for communicating with standard RCON will work with Eco RCON. A short list of known working tools can be found below


'''Tools'''
'''Tools'''
* https://github.com/n0la/rcon (RCON command line tool)
*https://github.com/n0la/rcon (RCON command line tool)
'''Libraries'''
*https://github.com/Tiiffi/mcrcon (RCON command line client)
* [https://github.com/Subtixx/source-rcon-library https://github.com/Subtixx/source-rcon-library (C# Library)]




All command requests sent through RCON are executed with server admin permissions. For best practice its advised you keep your RCON information secure and only let trusted users or trusted programs access your RCON server.  
All command requests sent through RCON are executed with server admin permissions. For best practice its advised you keep your RCON information secure and only let trusted users or trusted programs access your RCON server.  
== Establishing a Connection ==
== Developer Documentation==
===Establishing a Connection===
To establish a TCP connection to an Eco RCON server you need to know the server's configured RCON port and the server's configured password and connect via a standard TCP client. Once connected you must authenticate your selves by sending a '''SERVERDATA_AUTH''' packet. Failure to do so will result in no response. If your authentication request was successful you should receive back a '''SERVERDATA_AUTH_RESPONSE''' packet with a matching id of the authentication request packet. Receiving an packet id of -1 means the authentication request has failed. An authentication request can fail if the password is incorrect, misconfigured, or if there is already an active RCON client connection.
To establish a TCP connection to an Eco RCON server you need to know the server's configured RCON port and the server's configured password and connect via a standard TCP client. Once connected you must authenticate your selves by sending a '''SERVERDATA_AUTH''' packet. Failure to do so will result in no response. If your authentication request was successful you should receive back a '''SERVERDATA_AUTH_RESPONSE''' packet with a matching id of the authentication request packet. Receiving an packet id of -1 means the authentication request has failed. An authentication request can fail if the password is incorrect, misconfigured, or if there is already an active RCON client connection.
== Packet Structure ==
===Packet Structure===
=== Basic Packet Structure ===
==== Basic Packet Structure====
All Eco RCON packets payloads follow this basic structure and are sent over a TCP socket
All Eco RCON packets payloads follow this basic structure and are sent over a TCP socket
{| class="wikitable standard-table"
{| class="wikitable standard-table"
!Field||Type|||Value
!Field||Type|||Value
|-
|-
|Size||32-bit [[wiki:Endianness|little-endian]] Signed [[Integer]]||Varies, see below.
|Size||32-bit [[wiki:Endianness|little-endian]] Signed Integer||Varies, see below.
|-
|-
|ID||32-bit [[wiki:Endianness|little-endian]] Signed [[Integer]]||Varies, see below.
|ID||32-bit [[wiki:Endianness|little-endian]] Signed Integer||Varies, see below.
|-
|-
|Type||32-bit [[wiki:Endianness|little-endian]] Signed [[Integer]]||Varies, see below.
|Type||32-bit [[wiki:Endianness|little-endian]] Signed Integer||Varies, see below.
|-
|-
|Body||[[wiki:Null-terminated string|Null-terminated]] [[wiki:ASCII|ASCII]] [[String]]||Varies, see below.
|Body||[[wiki:Null-terminated string|Null-terminated]] ASCII String||Varies, see below.
|-
|-
|Empty String||[[wiki:Null-terminated string|Null-terminated]] [[wiki:ASCII|ASCII]] [[String]]||0x00
|Empty String||[[wiki:Null-terminated string|Null-terminated]] ASCII String||0x00
|-
|-
|}
|}
=== Packet Size ===
====Packet Size====
The RCON packet size field is represented by a 32-bit little endian integer, It represents the total length of the request in bytes. Note that the '''packet size''' field itself is '''not''' included when determining the size of the packet, so the value of this field is always 4 less than the packet's actual length. The minimum possible value for '''packet size''' is 14.
The RCON packet size field is represented by a 32-bit little endian integer, It represents the total length of the request in bytes. Note that the '''packet size''' field itself is '''not''' included when determining the size of the packet, so the value of this field is always 4 less than the packet's actual length. The minimum possible value for '''packet size''' is 14.
{| class="wikitable standard-table"
{| class="wikitable standard-table"
!Size||Containing
!Size||Containing
|-
|-
|4 [[Byte|Bytes]]||ID Field
|4 Bytes||ID Field
|-
|-
|4 [[Byte|Bytes]]||Type Field
|4 Bytes||Type Field
|-
|-
|At least 1 [[Byte]]||Packet body (potentially empty)
|At least 1 Byte||Packet body (potentially empty)
|-
|-
|1 [[Byte|Bytes]]||Empty string terminator
|1 Bytes||Empty string terminator
|}
|}
=== Packet ID ===
====Packet ID====
The packet id field is a 32-bit little endian integer which is specified by the requesting client for each request. Its value can be any positive integer. When the server responds to a client request it will send back the same packet id it received for that command request allowing you match the original request to the server response.  
The packet id field is a 32-bit little endian integer which is specified by the requesting client for each request. Its value can be any positive integer. When the server responds to a client request it will send back the same packet id it received for that command request allowing you match the original request to the server response.  
=== Packet Type ===
====Packet Type ====
The packet type field is represented by a 32-bit little endian integer. It the intended purpose of the packet.
The packet type field is represented by a 32-bit little endian integer. It the intended purpose of the packet.
{| class="wikitable standard-table"
{| class="wikitable standard-table"
! Value || String Descriptor
!Value||String Descriptor
|-
|-
| 3 || SERVERDATA_AUTH
|3||SERVERDATA_AUTH
|-
|-
| 2 || SERVERDATA_AUTH_RESPONSE
|2|| SERVERDATA_AUTH_RESPONSE
|-
|-
| 2 || SERVERDATA_EXECCOMMAND
|2||SERVERDATA_EXECCOMMAND
|-
|-
| 0 || SERVERDATA_RESPONSE_VALUE
|0||SERVERDATA_RESPONSE_VALUE
|}
|}
=== Packet Body ===
====Packet Body ====
The packet body field is a null-terminated ASCII encoded string. The contents of the packet body vary by the executed request.
The packet body field is a null-terminated ASCII encoded string. The contents of the packet body vary by the executed request.
=== Packet Types ===
====Packet Types====
==== '''SERVERDATA_AUTH''' ====
====='''SERVERDATA_AUTH'''=====
'''SERVERDATA_AUTH''' is the first packet to be sent by a newly connected client. It is used to authenticate with the RCON server and gain access to the '''SERVERDATA_EXECCOMMAND''' request. The values of this packet type's fields are as follows:
'''SERVERDATA_AUTH''' is the first packet to be sent by a newly connected client. It is used to authenticate with the RCON server and gain access to the '''SERVERDATA_EXECCOMMAND''' request. The values of this packet type's fields are as follows:
{| class="wikitable"
{| class="wikitable"
Line 77: Line 86:
|-
|-
|Body
|Body
|the RCON password of the server (If this field matches the password set in the Network configuration the auth request will succeed)
| the RCON password of the server (If this field matches the password set in the Network configuration the auth request will succeed)
|}
|}
'''Note''': If the password is not properly configured on the server all '''SERVERDATA_AUTH''' requests will be refused.
'''Note''': If the password is not properly configured on the server all '''SERVERDATA_AUTH''' requests will be refused.
==== '''SERVERDATA_AUTH_RESPONSE''' ====
====='''SERVERDATA_AUTH_RESPONSE'''=====
'''SERVERDATA_AUTH_RESPONSE''' is the response notification packet of a client's '''SERVERDATA_AUTH''' request and contains the results of its authentication attempt. The status is represented by the id of the packet. A -1 value denotes a failed authentication request. If authentication was a success it matches the packet id provided in the original authentication request.
'''SERVERDATA_AUTH_RESPONSE''' is the response notification packet of a client's '''SERVERDATA_AUTH''' request and contains the results of its authentication attempt. The status is represented by the id of the packet. A -1 value denotes a failed authentication request. If authentication was a success it matches the packet id provided in the original authentication request.
{| class="wikitable"
{| class="wikitable"
!Field
!Field
!Contains
! Contains
|-
|-
|ID
|ID
Line 93: Line 102:
|-
|-
|Body
|Body
|Empty string (0x00)
| Empty string (0x00)
|}
|}
===='''SERVERDATA_EXECCOMMAND'''====
====='''SERVERDATA_EXECCOMMAND'''=====
'''SERVERDATA_EXECCOMMAND''' represents a command issued to the server by a client. This can be any valid player or admin command that does not require a physical player in the world to execute. The response will vary depending on the command issued.
'''SERVERDATA_EXECCOMMAND''' represents a command issued to the server by a client. This can be any valid player or admin command that does not require a physical player in the world to execute. The response will vary depending on the command issued.
{| class="wikitable"
{| class="wikitable"
Line 110: Line 119:
|the command to be executed on the server
|the command to be executed on the server
|}
|}
===='''SERVERDATA_RESPONSE_VALUE'''====
====='''SERVERDATA_RESPONSE_VALUE'''=====
'''SERVERDATA_RESPONSE_VALUE''' is sent when a command had finished executing from a '''SERVERDATA_EXECCOMMAND''' request and contains the chat displayed results of the requested command.  
'''SERVERDATA_RESPONSE_VALUE''' is sent when a command had finished executing from a '''SERVERDATA_EXECCOMMAND''' request and contains the chat displayed results of the requested command.  
{| class="wikitable"
{| class="wikitable"
Line 117: Line 126:
|-
|-
|ID
|ID
|The ID assigned by the original request
| The ID assigned by the original request
|-
|-
|Type
|Type
Line 127: Line 136:
__NOEDITSECTION__
__NOEDITSECTION__
[[Category:Server Management]]
[[Category:Server Management]]
[[Category:Modding]]

Latest revision as of 21:34, 20 April 2024

Eco RCON (Remote Console) Protocol

The Eco RCON Protocol is a TCP based communication protocol loosely based on the Source RCON Protocol standard. It allows admin commands to be issued to the server via a "remote console". The most common use of RCON is to allow server owners to control their game servers without being in game for easy administration or automated processes.

Server Owner/Admin Documentation

Using Eco RCON

By default, Eco's RCON implementation listens on TCP port 3002. This setting can be changed inside the network configuration options as well as the IP/host address the RCON server binds to. To use RCON a valid password must be set inside the Network plugin configuration. Servers without a valid password will reject all incoming authentication requests.

rcon settings in network config


When executing a command through ECO RCON you do not need to supply the forward slash like you would in game. Below is an example of remote command execution to ban a using the mcrcon tool linked in the tool section below.

A complete list of commands that can be used with RCON or in game can be found here.

Public Tools and Libraries

Most standard tools for communicating with standard RCON will work with Eco RCON. A short list of known working tools can be found below

Tools


All command requests sent through RCON are executed with server admin permissions. For best practice its advised you keep your RCON information secure and only let trusted users or trusted programs access your RCON server.

Developer Documentation

Establishing a Connection

To establish a TCP connection to an Eco RCON server you need to know the server's configured RCON port and the server's configured password and connect via a standard TCP client. Once connected you must authenticate your selves by sending a SERVERDATA_AUTH packet. Failure to do so will result in no response. If your authentication request was successful you should receive back a SERVERDATA_AUTH_RESPONSE packet with a matching id of the authentication request packet. Receiving an packet id of -1 means the authentication request has failed. An authentication request can fail if the password is incorrect, misconfigured, or if there is already an active RCON client connection.

Packet Structure

Basic Packet Structure

All Eco RCON packets payloads follow this basic structure and are sent over a TCP socket

Field Type Value
Size 32-bit little-endian Signed Integer Varies, see below.
ID 32-bit little-endian Signed Integer Varies, see below.
Type 32-bit little-endian Signed Integer Varies, see below.
Body Null-terminated ASCII String Varies, see below.
Empty String Null-terminated ASCII String 0x00

Packet Size

The RCON packet size field is represented by a 32-bit little endian integer, It represents the total length of the request in bytes. Note that the packet size field itself is not included when determining the size of the packet, so the value of this field is always 4 less than the packet's actual length. The minimum possible value for packet size is 14.

Size Containing
4 Bytes ID Field
4 Bytes Type Field
At least 1 Byte Packet body (potentially empty)
1 Bytes Empty string terminator

Packet ID

The packet id field is a 32-bit little endian integer which is specified by the requesting client for each request. Its value can be any positive integer. When the server responds to a client request it will send back the same packet id it received for that command request allowing you match the original request to the server response.

Packet Type

The packet type field is represented by a 32-bit little endian integer. It the intended purpose of the packet.

Value String Descriptor
3 SERVERDATA_AUTH
2 SERVERDATA_AUTH_RESPONSE
2 SERVERDATA_EXECCOMMAND
0 SERVERDATA_RESPONSE_VALUE

Packet Body

The packet body field is a null-terminated ASCII encoded string. The contents of the packet body vary by the executed request.

Packet Types

SERVERDATA_AUTH

SERVERDATA_AUTH is the first packet to be sent by a newly connected client. It is used to authenticate with the RCON server and gain access to the SERVERDATA_EXECCOMMAND request. The values of this packet type's fields are as follows:

Field Contains
ID any positive integer, chosen by the client (will be mirrored back in the server's response)
Type 3
Body the RCON password of the server (If this field matches the password set in the Network configuration the auth request will succeed)

Note: If the password is not properly configured on the server all SERVERDATA_AUTH requests will be refused.

SERVERDATA_AUTH_RESPONSE

SERVERDATA_AUTH_RESPONSE is the response notification packet of a client's SERVERDATA_AUTH request and contains the results of its authentication attempt. The status is represented by the id of the packet. A -1 value denotes a failed authentication request. If authentication was a success it matches the packet id provided in the original authentication request.

Field Contains
ID The ID of the original authentication request if it was successful, otherwise -1 on failure.
Type 2
Body Empty string (0x00)
SERVERDATA_EXECCOMMAND

SERVERDATA_EXECCOMMAND represents a command issued to the server by a client. This can be any valid player or admin command that does not require a physical player in the world to execute. The response will vary depending on the command issued.

Field Contains
ID any positive integer, chosen by the client (will be mirrored back in the server's response)
Type 2
Body the command to be executed on the server
SERVERDATA_RESPONSE_VALUE

SERVERDATA_RESPONSE_VALUE is sent when a command had finished executing from a SERVERDATA_EXECCOMMAND request and contains the chat displayed results of the requested command.

Field Contains
ID The ID assigned by the original request
Type 0
Body The server's response to the original command.