updates.
[silc.git] / doc / draft-riikonen-silc-spec-01.nroff
index d31621949614bdc5a5566c35784b04c6e2e6fb05..ec7ba80c3850985242061157dac1f386875d3b5a 100644 (file)
@@ -79,6 +79,7 @@ Table of Contents
   2.3 Communication in the Network ..............................  6
   2.4 Channel Communication .....................................  7
   2.5 Router Connections ........................................  7
+  2.6 Backup Routers ............................................ XX
 3 SILC Specification ............................................  8
   3.1 Client ....................................................  8
       3.1.1 Client ID ...........................................  9
@@ -104,8 +105,9 @@ Table of Contents
   3.10 Algorithms ............................................... 20
       3.10.1 Ciphers ............................................ 20
       3.10.2 Public Key Algorithms .............................. 21
-      3.10.3 MAC Algorithms ..................................... 21
-      3.10.4 Compression Algorithms ............................. 22
+      3.10.3 Hash Functions ..................................... XXX
+      3.10.4 MAC Algorithms ..................................... XXX
+      3.10.5 Compression Algorithms ............................. XXX
   3.11 SILC Public Key .......................................... 22
   3.12 SILC Version Detection ................................... 24
 4 SILC Procedures ............................................... 25
@@ -416,6 +418,76 @@ broadcast packets.  Usually all router wide information in the network is
 distributed by SILC broadcast packets.
 
 
+.ti 0
+2.6 Backup Routers
+
+Backup routers may exist in the cell in addition of the primary router.
+However, they must not be active routers and act as routers in the cell.
+Only one router may be acting as primary router in the cell.  In the case
+of failure of the primary router may one of the backup routers become
+active.  The purpose of backup routers are in case of failure of the
+primary router to maintain working connections inside the cell and outside
+the cell and to avoid netsplits.
+
+Backup routers are normal servers in the cell that are prepared to take
+over the tasks of primary router if needed.  They need to have at least
+one direct and active connection to the primary router of the cell.
+This communication channel is used to send the router information to
+the backup router.  Backup router must know everything that the primary
+router knows to be able to take over the tasks of the primary router.
+It is the primary router's responsibility to feed the data to the backup
+router.  If the backup router does not know all the data in the case of
+failure some connections may be lost.  The primary router of the cell
+must consider the backup router being normal router server and feed the
+data accordingly.
+
+In addition of having direct connection to the primary router of the
+cell the backup router must also have connection to the same router
+the primary router of the cell has connected.  However, it must not be
+active router connection meaning that the backup router must not use
+that channel as its primary route and it must not notify the router
+about having connected servers, channels and clients behind it.  It
+merely connects to the router.  This sort of connection is later
+referred as being passive connection.  Some keepalive actions may be
+needed by the router to keep the connection alive.
+
+The primary router notifies its primary router about having backup
+routers in the cell by sending SILC_PACKET_CELL_ROUTERS packet.  If
+and when the primary router of the cell becomes unresponsive, its
+primary router knows that there exists backup routers in the cell.  
+After that it will start using the first backup router sent in the
+packet as router of that cell.  In this case the backup router must
+notify its new primary router about the servers, channels and clients
+it has connected to it.  The primary router knows that this server
+has become a router of the cell because of failure of the primary
+router in the cell.  It must also cope with the fact that the servers,
+channels and clients that the new backup router announces are not
+really new, since they used to exist in the primary router of the
+cell.
+
+It is required that other normal servers has passive connections to
+the backup router(s) in the cell.  Some keepalive actions may be needed
+by the server to keep the connection alive.  After they notice the
+failure of the primary router they must start using the connection to
+the first backup router as their primary route.
+
+It is recommended that there would be at least one backup router in
+the cell.  It is not recommended to have all servers in the cell acting
+as backup routers as it requires establishing several connections to
+several servers in the cell.  Large cells can easily have several
+backup routers in the cell.  The order of the backup routers are decided
+at the primary router of the cell and servers and backup servers in the
+cell must be configured accordingly.  It is not required that the backup
+server is actually active server in the cell.  Backup router may be spare
+server in the cell that does not accept normal client connections at all.
+It maybe reserved purely for the backup purposes.  These, however, are
+cell management issues.
+
+If the first backup router is down as well and there is another backup
+router in the cell then it will start acting as the primary router as
+described above.
+
+
 .ti 0
 3. SILC Specification
 
