Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] DTLS Implementation #122

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ RUN yum update -y && \
# Don't need old log files inside docker images
rm -f /var/log/*log

ENTRYPOINT bin/lwm2mAgent.js config-blank.js
ENTRYPOINT bin/lwm2mAgent.js config-secure.js
9 changes: 8 additions & 1 deletion bin/lwm2mAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ function start() {
config = require('../config');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an entry in CHANGES_NEXT_RELEASE about the changes included in this PR, eg:

- Add: DTLS support (#xx)

where #xx is an issue number, if we have some one for DTLS implementation in this repository.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(y)

}

if ( typeof(config.ngsi.contextBroker.verify) != "undefined" ){
if (config.ngsi.contextBroker.verify == false) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
logger.info(context, 'Verify certificate for contextBroker are disabled.');
}
}

iotAgent.start(config, function (error) {
if (error) {
logger.error(context, 'Error starting Agent: [%s] Exiting process', error);
Expand All @@ -48,4 +55,4 @@ function start() {
});
}

start();
start();
83 changes: 83 additions & 0 deletions config-secure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
*
* This file is part of fiware-iotagent-lib
*
* fiware-iotagent-lib is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* fiware-iotagent-lib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with fiware-iotagent-lib.
* If not, seehttp://www.gnu.org/licenses/.
*
* For those usages not covered by the GNU Affero General Public License
* please contact with::[[email protected]]
*/

var config = {};

config.lwm2m = {
logLevel: 'DEBUG',
port: 5683,
dtls: {
port: 5684,
cert: "cert.crt",
key: "cert.key"
},
defaultType: 'Device',
ipProtocol: 'udp4',
serverProtocol: 'udp4',
formats: [
{
name: 'application-vnd-oma-lwm2m/text',
value: 1541
},
{
name: 'application-vnd-oma-lwm2m/tlv',
value: 1542
},
{
name: 'application-vnd-oma-lwm2m/json',
value: 1543
},
{
name: 'application-vnd-oma-lwm2m/opaque',
value: 1544
}
],
writeFormat: 'application-vnd-oma-lwm2m/text',
types: [ ]
};

config.ngsi = {
logLevel: 'DEBUG',
contextBroker: {
host: 'localhost',
port: '1026',
protocol: 'https',
verify: false
},
server: {
port: 4041,
tls: {
key: "cert.key",
crt: "cert.crt"
}
},
deviceRegistry: {
type: 'memory'
},
types: { },
providerUrl: 'https://localhost:4041',
deviceRegistrationDuration: 'P1M'
};

module.exports = config;

Loading