다음 스크립트가 있는데 데비안에서 LSB 헤더를 어떻게 생성합니까? init.d를 넣고 싶습니다. Fedora에서는 가능하다는 것을 알고 있지만 Debian에서는 모르겠습니다. 아니면 어디에 어떻게 넣어야 하나요 rc.local
?
#!/bin/sh
# Variaveis
LOIF="lo"
LOIP="127.0.0.1/32"
LOOPBACKIF="lo"
LOOPBACKIP="127.0.0.1/32"
INTIF="eth0"
INTIP="192.3.1.2/32"
REDEINT="192.3.1.0/24"
EXTIF="eth1"
EXTIP="192.168.1.8/32"
UNIVERSO="0.0.0.0/0"
PALTAS="1024:65535"
IPTABLE="/sbin/iptables"
LOGGING="-l"
# Geral
echo " - Desabilitando ataques de IP Spoofing."
echo "2" > /proc/sys/net/ipv4/conf/all/rp_filter
# Habilitando FORWARDing
echo "1" > /proc/sys/net/ipv4/ip_forward
# Kill Timestamps
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
# Habilitando protecao a Cookie TCP SYN
echo " - Habilitando protecao a Cookie TCP SYN."
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
# Certifique que as configuracoes de diversos ICMP sanity estao presentes.
echo " - Habilitando configuracoes de ICMP."
# Desabilitando protecao a echo de broadcast ICMP.
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Habilitando protecao a mensagem de "bad error"
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
# Desabilitando redirecionamentos de ICMP
echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects
# Logar pacotes spoofed, roteados na origem ou redirecionados.
echo " - Logar pacotes spoofed, roteados na origem ou redirecionados "
echo "1" > /proc/sys/net/ipv4/conf/all/log_martians
# Set out local port range
echo "32768 61000" > /proc/sys/net/ipv4/ip_local_port_range
# Reduce Dos'ing ability by reducing timeout
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout
echo "1800" > /proc/sys/net/ipv4/tcp_keepalive_time
echo "0" > /proc/sys/net/ipv4/tcp_window_scaling
echo "0" > /proc/sys/net/ipv4/tcp_sack
# Carga dos Modulos
/sbin/modprobe ip_tables
/sbin/modprobe iptable_filter
/sbin/modprobe ip_nat_ftp
/sbin/modprobe iptable_nat
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
#Regra para pacotes com defeito
$IPTABLE -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLE -A INPUT -m state --state INVALID -j DROP
$IPTABLE -A FORWARD -m state --state INVALID -j DROP
$IPTABLE -t nat -A POSTROUTING -s $REDEINT -d $UNIVERSO -o $EXTIF -j MASQUERADE
답변1
파일 헤더에는 다음 블록이 있어야 합니다.
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
필요에 맞게 사용자 정의하세요.
자세한 내용은 다음을 참조하세요.데비안 LSB 초기화 스크립트 위키페이지.