{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible/pulls/comments/207374681","pull_request_review_id":142977094,"id":207374681,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzM3NDY4MQ==","diff_hunk":"@@ -429,6 +433,37 @@ def __init__(self, module):\n         else:\n             self.ssh_file = os.path.join('.ssh', 'id_%s' % self.ssh_type)\n \n+    def check_password_encrypted(self):\n+        # darwin need cleartext password, so no check\n+        if self.module.params['password'] and self.platform != 'Darwin':\n+            maybe_invalid = False\n+            # : for delimiter, * for disable user, ! for lock user\n+            # these character are invalid in password\n+            if any(char in self.module.params['password'] for char in ':*!'):\n+                maybe_invalid = True\n+            if '$' not in self.module.params['password']:\n+                maybe_invalid = True\n+            else:\n+                fields = self.module.params['password'].split(\"$\")\n+                if len(fields) >= 3:\n+                    # contains character outside crypt constrain\n+                    if bool(_HASH_RE.search(fields[-1])):\n+                        maybe_invalid = True\n+                    # md5\n+                    if fields[1] == '1' and len(fields[-1]) != 22:\n+                        maybe_invalid = True\n+                    # sha256\n+                    if fields[1] == '5' and len(fields[-1]) != 43:\n+                        maybe_invalid = True\n+                    # sha512\n+                    if fields[1] == '6' and len(fields[-1]) != 86:\n+                        maybe_invalid = True\n+                else:\n+                    maybe_invalid = True\n+            if maybe_invalid:\n+                self.module.warn(\"The iunput password seems not been hashed, \"","path":"lib/ansible/modules/system/user.py","position":50,"original_position":50,"commit_id":"f6cfd93f77c01ca85ddd7d221ba9c7aa3426ef12","original_commit_id":"f6cfd93f77c01ca85ddd7d221ba9c7aa3426ef12","user":{"login":"samdoran","id":4047861,"node_id":"MDQ6VXNlcjQwNDc4NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/4047861?v=4","gravatar_id":"","url":"https://api.github.com/users/samdoran","html_url":"https://github.com/samdoran","followers_url":"https://api.github.com/users/samdoran/followers","following_url":"https://api.github.com/users/samdoran/following{/other_user}","gists_url":"https://api.github.com/users/samdoran/gists{/gist_id}","starred_url":"https://api.github.com/users/samdoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdoran/subscriptions","organizations_url":"https://api.github.com/users/samdoran/orgs","repos_url":"https://api.github.com/users/samdoran/repos","events_url":"https://api.github.com/users/samdoran/events{/privacy}","received_events_url":"https://api.github.com/users/samdoran/received_events","type":"User","site_admin":false},"body":"\"iunput\" --> \"input\"","created_at":"2018-08-02T21:07:57Z","updated_at":"2018-08-02T21:07:57Z","html_url":"https://github.com/ansible/ansible/pull/43615#discussion_r207374681","pull_request_url":"https://api.github.com/repos/ansible/ansible/pulls/43615","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments/207374681"},"html":{"href":"https://github.com/ansible/ansible/pull/43615#discussion_r207374681"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible/pulls/43615"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/43615","id":205825305,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1ODI1MzA1","html_url":"https://github.com/ansible/ansible/pull/43615","diff_url":"https://github.com/ansible/ansible/pull/43615.diff","patch_url":"https://github.com/ansible/ansible/pull/43615.patch","issue_url":"https://api.github.com/repos/ansible/ansible/issues/43615","number":43615,"state":"open","locked":false,"title":"Give warning if user inputs not encrypted password to user module","user":{"login":"HD650","id":13494323,"node_id":"MDQ6VXNlcjEzNDk0MzIz","avatar_url":"https://avatars3.githubusercontent.com/u/13494323?v=4","gravatar_id":"","url":"https://api.github.com/users/HD650","html_url":"https://github.com/HD650","followers_url":"https://api.github.com/users/HD650/followers","following_url":"https://api.github.com/users/HD650/following{/other_user}","gists_url":"https://api.github.com/users/HD650/gists{/gist_id}","starred_url":"https://api.github.com/users/HD650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HD650/subscriptions","organizations_url":"https://api.github.com/users/HD650/orgs","repos_url":"https://api.github.com/users/HD650/repos","events_url":"https://api.github.com/users/HD650/events{/privacy}","received_events_url":"https://api.github.com/users/HD650/received_events","type":"User","site_admin":false},"body":"##### SUMMARY\r\n<!--- Describe the change, including rationale and design decisions -->\r\n`user` module doesn't check the input password and return very little information if users input unencrypted password (which is wrong), it's hard for users to figure out what's wrong. This PR check the format of the input password and give a warning if the password is not encrypted.\r\nFix #28772\r\n<!--- If you are fixing an existing issue, please include \"Fixes #nnn\" in your\r\ncommit message and your description; but you should still explain what\r\nthe change does.-->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Feature Pull Request\r\n\r\n##### COMPONENT NAME\r\n<!--- Name of the module, plugin, task or feature -->\r\n/lib/ansible/modules/system/user.py\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.7.0.dev0 (issue_28772 f5fa73be30) last updated 2018/08/02 13:59:35 (GMT -400)\r\n  config file = None\r\n  configured module search path = [u'/home/zhikangzhang/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /home/zhikangzhang/Desktop/ansible/lib/ansible\r\n  executable location = /home/zhikangzhang/Desktop/ansible/bin/ansible\r\n  python version = 2.7.15 (default, May 16 2018, 17:50:09) [GCC 8.1.1 20180502 (Red Hat 8.1.1-1)]\r\n","created_at":"2018-08-02T18:39:02Z","updated_at":"2018-08-02T21:07:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21ceeea9ec03efb7ca1b7365a4bf478e1205e2c1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":947190508,"node_id":"MDU6TGFiZWw5NDcxOTA1MDg=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.7","name":"affects_2.7","color":"ededed","default":false},{"id":513652538,"node_id":"MDU6TGFiZWw1MTM2NTI1Mzg=","url":"https://api.github.com/repos/ansible/ansible/labels/core_review","name":"core_review","color":"ededed","default":false},{"id":852590921,"node_id":"MDU6TGFiZWw4NTI1OTA5MjE=","url":"https://api.github.com/repos/ansible/ansible/labels/feature","name":"feature","color":"006b75","default":false},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":503572087,"node_id":"MDU6TGFiZWw1MDM1NzIwODc=","url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible/pulls/43615/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible/pulls/43615/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/43615/comments","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/f6cfd93f77c01ca85ddd7d221ba9c7aa3426ef12","head":{"label":"HD650:issue_28772","ref":"issue_28772","sha":"f6cfd93f77c01ca85ddd7d221ba9c7aa3426ef12","user":{"login":"HD650","id":13494323,"node_id":"MDQ6VXNlcjEzNDk0MzIz","avatar_url":"https://avatars3.githubusercontent.com/u/13494323?v=4","gravatar_id":"","url":"https://api.github.com/users/HD650","html_url":"https://github.com/HD650","followers_url":"https://api.github.com/users/HD650/followers","following_url":"https://api.github.com/users/HD650/following{/other_user}","gists_url":"https://api.github.com/users/HD650/gists{/gist_id}","starred_url":"https://api.github.com/users/HD650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HD650/subscriptions","organizations_url":"https://api.github.com/users/HD650/orgs","repos_url":"https://api.github.com/users/HD650/repos","events_url":"https://api.github.com/users/HD650/events{/privacy}","received_events_url":"https://api.github.com/users/HD650/received_events","type":"User","site_admin":false},"repo":{"id":135613022,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU2MTMwMjI=","name":"ansible","full_name":"HD650/ansible","owner":{"login":"HD650","id":13494323,"node_id":"MDQ6VXNlcjEzNDk0MzIz","avatar_url":"https://avatars3.githubusercontent.com/u/13494323?v=4","gravatar_id":"","url":"https://api.github.com/users/HD650","html_url":"https://github.com/HD650","followers_url":"https://api.github.com/users/HD650/followers","following_url":"https://api.github.com/users/HD650/following{/other_user}","gists_url":"https://api.github.com/users/HD650/gists{/gist_id}","starred_url":"https://api.github.com/users/HD650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HD650/subscriptions","organizations_url":"https://api.github.com/users/HD650/orgs","repos_url":"https://api.github.com/users/HD650/repos","events_url":"https://api.github.com/users/HD650/events{/privacy}","received_events_url":"https://api.github.com/users/HD650/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HD650/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":true,"url":"https://api.github.com/repos/HD650/ansible","forks_url":"https://api.github.com/repos/HD650/ansible/forks","keys_url":"https://api.github.com/repos/HD650/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HD650/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HD650/ansible/teams","hooks_url":"https://api.github.com/repos/HD650/ansible/hooks","issue_events_url":"https://api.github.com/repos/HD650/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/HD650/ansible/events","assignees_url":"https://api.github.com/repos/HD650/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/HD650/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/HD650/ansible/tags","blobs_url":"https://api.github.com/repos/HD650/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HD650/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HD650/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/HD650/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HD650/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/HD650/ansible/languages","stargazers_url":"https://api.github.com/repos/HD650/ansible/stargazers","contributors_url":"https://api.github.com/repos/HD650/ansible/contributors","subscribers_url":"https://api.github.com/repos/HD650/ansible/subscribers","subscription_url":"https://api.github.com/repos/HD650/ansible/subscription","commits_url":"https://api.github.com/repos/HD650/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/HD650/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/HD650/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/HD650/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/HD650/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/HD650/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HD650/ansible/merges","archive_url":"https://api.github.com/repos/HD650/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HD650/ansible/downloads","issues_url":"https://api.github.com/repos/HD650/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/HD650/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/HD650/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/HD650/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HD650/ansible/labels{/name}","releases_url":"https://api.github.com/repos/HD650/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/HD650/ansible/deployments","created_at":"2018-05-31T17:06:49Z","updated_at":"2018-08-02T18:17:57Z","pushed_at":"2018-08-02T20:57:36Z","git_url":"git://github.com/HD650/ansible.git","ssh_url":"git@github.com:HD650/ansible.git","clone_url":"https://github.com/HD650/ansible.git","svn_url":"https://github.com/HD650/ansible","homepage":"https://www.ansible.com/","size":126645,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"3a3869f4c845418da04a174e35ef3e6f9311ad20","user":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":3638964,"node_id":"MDEwOlJlcG9zaXRvcnkzNjM4OTY0","name":"ansible","full_name":"ansible/ansible","owner":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":false,"url":"https://api.github.com/repos/ansible/ansible","forks_url":"https://api.github.com/repos/ansible/ansible/forks","keys_url":"https://api.github.com/repos/ansible/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible/teams","hooks_url":"https://api.github.com/repos/ansible/ansible/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible/events","assignees_url":"https://api.github.com/repos/ansible/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible/tags","blobs_url":"https://api.github.com/repos/ansible/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible/subscription","commits_url":"https://api.github.com/repos/ansible/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible/merges","archive_url":"https://api.github.com/repos/ansible/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible/downloads","issues_url":"https://api.github.com/repos/ansible/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible/deployments","created_at":"2012-03-06T14:58:02Z","updated_at":"2018-08-02T20:56:31Z","pushed_at":"2018-08-02T21:07:40Z","git_url":"git://github.com/ansible/ansible.git","ssh_url":"git@github.com:ansible/ansible.git","clone_url":"https://github.com/ansible/ansible.git","svn_url":"https://github.com/ansible/ansible","homepage":"https://www.ansible.com/","size":134977,"stargazers_count":31735,"watchers_count":31735,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12237,"mirror_url":null,"archived":false,"open_issues_count":5376,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":12237,"open_issues":5376,"watchers":31735,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/43615"},"html":{"href":"https://github.com/ansible/ansible/pull/43615"},"issue":{"href":"https://api.github.com/repos/ansible/ansible/issues/43615"},"comments":{"href":"https://api.github.com/repos/ansible/ansible/issues/43615/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible/pulls/43615/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible/pulls/43615/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible/statuses/f6cfd93f77c01ca85ddd7d221ba9c7aa3426ef12"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"samdoran"}}