FreeBSD 8.0 och sysctl.conf

24 Jan/10
2

Kategorier: FreeBSD, Nätverk, Exempel, Säkerhet

Beslutade mig för att gå igenom diverse inställningar i sysctl här om dagen då jag planerade att göra ena maskinen lite mer publik och lägga till diverse vänner och bekanta som användare. Googlade runt lite här och var för att få reda på vad alla grejer betydde och vad som skulle kunna vara vettiga värden. Resultatet är det som ni hittar nedan. Vill flagga/varna för att flertalet av dessa värden kanske inte är vad du önskar. Om du dock beslutar att använda filen, gör det på egen risk och kolla gärna igenom vad allt är.

Om något ser konstigt ut eller rent av är helt fel, tveka inte att säga till, all form av kritik är välkommet!

####################
#
# File:   /etc/sysctl.conf
# Author: Jesper Wallin (jesper@ifconfig.se)
# Date:   18-01-2010
#

###[ NETWORKING ]###

#
# limit responses to ICMP for bandwidth purposes
net.inet.icmp.icmplim=50
net.inet.icmp.icmplim_output=1
net.inet.icmp.drop_redirect=1
net.inet.icmp.log_redirect=1
net.inet.icmp.maskrepl=0
net.inet.icmp.bmcastecho=0

#
# make the identification header random in ip packets
net.inet.ip.random_id=1

#
# verify that a packet arrived on the correct interface
net.inet.ip.check_interface=1

#
# stop syn-flood attacks and route cache degregation during a high-bandwidth flood
net.inet.ip.rtexpire=2
net.inet.ip.rtminexpire=2
net.inet.ip.rtmaxcache=256

#
# don't accept sourcerouted packets (they are evil, gross, and have cooties)
net.inet.ip.accept_sourceroute=0
net.inet.ip.sourceroute=0

#
# icmp may not generate rst
net.inet.tcp.icmp_may_rst=0

#
# drop synfin packets
net.inet.tcp.drop_synfin=1

#
# enable tcp inflight (bandwidth delay product)
net.inet.tcp.inflight.enable=1
net.inet.tcp.inflight.min=6144

#
# defines the Maximum Segment Life
net.inet.tcp.msl=5000

#
# keep rfc1323 (high performance tcp) disable since it leaks our uptime
net.inet.tcp.rfc1323=0

#
# enable tcp sack support
net.inet.tcp.sack.enable=1

#
# regemerate our ISN secret for syn packets
net.inet.tcp.isn_reseed_interval=1800

#
# try to piggyback the ack packets with data packets
net.inet.tcp.delayed_ack=1
net.inet.tcp.delacktime=100

#
# increase the send/recieve buffers for tcp packets
net.inet.tcp.sendspace=65536
net.inet.tcp.recvspace=65536

#
# security against stealth port scans and some DoS attacks
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1

#
# up the maximum connections allowed, good for ddos's
kern.ipc.somaxconn=2048

#
# increase the size of network mbufs to allocate
kern.ipc.nmbclusters=65536

###[ PROCESSES ]###

#
# randomize process ID's
kern.randompid=123

###[ SECURITY ]###

#
# these two are enabled by default
security.bsd.unprivileged_proc_debug=1
security.bsd.conservative_signals=1

#
# only root can see all processes
security.bsd.see_other_gids=0
security.bsd.see_other_uids=0

#
# treat processes with uid 0 as privilged
security.bsd.suser_enabled=1

#
# we don't want people being able to read msgbuf of the entire system
security.bsd.unprivileged_read_msgbuf=0

#
# processes may not hardlink to files/directories owned by other users or groups
security.bsd.hardlink_check_uid=0
security.bsd.hardlink_check_gid=0

#
# only priviged processes may get the quota status of another user or group
security.bsd.unprivileged_get_quota=0

###[ KERNEL ]###

#
# update maximum files allowed for the kernel
kern.maxfiles=65536

#
# make the linux emulation work as intended
kern.fallback_elf_brand=3

För att ladda om dessa, spara filen till /etc/sysct.conf och kör följande:

/etc/rc.d/sysctl restart

2 Kommentarer

Profilbild
Datum 31-03-2010 21:39
Mike skrev:

jag tycker du borde "comit:a" dessa förklaringar till man-sidan... om det inte redan finns bra förklaringar i den nu för tiden.

Profilbild
Datum 01-04-2010 12:13

Står ju i man-sidan att -d förklarar vad MIB'en gör istället för att skriva ut värdet på den.

E.g:
user@host[~]$ sysctl net.inet.tcp.blackhole
net.inet.tcp.blackhole: 2
user@host[~]$ sysctl -d net.inet.tcp.blackhole
net.inet.tcp.blackhole: Do not send RST on segments to closed ports

Kan dock hålla med om att vissa av dessa förklaring är rätt så luddiga.

Kommentera





«