标签:back ref bin 有效期 config 传统 tle line new t
一、Managing Services in FreeBSD
service sshd onerestart
/* 如下为启动脚本的基本格式 */
#!/bin/sh # PROVIDE: xxx #将要启动的程序名称 # REQUIRE: xxx #在指定进程之后启动——依賴 # BEFORE: xxx #在指定进程之前启动——被依賴 # KEYWORD: shutdown #表示在关机之前执行正常程序终止流程 . /etc/rc.subr #固定格式,载入系统預定义的规则(函数等) name=xxx #指定該脚本的名称 rcvar=${name}_enable #指定用于 /etc 下 rc.conf 或 rc.conf.local 的开机启动标志(語法) command="/usr/sbin/${name}" #指定可执行文件的路径 pidfile="/var/run/${name}.pid" #指定 pid 文件,提高操作效率 # 以下两行为固定格式 load_rc_config $name #使 rc.subr 载入 rc.conf 中的参数 run_rc_command "$1" #使 rc.subr 载入当前脚本中定义的参数
ifconfig_fxp0="inet 10.1.1.1/24" #物理 NIC ,首 IP
ifconfig_fxp0_alias0="inet 10.1.1.2 netmask 0xffffffff"
ifconfig_fxp0_alias1="inet 10.1.1.3 netmask 255.255.255.255"
ifconfig_fxp0_alias2="inet 10.1.1.4/32"
ifconfig_fxp0_alias3="inet 10.1.1.5/32"
ifconfig_fxp0_alias4="inet 202.0.75.17 netmask 255.255.255.240" #新网段,首 IP
ifconfig_fxp0_alias5="inet 202.0.75.18/32"
ifconfig_fxp0_alias6="inet 202.0.75.19 netmask 0xffffffff"
ifconfig_fxp0_alias7="inet 202.0.75.20/32"
简写模式:
ifconfig_alc0_aliases="inet 10.1.1.1-5/24 inet 202.0.75.17-20/28"
*.err;kern.*;auth.notice;authpriv.none;mail.crit /dev/console
注:all facility 的大于或等于(=>) err 級别(level)的日志,kern facility 的所有 level 日志,及 mail facility 的 =>crit level 的日志,显示到控制台;authpriv facility 的所有 level 日志均不显示在控制台
*.info;mail.none;authpriv.none /var/log/messages
注:除了 mail 与 authpriv 之外的所有 facility 的 info level 以上的日志,记录到 messages 文件
daemon.=debug /var/log/daemon.debug
注:记录 daemon facility 的 debug level 日志(“=” 指仅记录此一个級别)
authpriv.* /var/log/secure
注:authpriv facility 的所有 level 日志记录到单独的文件以确保安全
mail.* -/var/log/maillog
注:记录 mail facility 的所有 level 日志,但 I/O 不以 fsync 方式同步(“-” 指以普通緩存形式执行非同步写入,以减少到系统性能的影响)
*.emerg *
*.emerg @arpa.berkeley.edu
注:以上两行,将所有 facility 的 emerg level 日志记录到远程主机,即使已记录到其它位置(“*” 指重置,对应的日志可重复记录)
*.alert root,eric
注:仅 root 及 eric 两个用户可以收到 alert 信息
auth.* |exec /usr/local/sbin/authfilter
注:将 auth facility 的所有 level 日志首先通过管道传递給 authfilter 处理
console.* /var/log/console.log
注:将所有原先写往控制台的信息,记录到文件
!ipfw
*.* -/var/log/ipfw
!*
注:以上三行,仅记录 ipfw 程序产生的日志,且非同步写入(使用緩存),“!” 指明接下来的内容仅对 ipfw 有效,最后的 "!*" 将重置记录对象
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
1 logfilename:生成的分段日志文件存放路径,如:/root/logdir
2 [owner:group]:可选项,指定生成的文件的属主属組,如:root:wheel
3 mode:指定生成的文件的訪问权限,如:0600
4 count:指定能生成的最大文件数量
5 size:数字,以 KB 为单位,指定日志大小維度的触发条件
6 when:指定时间維度的触发条件,如:$D23(每天 23:00)、$W5D20(每周五 20:00 ,W0 指星期日)、$M10D0(每月的第 10 天 00:00)
7 flags:指定压缩格式等,如:X 指用 xz 压缩以节約空间;B 指源文件为二进制格式,直接压縮不添加备注信息
/etc/syslog.conf +logclient.example.org # “+” 指接受远程主机存储日志 *.* /var/log/logclient.log #指定远程客户端的日志存储位置
/etc/rc.conf syslogd_enable="YES" syslogd_flags="-d -a logclient.example.org -v -v"
# -d ,Put syslogd into debugging mode(仅用于故障調试)
# -a 指添加,多个客户端須用多个 -a 选项,格式可以为:IP/masklen:port 或 IP/masklen:syslogd 或 hostname:syslogd 等,syslogd可以替换为其它可用的日志服务器名称
# -v -v 指存储详细信息,日志按 facility 分类显示
/etc/syslog.conf *.* @logserv.example.org # “@” 指将日志存储到其后的 hostname 主机之上
/etc/rc.conf syslogd_enable="YES" syslogd_flags="-s -v -v" # -s 不为其它主机存储日志,若 -s -s (两个 -s),则同时不能将日志存储到其它主机
1 /etc Generic system-specific configuration information
2 /etc/defaults Default versions of system configuration files
3 /etc/mail Extra sendmail configuration and other MTA configuration files
4 /etc/ppp Configuration for both user- and kernel-ppp programs
5 /etc/namedb Default location for named data. Normally named.conf and zone files are stored here
6 /usr/local/etc Configuration files for installed applications. May contain per-application subdirectories
7 /usr/local/etc/rc.d rc scripts for installed applications.
8 /var/db Automatically generated system-specific database files, such as the package database and the locate database
[Internet address] [official hostname] [alias1] [alias2] ...
如:
10.0.0.4 myname.xxx.org myname cat monkey
kern.ipc.soacceptqueue 默认值是 128,limits the size of the listen queue for accepting new TCP connections.For Web Server,increase this value to 1024 or higher. net.inet.ip.portrange.first/net.inet.ip.portrange.last 服务器主动对外连接可用的端口范围:last - first sysctl kern.maxvnodes/sysctl vfs.numvnodes maxvnodes 指系统最大可用 vnodes 数量,numvnodes 指当前已用数量;当后者的数量与前者接近时,有必要提升前者的值,以避免 I/O 瓶颈
二、The FreeBSD Booting Process
# If console is marked "insecure", then init will ask for the root password when going to single-user mode console none unknown off insecure
三、Security
rctl requires the kernel to be compiled with: options RACCT options RCTL 启用 rctl 支持: 在 /boot/loader.conf 中 添加 kern.racct.enable=1 #只读项,无法能过 sysctl 直接设置 /etc/rctl.conf 格式: subject:subject-id:resource:action=amount/per(user/process...) 示例:jail:httpd:memoryuse:deny=2G/jail #Block jail from using more than 2G memory subject:process, user, loginclass, or jail subject-id:process ID, user name, numerical user ID, login class name, or jail name resouce:memoryuse, maxproc, datasize(单文件大小), pcpu(single CPU 占用率), readbps(bytes/sec), writebps(B/sec), readiops(operations/sec), writeiops(每秒钟的 I/O 写数量) action:
<1> deny(deny the allocation,not supported for cputime, wallclock, readbps, writebps, readiops, and writeiops)
<2> log(log a warning to the console)
<3> throttle(slow down process execution; only supported for readbps, writebps, readiops, and writeiops)
pw lock USERNAME 或 chsh -s /usr/sbin/nologin USERNAME
#賦予 webadmin 組的成员操作 apache24 的权限
%webadmin ALL=(ALL) /usr/sbin/service apache24 *
# /etc/pam.d/passwd # 格式如下: # module-type control-flag pam_passwdqc [options] password requisite pam_passwdqc.so min(密码最小长度:N0...N5,分别指明不同复杂度性况下的长度要求)=disabled,18,14,12,10 max(密码最大长度)=40 similar(是否允许与以前设置过的密码类似)=permit|deny enforce(策略类型:仅警告|普通用户|包括 root )=none|users|everyone
:passwd_format=blf:\ #设置密码加密算法为 Blowfish :passwordtime=90d:\ #设置所有普通账户的密码有效期为 90 天 #配置完成后,执行 cap_mkdb /etc/login.conf 使之生效
四、Jails
五、Storage
六、Updating and Upgrading FreeBSD
七、Dtrace
标签:back ref bin 有效期 config 传统 tle line new t
原文地址:http://www.cnblogs.com/hadex/p/6057941.html