<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
 which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
There has to be one entity for each item to be referenced.
An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2865 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2865.xml">
<!ENTITY RFC7043 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7043.xml">


]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
 please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
 (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space
 (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc ipr="trust200902" category="exp" docName="draft-garcia-radext-radius-lorawan-01">
    <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN"
     they will automatically be output with "(if approved)" -->
    
    <!-- ***** FRONT MATTER ***** -->
    
    <front>
        <!-- The abbreviated title is used in the page header - it is only necessary if the
         full title is longer than 39 characters -->
        
        <title abbrev="LoRaWAN-RADIUS">LoRaWAN Authentication in RADIUS</title>
        
        <!-- add 'role="editor"' below for the editors if appropriate -->
        
        <!-- Another author who claims to be an editor -->
        
        <author fullname="Dan Garcia-Carrillo (Ed.)" initials="D." surname="Garcia">
            <organization>University of Murcia</organization>
            <address>
                <postal>
                    <street>Campus de Espinardo S/N, Faculty of Computer Science</street>
                    <!-- Reorder these if your country does things differently -->
                    <city>Murcia</city>
                    <region></region>
                    <code>30100</code>
                    <country>Spain</country>
                </postal>
                <phone>+34 868 88 78 82</phone>
                <email>dan.garcia@um.es</email>
                <!-- uri and facsimile elements may also be added -->
            </address>
        </author>
        <author fullname="Rafa Marin-Lopez" initials="R." surname="Marin">
            <organization>University of Murcia</organization>
            <address>
                <postal>
                    <street>Campus de Espinardo S/N, Faculty of Computer Science</street>
                    <!-- Reorder these if your country does things differently -->
                    <city>Murcia</city>
                    <region></region>
                    <code>30100</code>
                    <country>Spain</country>
                </postal>
                <phone>+34 868 88 85 01</phone>
                <email>rafa@um.es</email>
                <!-- uri and facsimile elements may also be added -->
            </address>
        </author>
        
        <author fullname="Arunprabhu Kandasamy" initials="A" surname="Kandasamy">
            <organization>Acklio</organization>
            
            <address>
                <postal>
                    <street>2bis rue de la Chataigneraie</street>
                    
                    <city>35510 Cesson-Sevigne Cedex</city>
                    
                    <country>France</country>
                </postal>
                
                <email>arun@ackl.io</email>
            </address>
        </author>
        
        <author fullname="Alexander Pelov" initials="A" surname="Pelov">
            <organization>Acklio</organization>
            
            <address>
                <postal>
                    <street>2bis rue de la Chataigneraie</street>
                    
                    <city>35510 Cesson-Sevigne Cedex</city>
                    
                    <country>France</country>
                </postal>
                
                <email>a@ackl.io</email>
            </address>
        </author>
        
        <date month="Jul" year="2016" />
        
        <!-- If the month and year are both specified and are the current ones, xml2rfc will fill
         in the current day for you. If only the current year is specified, xml2rfc will fill
         in the current day and month for you. If the year is not the current one, it is
         necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the
         purpose of calculating the expiry date).  With drafts it is normally sufficient to
         specify just the year. -->
        
        <!-- Meta-data Declarations -->
        <area>General</area>
        <workgroup>Network Working Group</workgroup>
        
        <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.
         If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->
        <keyword>template</keyword>
        
        <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->
        <abstract>
            <t>
                This document describes a proposal for adding LoRaWAN support in RADIUS. The purpose is to integrate the LoRaWAN network join procedure with an Authentication, Authorization and Accounting (AAA) infrastructure based on RADIUS.
            </t>
        </abstract>
    </front>
    
    <middle>
        <section title="Introduction">
            <t> Low Power Wide Area Network (LP-WAN) groups several radio technologies that allow communications with nodes far from the central communication endpoint (base station) in the range of kilometers depending on the specifics of the technology and the scenario.
                They are fairly recent and the protocols to manage those infrastructures are in continuous development. In some cases they may not consider aspects such as key management or directly tackle scalability issue in terms of authentication and authorization. The nodes to be authenticated and authorized is expected to be considerably high in number.  One of the protocols that provide a complete solution is LoRaWAN <xref target="LoRaWAN"></xref>. LoRaWAN is a MAC layer protocol that use LoRa as its physical medium to cover long range (up-to 20 km depending on the environment) devices. LoRaWAN is designed for large scale networks and currently has a central entity called Network Server which maintains a pre-configured key named AppKey for each of the devices on the network. Furthermore, session keys such as NwkSKey and AppSKey used for encryption of data messages, are derived with the help of this AppKey. Since each service provider would operate their Network Server individually, authenticating the devices becomes a tedious process because of inter-interoperability or the roaming challenges between the operators. An illustration of the LoRaWAN architecture can be seen in figure <xref target="lorawan-architecture" />.
                
                As we know the AAA infrastructure provides a flexible, scalable solution. They offer an opportunity to manage all these processes in a centralized manner as happens in other type of networks (e.g. cellular, WiFi, etc...) making it an interesting asset when integrated into the LoRaWAN architecture.
            </t>
            
            <t>
                <figure align="center" anchor="lorawan-architecture" title="LoRAWAN Architecture">
                    <!-- maximum wide of the figure                                   -->
                    <artwork align="left"><![CDATA[
                  +-------+        +-------+              +--------+
+------+          |       |        |       |              |        |
|      +--(LoRa)--+       +--(IP)--+       +-----(IP)-----+        |
+------+          |       |        |       |              |        |
                  +-------+        +-------+              +--------+
End-Device         Gateway          Network                  Join
                                     Server                 Server
                    ]]></artwork>
                </figure>
            </t>
            
            <t>The End-Device communicates with the Gateway by using the LoRa modulation. The Gateway acts as a simple transceiver, which forwards all data do the Network Server, which performs the processing of the frames, network frame authentication (MIC verification), and which serves as Network Access Port. The Application Server can be handling user data OR can be used during the join procedure to accept an End-Node to the network. In this case, the Application Server is called a Join Server. This document describes a way to use standard RADIUS servers as a Join Server, and to use the RADIUS protocol for the interaction between the Network Server and the Application Server. This integration is illustrated in figure <xref target="lorawan-radius" /></t>
            
            <t>
                <figure align="center" anchor="lorawan-radius" title="LoRAWAN Architecture with AAA and RADIUS authentication. End-Device and RADIUS server have a shared secret - the AppKey, which is used to derive the session keys (NwkSKey and AppSKey).">
                    <!-- maximum wide of the figure                                   -->
                    <artwork align="left"><![CDATA[
                  +-------+        +-------+              +--------+
+------+          |       |        |       |              |        |
|AppKey+--(LoRa)--+       +--(IP)--+       +---(RADIUS)---+ AppKey |
+------+          |       |        |       |              |        |
                  +-------+        +-------+              +--------+
End-Device         Gateway          Network                  Join
                                     Server                 Server
                                (+ RADIUS client)      (+ RADIUS server)
                    ]]></artwork>
                </figure>
            </t>
            <t> The document describes how LoRaWAN join procedure is integrated with AAA infrastructure using RADIUS <xref target="RFC2865"/> by defining the new attributes needed to support the LoRaWAN exchange.
            </t>
            
            <section title="Requirements Language">
                <t>
                    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
                    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
                    document are to be interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
                </t>
            </section>
        </section>
        
        <section title="LoRaWAN support in RADIUS">
            <t>
                Regarding the overall functionality, the RADIUS LoRaWAN support defines the new Attributes needed for the management of the join procedure.
                
                The Network Server will implement a RADIUS client supporting this specification and therefore, it MUST implement the RADIUS attributes for this service.
                
                The NAS-Port-Type specifying the type of port on which the Network Server is authenticating the End-Device in this case MAY be 18 ( Wireless - Other ) or a new one specifically assigned for LoRaWAN (TBD.).
            </t>
        </section>
        
        <section title="LoRaWAN Overview">
            <section title="Introduction">
                <t> The LoRAWAN specification defines how the MAC and PHY layer will be used with the LoRa radio technologies. It defines a process by which the smart objects can securely join the network in an authenticated way and exchange application information ciphered and integrity protected.
                    
                    The focus of this document is to extend how the process of joining is performed by the specification including a AAA infrastructure (RADIUS) to accomplish this.
                    
                    Next we review how the keys, and each message is used in the joining procedure. Then we elaborate some assumptions to design the integration of AAA in the joining procedure possible.
                </t>
            </section>
            
            <section title="LoRaWAN join procedure Key Material">
                <t> The LoRaWAN specification describes 3 keys involved in the joining procedure. One as a root key that will be used to generate the other two, which will be used to secure the message exchanges after the joining procedure success.
                    
                    The AppKey key used to derive the other two keys, NwkSKey and AppSKey:
                    
                    <list style="symbols">
                        <t>The AppKey is an AES-128 application specific key assigned by the owner of the application. This key is derived from an application-specific root key that is only known to the application owner and is stored in each device and in the Join Server that will perform the authentication.
                        </t>
                        <t>The NwkSKey is a network session key that is specific to each End-Device. It is shared between the Network Server and the End-Device and used to calculate and verify the Message Integrity Code (MIC) for each data message, between both entities. Furthermore, it is used to cipher and decipher the payload of MAC-only data message.
                        </t>
                        <t>The AppSKey is an application session key specific to each End-Device. It is in charge of ciphering and deciphering the payload of application-specific data messages and is also used to calculate and verify the MIC that may be added to the payload of application-specific data messages.
                        </t>
                    </list>
                </t>
            </section>
            
            <section title="LoRaWAN joining procedure">
                
                <t>
                    The LoRaWAN joining procedure, as described in the LoRaWAN Specification 1.0 <xref target="LoRaWAN" />, consists on one exchange. The first message of this exchange is called join-request (JR) message and is sent from the End-Device to the Network Server containing the AppEUI and DevEUI of the End-Device with a nonce of 2 octets called DevNonce. <xref target="join-request"/> summarizes the format.
                </t>
                <t>
                    <figure align="center" anchor="join-request" title="Join Request Message">
                        <!-- maximum wide of the figure                                   -->
                        <artwork align="left"><![CDATA[
              +-------------+-------------+-------------+
Size (bytes)  |      8      |      8      |      2      |
+---------------------------+-------------+-------------+
Join Request  |   AppEUI    |    DevEUI   |   DevNonce  |
              +-------------+-------------+-------------+
                        ]]></artwork>
                    </figure>
                </t>
                <t>In response to the join-request, the other endpoint will answer with the join-accept (JA) (<xref target="join-accept" />) if the End-Device is successfully authenticated and authorized to join the network. The join-accept contains a nonce (AppNonce), a network identifier (NetID), an End-Device address (DevAddr), a delay between the TX and RX (RxDelay) and, optionally, the CFList (see LoRaWAN specification <xref target="LoRaWAN"/> section 7).
                </t>
                <t>
                    <figure align="center" anchor="join-accept" title="Join Accept Message">
                        <!-- maximum wide of the figure                                   -->
                        <artwork align="left"><![CDATA[
            +--------+-----+-------+----------+-------+-------------+
Size (bytes)|   3    |  3  |   4   |    1     |   1   |16 (Optional)|
+-------------------------------------------------------------------+
Join Accept |AppNonce|NetID|DevAddr|DLSettings|RxDelay|    CFList   |
            +--------+-----+-------+----------+-------+-------------+
                        ]]></artwork>
                    </figure>
                    
                </t>
                    <t>
                        Next, we enumerate and describe each field involved in the join procedure message exchange.
                        <list style="symbols">
                            <t>AppEUI: Global application ID in IEEE EUI64 to uniquely identify the application provider.
                            </t>
                            
                            <t>DevEUI: Global End-Device ID in IEEE EUI64 to uniquely identify the End-Device
                            </t>
                            
                            <t>DevNonce: A random value.
                            </t>
                            
                            <t>AppNonce: A random value or some kind of unique ID provided by the Network Server.
                            </t>
                            
                            <t>NetID: A network identifier
                            </t>
                            
                            <t>DevAddr: A 32 bit identifier of the End-Device in the current network. It is composed of the Network ID and the Network Address.
                            </t>
                            
                            <t>DLSettings: 8 bits containing the down-link configuration.
                            </t>
                            
                            <t>RxDelay: 8 bits containing the delay between TX and RX.
                            </t>
                            
                            <t>CFList (Optional): Channel frequency list.
                            </t>
                            
                        </list>
                    </t>
            </section>
            <section title="LoRaWAN Key Derivation">
                <t>
                    The keys NwkSKey and AppSKey are derived from the AppKey in both the Join Server and the End-Device according to the LoRaWAN specification <xref target="LoRaWAN " /> as follows: 
                </t>

                <t>
                    Derivation of the NwkSkey:
                </t>
                <t>
                    NwkSKey = aes128_encrypt(AppKey, 0x01 | AppNonce | NetID | DevNonce | pad16)
                </t>
                <t>
                    Derivation of the AppSkey:
                </t>

                <t>
                    AppSKey = aes128_encrypt(AppKey, 0x02 | AppNonce | NetID | DevNonce | pad16)
                </t>
                <t>
                    Note: The pad16 function appends octets of containing "zero" so that the length of the data is a multiple of 16.
                </t>

            </section>
        </section>

        <section title="Integration Overview">

            <section title="Mapping LoRaWAN Entities to AAA Infrastructure">
                <t>In the current specification of LoRaWAN <xref target="LoRaWAN"/>, there is no explicit reference to an external entity to which the Network Server can go to authenticate the End-Device. However, ongoing work related to LoRaWAN, such as the work in the LoRa Alliance <xref target="LoRaAllianceSecurity" /> sketches the use of a new entity, the Join Server, that will be in charge of performing the authentication. This separation of responsibilities is also the aim of our work, where the Join Server acts as an external AAA server in a AAA infrastructure using RADIUS as the protocol to communicate the Network Server and the Join Server.

                Further, it is under consideration the distribution of the AppSKey to a target application server instead of the Network Server. Therefore, the Join Server would need another protocol to deliver the AppSKey. Another RADIUS interface could be used for this purpose, though this I-D focuses on the joining procedure so far.

                </t>
            </section>
            
            
            <section title="Assumptions">
                <t>For the integration of LoRaWAN joining procedure with RADIUS next we describe some assumptions regarding the LoRaWAN specification. The first is that the AppKey is only shared between the AAA server (Join Server) and the End-Device. The outcome of the successful join procedure (i.e. NwkSKey and AppSKey) are sent from the AAA server to the network-server.
                    This allows for the End-Device to exchange message with the network-server, once the join procedure is finished, as specified in LoRaWAN  <xref target="LoRaWAN"/>.
                </t>
            </section>
            
            <section title="Protocol Exchange">
                <t>The join procedure between the End-Device and the network-server entails one exchange consisting on a join-request message and a join-response message. In RADIUS the network-server implements a RADIUS client to communicate with the Join Server, which act as AAA Server.
                </t>
                    
                <t>
                    The protocol exchange is done in the following steps:
                <list style="numbers">
                 <t> The End-Device sends the join-request message to to the Network Server. </t>

                 <t>Upon reception of the LoRaWAN join-request message, the Network Server creates a RADIUS Access-Request message, with the Join-Request attribute containing the original message from the End-Device, and the Join-Answer Attribute with all the fields of a join-answer message except for the MIC, which will be calculated by the AAA Server (Join Server), since is the one that holds the AppKey.
                </t>
            
                <t>Once the AAA Server authenticates and authorizes the End-Device, sends back the Join-Answer with the MIC generated as specified by the LoRaWAN specification.
                Furthermore, as a consequence of a successful join procedure, the AppSKey (optional) and NwkSKey are generated and sent along in AppSKey and NwkSKey Attributes respectively.
                </t>
                    
                <t> The Network Server receives the Access-Accept (if successful), obtains the content of the Join-Request attribute and sends it to the End-Device, storing in association with that End-Device the NwkSKey and the AppSKey.
                </t>

                </list>
                </t>    
                    
<figure align="center" anchor="protocol-overview" title="Protocol">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[
                            
                                                                AAA
 End-Device              Network Server                Server (Join Server)
-----------                ---------                           -------
    |                         |                                    |
1)  |  JR[MIC]                |                   Access-Request   |
    |------------------------>|                  Join-Request Att  |
    |                         |                  Join-Answer Att*  |
2)  |                         |----------------------------------->|
    |                         |                                    |
    |   gen                   |                                    |  gen
    |    |                    |                                    |   |
    |    |                    |                     Access-Accept  |   |
    |    v                    |                   Join-Answer Att  |   v
    | AppSKey                 |                       AppSKey Att* | AppSKey
