๊ตฌ์ฑ ํ์ผ์ ignoreregex ์ต์
์ด ์๋ํ์ง ์์ต๋๋ค(v0.8.4).
fail2ban-regex๋ก ํ
์คํธํ ๋ "์ ๊ท ํํ์์ ์ปดํ์ผํ ์ ์์" ์ค๋ฅ๋ ๋ฐ์ํ์ง ์์ต๋๋ค.
fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf
์ผ์นํ๋ ํญ๋ชฉ์ด ์์ต๋๋ค.
|- Regular expressions:
|
`- Number of matches:
์์:
suhosin.conf
[Definition]
failregex = suhosin\[\d*\].*\(attacker\s'<HOST>'.*
ignoreregex = suhosin\[\d*\].*(memory_limit).*\(attacker\s'<HOST>'.*
์ค๋ฅ ๊ธฐ๋ก
Dec 17 15:51:13 server suhosin[27622]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'action' (attacker '67.210.100.166', file '/bla.php')
Dec 17 15:51:13 server suhosin[27624]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'board' (attacker '67.210.100.166', file '/bla.php')
Dec 17 15:51:13 server suhosin[27624]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'topic' (attacker '67.210.100.166', file '/bla.php')
Dec 20 18:58:21 server suhosin[4088]: ALERT - script tried to increase memory_limit to 120000000 bytes which is above the allowed value (attacker '123.123.123.123', file '/bla.php', line 10)
Dec 20 18:58:32 server suhosin[4051]: ALERT - script tried to increase memory_limit to 120000000 bytes which is above the allowed value (attacker '123.123.123.123', file '/bla.php', line 10)
๋๋ ๋ชจ๋ ์ํธ์ ๊ณต๊ฒฉ์ ์ผ์น์ํค๊ณ memory_limit๋ฅผ ๋๋ฆฌ๋ ค๊ณ ๋ชจ๋ ๊ณต๊ฒฉ์ ๋นผ๋ ค๊ณ ํฉ๋๋ค.
์ค๋ช ํ๊ธฐ: ignoreregex๋ฅผ ์ ํ ์ง์ ํ์ต๋๊น?
$> /usr/bin/fail2ban-regex | head
Usage: /usr/bin/fail2ban-regex [OPTIONS] <LOG> <REGEX> [IGNOREREGEX]
๋ฐ๋ผ์ ์๋ฅผ ๋ค์ด sshd.conf์ ignoregex๋ฅผ ์ถ๊ฐํ๋ฉด (ํผํ ํ์๊ฐ ์์ง๋ง
ignoreregex์ ๋ํ ์ผ์น๊ฐ ์ ์ฒด์ ์ ์ฉ๋๋ฏ๋ก ์ ๋ฉด์ ๊ณ ์
๋ผ์ธ, ์คํธ๋ฆฝ ์๊ฐ/๋ ์ง ์์) -- ๋ชจ๋ ์ข์ต๋๋ค.
$> ./fail2ban-regex testcases/files/logs/sshd config/filter.d/sshd.conf config/filter.d/sshd.conf 2>/dev/null | grep -A2 Ignoreregex
Ignoreregex: 2 total
|- #) [# of hits] regular expression
| 1) [2] \s*(?:\S+ )?(?:kernel: \[\d+\.\d+\] )?(?:@vserver_\S+ )?(?:(?:\[\d+\])?:\s+[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?|[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?(?:\[\d+\])?:)?\s*(?:error: PAM: )?Authentication failure for .* from <HOST>\s*$
$> grep ignoreregex config/filter.d/sshd.conf
# Option: ignoreregex
ignoreregex = %(__prefix_line)s(?:error: PAM: )?Authentication failure for .* from <HOST>\s*$
2012๋ 12์ 21์ผ ๊ธ์์ผ Jens-Andrรฉ Koch๋ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
๊ตฌ์ฑ ํ์ผ์ ignoreregex ์ต์ ์ด ์๋ํ์ง ์์ต๋๋ค(v0.8.4).
fail2ban-regex๋ก ํ ์คํธํ ๋ "Unable to compile regular
์" ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ผ์นํ๋ ํญ๋ชฉ์ด ์์ต๋๋ค.์ ๊ท์ ๋ฌด์
|- ์ ๊ท ํํ์:`- ์ผ์น ํ์:
์ผ๋ฐ ๊ตฌ์ฑ ์ต์ ์ด ๋๋ฝ๋์๊ฑฐ๋ ๋ฒ๊ทธ์ ๋๊น?
์ผ๋ก์ฌ๋ผํ O. ํ ์ฒธ์ฝ
์ฌ๋ฆฌํ ๋ฐ ๋๊ณผํ๋ถ ๋ฐ์ฌํ ์ฐ๊ตฌ์
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
์ ํ: +1 (603) 646-9834 ํฉ์ค: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
:+1:
์, ๋น์ ๋ง์ด ๋ง์. ์ฌ๋ฐ๋ฅธ ์ธ ๋ฒ์งธ ๋งค๊ฐ๋ณ์๋ฅผ ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
์ด๊ฒ์ ๊ฒ์ํ๊ธฐ ์ ์ ๋งค๋ด์ผ ํ์ด์ง๋ฅผ ์ฝ์์ด์ผ ํ์ต๋๋ค.
์ด์จ๋ ์ด๊ฒ์ ์๋ํฉ๋๋ค.
fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf /etc/fail2ban/filter.d/suhosin.conf
๋ฌธ์ ๋ฅผ ๋ซ์ต๋๋ค. ๋ฉ๋ฆฌ ํฌ๋ฆฌ์ค๋ง์ค. ์๋ ํ ๊ณ์ธ์.
๋ฉ๋ฆฌ ํฌ๋ฆฌ์ค๋ง์ค! ;)
2012๋ 12์ 21์ผ ๊ธ์์ผ Jens-Andrรฉ Koch๋ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
[1]:+1:
์, ๋น์ ๋ง์ด ๋ง์. ์ฌ๋ฐ๋ฅธ ์ธ ๋ฒ์งธ ๋งค๊ฐ๋ณ์๋ฅผ ์๋ ค์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
์ด๊ฒ์ ๊ฒ์ํ๊ธฐ ์ ์ ๋งค๋ด์ผ ํ์ด์ง๋ฅผ ์ฝ์์ด์ผ ํ์ต๋๋ค.
์ด์จ๋ ์ด๊ฒ์ ์๋ํฉ๋๋ค.
fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf
/etc/fail2ban/filter.d/suhosin.conf๋ฌธ์ ๋ฅผ ๋ซ์ต๋๋ค. ๋ฉ๋ฆฌ ํฌ๋ฆฌ์ค๋ง์ค. ์๋ ํ ๊ณ์ธ์.
โ
์ด ์ด๋ฉ์ผ์ ์ง์ ํ์ ํ๊ฑฐ๋ [2]GitHub์์ ํ์ธํ์ธ์.์ฐธ๊ณ ๋ฌธํ
๋ณด์ด๋ ๋งํฌ
์ผ๋ก์ฌ๋ผํ O. ํ ์ฒธ์ฝ
์ฌ๋ฆฌํ ๋ฐ ๋๊ณผํ๋ถ ๋ฐ์ฌํ ์ฐ๊ตฌ์
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
์ ํ: +1 (603) 646-9834 ํฉ์ค: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
:+1:
์, ๋น์ ๋ง์ด ๋ง์. ์ฌ๋ฐ๋ฅธ ์ธ ๋ฒ์งธ ๋งค๊ฐ๋ณ์๋ฅผ ์๋ ค์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
์ด๊ฒ์ ๊ฒ์ํ๊ธฐ ์ ์ ๋งค๋ด์ผ ํ์ด์ง๋ฅผ ์ฝ์์ด์ผ ํ์ต๋๋ค.
์ด์จ๋ ์ด๊ฒ์ ์๋ํฉ๋๋ค.
๋ฌธ์ ๋ฅผ ๋ซ์ต๋๋ค. ๋ฉ๋ฆฌ ํฌ๋ฆฌ์ค๋ง์ค. ์๋ ํ ๊ณ์ธ์.