{"action":"created","issue":{"url":"https://api.github.com/repos/gitblit/gitblit/issues/1050","repository_url":"https://api.github.com/repos/gitblit/gitblit","labels_url":"https://api.github.com/repos/gitblit/gitblit/issues/1050/labels{/name}","comments_url":"https://api.github.com/repos/gitblit/gitblit/issues/1050/comments","events_url":"https://api.github.com/repos/gitblit/gitblit/issues/1050/events","html_url":"https://github.com/gitblit/gitblit/issues/1050","id":147080810,"number":1050,"title":"Update FAQ with how to use a CA-issued certificate","user":{"login":"lewellyn","id":658826,"avatar_url":"https://avatars.githubusercontent.com/u/658826?v=3","gravatar_id":"","url":"https://api.github.com/users/lewellyn","html_url":"https://github.com/lewellyn","followers_url":"https://api.github.com/users/lewellyn/followers","following_url":"https://api.github.com/users/lewellyn/following{/other_user}","gists_url":"https://api.github.com/users/lewellyn/gists{/gist_id}","starred_url":"https://api.github.com/users/lewellyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lewellyn/subscriptions","organizations_url":"https://api.github.com/users/lewellyn/orgs","repos_url":"https://api.github.com/users/lewellyn/repos","events_url":"https://api.github.com/users/lewellyn/events{/privacy}","received_events_url":"https://api.github.com/users/lewellyn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-09T02:39:48Z","updated_at":"2016-04-09T02:50:53Z","closed_at":null,"body":"There should be a mention of how to use a standard CA-issued PEM-format certificate (such as a wildcard certificate used for Apache HTTPD, Nginx, etc.) in the FAQ (as this does seem to be a generally unanswered question, from my trawling of the web earlier). All the documentation for serving SSL directly with Gitblit is regarding self-signed certificates (e.g. issued via the authority tool). Even if it starts off fairly rudimentary and has big old warning flags that it's for experts only, that hopefully will get clueful people to provide feedback on how to make it more beginner-friendly.\r\n\r\nIn an effort to make this a reality, here's some helpful information. :)\r\n\r\n- To convert a key from the standard PEM + key format used by most traditional webservers into something Java can use:\r\n  1.  `openssl pkcs12 -export -in /path/to/certs/yourdomain.pem -inkey /path/to/keys/yourdomain.key > yourdomain.p12`\r\n  - Enter a passphrase that will be required upon importing the certificate file.\r\n\r\n- To import the key into your Java keystore:\r\n  1. `keytool -importkeystore -srckeystore yourdomain.p12 -destkeystore data/serverKeyStore.jks -srcstoretype pkcs12 -name yourdomain`\r\n  - Note that the name you use here will be the alias in Gitblit's keystore.\r\n  2. Enter the password to the Gitblit keystore (default `gitblit`).\r\n  3. Enter the password to the certificate file, as entered above.\r\n\r\n- To use the key in the keystore:\r\n  1. Edit data/gitblit.properties and add the following line:\r\n`server.certificateAlias = yourdomain`\r\n  - Make sure that this is the same as the name you gave upon importing the key.\r\n  2. Save data/gitblit.properties.\r\n  3. Restart Gitblit.\r\n\r\nCaveats:\r\n\r\n- The Java runtime can apparently only reliably handle RSA keys up to 2048 bits. It doesn't matter if you're using Oracle, IBM, or OpenJDK's Java. It doesn't matter if you're using Java 7 or 8. It also doesn't matter if you have the Unlimited JCE Policies.\r\n- I probably forgot something important in between at least one pair of steps. :)\r\n- Any or all of the above information may be inaccurate, but it should be a starting point for someone more familiar with keytool to be able to massage into something as friendly as keytool can get.\r\n- None of the above applies to .pfx files exported from Windows, but theoretically they can be used with keytool without the initial openssl step."},"comment":{"url":"https://api.github.com/repos/gitblit/gitblit/issues/comments/207688713","html_url":"https://github.com/gitblit/gitblit/issues/1050#issuecomment-207688713","issue_url":"https://api.github.com/repos/gitblit/gitblit/issues/1050","id":207688713,"user":{"login":"lewellyn","id":658826,"avatar_url":"https://avatars.githubusercontent.com/u/658826?v=3","gravatar_id":"","url":"https://api.github.com/users/lewellyn","html_url":"https://github.com/lewellyn","followers_url":"https://api.github.com/users/lewellyn/followers","following_url":"https://api.github.com/users/lewellyn/following{/other_user}","gists_url":"https://api.github.com/users/lewellyn/gists{/gist_id}","starred_url":"https://api.github.com/users/lewellyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lewellyn/subscriptions","organizations_url":"https://api.github.com/users/lewellyn/orgs","repos_url":"https://api.github.com/users/lewellyn/repos","events_url":"https://api.github.com/users/lewellyn/events{/privacy}","received_events_url":"https://api.github.com/users/lewellyn/received_events","type":"User","site_admin":false},"created_at":"2016-04-09T02:50:53Z","updated_at":"2016-04-09T02:50:53Z","body":"It might be worth noting that this should alleviate any and all problems with git clients when it comes to certificate verification.\r\n\r\nAlso, I suppose a feature request might be to have an import button in the GitBlit Authority tool that can validate and import PEM certificates. However, I have no idea how much work that might be and whether that might require pulling in dependencies which are not currently needed, so I'm hesitant to ask for it (nor can I currently implement it myself)."}}