@@ -846,8 +918,12 @@ however, choose ignore the command reply, but should not.
 It is expected that some of the commands may be miss-used by clients
 resulting various problems on the server side.  Every implementation
 should assure that commands may not be executed more than once, say,
-in two (2) seconds.  This should be sufficient to prevent the miss-use
-of commands.
+in two (2) seconds.  However, to keep response rate up, allowing for
+example five (5) commands before limiting is allowed.  It is recommended
+that commands such as SILC_COMMAND_NICK, SILC_COMMAND_JOIN and 
+SILC_COMMAND_LEAVE should be limited in all cases as they require
+heavy operations.  This should be sufficient to prevent the miss-use of
+commands.
 
 SILC commands are described in section 5 SILC Commands.
 
@@ -1114,7 +1190,8 @@ o Authentication Data (variable length) - Authentication
 
 If the authentication method is password based, the Authentication
 Data field includes the plaintext password.  It is safe to send
-plaintext password since the entire payload is encrypted.
+plaintext password since the entire payload is encrypted.  In this
+case the Public Data Lenght is set to zero (0).
 
 If the authentication method is public key based (or certificate)
 the Authentication Data is computed as follows:
@@ -1213,7 +1290,20 @@ Additional public key algorithms may be defined to be used in SILC.
 
 
 .ti 0
-3.10.3 MAC Algorithms
+3.10.3 Hash Functions
+
+Hash functions are used as part of MAC algorithms defined in the next
+section.  They are also used in the SILC Key Exchange protocol defined
+in the [SILC3].
+
+Following Hash algorithm are defined in SILC protocol:
+
+sha1             SHA-1, length = 20      (mandatory)
+md5              MD5, length = 16        (optional)
+
+
+.ti 0
+3.10.4 MAC Algorithms
 
 Data integrity is protected by computing a message authentication code
 (MAC) of the packet data.  See [SILC2] for details how to compute the
@@ -1222,7 +1312,9 @@ MAC.
 Following MAC algorithms are defined in SILC protocol:
 
 .in 6
-hmac-sha1        HMAC-SHA1, length = 20  (mandatory)
+hmac-sha1-96     HMAC-SHA1, length = 12  (mandatory)
+hmac-md5-96      HMAC-MD5, length = 12   (optional)
+hmac-sha1        HMAC-SHA1, length = 20  (optional)
 hmac-md5         HMAC-MD5, length = 16   (optional)
 none             No MAC                  (optional)
 .in 3
@@ -1240,7 +1332,7 @@ Additional MAC algorithms may be defined to be used in SILC.
 
 
 .ti 0
-3.10.4 Compression Algorithms
+3.10.5 Compression Algorithms
 
 SILC protocol supports compression that may be applied to unencrypted
 data.  It is recommended to use compression on slow links as it may
@@ -1564,12 +1656,6 @@ send information about newly joined client to all routers in the SILC
 network.  This is done by broadcasting the SILC_NOTIFY_TYPE_JOIN notify
 type to the router's primary route. 
 
-After joining the client to the channel server or router must send
-command reply packet for SILC_COMMAND_USERS command.  This way the
-client gets the list of users on the channel.  If the router joined
-the client to the channel then the router sends this command reply
-to the server which must send it further to the original client.
-
 It is important to note that new channel key is created always when
 new client joins to channel, whether the channel has existed previously
 or not.  This way the new client on the channel is not able to decrypt
@@ -1602,6 +1688,17 @@ send the new key to its router.  See [SILC2] on more information about
 how channel messages must be encrypted and decrypted when router is
 processing them.
 
+When client receives the SILC_PACKET_CHANNEL_KEY packet with the
+Channel Key Payload it must process the key data to create encryption
+and decryption key, and to create the HMAC key that is used to compute
+the MACs of the channel messages.  The processing is as follows:
+
+  channel_key  = raw key data
+  HMAC key     = hash(raw key data)
+
+The raw key data is the key data received in the Channel Key Payload.
+The hash() function is the hash function used in the HMAC of the channel.
+
 
 .ti 0
 4.5 Private Message Sending and Reception
