medooze / media-server-demo-node

Demo application for the Medooze Media Server for Node.js
MIT License
92 stars 48 forks source link

Server Key Error #33

Open krishnakanthpps opened 4 years ago

krishnakanthpps commented 4 years ago

Hi..

Wanted to try this MCU module. Getting the following error.

root@ubuntu-s-1vcpu-2gb-nyc1-01:~/media-server-demo-node# node index.js 192.241.132.6 [0x7f32161ab740][1593716900.856][LOG]>RTPBundleTransport::Init() [0x7f32161ab740][1593716900.856][LOG]-RTPBundleTransport::Init() | Got port [50977] [0x7f32161ab740][1593716900.856][LOG]<RTPBundleTransport::Init() fs.js:114 throw err; ^

Error: ENOENT: no such file or directory, open 'server.key' at Object.openSync (fs.js:443:3) at Object.readFileSync (fs.js:343:35) at Object. (/root/media-server-demo-node/index.js:22:10) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19)

Here are the steps I followed.

git clone https://github.com/medooze/media-server-demo-node.git ls cd media-server-demo-node/ ls npm install npm audit fix ls npm index.js 192.241.132.6 node index.js 192.241.132.6 history

enderocean commented 4 years ago

Hi, Just installed a self-signed certificated in "media-server-demo-node" directory :

cd media-server-demo-node/
sudo apt-get install openssl
openssl genrsa -des3 -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert

It works.

Asim187 commented 4 years ago

after running node index.js

i am getting following error

[0x7fcb87035740][1600323514.310][ERR]-DTLSConnection::Initialize() | Specified certificate file '' could not be used
[0x7fcb87035740][1600323514.311][LOG]>RTPBundleTransport::Init()
[0x7fcb87035740][1600323514.311][LOG]-RTPBundleTransport::Init() | Got port [56905]
[0x7fcb87035740][1600323514.312][LOG]<RTPBundleTransport::Init()
[0x7fcb87035740][1600323514.313][LOG]-RTPTransport::SetPortRange() | configured RTP/RTCP ports range [10000,20000]
[0x7fcb87035740][1600323514.339][LOG]>RTPTransport::Init()
[0x7fcb87035740][1600323514.339][LOG]-RTPTransport::Init() | Got ports [5004,5005]
[0x7fcb87035740][1600323514.339][LOG]<RTPTransport::Init()
newmips commented 4 years ago

I have cloned last master version of repository and executed the following commands:

openssl genrsa -aes128 -out server.key 2048 

Type "mypasswd" when asked for password

openssl rsa -passin pass:mypasswd -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert
node index.js 127.0.0.1

Can you do the same and tell me if it works?

Asim187 commented 4 years ago

@newmips getting the following error after executing openssl rsa -passin pass:mypasswd -in server.pass.key -out server.key

Can't open server.pass.key for reading, No such file or directory
140433960330560:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('server.pass.key','r')
140433960330560:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
unable to load Private Key
newmips commented 4 years ago

Sorry... "server.pass.key is only generated if you executes:

openssl genrsa -des3 -out server.pass.key 2048
Asim187 commented 4 years ago

@newmips still getting same error

node index.js 127.0.0.1
[0x7fe958cb2740][1600526338.243][ERR]-DTLSConnection::Initialize() | Specified certificate file '' could not be used
[0x7fe958cb2740][1600526338.244][LOG]>RTPBundleTransport::Init()
[0x7fe958cb2740][1600526338.245][LOG]-RTPBundleTransport::Init() | Got port [44494]
[0x7fe958cb2740][1600526338.245][LOG]<RTPBundleTransport::Init()
[0x7fe958cb2740][1600526338.246][LOG]-RTPTransport::SetPortRange() | configured RTP/RTCP ports range [10000,20000]
[0x7fe958cb2740][1600526338.271][LOG]>RTPTransport::Init()
[0x7fe958cb2740][1600526338.271][LOG]-RTPTransport::Init() | Got ports [5004,5005]
[0x7fe958cb2740][1600526338.272][LOG]<RTPTransport::Init()

what do i need to enter A challenge password during SSL installation i entered mypasswd. is that correct ?

newmips commented 4 years ago

No. You just need to enter mypasswd for the passphrase (when you generate the key). When prompt for A challenge password , you must leave it like that and press Enter key

Asim187 commented 4 years ago

