Computer >> 컴퓨터 >  >> 프로그램 작성 >> HTML

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

HTTP 인증을 통한 비밀번호 보호 로그인 페이지: 6천만 개의 WordPress 웹사이트가 있어 세계에서 가장 인기 있는 웹사이트 구축 플랫폼입니다. 하지만 이 인기에는 대가가 있습니다. WordPress 사이트에서는 하루 1분마다 약 90,978회의 해킹 시도가 이루어집니다. 해커가 웹 사이트에 침입하기 위해 사용하는 다양한 방법이 있지만 매우 인기 있고 널리 사용되는 방법 중 하나를 무차별 대입 공격이라고 합니다. 이러한 유형의 공격에서 해커는 봇이 자격 증명으로 로그인을 올바르게 시도하고 추측하도록 봇을 프로그래밍하므로 WordPress 로그인 페이지를 보호해야 합니다.

로그인 보호에 대한 이전 게시물에서 우리는 고유한 사용자 이름을 만들고 강력한 암호를 적용하는 것에 대해 논의했습니다. 해커 봇을 사이트에 접근하지 못하게 하는 효과적인 방법이지만 보안과 관련하여 사이트가 안전하게 유지된다는 절대적인 보장은 없습니다. 인터넷은 그 어느 때보다 안전한 곳이었으며 어느 정도의 보안으로도 충분하지 않습니다. 따라서 사이트를 여러 겹으로 보호하는 것이 좋습니다. 고유한 사용자 이름과 암호가 중요하지만 로그인 페이지를 잠그는 것도 보안을 위한 중요한 단계입니다. 이를 수행하는 한 가지 방법은 HTTP 인증으로 로그인 페이지를 암호로 보호하는 것입니다. 이 게시물에서는 이를 달성할 수 있는 방법을 보여드리겠습니다.

HTTP 인증이란 무엇입니까?

HTTP 인증 또는 HTTP 기본 인증(BA)은 로그인 페이지에 대한 액세스를 제한하는 기술입니다. 간단한 비유를 하자면 웹사이트를 집이라고 생각하십시오. 메인 도어는 로그인 페이지입니다. 사람들이 집에 침입하려고 할 수 있으므로 강력한 잠금 장치를 설치해야 합니다. 자물쇠는 로그인 자격 증명을 의미합니다. 정문 너머에는 집을 추가로 보호하는 울타리가 있습니다. 비슷한 방식으로 HTTP 인증은 집에 추가 보호 계층을 제공합니다. 즉, 로그인 페이지에 액세스하려는 사람은 먼저 HTTP 인증(펜스)과 로그인 자격 증명(정문)을 거쳐야 합니다.

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법 ?

HTTP 인증으로 WordPress 사이트를 보호하려면 가장 먼저 .htpasswd 파일을 생성해야 합니다. 그런 다음 웹 사이트의 .htaccess 파일에 .htpasswd 파일의 위치를 ​​알려야 합니다. 그러면 로그인 페이지가 잠깁니다.

.htpasswd 파일을 만드는 방법은 무엇입니까?

이 특정 파일에는 로그인 페이지에 액세스하려는 사람들의 사용자 이름과 암호를 저장합니다. 기본적으로 집을 둘러싸고 있는 울타리에 문이 있는 것과 같습니다. 사이트에 액세스할 수 있는 사람에게만 게이트 키를 제공할 수 있습니다. .htpasswd 파일을 만드는 방법을 알아보겠습니다.

새 .htpasswd 파일을 만들려면 .htpasswd 명령줄 도구를 사용해야 합니다. 온라인에서 사용할 수 있는 여러 도구가 있습니다. 사용하고 싶은 것을 찾으면 그것을 열고 명령줄에서 다음 코드를 작성하십시오:

htpasswd -c .htpasswd 하리니

이 명령줄에서 c는 create를 나타내고 harini는 우리가 선택한 사용자 이름입니다. 이 코드를 입력한 후 Enter 키를 누르면 이 사용자 이름에 고유한 암호를 생성하라는 메시지가 표시됩니다. 괜찮아요; 비밀번호가 암호화됩니다.

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

그러나 이미 .htpasswd 파일이 있는 경우 새 사용자 이름과 암호를 추가하기만 하면 됩니다. 다음 명령줄을 작성하여 수행할 수 있습니다.

htpasswd .htpasswd 라훌

새 파일을 생성하지 않기 때문에 여기에서 -c를 사용하지 않은 것에 주목하십시오.

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

일반적으로 .htpasswd 파일은 다음과 같습니다:username:encrypted_password. So if the username is harini and the password is dummy123pass, then the .htaccess file would be:harini:$apr1$50r17zis$lNbFJs4rQFfkp4ToO2/ZS/

The password has been encrypted. This .htaccess file is essentially your HTTP Basic Authentication credentials.

In case, you don’t want to use a tool or don’t know how to; you can use a .htpasswd generator. Open this link, and you should be able to see a window like an image below.

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

Type the username and password of your choice. There is an option to generate a random password too. Once done, hit the button that says Generate .htpasswd file. You should be able to see an output.

Modifying the .htaccess File

The .htaccess file is one of the most important files of your WordPress site. There are two things we’ll do with your .htaccess file. One, we’ll tell it what it needs to restrict and two, we tell it from where it could get the HTTP Basic Authentication credentials we just created in the steps above.

.htaccess is present in the public_html folder. To access it you will have to visit your web host account. Log in to your web host and go to a page called cPanel. There you should be able to find an option for File Manager. Select that, and a page will open, and in that page, you should be able to view the file.

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

Sometimes .htaccess is hidden and may not appear in the public_html folder. When that’s the case, what you need to do is go back to the cPanel, and click on File Manager. A popup will appear where you’ll have to select ‘Show Hidden Files.’

HTTP 인증으로 로그인 페이지를 비밀번호로 보호하는 방법은 무엇입니까?

Next, you need download the file and then open it to add this code of line:

<Files wp-login.php>

AuthUserFile /path/to/.htpasswd

AuthName "Private access"

AuthType Basic

require valid-user

</Files>

A few things you need to keep in mind when inserting this code: AuthUserFile /path/to/.htpasswd – is the path to the .htpasswd file you just created. Make sure the path is correct. The term ‘valid-user’ tells the system any user who has been mentioned in the .htpasswd file with access to the login page. But if you want to be selective about who you grant access to, then instead of using ‘valid-user’, you can just mention the usernames.

After you are done, save it and upload it to the same place from where you downloaded it. 그리고 그게 다야. The next time you try to access the login page, you’ll see a small window appearing asking you for specific login credentials.

Besides HTTPS authentication, we suggest that you also implement two-factor authentication, which will add another layer of security to your WordPress login page.

Also take a few more security measures like moving your site from HTTP to HTTPS, installing a security plugin, protecting the login page, etc. While protecting your login page is a great idea, there are other ways in which hackers can gain access to your website. We strongly suggest that you take a more holistic approach to security by following our guide on Complete WordPress Security.