@@ -1650,10 +1747,14 @@ The key material used as private message key is implementation issue.
 However, SILC_PACKET_KEY_AGREEMENT packet may be used to negotiate
 the key material.  If the key is normal pre-shared-key or randomly
 generated key, and the SILC_PACKET_KEY_AGREEMENT was not used, then
-the key material should be processed as defined in the [SILC3].  After
-processing the key material it is employed as defined in [SILC3],
-however, the HMAC key material must be discarded.
+the key material should be processed as defined in the [SILC3].  In
+the processing, however, the HASH, as defined in [SILC3] must be 
+ignored.  After processing the key material it is employed as defined
+in [SILC3], however, the HMAC key material must be discarded.
 
+If the key is pre-shared-key or randomly generated the implementations
+should use the SILC protocol's mandatory cipher as the cipher.  If the
+SKE was used to negotiate key material the cipher was negotiated as well.
 
 .ti 0
 4.7 Channel Message Sending and Reception
@@ -1938,9 +2039,10 @@ List of all defined commands in SILC follows.
 
         Reply messages to the command:
 
-        Max Arguments:  3
-            Arguments:  (1) <Status Payload>  (2) <nickname>[@<server>]
-                        (3) <username@host>
+        Max Arguments:  5
+            Arguments:  (1) <Status Payload>        (2) <Client ID>
+                        (3) <nickname>[@<server>]   (4) <username@host>
+                        (5) [<real name>]
 
         This command may reply with several command reply messages to form
         a list of results.  In this case the status payload will include
@@ -2323,7 +2425,7 @@ List of all defined commands in SILC follows.
    13   SILC_COMMAND_OPER
 
         Max Arguments:  2
-            Arguments:  (1) <username>  (2) <authentication data>
+            Arguments:  (1) <username>  (2) <authentication payload>
 
         This command is used by normal client to obtain server operator
         privileges on some server or router.  Note that router operator
@@ -2332,11 +2434,10 @@ List of all defined commands in SILC follows.
         must use SILCOPER command to obtain router level privileges.
 
         The <username> is the username set in the server configurations
-        as operator.  The <authentication data> is the data that the
+        as operator.  The <authentication payload> is the data that the
         client is authenticated against.  It may be passphrase prompted
-        for user on client's screen or it may be public key
-        authentication data (data signed with private key), or 
-        certificate.
+        for user on client's screen or it may be public key or certificate
+        authentication data (data signed with private key).
 
         Reply messages to the command:
 
@@ -2351,15 +2452,15 @@ List of all defined commands in SILC follows.
             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
             SILC_STATUS_ERR_TOO_MANY_PARAMS
             SILC_STATUS_ERR_NOT_REGISTERED
-            SILC_STATUS_ERR_BAD_PASSWORD
             SILC_STATUS_ERR_AUTH_FAILED
 
 
    14   SILC_COMMAND_JOIN
 
-        Max Arguments:  4
+        Max Arguments:  5
             Arguments:  (1) <channel>       (2) <Client ID>
                         (3) [<passphrase>]  (4) [<cipher>]
+                        (5) [<hmac>]
 
         Join to channel/create new channel.  This command is used to
         join to a channel.  If the channel does not exist the channel is
@@ -2379,7 +2480,9 @@ List of all defined commands in SILC follows.
         requested by sending the name of the requested <cipher>.  This
         is used only if the channel does not exist and is created.  If
         the channel already exists the cipher set previously for the
-        channel will be used to secure the traffic.
+        channel will be used to secure the traffic.  The computed MACs
+        of the channel message are produced by the default HMAC or by
+        the <hmac> provided for the command.
 
         The server must check whether the user is allowed to join to
         the requested channel.  Various modes set to the channel affect
@@ -2399,20 +2502,27 @@ List of all defined commands in SILC follows.
 
         Reply messages to the command:
 
