| 안녕하세요?
iptables rule을 웹에서 볼 수 있도록 cgi를 짜보려고 합니다. 브라우저를 통해 룰을 리스트하고, 필요하다면 룰의 추가와 삭제 기능도 넣고 싶습니다.
하지만 iptables룰은 파일 형태로 관리되는 건 아닌것 같습니다. /proc 밑에도 이와 관련된 설정은 없는 것 같구요...
그래서 iptables의 룰 테이블을 파일로 출력하고 파일을 읽어와서 웹 페이지로 뿌리려고 생각중인데요,
보통 콘솔에서는 다음과 같이 하면 파일이 만들어지잖아요?
# iptables -t nat -L > /jffs/iptables.rule
그대로 cgi program에 넣고 돌려봤습니다.
2 #include <stdio.h>
3
4 int main(void)
5 {
6 printf(Content-type : text/html\n\n);
7
8 system(iptables -t nat -L > /jffs/iptables.rule);
9
10 /* read iptables.rule and convert it to <table>. */
11 /* ... future work ... */
12
13 return 0;
14 }
컴파일 뒤에 browser에서 이 파일을 호출해도 /jffs/iptables.rule파일은 만들어지지 않던데요, 왜 그런가요? 어떻게하면 브라우저로 룰 파일을 서버에 만들수 있을까요?
3 <html>
4 <head>
5 <title> iptables management page </title>
6 </head>
7
8 <!- ------------------------------------->
9 <body>
10
11 <form method=get action=cgi-bin/iptablespage.cgi>
12 display iptables
at rules <br>
13 <input type=submit name=utton value=show me nat tables rules>
14 </form>
15
16 </body>
17
18 </html>
|