3)  | NwkSKey                 |                       NwkSKey Att  | NwkSKey
    |                         |<-----------------------------------|
    |  JA[MIC]                |                                    |
4)  |<------------------------|                                    |
    |                         |                                    |
                        ]]></artwork>
                    </figure>

                <section title="Join-Request Attribute">
                    <t>Description</t>
                    <t> This Attribute contains the original Join-Request message. This attribute will only appear in the Access-Request message.
                        A summary of the Join-Request attribute format is shown below.  The fields are transmitted from left to right.
                    </t>
                    <t>
 <figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[                        
0                   1                   2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     String...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type

TBD. for Join-Request

Length

18

String

]]></artwork>
</figure> 

The String field contains an octet string with the Join-Request message as received over the network, such as defined in <xref target="LoRaWAN"/>.
                        
                    </t>
                </section>
                <section title="Join-Answer Attribute">
                    <t>Description</t>
                    <t> This Attribute is used in both RADIUS Access-Request and RADIUS Access-Accept messages. In the first case, it contains the Join Answer message with all the needed values filled by the network-server except the MIC (this fact is marked with an *). With these values, the Join Server (AAA server) that holds the AppKey is able to create the MIC and compose the final Join Answer message. In the second case, it contains the Join Answer with the MIC generated by the Join Server (AAA server).
                        
                        A summary of the Join-Answer attribute format is shown below.  The fields are transmitted from left to right.
 <figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[                        
0                   1                   2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     String...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type

TBD. for Join-Answer

Length

28

String

]]></artwork>
</figure>                        
                        The String field contains an octet string with the Join-Answer as received over the network , as defined in <xref target="LoRaWAN"/>.
                        
                    </t>
                </section>
                <section title="AppSKey Attribute">
                    <t>Description</t>
                    <t> This Attribute contains the AppSKey, an application session key specific for the End-Device. This attribute is optional, and will only appear in the RADIUS Access-Accept message.
                        
                        A summary of the AppSKey attribute format is shown below.  The fields are transmitted from left to right.
                        
 <figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[                        
0                   1                   2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     String...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type

TBD. for AppSKey

Length

16+

String

]]></artwork>
</figure> 
                        
                        The String field contains an octet string containing the Application Session Key, as defined in <xref target="LoRaWAN"/>. 
                    </t>
                </section>
                <section title="NwkSKey Attribute">
                    <t>Description</t>
                    <t> This Attribute contains the NwkSKey, an network session key specific for the End-Device. This attribute will only appear in the Access-Accept message.
                        
                        
                        A summary of the NwkSKey attribute format is shown below.  The fields are transmitted from left to right.
                        
 <figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[                        
0                   1                   2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     String...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type

TBD. for NwkSKey

Length

16+

String

]]></artwork>
</figure> 
                        The String field contains the octet string of the Network Session Key , as defined in <xref target="LoRaWAN"/>. 
                    </t>
                </section>
                <section title="Table of Attribute">
                    <t>
                        <figure align="center" anchor="table-attributes" title="Attributes Table">
                            <!-- maximum wide of the figure                                   -->
                            <artwork align="left"><![CDATA[
                                
Request  Accept  Reject  Challenge   #    Attribute
  1       0       0        0       TBD.   Join-Request
  1       1       0        0       TBD.   Join-Answer
  0       0-1     0        0       TBD.   AppSKey
  0       1       0        0       TBD.   NwkSKey
Request  Accept  Reject  Challenge   #    Attribute
                            ]]></artwork>
                        </figure>
                    </t>
                </section> 
        </section>
    </section>
            
        <section anchor="open-issue" title="Open Issues">
            <t> With the purpose of extending the authentication process via AAA infrastructures, and concretely, RADIUS, we have faced a question regarding the relationship between the AppEUI associated to the organization operating the Join Server and the realm used by RADIUS to route the AAA information to the AAA Server (Join Server) of that organization. </t>
            
            <t> In particular, the Network Server knows the AppEUI included in the Join Request, but it needs to discover the realm (Fully Qualified Domain Name) that corresponds to that organizations ID to be able to communicate with the concrete RADIUS server.</t>
                    
            <t> NOTE: One option MAY be to use the DNS system to provide the FQDN associated to an AppEUI (which is an EUI64 address). The mapping using DNS to find out the domain name associated to an EUI64 address has been described in <xref target="RFC7043"/>. However, we would need the inverse process. Nevertheless, this needs further discussion.</t>
        </section>
        
        <section anchor="Security" title="Security Considerations">
            <t>   In the LoRaWAN 1.0 specification, the AppSKey and NwkSKey are not sent over the network, they are derived in each of the endpoints that communicate, namely the End-Device and the Network Server. In this document we propose relegating the responsibility of deriving the Network Session Key and Application Session Key to the RADIUS server (the Join Server). These session keys need to be sent to the Network Server and if necessary to the application server. </t>
                
            <t>To send the messages over the network between the RADIUS server and the RADIUS client (in this case the Network Server). How to provide confidentiality to the key distributed is outside the scope of this document, nevertheless  RadSec (RFC6614) or extensions such as those defined in RFC 6218 may be considered to protect the distribution. </t>
        </section>
        
        <section anchor="Implementation" title="Proof of concept implementation" >
            <t>
            The proof of concept is implemented using the Go programming language, that is well suited for the development of web servers or a network servers as in this case.
            </t>
            <t>
            The implementation of the network server is from <xref target="LoRaSERVER" /> which is tailored with the features of a RADIUS Client and the RADIUS server implementation from  <xref target="RADIUSGo" /> that is modified to handle LoRaWAN attributes.
            </t>
            <t>
            The LoRa end-device, pre-configured with AppKey, from Nemeus  <xref target="MK002"/> is a USB key that can be controlled by UART (AT command) through USB interface. A JAVA application installed on a Linux machine is used to send control and data messages from the End-Device.
            </t>
            <t>
            The LoRa Gateway is from EXPEMB <xref target="EXPEMB" /> which uses the packet forwarder to forward the LoRa packets to the LoRa Network Server. The Network Server is run in a docker container on a Linux machine transfers the LoRa packets into the RADIUS attributes to be sent to the RADIUS server. For now, the packets are sent to the default RADIUS server but in the future this would be changed as per the discussion in Section 5 in order to redirect the RADIUS request to appropriate RADIUS server.
            </t>
            <t>
            The RADIUS server is run in a docker container on a Linux machine which contains the mapping between the DevEUI of the End-Device and the AppKey. This AppKey from the map along with the received LoRa attributes is used to derive the session keys, NwkSKey and AppSKey, in the RADIUS server. These keys are transported as RADIUS attributes back to the network server. 
             </t>
            <t>
<figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[

+----------+         +---------+          +-------------+        +---------+
|          |         |  LoRa   |          | Nwk server/ |        | Radius  |
|End-device+---------+ Gateway +----------+   RADIUS    +--------+ Server  |
|          |  LoRa   |         |    IP    |   client    |   IP   |         |
+----------+         +---------+          +-------------+        +---------+

]]></artwork>
</figure>     
            </t>
            <t>
            A successful authentication would result in the session keys, NwkSKey and AppSKey, being visible on the network server that can be viewed using a web interface and the DevAddr being acquired by the End-Device from the Join Accept Lora message. Running Wireshark on the interface between RADIUS server and the Network Server shows the RADIUS packets with the LoRa attributes.
            </t>

            <t>
            	As future work, we intend to implement the proof of concept in FreeRADIUS
            </t>
        </section>
        
        <section title="Acknowledgments">
            <t>This work has been possible partially by the SMARTIE project (FP7-SMARTIE-609062 EU Project) and the Spanish National Project CICYT EDISON (TIN2014-52099-R) granted by the Ministry of Economy and Competitiveness of Spain (including ERDF support).
            </t>
            <t>
            We also wanted to thank for the comments received about this document by Sri Gundavelli, Yeoh Chun-Yeow, Alan DeKok, Stephen Farrell and Mark Grayson. 
            </t>

        </section>
        
        
        <section anchor="IANA" title="IANA Considerations">
            <t> In this document we define 4 new RADIUS Attributes that would need actions from IANA to assign the corresponding numbers.