-        Max Arguments:  9
-            Arguments:  (1) <Status Payload>  (2) <channel> 
-                        (3) <Channel ID>      (4) <channel mode mask>
-                        (5) <created>         (6) <Channel Key Payload>
-                        (7) [<ban mask>]      (8) [<invite list>]
-                        (9) [<topic>]
+        Max Arguments:  14
+            Arguments:  (1) <Status Payload>      (2) <channel> 
+                        (3) <Channel ID>          (4) <Client ID>
+                        (5) <channel mode mask>   (6) <created>
+                        (7) <Channel Key Payload> (8) [<ban mask>]
+                        (9) [<invite list>]       (10) [<topic>]
+                       (11) [<hmac>]              (12) <list count>
+                       (13) <Client ID list>      (14) <client mode list>
 
         This command replies with the channel name requested by the
         client, channel ID of the channel and topic of the channel
-        if it exists.  It also replies with the channel mode mask
+        if it exists.  The <Client ID> is the Client ID which was joined
+        to the channel.  It also replies with the channel mode mask
         which tells all the modes set on the channel.  If the
         channel is created the mode mask is zero (0).  If ban mask
         and/or invite list is set they are sent as well.
 
+        The <list count>, <Client ID list> and <client mode list> are
+        the clients curerntly on the channel and their modes on the
+        channel.
+
         Client receives the channel key in the reply message as well
         inside <Channel Key Payload>.
 
@@ -2518,11 +2628,11 @@ List of all defined commands in SILC follows.
 
    17   SILC_COMMAND_CMODE
 
-        Max Arguments:  7
+        Max Arguments:  8
             Arguments:  (1) <Channel ID>    (2) <channel mode mask>
                         (3) [<user limit>]  (4) [<passphrase>]
                         (5) [<ban mask>]    (6) [<invite list>]
-                        (7) [<cipher>[:<key len>]]
+                        (7) [<cipher>]      (8) [<hmac>]
 
         This command is used by client to set or change channel flags on
         a channel.  Channel has several modes that set various properties
@@ -2694,9 +2804,7 @@ List of all defined commands in SILC follows.
               Sets specific cipher to be used to protect channel
               traffic.  The <cipher> argument is the requested cipher.
               When set or unset the server must re-generate new
-              channel key.  If <key len> argument is specified with
-              <cipher> argument the new key is generated of <key len>
-              length in bits.  Only channel founder may set the cipher of 
+              channel key.  Only channel founder may set the cipher of 
               the channel.  When unset the new key is generated using
               default cipher for the channel.
 
@@ -2704,6 +2812,16 @@ List of all defined commands in SILC follows.
               to set/unset this mode.
 
 
+           0x0400    SILC_CMODE_HMAC
+
+              Sets specific hmac to be used to compute the MACs of the
+              channel message.  The <hmac> argument is the requested hmac.
+              Only channel founder may set the hmac of the channel.
+
+              Typical implementation would use [+|-]h on user interface
+              to set/unset this mode.
+
+
         To make the mode system work, client must keep the channel mode
         mask locally so that the mode setting and unsetting would work
         without problems.  The client receives the initial channel mode
@@ -2912,7 +3030,7 @@ List of all defined commands in SILC follows.
    23   SILC_COMMAND_SILCOPER
 
         Max Arguments:  2
-            Arguments:  (1) <username>  (2) <authentication data>
+            Arguments:  (1) <username>  (2) <authentication payload>
 
         This command is used by normal client to obtain router operator
         privileges (also known as SILC operator) on some router.  Note
@@ -2920,7 +3038,7 @@ List of all defined commands in SILC follows.
         server operator privileges.
 
         The <username> is the username set in the server configurations
-        as operator.  The <authentication data> is the data that the
+        as operator.  The <authentication payload> is the data that the
         client is authenticated against.  It may be passphrase prompted
         for user on client's screen or it may be public key
         authentication data (data signed with private key), or 
@@ -2945,7 +3063,6 @@ List of all defined commands in SILC follows.
             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
             SILC_STATUS_ERR_TOO_MANY_PARAMS
             SILC_STATUS_ERR_NOT_REGISTERED
-            SILC_STATUS_ERR_BAD_PASSWORD
             SILC_STATUS_ERR_AUTH_FAILED