even getting same error :(

On Sun, 20 Sep 2020 at 13:05, Newmips Team notifications@github.com wrote:

No. You just need to enter mypasswd for the passphrase (when you generate the key). When prompt for A challenge password , you must leave it like that and press Enter key

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/medooze/media-server-demo-node/issues/33#issuecomment-695755951, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANL63GEHBCWHFHBTV754YR3SGWWCNANCNFSM4OPFL5HQ .

newmips commented 4 years ago

Are you logged as sudo ? Here come my logs after sudo npm install cloned repository:

root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl genrsa -des3 -out server.pass.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
.............................................+++++
...................................................+++++
e is 65537 (0x010001)
Enter pass phrase for server.pass.key:
Verifying - Enter pass phrase for server.pass.key:
root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl rsa -passin pass:mypasswd -in server.pass.key -out server.key
writing RSA key
root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert
Signature ok
subject=C = AU, ST = Some-State, O = Internet Widgits Pty Ltd
Getting Private key
root@denis-N501JW:/home/denis/tmp/media-server-demo-node# node index.js 127.0.0.1
[0x7f51643d0740][1600590031.530][LOG]>RTPBundleTransport::Init()
[0x7f51643d0740][1600590031.530][LOG]-RTPBundleTransport::Init() | Got port [52144]
[0x7f51643d0740][1600590031.530][LOG]<RTPBundleTransport::Init()
[0x7f51643d0740][1600590031.530][LOG]-RTPTransport::SetPortRange() | configured RTP/RTCP ports range [10000,20000]
[0x7f51643d0740][1600590031.547][LOG]>RTPTransport::Init()
[0x7f51643d0740][1600590031.547][LOG]-RTPTransport::Init() | Got ports [5004,5005]
[0x7f51643d0740][1600590031.547][LOG]<RTPTransport::Init()

Relevant files are in application directory:

root@denis-N501JW:/home/denis/tmp/media-server-demo-node# ls
index.js  lib  LICENSE  node_modules  package.json  package-lock.json  README.md  recordings  server.cert  server.csr  server.key  server.pass.key  www
Asim187 commented 4 years ago

You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.

Country Name (2 letter code) [AU]:IN State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]: Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []:

Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:. An optional company name []:. root@medooze:~/media-server-demo-node# openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert Signature ok subject=C = IN, ST = Maha, L = Mumbai, O = Admin, OU = Admin, CN = medooze, emailAddress =mymailid Getting Private key root@medooze:~/media-server-demo-node# node index.js 127.0.0.1 [0x7f4bc5da8740][1600600759.031][ERR]-DTLSConnection::Initialize() | Specified certificate file '' could not be used [0x7f4bc5da8740][1600600759.032][LOG]>RTPBundleTransport::Init() [0x7f4bc5da8740][1600600759.032][LOG]-RTPBundleTransport::Init() | Got port [59373] [0x7f4bc5da8740][1600600759.033][LOG]<RTPBundleTransport::Init() [0x7f4bc5da8740][1600600759.034][LOG]-RTPTransport::SetPortRange() | configured RTP/RTCP ports range [10000,20000] [0x7f4bc5da8740][1600600759.060][LOG]>RTPTransport::Init() [0x7f4bc5da8740][1600600759.061][LOG]-RTPTransport::Init() | Got ports [5004,5005] [0x7f4bc5da8740][1600600759.061][LOG]<RTPTransport::Init()

On Sun, 20 Sep 2020 at 13:52, Newmips Team notifications@github.com wrote:

Are you logged as sudo ? Here come my logs after sudo npm install cloned repository:

root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl genrsa -des3 -out server.pass.key 2048 Generating RSA private key, 2048 bit long modulus (2 primes) .............................................+++++ ...................................................+++++ e is 65537 (0x010001) Enter pass phrase for server.pass.key: Verifying - Enter pass phrase for server.pass.key: root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl rsa -passin pass:mypasswd -in server.pass.key -out server.key writing RSA key root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl req -new -key server.key -out server.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.

Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]: Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []:

Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: root@denis-N501JW:/home/denis/tmp/media-server-demo-node# openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert Signature ok subject=C = AU, ST = Some-State, O = Internet Widgits Pty Ltd Getting Private key root@denis-N501JW:/home/denis/tmp/media-server-demo-node# node index.js 127.0.0.1 [0x7f51643d0740][1600590031.530][LOG]>RTPBundleTransport::Init() [0x7f51643d0740][1600590031.530][LOG]-RTPBundleTransport::Init() | Got port [52144] [0x7f51643d0740][1600590031.530][LOG]<RTPBundleTransport::Init() [0x7f51643d0740][1600590031.530][LOG]-RTPTransport::SetPortRange() | configured RTP/RTCP ports range [10000,20000] [0x7f51643d0740][1600590031.547][LOG]>RTPTransport::Init() [0x7f51643d0740][1600590031.547][LOG]-RTPTransport::Init() | Got ports [5004,5005] [0x7f51643d0740][1600590031.547][LOG]<RTPTransport::Init()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/medooze/media-server-demo-node/issues/33#issuecomment-695759726, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANL63GBY4P7GEJSOBJSBQ4DSGW3SXANCNFSM4OPFL5HQ .

AlexLionne commented 4 years ago

Hi, Just installed a self-signed certificated in "media-server-demo-node" directory :

cd media-server-demo-node/
sudo apt-get install openssl
openssl genrsa -des3 -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.cert

It works.

Hi, I followed exaclty your steps and still got an issue with

DTLSConnection::Initialize() |
Specified certificate file '' could not be used
newmips commented 4 years ago

Are you logged as root ? Have you checked you have execution rights ? chmod +x server.*

AlexLionne commented 4 years ago

Yes I am but nvm I found it :) thanks