<p>The default "add" functionality of the mesh key-chain page does not create a new key or update the current commotion profiles mdp values.</p>

<p>The correct behavior when the "add" button is clicked should be as follows:</p>

<ul>
<li>Any key-ring at /etc/commotion/keys.d/mdp.keyring/serval.keyring should be deleted</li>
<li>A new key should be created at the above location</li>
<li>All active mesh profiles should have their   "mdp_keyring" and "mdp_sid"'s updated</li>
<li>finally the values in /etc/config/olsrd in the olsrd_mdp section should be updated</li>
</ul><p>Related Documentation Bug/Fix that will allow R1.1 to be put out regardless of this bug can be found @ <a href="https://github.com/opentechinstitute/commotion-docs/issues/45" class="issue-link" title="Add a serval key-chain documentation needs to read as follows.">opentechinstitute/commotion-docs#45</a></p>

<p>To re-create:</p>

<p>KEY:<br>
  Node 1 = N1<br>
  Node 1 command line argument = root@n1: <br>
  Node 2 = N2<br>
  Node 2 command line argument = root@n2: </p>

<p>N1: Create a new shared mesh keychain following these instructions.</p>

<ul>
<li>Go to the  “Basic –> Security –> Shared Mesh Keychain” menu

<ul>
<li>If the menu is populated with the options to "upload, download, and create" a shared mesh keychain follow the "Delete a keychain" instructions below and then continue.</li>
</ul>
</li>
<li>Click the add button</li>
<li>Click the "Save" button</li>
<li>Click "Save and Apply" when asked to confirm the configuration.</li>
<li>Wait for the "Applying Changes" page to redirect you back to the status page.</li>
</ul><p>N1: Download the created keychain using these instructions.</p>

<ul>
<li>Go to the  “Basic –> Security –> Shared Mesh Keychain” menu

<ul>
<li>If the menu shows ONLY the "help text" and "add"  button follow the "Add a new key-chain" instructions above then continue.</li>
</ul>
</li>
<li>Click the "Download Shared Mesh Keychain" button.</li>
<li>This will start the download of a file called serval.keyring</li>
<li>This file is your shared mesh key-chain.</li>
</ul><p>N2: Upload a keychain using these instructions.</p>

<ul>
<li>Make sure you have a valid key-chain on the device you will be uploading a key from</li>
<li>Go to the  “Basic –> Security –> Shared Mesh Keychain” menu

<ul>
<li>If the menu shows ONLY the "help text" and "add"  button follow the "Add a new key-chain" instructions above then continue. This not only adds a new key, which you don't need, but configures the device to require a key-chain file.</li>
</ul>
</li>
<li>In the "Upload Shared Mesh Keychain File" box click on the "Choose File" button.</li>
<li>Select a key-ring file from your device and click "Open"</li>
<li>Click the "Save" Button</li>
<li>You do not have to click the "Save and Apply" button because we have not changed any settings, we have only replaced the keyring.</li>
</ul><p>root@n1: cat /etc/commotion/profiles.d/profile_name</p>

<pre><code>{
  "announce": "true",
  "bssid": "02:CA:FF:EE:BA:BE",
  "bssidgen": "true",
  "channel": "5",
  "dns": "208.67.222.222",
  "domain": "mesh.local",
  "encryption": "psk2",
  "ip": "100.64.0.0",
  "ipgen": "true",
  "ipgenmask": "255.192.0.0",
  "key": "c0MM0t10n!r0cks",
  "mdp_keyring": "/etc/commotion/keys.d/mdp.keyring/serval.keyring",
  "mdp_sid": "0000000000000000000000000000000000000000000000000000000000000000",
  "mode": "adhoc",
  "netmask": "255.192.0.0",
  "serval": "false",
  "ssid": "commotionwireless.net",
  "type": "mesh"
}
</code></pre>

<p>root@n2: cat /etc/commotion/profiles.d/profile_name</p>

<pre><code>{
  "announce": "true",
  "bssid": "02:CA:FF:EE:BA:BE",
  "bssidgen": "true",
  "channel": "5",
  "dns": "208.67.222.222",
  "domain": "mesh.local",
  "encryption": "psk2",
  "ip": "100.64.0.0",
  "ipgen": "true",
  "ipgenmask": "255.192.0.0",
  "key": "c0MM0t10n!r0cks",
  "mdp_keyring": "/etc/commotion/keys.d/mdp/serval.keyring",
  "mdp_sid": "0000000000000000000000000000000000000000000000000000000000000000",
  "mode": "adhoc",
  "netmask": "255.192.0.0",
  "serval": "false",
  "ssid": "commotionwireless.net",
  "type": "mesh"
}
</code></pre>

<p>N1 & N2: Note the difference between the mdp_keyring lines and the mdp_sid lines.</p>

<pre><code>     N2:
         "mdp_keyring": "/etc/commotion/keys.d/mdp/serval.keyring",
         "mdp_sid": "0000000000000000000000000000000000000000000000000000000000000000",
     N1:
         "mdp_keyring": "/etc/commotion/keys.d/mdp.keyring/serval.keyring",
             "mdp_sid": "A6D29C35D0409F176B22AEF2FAC447572540F39D8AEB8C48C107F9A11D224B06"
</code></pre>

<p>root@n2: logread</p>

