Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 1 | intermud v2.5 |
| 2 | ************* |
| 3 | |
| 4 | Abstract |
| 5 | ======== |
| 6 | This documents describes how intermud data is send across the internet in the |
| 7 | protocol specification v2.5. |
| 8 | This specification is derived from Zebedee Intermud (aka Intermud 2) and |
| 9 | intends to be compatible to it, i.e. hosts conforming to both protocols should |
| 10 | be able to exchange data. The aim of v2.5 is to deprecate several historic |
| 11 | ambiguities, define a more consistent (stricter, less implementation-defined) |
| 12 | behaviour, add some optional system services and improve reliability and |
| 13 | remove spoofability of MUDs by introducing hash based message authentication |
| 14 | codes. |
| 15 | |
| 16 | Introduction |
| 17 | ============ |
| 18 | |
| 19 | Overview |
| 20 | -------- |
| 21 | The intermud protocols define, how (players on) different muds can |
| 22 | communicate with each other. There are several different variants. |
| 23 | In version 2 all muds are peers and directly talking to each other. There |
| 24 | is no central router. Version 2.5 keeps this behaviour but intends to |
| 25 | strengthen the P2P character of the intermud by defining a default |
| 26 | behaviour of learning other peers from one known peer. |
| 27 | The participants of the intermud are intended to be MUDs, not |
| 28 | individual players. |
| 29 | |
| 30 | Terminology |
| 31 | ----------- |
| 32 | The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL", |
| 33 | "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and |
| 34 | "OPTIONAL" in this document are to be interpreted as described in BCP |
| 35 | 14, RFC 2119 [TERMS]. |
| 36 | |
| 37 | MUD |
| 38 | multi user dungeon |
| 39 | intermud peer |
| 40 | a participant in the intermud |
| 41 | inetd |
| 42 | a program encoding and sending and receiving and decoding intermud data |
| 43 | peer address |
| 44 | IP address of a peer (MUD) |
| 45 | MUD name / peer name |
| 46 | a name (string) for a peer (MUD) |
| 47 | peer identifier |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 48 | a unique combination of MUD name, peer address and receiving peer port |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 49 | |
Zesstra | 79cdbe5 | 2016-04-22 19:26:49 +0200 | [diff] [blame] | 50 | Host list / Peer data |
| 51 | ===================== |
| 52 | A peer **MUST** store the following data about other known peers: |
| 53 | |
| 54 | * peer name (unique) (name) |
| 55 | * public key (unique), if available (pkey) |
| 56 | * peer address (ip) |
| 57 | * receiving peer port (port) |
Zesstra | ca0502f | 2016-04-24 20:11:54 +0200 | [diff] [blame] | 58 | * time of last contact (last_contact) |
| 59 | * time of first contact (first_contact) |
Zesstra | 79cdbe5 | 2016-04-22 19:26:49 +0200 | [diff] [blame] | 60 | * reputation (trust) of that peer (reputation) |
| 61 | |
| 62 | A peer **SHOULD** store the following data about other known peers: |
| 63 | |
| 64 | * list of supported services (services) |
Zesstra | ca0502f | 2016-04-24 20:11:54 +0200 | [diff] [blame] | 65 | * last seen intermud version (im_version) |
Zesstra | 79cdbe5 | 2016-04-22 19:26:49 +0200 | [diff] [blame] | 66 | * expiration time (ncttl) |
| 67 | * MTU of the peer (mtu) |
| 68 | |
| 69 | A peers public key would be the best unique identifier. However, in the |
| 70 | intermud a peer needs a unique symbolic name to address it. So a peers name |
| 71 | and its public key should both be used as unique and long-lived identifier. |
| 72 | |
| 73 | But a peer MAY change its name by either announcing it or by just using a new |
| 74 | name. If the public key remains the same, the entry in the peer list should |
| 75 | be updated accordingly. |
| 76 | |
| 77 | If a peer claims to have a name that already exists, but its public key does |
| 78 | not match the known public key of the existing peer entry, the new peer **MUST |
| 79 | NOT** be entered in the peer list. Instead, any packets from that peer |
| 80 | **SHOULD** be discarded. An implementation MAY notify the operator about this. |
| 81 | |
| 82 | When a peer starts up, it **SHOULD** make itself known by pinging known peers |
| 83 | or sending a HELO packet. |
| 84 | |
| 85 | Host keys |
| 86 | --------- |
| 87 | Each host **MUST** have an elliptic curve private/public key pair for ECDSA or |
| 88 | EdDSA signatures using one of the following curves: |
| 89 | |
| 90 | * secp256r1 / prime256v1 |
| 91 | * Curve25519 |
| 92 | * secp521r1 |
| 93 | |
| 94 | This *identity key* is long-lived. Bascically, the intermud peer name and its |
| 95 | reputation tie to this identity key. |
| 96 | |
| 97 | Reputation |
| 98 | ---------- |
| 99 | The reputation is a score that symbolizes how trustworthy a peer is. It may be |
| 100 | used for a number of decisions. By default, the reputation score is used for |
| 101 | the following: |
| 102 | |
| 103 | * scaling factor when exchanging peer information (see below) |
| 104 | * peer expiration time since last contact (ncttl) |
| 105 | * services that are offered to the other peer |
| 106 | |
| 107 | Specififally, to prevent spam and misuse, services like public channel |
| 108 | messages and intermud mail **SHOULD** be restricted to peers with a reputation |
| 109 | > 0. A peer may also restrict the accessibility of user depending on the |
| 110 | reputation of the sending peer (e.g. beginners can't be disturbed from freshly |
| 111 | known intermud peers). |
| 112 | |
| 113 | By default, a new peer starts with a score of 0 (which basically means, the |
| 114 | information it offers, is not trusted). After a peer has been known for some |
| 115 | time, its score gets increased: |
| 116 | |
| 117 | ========== ============== |
| 118 | time known score increase |
| 119 | ========== ============== |
| 120 | 7 days +1 |
| 121 | 3 months +1 |
| 122 | 1 year +1 |
| 123 | ========== ============== |
| 124 | |
| 125 | A reputation of more than 3 can only be assigned by an operator. |
| 126 | |
| 127 | A negative reputation is possible (e.g. manually assigned by operators) and |
| 128 | should be used to restrict services. Peers with negativ reputation should also |
| 129 | be kept longer in the peer list. |
| 130 | |
| 131 | Peer expiration |
| 132 | --------------- |
| 133 | A peer should expire peers from its host list some time after the last contact. The |
| 134 | expiration time may be chosen by the operator. |
| 135 | |
| 136 | However, to prevent rogue peers impersonating other peers, peers **MUST NOT** |
| 137 | be expired before 48h or a time this peer announced earlier (see module... |
| 138 | TODO) passed without contact. |
| 139 | |
| 140 | ========== =============== |
| 141 | reputation expiration time |
| 142 | ========== =============== |
| 143 | 0 72h |
| 144 | 1 14 days |
| 145 | 2 3 months |
| 146 | 3 6 months |
| 147 | 4+ 12 months |
| 148 | ========== =============== |
| 149 | |
| 150 | If a peer announces it wants to be remembered for longer than 72h without |
| 151 | contact, this wish MAY be respected and the decision MAY be based on its |
| 152 | reputation. A peer **SHOULD NOT** request more then 12 months. |
| 153 | |
| 154 | An implementation **MAY** may move offline peers to a separate list for |
| 155 | bookkeeping after some time and stop trying to contact it anymore. This keeps |
| 156 | the active peer list short and efficient. However the 'long offline' peers |
| 157 | should still be remembered to keep the binding of public key and name. |
| 158 | |
| 159 | If a peer has problems keeping track of peers, it **SHOULD** prefer to |
| 160 | temporarily stop accepting new peers instead of expiring known ones. |
| 161 | If a peer experiences too much intermud traffic (or other resource drains), it |
| 162 | **MAY** favor peers with higher reputation. |
| 163 | |
| 164 | Automatic update of peer data |
| 165 | ----------------------------- |
| 166 | When receiving a v2.5 packet with valid HMAC from an address and/or port that |
| 167 | differs from the one in the peer list, the peer entry **SHOULD** be updated to |
| 168 | the new address/port. |
| 169 | |
| 170 | If the address or port of a peer changes, this peer **SHOULD** send a ping to |
| 171 | known peers to announce the new address or port. |
| 172 | |
| 173 | When receiving a legacy mode packet, the peer entry **MAY** be updated. |
| 174 | However, this carries the risk of rogue peers successfully impersonating |
| 175 | another peer for an extended time. |
| 176 | |
| 177 | An inetd **SHOULD** contact the known peers at least once per 24h to check if |
| 178 | it is still online and reachable (ping or helo). |
| 179 | |
| 180 | Update of the public key |
| 181 | ------------------------ |
| 182 | There ist a way to perform an update of the public key without operator |
| 183 | intervention. The new public key **MUST** be received in a v2.5 packet with |
| 184 | valid signature. |
| 185 | |
| 186 | A peer may inform other peers about an update of its public key by |
| 187 | sending a push notification - TODO fill in module - Such an |
| 188 | update **SHOULD** be honored. |
| 189 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 190 | |
| 191 | Transport layer |
| 192 | =============== |
| 193 | Data between intermud peers is sent as UDP packets (datagrams) over |
| 194 | IP. |
| 195 | Each peer listens on one port and uses one to send data. This kind of |
| 196 | transfer is inherently unreliable, but it's fast and doesn't use up |
| 197 | file descriptors. |
| 198 | |
| 199 | Packet length (MTU) |
| 200 | ------------------- |
| 201 | A peer **MUST** be able to send and receive datagrams of at least 1024 |
| 202 | byte length. The default packet length **SHOULD** be 1024 bytes. If a peer |
| 203 | announces a greater possible length limit, that **SHOULD** be used by other peers |
| 204 | when sending packets to this peer. |
| 205 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 206 | A peer may announce the largest reliable packet (maximum transmission unit, |
| 207 | maximum size of datagram) it can receive when asked with the QUERY module |
| 208 | which should be the preferred way. |
| 209 | |
| 210 | If the MTU cannot be determined with a QUERY, the two peers should try to |
| 211 | determine them by sending heartbeat packets of increasing size to the other |
| 212 | peer (see below). |
| 213 | |
| 214 | The packet size that is used for sending **SHOULD** be the smaller of the |
| 215 | maximum packet length of the two communicating peers. |
| 216 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 217 | Packet format |
| 218 | ------------- |
| 219 | All information is encoded and transferred as a string of bytes. The header |
| 220 | names **SHOULD** consist of ASCII characters. |
| 221 | Each packet sent consists of a string as follows: |
| 222 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 223 | S:xxx|V:nnn|F:nnn|header1:body1|headerN:bodyN|DATA:body-data |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 224 | |
| 225 | In other words, a header name, followed by a : and then the data |
| 226 | associated with this header. Each field, consisting of a header/body pair, is |
| 227 | separated by the | character. This means that headers and their body cannot |
| 228 | contain the | character. Peers **SHOULD** check for this in outgoing |
| 229 | packets to avoid decoding errors at the receiving end. |
| 230 | |
| 231 | The exception to this is the DATA field. If it is present, it **MUST** |
| 232 | be positioned at the end of the packet. Once a DATA header is |
| 233 | found, everything following it is interpreted as the body of the DATA |
| 234 | field. This means it can contain special characters without error and |
| 235 | it is used to carry the main body or data of all packets. |
| 236 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 237 | The fields S (packet signature), V (version) and F (flags) **MUST** be in this |
| 238 | order at the start of the packet before any other fields. This 3 fields are |
| 239 | also referred to as the 'packet header'. The general layout of packets is: |
| 240 | |
Zesstra@Morgengrauen | 18f4e04 | 2016-05-07 11:02:19 +0200 | [diff] [blame^] | 241 | [fragmentation header|]packet header|packet payload/data |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 242 | |
| 243 | The packet header **MUST NOT** be larger than 512 bytes. |
| 244 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 245 | By convention, predefined system fields will use capital letters for |
| 246 | field headers and custom headers used by specific applications will |
| 247 | use lowercase names to avoid clashes. |
| 248 | |
| 249 | A header name **MUST** be unique in a packet. |
| 250 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 251 | |
| 252 | Fragmented packets |
| 253 | ------------------ |
| 254 | If a packet exceeds the maximum packet length, it **MUST** be split |
| 255 | (fragmented) into individual packets small enough. |
| 256 | Each fragment **MUST** start with a fragmentation header describing how the |
| 257 | fragments are to be reassembled at the receiving end. |
| 258 | |
| 259 | These fragmentation headers are of the format: |
| 260 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 261 | PKT:peername:packet-id:packet-number/total-packets|S:xxx|rest-of-packet |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 262 | |
| 263 | In this case, the mudname and packet-id combine to form a unique id |
| 264 | for the packet. The packet-number and total-packets information is |
| 265 | used to determine when all buffered packets have been received. The |
| 266 | rest-of-packet part is not parsed, but is stored while the receiver |
| 267 | awaits the other parts of the packet. When/if all parts have been |
Zesstra | ca0502f | 2016-04-24 20:11:54 +0200 | [diff] [blame] | 268 | received they are concatenated (without the fragmentation header and S fields |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 269 | of the individual fragments) and decoded as a normal packet. |
| 270 | |
| 271 | When storing fragments of a packet, the receiver **MUST** use a unique packet |
| 272 | id which uses the peer name, peer address and sending peer port and the sent |
| 273 | packet-id. |
| 274 | |
| 275 | Any peer **MUST** support at least 100 fragments per packet. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 276 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 277 | Each fragment **MUST** contain its own valid signature in the field S. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 278 | |
| 279 | The sender **SHOULD** send the fragments in the correct order. However, the |
| 280 | receiver **MUST** assume the fragments arrive in any order. |
| 281 | |
| 282 | The sender **MUST** send all fragments of a packet within 30 s from sending the |
| 283 | first fragment. |
| 284 | The receiver **MUST** wait for fragments at least 60 s after the first fragment |
| 285 | arrived. After this, the receiver may discard any fragments of this packet and |
| 286 | therefore the packet as a whole. |
| 287 | |
| 288 | Packet encoding |
| 289 | --------------- |
| 290 | Only 2 generic data types are supported (namely strings and integers). All |
| 291 | other data types **MUST** be expressed as strings or integers. |
| 292 | |
| 293 | On encoding integers are simply converted to a corresponding string. |
| 294 | Strings **MUST** be prefixed with the character $. If the first character of a |
| 295 | string is the $ character, it is escaped by prepending another $ character. |
| 296 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 297 | Packet signatures |
| 298 | ----------------- |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 299 | For packet validation and to prevent tampering on the wire and spoofing of |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 300 | peers, each packet sent **MUST** contain a field S containing the EC-DSA |
| 301 | signature of the packet. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 302 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 303 | The first byte of the MAC field specifies the method and curve used. In intermud |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 304 | v2.5 the following algorithms **MUST** be supported: |
| 305 | |
Zesstra | ca0502f | 2016-04-24 20:11:54 +0200 | [diff] [blame] | 306 | * (a) Ed25519 + SHA512 |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 307 | |
Zesstra | ca0502f | 2016-04-24 20:11:54 +0200 | [diff] [blame] | 308 | The recommended method is Ed25519 + SHA512 |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 309 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 310 | The transferred data is the complete packet string **without** the field S. |
| 311 | After the packet (or fragment) is encoded (without the field S), the signature |
| 312 | is calculated using the private EC key and then inserted into the packet |
| 313 | string either at the beginning of the packet or (for fragments) at the end of |
| 314 | the fragmentation header. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 315 | |
| 316 | Packet validation |
| 317 | ----------------- |
| 318 | Upon receiving a fragment or packet, the receiver **MUST** first try to |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 319 | validate the signature in the field S, if a public key for the sending peer is |
| 320 | known. The receiver extracts the whole field from the received string and |
| 321 | verifies the signature. If signature can't be verified, the receiver **MUST** |
| 322 | discard the fragment or packet. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 323 | |
| 324 | Fragments are then stored until the packet is completed or the timeout is |
| 325 | exceeded. |
| 326 | |
| 327 | The receiver **SHOULD** parse and decode the packet only after this initial |
| 328 | validation. If the packet is malformed and cannot be parsed, the receiver |
| 329 | **MUST** discard the packet. |
| 330 | |
| 331 | The intermud protocol versions of peers **SHOULD** be stored and no packets in |
| 332 | an older protocol version **SHOULD** be accepted. |
| 333 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 334 | Packet decoding |
| 335 | --------------- |
| 336 | On decoding, any string with a $ as its first character will have it removed |
| 337 | and will then be treated as a string. |
| 338 | Any other strings will be converted to integers. |
| 339 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 340 | The fields S, V and F **SHOULD** be stripped from the packet data that is |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 341 | transferred from the inetd implementation to the application. |
| 342 | |
| 343 | Legacy mode packets and encoding |
| 344 | -------------------------------- |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 345 | Any intermud v2.5 peer **MUST** send data as described above. However, unless |
| 346 | in a so-called strict mode, a receiving peer **MUST** accept data in a relaxed |
| 347 | format that is sent by older intermud peers. Unless in strict mode, the following |
| 348 | deviations are acceptable when receiving: |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 349 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 350 | * The packet header (S, V and F fields) is missing. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 351 | * A string **MAY** be prefixed with the character $, but does not have to, unless |
| 352 | there ambiguity as to wether they should be decoded as a string or an |
| 353 | integer. If a string is losslessly convertable to an integer and back to a |
| 354 | string, it **MUST** be prefixed by $. |
| 355 | This means however, that any string not starting with $ **MUST** be checked |
| 356 | whether it is to be interpreted as integer or string. |
| 357 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 358 | However, a packet **MUST NOT** be parsed as legacy mode packet, if one of the |
| 359 | following conditions are met: |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 360 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 361 | * the packet contains the field S |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 362 | * the packet contains a version field F with a version of at least 2500 |
| 363 | * the receiving peer operates in strict mode |
| 364 | |
| 365 | After a packet conforming to protocol version >= 2.5 (>=2500) was received |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 366 | from a peer (this implies the succesful validation of the signature), legacy mode |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 367 | packets from that peer **MUST NOT** be accepted without manual intervention of |
| 368 | an operator or expiration of the peer from the peer list. |
| 369 | |
| 370 | If a peer sends to a peer with a known protocol version older than v2.5 it |
| 371 | **MAY** send the data as a legacy mode packet. However, this is not recommended. |
| 372 | |
| 373 | Strict mode |
| 374 | ----------- |
| 375 | To prevent spoofing of other muds, an operator MAY decide to operate in strict |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 376 | mode. In this mode, the peer accepts intermud v2.5 packets with a valid S |
| 377 | field only and discards all other packets. |
| 378 | In other words, it disables the compatibility with peers older than v2.5 and |
| 379 | does not communicate with unknown peers. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 380 | |
| 381 | Request bookkeeping |
| 382 | ------------------- |
| 383 | When sending a request that expects/requires an answer, the sender **MUST** |
| 384 | keep track of the request to relate any answers to the original request. |
| 385 | |
| 386 | Any peer **MUST** be able to keep track of at least 100 requests. |
| 387 | |
| 388 | If the answer of a request does not arrive within 60s, the request **SHOULD** |
| 389 | be expired (timeout). |
| 390 | |
| 391 | |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 392 | Defined system headers / fields |
| 393 | =============================== |
| 394 | The fields defined in this section **MUST NOT** be used in any application sending |
| 395 | data via intermud. The sending inetd **SHOULD** check for this during input |
| 396 | validation before assembling a packet. |
| 397 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 398 | RCPNT |
| 399 | (RECIPIENT) The body of this field should contiain the recipient the message |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 400 | is to be sent to if applicable. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 401 | REQ |
| 402 | (REQUEST) The name of the intermud request that is being made of the |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 403 | receiving mud. Standard requests that should be supported by |
| 404 | all systems are "ping" (PING), "query" (QUERY), and "reply" |
| 405 | (REPLY). The PING request is used to determine wether or not a |
| 406 | mud is active. The QUERY request is used to query a remote mud |
| 407 | for information about itself (look at the udp/query module for |
| 408 | details of what information can be requested). The REPLY request |
| 409 | is special in that it is the request name used for all replies |
| 410 | made to by mud B to an initial request made by a mud A. It is |
| 411 | mud A's responsibility to keep track of the original request |
| 412 | type so that the reply can be handled appropriately. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 413 | SND |
| 414 | (SENDER) The name of the person or object which sent the request or to |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 415 | whom replies should be directed. This is essential if a reply |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 416 | is expected. |
| 417 | DATA |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 418 | This field should contain the main body of any packet. It is |
| 419 | the only field that can contain special delimiting characters |
| 420 | without error. |
| 421 | |
| 422 | The following headers are used internally by the inetd and should |
| 423 | not be used by external objects: |
| 424 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 425 | HST |
| 426 | (HOST) The IP address of the host from which a request was received. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 427 | This is set by the receiving mud and is not contained in |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 428 | outgoing packets. |
| 429 | ID |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 430 | The packet id. This field is simply an integer which is set by |
| 431 | the sending inetd. The number is incremented each time a packet |
| 432 | is sent (zero is never used). This field is only needed if a |
| 433 | reply is expected. REPLY packets _must_ include the original |
| 434 | request id. This is _not_ done by the inetd. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 435 | NAME |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 436 | The name of the local mud. Used for security checking and to |
| 437 | update host list information. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 438 | PKT |
| 439 | (PACKET) A special header reserved for packets which have been fragmented. |
| 440 | UDP |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 441 | The UDP port the local mud is receiving on. Used for security |
| 442 | checking and updating host list information. |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 443 | SYS |
| 444 | (SYSTEM) Contains special system flags. The only system flag used at |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 445 | present is TIME_OUT. This is included in packets returned due |
| 446 | to an expected reply timing out to differentiate it from an |
| 447 | actual reply. |
| 448 | |
| 449 | |
| 450 | Intermud requests / modules |
| 451 | =========================== |
| 452 | |
| 453 | Mandatory requests / modules |
| 454 | ---------------------------- |
| 455 | The following are standard request types that **MUST** be supported |
| 456 | by all systems: |
| 457 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 458 | ping |
| 459 | ^^^^ |
| 460 | This module should return a REPLY packet that contains the |
| 461 | original requests ID in it's ID field and the SENDER in it's |
| 462 | RECIPIENT field. It should also include an appropriate string |
| 463 | in the DATA field, eg. "Mud-Name is alive.\n" |
| 464 | |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 465 | helo |
| 466 | ^^^^ |
| 467 | Used to exchange information like the public key. |
Zesstra | 79cdbe5 | 2016-04-22 19:26:49 +0200 | [diff] [blame] | 468 | To make UDP amplification attacks (e.g. sending a small packet with a faked |
| 469 | source which causes a larger packet be sent to the victim) more difficult, |
| 470 | sent HELO **MUST** be larger than xxx bytes by adding a field 'dummy' |
| 471 | containing zeroes. |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 472 | |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 473 | query |
| 474 | ^^^^^ |
| 475 | This module expects the type of query requested to appear in the |
| 476 | recieved DATA field. It should return a REPLY packet containing |
| 477 | the original ID in the ID field, the SENDER in it's RECIPIENT |
| 478 | field, and the query type in a QUERY field. The DATA field should |
| 479 | contain the information requested. |
Zesstra@Morgengrauen | 09eef28 | 2016-04-21 23:00:38 +0200 | [diff] [blame] | 480 | TODO: include asking for peer list in JSON format. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 481 | |
| 482 | |
| 483 | Optional requests / modules |
| 484 | ---------------------------- |
Zesstra@Morgengrauen | 2021921 | 2016-04-20 22:34:41 +0200 | [diff] [blame] | 485 | These modules are completely optional and their availability at the discretion |
| 486 | of the operator of a peer. |
| 487 | |
| 488 | |
| 489 | Exchange of secrets for the HMAC |
| 490 | ================================ |
| 491 | In this draft the secrets should be either exchanged manually between |
| 492 | operators or sent with a push update to known peers. |
| 493 | For the german MUDs participating in the Intermud, the mailing list |
| 494 | mudadmins-de@groups.google.com is available. |
Zesstra@Morgengrauen | 5cad50a | 2016-04-19 21:44:10 +0200 | [diff] [blame] | 495 | |