[그누보드] 그누보드 스팸봇 차단 실전 가이드 – 운영자라면 꼭 해야 할 보안 튜닝!


2025-05-03 23:44
27
0
본문
1️⃣ 구글 reCAPTCHA v2/v3 도입하기
가장 확실하고 공식적인 방법입니다.
### 적용 위치
-
회원가입 폼 (
/bbs/register_form.php
) -
로그인 폼 (
/bbs/login.php
) -
글쓰기 폼 (
write.skin.php
또는write.tail.skin.php
)
✅ 적용 예시 (v2 체크박스 방식)
<!-- HTML form 안에 추가 -->
<div class="g-recaptcha" data-sitekey="사이트키"></div>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
그리고 PHP에서는 다음 코드로 인증 확인:
$secretKey = '비밀키';
$response = $_POST['g-recaptcha-response'];
$data = ['secret' => $secretKey, 'response' => $response];
$options = ['http' => [
'method' => 'POST',
'content' => http_build_query($data),
]];
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success = json_decode($verify);
if (!$captcha_success->success) {
alert('로봇 확인에 실패했습니다.');
}
2️⃣ .htaccess로 해외 IP 차단
스팸봇은 종종 해외 서버를 통해 유입됩니다. 해외 IP 차단으로 기본 방어선 구성 가능.
.htaccess
예시
# Korea IP만 허용 (예시)
<RequireAll>
Require ip 123.456.0.0/16
Require ip 789.101.0.0/16
</RequireAll>
3️⃣ honeypot 필드 삽입 (봇 전용 잡기용 필드)
사용자에게는 보이지 않지만 봇은 채워 넣는 필드를 두면 쉽게 잡을 수 있습니다.
✅ 예시
HTML 폼에:
<input type="text" name="hp_check" style="display:none">
PHP에서는:
if (!empty($_POST['hp_check'])) {
alert('스팸봇으로 의심됩니다.');
}
댓글목록0
댓글 포인트 안내