<figure align="center">
<!-- maximum wide of the figure                                   -->
<artwork align="left"><![CDATA[                        
+--------+--------------+----------------------------+
| Number |     Name     |          Reference         |
+----------------------------------------------------+
|   TBD  | Join-Request | Section 4 of this document |
|   TBD  | Join-Answer  | Section 4 of this document |
|   TBD  | AppSKey      | Section 4 of this document |
|   TBD  | NwkSKey      | Section 4 of this document |
+--------+--------------+----------------------------+
]]></artwork>
</figure>

            </t>
        </section>
    </middle>
    
    <back>
        <references title="Normative References">
            &RFC2119;
            &RFC2865;
            &RFC7043;
            
        </references>
        <references title="Informative References">
            <reference anchor="LoRaWAN" target="https://www.lora-alliance.org/portals/0/specs/LoRaWAN%20Specification%201R0.pdf">
                <front>
                    <title>LoRa Specification V1.0</title>
                    <author initials="N." surname="Sornin"></author>
                    <author initials="M." surname="Luis"></author>
                    <author initials="T." surname="Eirich"></author>
                    <author initials="T." surname="Kramp"></author>
                    <date month="January" year="2015" />
                </front>
            </reference>

            <reference anchor="LoRaAllianceSecurity" target="http://portal.lora-alliance.org/DesktopModules/Inventures_Document/FileDownload.aspx?ContentID=1085">
            	<front>
            		<title>LoRaWAN - SECURITY a comprehensive insight - Online Resource: Last Accessed </title>
            		<author initials="P." surname="Girard"></author>
                    <date month="July" year="2016" />
            	</front>
            </reference>
          
            <reference anchor="LoRaSERVER" target="http://www.ackl.io">
                <front>
                    <title>LoRa Server</title>
                    <author initials="A." surname="Acklio"></author>
                    <date month="July" year="2016" />
                </front>
            </reference>    

           <reference anchor="EXPEMB" target="www.expemb.com/en/product/multi%E2%80%90connectivity-service-gateway-sgwmc%E2%80%90x86lr%E2%80%9012132/">
                <front>
                    <title>LoRa MultiConnectivity Service Gateway - Last Accessed: </title>
                    <author initials="E." surname="EXPEMB"></author>
                    <date month="July" year="2016" />
                </front>
           </reference>    

           <reference anchor="MK002" target="http://www.nemeus.fr/en/mk002-usb-key">
                <front>
                    <title>MK002-xx-EU - Last Accessed: </title>
                    <author initials="N." surname="Nemesus"></author>
                    <date month="July" year="2016" />
                </front>
           </reference>    



            <reference anchor="RADIUSGo" target="https://github.com/bronze1man/radius">
                <front>
                    <title>Radius: A golang radius library - Last Accessed: </title>
                    <author initials="B." surname="bronze1man"></author>
                    <date month="July" year="2016" />
                </front>
           </reference>    

        </references>
        
        
    </back>
</rfc>