<pre><code>Feb 25 23:25:26 commotion user.notice luci: get sid
Feb 25 23:25:27 commotion user.notice luci: changes NOT found
Feb 25 23:25:27 commotion user.notice luci: lib parse
Feb 25 23:25:27 commotion user.notice luci: olsrd_mdp.so.0.1
Feb 25 23:25:27 commotion user.notice luci: sp parse
Feb 25 23:25:27 commotion user.notice luci: /etc/commotion/keys.d/mdp/serval.keyring
Feb 25 23:25:27 commotion user.notice luci: sid parse
Feb 25 23:25:50 commotion user.notice luci: uploader write
Feb 25 23:25:51 commotion user.notice luci: get sid
Feb 25 23:25:51 commotion user.notice luci: get sid
Feb 25 23:25:51 commotion user.notice luci: set
Feb 25 23:25:51 commotion user.notice luci: get sid
Feb 25 23:25:51 commotion user.notice luci: get sid
</code></pre>

<p>N2: The important line is the one that states "set"</p>

<p>root@n1: logread</p>

<pre><code>Feb 25 23:25:26 commotion user.notice luci: get sid
Feb 25 23:25:27 commotion user.notice luci: changes NOT found
Feb 25 23:25:27 commotion user.notice luci: lib parse
Feb 25 23:25:27 commotion user.notice luci: olsrd_mdp.so.0.1
Feb 25 23:25:27 commotion user.notice luci: sp parse
Feb 25 23:25:27 commotion user.notice luci: /etc/commotion/keys.d/mdp/serval.keyring
Feb 25 23:25:27 commotion user.notice luci: sid parse
Feb 25 23:25:50 commotion user.notice luci: get sid
Feb 25 23:25:51 commotion user.notice luci: changes NOT found
Feb 25 23:25:51 commotion user.notice luci: lib parse
Feb 25 23:25:51 commotion user.notice luci: olsrd_mdp.so.0.1
Feb 25 23:25:51 commotion user.notice luci: sp parse
Feb 25 23:25:51 commotion user.notice luci: /etc/commotion/keys.d/mdp/serval.keyring
Feb 25 23:25:51 commotion user.notice luci: sid parse
</code></pre>

<p>N1: Notice that there is no "set" command announced on new key creation. This means that the function that sets the commotion profile values was never run when "adding" a new key.</p>

<p>Conclusion:</p>

<p>Upon running firstboot and then restarting to set the node back to its defaults it seems that the node has defaults that are not getting overwritten.</p>

<p>root@test-01-1011232331:~# reboot<br>
root@test-01-1011232331:~# Connection to 10.46.75.1 closed by remote host.<br>
me@my_computer:~$  telnet 10.46.75.1<br>
root@commotion:/# ls /etc/commotion/keys.d/mdp/serval.keyring </p>

<pre><code>/etc/commotion/keys.d/mdp/serval.keyring
</code></pre>

<p>root@commotion:/# SERVALINSTANCE_PATH=/etc/commotion/keys.d/mdp serval-client keyring list</p>

<pre><code>INFO: Local date/time: 2014-02-25 21:00:08 +0000
INFO: Serval DNA version: UNKNOWN-VERSION
WARN: conf.c:85:reload()  config file /etc/commotion/keys.d/mdp/serval.conf does not exist -- using all defaults
A6D29C35D0409F176B22AEF2FAC447572540F39D8AEB8C48C107F9A11D224B06::
</code></pre>

<p>root@commotion:/# commotion new newProfile</p>

<pre><code>{
  "newProfile": "Created."
}
</code></pre>

<p>root@commotion:/# commotion profiles</p>

<pre><code>{
  "commotionwireless_46net": "commotionwireless_46net",
  "newProfile": "newProfile"
}
</code></pre>

<p>root@commotion:/# commotion save newProfile</p>

<pre><code>{
  "newProfile": "Saved."
}
</code></pre>

<p>root@commotion:/# cat /etc/commotion/profiles.d/newProfile </p>

<pre><code>{
  "announce": "true",
  "bssid": "02:CA:FF:EE:BA:BE",
  "bssidgen": "true",
  "channel": "5",
  "dns": "208.67.222.222",
  "domain": "mesh.local",
  "encryption": "psk2",
  "ip": "100.64.0.0",
  "ipgen": "true",
  "ipgenmask": "255.192.0.0",
  "key": "c0MM0t10n!r0cks",
  "mdp_keyring": "/etc/commotion/keys.d/mdp.keyring/serval.keyring",
  "mdp_sid": "0000000000000000000000000000000000000000000000000000000000000000",
  "mode": "adhoc",
  "netmask": "255.192.0.0",
  "serval": "false",
  "ssid": "commotionwireless.net",
  "type": "mesh"
</code></pre>

<p>A node contains a default mdp serval keyring file, which it should not for security reasons, but that is besides the point. Beyond this, when a new serval-keyring is added in the security menu it only creates a new keyring if a key does NOT already exist. The act of adding a new keyring also does not trigger the modification of the commotion profile values when using the basic "add" command. As such, adding a new serval keyring without using one of the sub-options does not work.</p>

<p>BUT! If a user adds a new serval keyring AND then uses the "Create a new Shared Mesh Keychain file" button on that page it will properly set the new serval keyring.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/opentechinstitute/luci-commotion/issues/172'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/3074564__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwODk4NTMyNiwiZGF0YSI6eyJpZCI6MjY1NDEyNDV9fQ==--1f48c8086b249d428ca96cb755d0982df067fecd.gif' height='1' width='1'></p>