Cheatsheets

共 57 篇文章。

在 FreeBSD 的 Firefox 3 上使用 Google Toolbar

• Cheatsheets

之前一直比较公开的一个秘密是,Google Toolbar实际上是可以在 FreeBSD 上运行的(注意不是通过 Linux ABI 支持)。不过 Firefox 3 发布之后,以前通过 Linux Firefox 安装 toolbar 这条路被堵住了,因此只好寻求新的解决途径。

阅读全文… ( 本文约 320 字,阅读大致需要 1 分钟 )

HOWTO: Fix Lenovo ThinkAdvantage Update caused boot problem for FreeBSD boot manager

• Cheatsheets

It seems that a recent ThinkAdvantage update will cause FreeBSD boot manager to have some problem (A “Drive 0” will appear as fifth option, and all other options would not work except a beep). It is possible to recover from this situation by using FreeBSD LiveFS disc (for amd64 platform):

Start from CD-ROM;
Choose “Fixit” and “CD-ROM”;
Now you get the command line prompt;
Mount your hdd to /mnt/;
mv /boot /boot.old && ln -s /mnt2/boot /boot
mv /usr /usr.old && ln -s /mnt2/usr /usr
“boot0cfg -B /dev/ad4” (Note: your SATA controller should be in AHCI mode, otherwise it should be ad0)
Then you will be able to use boot0cfg to configure the boot partition. Reboot system then everything will go well.

阅读全文… ( 本文约 150 字,阅读大致需要 1 分钟 )

作弊条:如何用pf实现基于源地址的发出流量分网卡/网关路由

• Cheatsheets

我想这可能是很多人比较关心的问题,特别是希望用一台机器,多块网卡,甚至有多个网关来实现伪双线的同学。

默认情况下FreeBSD系统中配置的网关,是不会自动使用多个网卡的。网关会与某一块网卡关联,并且,默认网关只能有一个。

但是,我们经常会遇到一些比较复杂的情况。例如,你有两块网卡,并且都接入了同一个网段,使用同一个网关,此时,所有的流量都会从一块网卡出去,另一块网卡则没有出流量;另一种比较极端的情况是,你有网通、电信各一个IP,但只有1台机器,而且机房也不给做BGP(当然,这是伪双线,我个人强烈建议不要使用这种机房服务),标准的路由方式就不太好用了。这时候,我们可以借助 FreeBSD 内建的 pf (通过route-to规则)来完成一些比较复杂的功能。

阅读全文… ( 本文约 536 字,阅读大致需要 2 分钟 )

作弊条:SSL/TLS证书的生成

• Cheatsheets

防止下次再求助于archive。这是我用来给自己的SMTP/POP3/HTTPS服务器生成证书的全部命令行,仅限服务器证书部分。

cd /usr/local/CA
openssl req -nodes -new -x509 -keyout mykey.pem -out myreq.pem \
-days 365 -config openssl.cnf
openssl x509 -x509toreq -in myreq.pem -signkey mykey.pem -out tmp.pem
openssl ca -config openssl.cnf -policy policy_anything \
-out mycert.pem -infiles tmp.pem
rm -f tmp.pem

参与评论

trac的ticket notification

• Cheatsheets

半作弊条性质。

找到trac环境目录。

进入其下的conf,揪出trac.ini
编辑,找到下面的段落替换为类似的内容

[notification]
always_notify_owner = true
smtp_always_cc = !!你的邮件列表名字!!
smtp_password = !!密码!!
smtp_enabled = yes
smtp_replyto = !!回复给谁?通常是管理员或留空!!
smtp_port = 25
always_notify_reporter = yes
smtp_server = !!邮件服务器名字!!
smtp_from = !!邮件以谁的身份发出?通常是trac管理员!!
smtp_user = !!登录邮件服务器的用户名!!

阅读全文… ( 本文约 223 字,阅读大致需要 1 分钟 )

作弊条:如何为postfix配置TLS

• Cheatsheets

以下内容为作弊条,仅供参考;只保证在FreeBSD下能用。

为postfix配置TLS的关键是产生自己的CA证书,并签署一年一续的服务证书。注意一定要保管好前者的私钥!

第一步,创建自签名CA:

mkdir /usr/local/etc/ca
cd /usr/local/etc/ca
mkdir certs crl newcerts private
echo 「01」 > serial
cp /dev/null index.txt
cp /etc/ssl/openssl.cnf openssl.cnf
vi openssl.cnf

阅读全文… ( 本文约 347 字,阅读大致需要 1 分钟 )

作弊条:如何限制ssh验证的cvs/svn用户权限

• Cheatsheets

传统上,SCM系统的用户登录有两种方式,一种是通过启动自己对应的服务,如cvs的cvs pserver或svn的svnserve、Apache DAV等等,而另一种方式是ssh,即不启动服务,而使用ssh来完成身份认证工作,如果通过,则通过ssh远程启动对应的服务,如cvs server和svnserve。

阅读全文… ( 本文约 766 字,阅读大致需要 2 分钟 )