{"action":"created","issue":{"url":"https://api.github.com/repos/erlio/vernemq/issues/727","repository_url":"https://api.github.com/repos/erlio/vernemq","labels_url":"https://api.github.com/repos/erlio/vernemq/issues/727/labels{/name}","comments_url":"https://api.github.com/repos/erlio/vernemq/issues/727/comments","events_url":"https://api.github.com/repos/erlio/vernemq/issues/727/events","html_url":"https://github.com/erlio/vernemq/issues/727","id":328670547,"node_id":"MDU6SXNzdWUzMjg2NzA1NDc=","number":727,"title":"Allow configurable username attribute from client certificate subject","user":{"login":"msqr","id":139448,"node_id":"MDQ6VXNlcjEzOTQ0OA==","avatar_url":"https://avatars3.githubusercontent.com/u/139448?v=4","gravatar_id":"","url":"https://api.github.com/users/msqr","html_url":"https://github.com/msqr","followers_url":"https://api.github.com/users/msqr/followers","following_url":"https://api.github.com/users/msqr/following{/other_user}","gists_url":"https://api.github.com/users/msqr/gists{/gist_id}","starred_url":"https://api.github.com/users/msqr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msqr/subscriptions","organizations_url":"https://api.github.com/users/msqr/orgs","repos_url":"https://api.github.com/users/msqr/repos","events_url":"https://api.github.com/users/msqr/events{/privacy}","received_events_url":"https://api.github.com/users/msqr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-01T21:47:13Z","updated_at":"2018-06-05T06:06:06Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI really like VerneMQ, and am trying to integrate it into an existing IoT infrastructure relying on X.509 client certificate authentication. The certificate subjects do not contain `CN` attributes, however (they use `UID`). I know VerneMQ [already supports](https://github.com/erlio/vernemq/blob/d2362d2fb8426e5d9d732ff75d7b91cf53d6f225/apps/vmq_server/src/vmq_ssl.erl#L28-L46) extracting the `CN` attribute as the client's username via the `listener.ssl.use_identity_as_username` configuration.\r\n\r\nWhat I am proposing is a way to configure which attribute name to use for the username, something like the following:\r\n\r\n```\r\nlistener.ssl.identity_username_attribute = CN\r\n```\r\n\r\nso in my situation I could configure it like\r\n\r\n```\r\nlistener.ssl.identity_username_attribute = UID\r\n```\r\n\r\nI've been evaluating RabbitMQ, which by default [maps the entire subject](https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl#username-extraction-from-certificate) to the username while allowing the `CN` attribute to be used, so that approach is also viable from this perspective, for example:\r\n\r\n```\r\nlistener.ssl.identity_as_dn = on\r\n```\r\n\r\ncould result in usernames like `UID=X, O=Y` that would be workable. Being able to extract the `UID` attribute alone, however, would result in usernames that are much shorter and easier to wrangle.\r\n\r\nI am not familiar with Erlang to feel confident I could create a patch for this myself easily, so hoped that this might be an easy and desirable enough feature to be added by an existing contributor?"},"comment":{"url":"https://api.github.com/repos/erlio/vernemq/issues/comments/394592310","html_url":"https://github.com/erlio/vernemq/issues/727#issuecomment-394592310","issue_url":"https://api.github.com/repos/erlio/vernemq/issues/727","id":394592310,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDU5MjMxMA==","user":{"login":"dergraf","id":155396,"node_id":"MDQ6VXNlcjE1NTM5Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/155396?v=4","gravatar_id":"","url":"https://api.github.com/users/dergraf","html_url":"https://github.com/dergraf","followers_url":"https://api.github.com/users/dergraf/followers","following_url":"https://api.github.com/users/dergraf/following{/other_user}","gists_url":"https://api.github.com/users/dergraf/gists{/gist_id}","starred_url":"https://api.github.com/users/dergraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dergraf/subscriptions","organizations_url":"https://api.github.com/users/dergraf/orgs","repos_url":"https://api.github.com/users/dergraf/repos","events_url":"https://api.github.com/users/dergraf/events{/privacy}","received_events_url":"https://api.github.com/users/dergraf/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T06:06:06Z","updated_at":"2018-06-05T06:06:06Z","author_association":"CONTRIBUTOR","body":"+1"}}
{"actor":{"display_login":"dergraf"}}