{"id":2405,"date":"2017-06-29T13:47:30","date_gmt":"2017-06-29T05:47:30","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2405"},"modified":"2017-06-29T13:47:30","modified_gmt":"2017-06-29T05:47:30","slug":"centos7-x-%e8%ae%be%e7%bd%ae%e5%af%86%e7%a0%81%e8%a7%84%e5%88%99","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/centos7-x-%e8%ae%be%e7%bd%ae%e5%af%86%e7%a0%81%e8%a7%84%e5%88%99\/","title":{"rendered":"CentOS7.x \u8bbe\u7f6e\u5bc6\u7801\u89c4\u5219"},"content":{"rendered":"<h1><strong><b>\u51fa\u4e8e\u5b89\u5168\u8003\u8651\u8bbe\u7f6e\u5bc6\u7801\u89c4\u5219<\/b><\/strong><\/h1>\n<p>\u8bbe\u7f6e\u5bc6\u7801\u5230\u671f\u7684\u5929\u6570\u3002<br \/>\n\u7528\u6237\u5fc5\u987b\u5728\u5929\u5185\u66f4\u6539\u5bc6\u7801\u3002<br \/>\n\u6b64\u8bbe\u7f6e\u4ec5\u5f71\u54cd\u521b\u5efa\u7528\u6237\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u73b0\u6709\u7528\u6237\u3002<br \/>\n\u5982\u679c\u8bbe\u7f6e\u4e3a\u73b0\u6709\u7528\u6237\uff0c\u8bf7\u8fd0\u884c\u547d\u4ee4\u201cchage -M\uff08days\uff09\uff08user\uff09\u201d\u3002<\/p>\n<p>PASS_MAX_DAYS \u00a0\u00a060\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u5bc6\u7801\u5230\u671f\u65f6\u95f4<\/p>\n<p>PASS_MIN_DAYS \u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u521d\u59cb\u5bc6\u7801\u66f4\u6539\u65f6\u95f4<\/p>\n<p>PASS_MIN_LEN \u00a0\u00a0\u00a08\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u5bc6\u7801\u6700\u5c0f\u957f\u5ea6<\/p>\n<p>PASS_WARN_AGE \u00a0\u00a07\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u5bc6\u7801\u8fc7\u671f\u63d0\u793a\u65f6\u95f4<\/p>\n<p>\u91cd\u590d\u5bc6\u7801\u9650\u5236\u4f7f\u7528<\/p>\n<p># vi \/etc\/pam.d\/system-auth<\/p>\n<p># near line 15: prohibit to\u00a0use\u00a0the same password for\u00a05\u00a0generation in\u00a0past<\/p>\n<p>password \u00a0\u00a0\u00a0\u00a0sufficient \u00a0\u00a0\u00a0\u00a0pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5<\/p>\n<p>&nbsp;<\/p>\n<p>\u8bbe\u7f6e\u6700\u5c0f\u5bc6\u7801\u957f\u5ea6\uff0c\u7528\u6237\u4e0d\u80fd\u8bbe\u7f6e\u5c0f\u4e8e\u6b64\u53c2\u6570\u7684\u5bc6\u7801\u957f\u5ea6<\/p>\n<p># set 8 for minimum password length<\/p>\n<p># authconfig &#8211;passminlen=8 &#8211;update# the parameter is set in a config below<\/p>\n<p># grep &#8220;^minlen&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>minlen = 8<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u65b0\u5bc6\u7801\u4e2d\u8bbe\u7f6e\u540c\u4e00\u7c7b\u7684\u5141\u8bb8\u8fde\u7eed\u5b57\u7b26\u7684\u6700\u5927\u6570\u76ee<\/p>\n<p>set 4 for maximum number of allowed consecutive characters of the same class<\/p>\n<p># authconfig &#8211;passmaxclassrepeat=4 &#8211;update# the parameter is set in a config below<\/p>\n<p># grep &#8220;^maxclassrepeat&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>maxclassrepeat = 4<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u65b0\u5bc6\u7801\u4e2d\u81f3\u5c11\u9700\u8981\u4e00\u4e2a\u5c0f\u5199\u5b57\u7b26\u3002<\/p>\n<p># authconfig &#8211;enablereqlower &#8211;update# the parameter is set in a config below# (if you&#8217;d like to edit the value, edit it with vi and others)<\/p>\n<p># grep &#8220;^lcredit&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>lcredit = -1<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u65b0\u5bc6\u7801\u4e2d\u81f3\u5c11\u9700\u8981\u4e00\u4e2a\u5927\u5199\u5b57\u7b26<\/p>\n<p># authconfig &#8211;enablerequpper &#8211;update# the parameter is set in a config below<\/p>\n<p># (if you&#8217;d like to edit the value, edit it with vi and others)<\/p>\n<p># grep &#8220;^ucredit&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>ucredit = -1<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u65b0\u5bc6\u7801\u4e2d\u81f3\u5c11\u9700\u8981\u4e00\u4e2a\u6570\u5b57<\/p>\n<p># authconfig &#8211;enablereqdigit &#8211;update# the parameter is set in a config below<\/p>\n<p># (if you&#8217;d like to edit the value, edit it with vi and others)<\/p>\n<p># grep &#8220;^dcredit&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>dcredit = -1<\/p>\n<p>&nbsp;<\/p>\n<p>\u5bc6\u7801\u5305\u62ec\u81f3\u5c11\u4e00\u4e2a\u7279\u6b8a\u5b57\u7b26<\/p>\n<p># authconfig &#8211;enablereqother &#8211;update# the parameter is set in a config below<\/p>\n<p># (if you&#8217;d like to edit the value, edit it with vi and others)<\/p>\n<p># grep &#8220;^ocredit&#8221; \/etc\/security\/pwquality.conf<\/p>\n<p>ocredit = -1<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u65b0\u5bc6\u7801\u4e2d\u8bbe\u7f6e\u5355\u8c03\u5b57\u7b26\u5e8f\u5217\u7684\u6700\u5927\u957f\u5ea6\u3002 \uff08ex\u21d2&#8217;12345&#8217;\uff0c&#8217;fedcb&#8217;\uff09<\/p>\n<p>[root@linuxprobe~]# vi \/etc\/security\/pwquality.conf# add to the end<\/p>\n<p>maxsequence = 3<\/p>\n<p># \u8bbe\u7f6e\u65b0\u5bc6\u7801\u4e2d\u4e0d\u80fd\u51fa\u73b0\u5728\u65e7\u5bc6\u7801\u4e2d\u7684\u5b57\u7b26\u6570<\/p>\n<p># vi \/etc\/security\/pwquality.conf# add to the end<\/p>\n<p>difok = 5<\/p>\n<p>&nbsp;<\/p>\n<p>\u68c0\u67e5\u6765\u81ea\u7528\u6237passwd\u6761\u76ee\u7684GECOS\u5b57\u6bb5\u7684\u957f\u5ea6\u8d85\u8fc73\u4e2a\u5b57\u7b26\u7684\u5b57\u662f\u5426\u5305\u542b\u5728\u65b0\u5bc6\u7801\u4e2d\u3002<\/p>\n<p># vi \/etc\/security\/pwquality.conf# add to the end<\/p>\n<p>gecoscheck = 1<\/p>\n<p>&nbsp;<\/p>\n<p>\u8bbe\u7f6e\u4e0d\u80fd\u5305\u542b\u5728\u5bc6\u7801\u4e2d\u7684Ssace\u5206\u9694\u7684\u5355\u8bcd\u5217\u8868<\/p>\n<p># vi \/etc\/security\/pwquality.conf# add to the end<\/p>\n<p>badwords = denywords1 denywords2 denywords3<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e3a\u65b0\u5bc6\u7801\u8bbe\u7f6ehash \/ crypt\u7b97\u6cd5\u3002 \uff08\u9ed8\u8ba4\u4e3asha512\uff09# show current algorithm<\/p>\n<p># authconfig &#8211;test | grep hashing<\/p>\n<p>password hashing algorithm is\u00a0md5# chnage algorithm to sha512<\/p>\n<p># authconfig &#8211;passalgo=sha512 &#8211;update<\/p>\n<p># authconfig &#8211;test | grep hashing<\/p>\n<p>password hashing algorithm is\u00a0sha512<\/p>\n<p><strong><b>\u00a0<\/b><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51fa\u4e8e\u5b89\u5168\u8003\u8651\u8bbe\u7f6e\u5bc6\u7801\u89c4\u5219 \u8bbe\u7f6e\u5bc6\u7801\u5230\u671f\u7684\u5929\u6570\u3002 \u7528\u6237\u5fc5\u987b\u5728\u5929\u5185\u66f4\u6539\u5bc6\u7801\u3002 \u6b64\u8bbe\u7f6e\u4ec5\u5f71\u54cd\u521b\u5efa\u7528\u6237\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u73b0\u6709 &#8230; <a title=\"CentOS7.x \u8bbe\u7f6e\u5bc6\u7801\u89c4\u5219\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/centos7-x-%e8%ae%be%e7%bd%ae%e5%af%86%e7%a0%81%e8%a7%84%e5%88%99\/\" aria-label=\"\u9605\u8bfb CentOS7.x \u8bbe\u7f6e\u5bc6\u7801\u89c4\u5219\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49,5],"tags":[495],"class_list":["post-2405","post","type-post","status-publish","format-standard","hentry","category-linux","category-jishu","tag-centos7-x"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=2405"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2405\/revisions"}],"predecessor-version":[{"id":2406,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2405\/revisions\/2406"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}