![failure2ban:11 줄은 키워드 또는 파일 이름으로 시작해야 합니다(큰따옴표 사용 가능).](https://linux55.com/image/118766/failure2ban%3A11%20%EC%A4%84%EC%9D%80%20%ED%82%A4%EC%9B%8C%EB%93%9C%20%EB%98%90%EB%8A%94%20%ED%8C%8C%EC%9D%BC%20%EC%9D%B4%EB%A6%84%EC%9C%BC%EB%A1%9C%20%EC%8B%9C%EC%9E%91%ED%95%B4%EC%95%BC%20%ED%95%A9%EB%8B%88%EB%8B%A4(%ED%81%B0%EB%94%B0%EC%98%B4%ED%91%9C%20%EC%82%AC%EC%9A%A9%20%EA%B0%80%EB%8A%A5)..png)
매일 Fail2Ban 서비스의 로그를 순환하지만 매일 이 오류가 발생합니다.
/etc/cron.daily/logrotate:
error: fail2ban:11 lines must begin with a keyword or a filename (possibly in double quotes)
이 내 꺼야/etc/cron.daily/logrotate file
#!/bin/sh
# Clean non existent log file entries from status file
cd /var/lib/logrotate
test -e status || touch status
head -1 status > status.clean
sed 's/"//g' status | while read logfile date
do
[ -e "$logfile" ] && echo "\"$logfile\" $date"
done >> status.clean
mv status.clean status
test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf
이것은 내 라인 11입니다.
mv status.clean status
오류에 따르면 이 줄에 오류가 있습니다. 이 파일 줄에 무슨 문제가 있는지 이해할 수 없는 것 같나요?
이것은 내 /etc/logrotate.d/fail2ban
파일입니다:
/var/log/fail2ban.log {
monthly
rotate 13
compress
delaycompress
missingok
notifempty
postrotate
fail2ban-client flushlogs 1>/dev/null
endscript
640 fail2ban adm
create 640 root adm
}
답변1
오류 메시지는 쉘 스크립트가 아니라 logrotate에서 나옵니다. 이것은 fail2ban
cron.daily 스크립트의 11번째 줄이 아니라 logrotate 구성 파일의 11번째 줄입니다 .
logrotate 구성 파일을 편집할 때 실수를 한 것 같습니다. 라인 11은 640 fail2ban adm
실제로 유효한 것이 아닙니다. 어쩌면 create
아래 줄의 일부로 말하는 것일까요 ?
fall2ban을 실행하는 Debian Jessie 머신에서 구성 파일을 확인했는데 다음과 같습니다:
/var/log/fail2ban.log {
weekly
rotate 4
compress
delaycompress
missingok
postrotate
fail2ban-client flushlogs 1>/dev/null
endscript
# If fail2ban runs as non-root it still needs to have write access
# to logfiles.
# create 640 fail2ban adm
create 640 root adm
}
...그래서 실제로 그 앞에 생성되어야 합니다(그리고 둘 중 하나는 주석 처리/제거되어야 합니다).
답변2
이 오류는 구성의 11번째 줄에 오류가 있음을 나타냅니다. logrotate 스크립트의 11번째 줄이 아닙니다.
640 fail2ban adm