gabrielcsapo / node-git-server

🎡 A configurable git server written in Node.js
https://gabrielcsapo.github.io/node-git-server
MIT License
253 stars 73 forks source link

adds https support #35

Closed gabrielcsapo closed 6 years ago

gabrielcsapo commented 6 years ago

@echopoint thoughts on the readme and example update?

echopoint commented 6 years ago

Looks good, let me pull it down and check it out.

echopoint commented 6 years ago

Only actual issue I see is the normal https issue with a self signed cert. fatal: unable to access 'https://localhost:7005/test/': SSL certificate problem: self signed certificate

So at worst, we may just need a command line switch enable a bypass but make sure it's off by default. Something like --selfsigned would suffice.

Though, let's just document that the problem can be bypassed on the git client side instead. I don't want to be adding in overlooks into a server codebase. 😈

git config http.sslVerify false

gabrielcsapo commented 6 years ago

@echopoint I agree, the problem is that the git client doesn't use the specific certs when making the request. This can be done via:

git config --global http.sslCAInfo /path/to/cert.pem

It doesn't look like I can do anything from the node side to fix this. The docs https://nodejs.org/api/https.html don't have any mention of being able to fix this behavior. What do you think the best course of action is?

echopoint commented 6 years ago

There is a way to override the ssl behavior in node, it's just not wise to do so. Basically bypassing the verification step of ssl, which is besides the point. With a self signed cert, this behavior can be overridden in the git client like we both stated, so let's document that, and not add bypasses to the server. It's the same behavior on anything using ssl.. if it's self signed, obviously this isn't going to be able to be verified via a CA cache without user intervention. The method I posted will make git skip verification on a singular repo.. The method you posted is better because it adds the cert to the git config and shouldn't need more user interaction to clone, push, etc after that.

gabrielcsapo commented 6 years ago

@echopoint added doc to readme

gabrielcsapo commented 6 years ago

going to merge and publish under 0.4.2

oscartbeaumont commented 6 years ago

This is much better than my code thanks for adding https.

gabrielcsapo commented 6 years ago

@oscartbeaumont thank you!