目前分類:FreeBSD (119)

瀏覽方式: 標題列表 簡短摘要
延續上一篇打造安全的 SMTP Server 後,再補上一篇安全的 POP3 Server。以往使用 Outlook Express 時都是用預設沒有加密的 110 Port 來收信,這次我再來把它補強一下,讓它收信的過程中也是加密傳輸以提高安全性。首先切換到 qpopper 的目錄中來安裝,安裝的過程中請記得勾選 SSL 的選項喔



# cd /usr/ports/mail/qpopper
# make install clean

接下來我們要去產生二個 QPopper 所需要的二個設定檔,一個是一般未加密用的,另一個是加密傳輸用的。

# cd /usr/local/etc/qpopper
# touch qpopper.conf qpopper-s.conf

qpopper.conf 內容如下

set clear-text-password = always
set statistics = true
set tls-support = stls
set tls-private-key-file = /path/to/your/key
set tls-server-cert-file = /path/to/your/crt

qpopper-s.conf 內容如下

set clear-text-password = tls
set statistics = true
set tls-support = alternate-port
set tls-private-key-file = /path/to/your/key
set tls-server-cert-file = /path/to/your/crt

然後我們再去設定 inetd.conf 這檔案,把 pop3 的服務加進去\


pop3 stream tcp nowait root /usr/local/libexec/qpopper qpopper -s -l 1 -p 4 -f /usr/local/etc/qpopper/qpopper.conf
pop3s stream tcp nowait root /usr/local/libexec/qpopper qpopper -s -l 2 -p 4 -f /usr/local/etc/qpopper/qpopper-s.conf

最後重新啟動 inted ,再檢查一下有沒有起來吧!


qpopper

Bojack 發表在 痞客邦 留言(0) 人氣()

Postfix 用蠻久了,這次將過去的筆記都整理上來,以備不時之需。目前的環境是 FreeBSD 6.2 PRELEASE,要將本來的 Sendmail 換成 Postfix ,並且讓它支援身份驗證、加密傳輸與垃圾郵件過濾的功能。


1. 安裝 Postfix 主程式


首先我們要安裝 Postfix ,先更新 ports 後,直接切換到目錄後安裝



# cd /usr/ports/mail/postfix
# make install clean

Postfix configureation options 的選項我是勾選 SASL、TLS、OPENLDAP 這三個選項。SASL 是用來做身份驗證,TLS 是支援加密傳輸,而 OPENLDAP 是未來要試著將它們二者結合在一起,未來完成後會將筆記寫上來。選好後就按 OK 吧,而在安裝 Cyrus-sasl 時,只要勾選 pwcheck 就行了,然後再繼續往下跑,安裝到後面,會出現一行


Bojack 發表在 痞客邦 留言(0) 人氣()

2018.09.18 更新加入 FreeBSD 11.2 版本

當加入新硬碟時,可以先到 /var/log/message 檔案裡去確認新加入硬碟代號,以我這次範例為加入一顆 2GB 硬碟,代號為 ada1

首先先使用 gpart 指令來分割一下新建立的硬碟

# gpart create -s GPT ada1

# gpart add -t freebsd-ufs -a 1M ada1

接下來可以用 show 指令來看分割完的情況

# gpart show ada1

接下來就在分割區建立檔案系統

# newfs -U /dev/ada1p1

假設我要掛載一個是給網頁用的資料目錄,例如 /www,就先建立一個空目錄

# mkdir /www

將新建好的 /dev/ada1p1 與 /www 目錄掛在一起,並設定開機好自動 mount

# vi /etc/fstab

/dev/ada1p1 /newdisk ufs rw 2 2

最後 Mount 起來就可以用了

# mount /www

參考資料 : https://www.freebsd.org/doc/zh_TW/books/handbook/disks-adding.html

以下為舊資料

FreeBSD 6 為例,Mount 新的硬碟只需要幾個步驟就好

# sysinstall

 


情況1.我是要加入一顆全新的硬碟

 


將光棒移至 Configure -> Fdisk


此時就像一開始切割安裝硬碟一樣,選擇要 mount 的硬碟,把全部都切為 165 給 BSD 使用吧


Boot manager 就選擇 none


接下來選擇 Label,先按 C 來切割磁區,好了之後就按 W 寫入即可,此時要記下 Part 部份的代號唷



情況2.我是要加入一顆先前曾安裝過 FreeBSD 的硬碟


這種情況就只是要 mount 上去而已


將光棒移至 Configure -> Label


將光棒移到下方要 mount 的磁區後,直接按下 M,然後打入你要 mount 的磁區名稱,再按下 W 寫入


一樣,此時要記下 Part 部份的代號

 


離開 sysinstall 畫面後,打 df 應該就可以看到我們剛才 mount 上去的磁區了。若是要開機後自動 mount 新加入的硬碟,請去修改 /etc/fstab , 加入下面這行 (請視情況修改)

 

/dev/ad1s1e /osa_backup ufs rw 2 2


最左邊的 /dev/ad1s1e 就是剛才一直要您記下的 Part 代號,這樣以後開機後就會自動 mount 新硬碟囉!

Bojack 發表在 痞客邦 留言(0) 人氣()

先前在王俊斌的網站就看到這個小巧可愛的 FTP Server 了,今晚參考並做下筆記,不過原來的說明已經非常清楚了 ~


可以利用 ports 來快速安裝,安裝方式如下:



# cd /usr/ports/ftp/smbftpd
# make install clean

或者用 tarball 的方法來安裝,方式如下:



# cd /usr/ports/ftp/smbftpd
# make fetch
# cd /tmp
# cp /usr/ports/distfiles/smbftpd-0.96.tar.gz .
# tar zxvf smbftpd-0.96.tar.gz
# cd smbftpd-0.96
# ./configure
# make
# make certs ( 如果需要 SSL 加密的話,可以在此製作憑證)
# make install

若已經有憑證的話,上面的 make certs 就可以不用做 ... 等一下我們再來設定也行(也可以參考這篇來製作自己的憑證)。


接下來切換到 /usr/local/etc/smbftpd/ 裡面,來設定一下 smbftpd.conf 就可以讓它 work 了,詳細的設定請參考這裡,再也沒有比這還詳細的說明 XD


Server 運作的模式選用 standalone 方式,只要編輯 /etc/rc.conf,並加入下列二行,以在開機時啟動 SmbFTPD



smbftpd_enable="Yes"
smbftpd_flags="-D"

若要啟動|關閉的話,就用這行指令

# /usr/local/etc/rc.d/smbftpd.sh start or stop

Bojack 發表在 痞客邦 留言(0) 人氣()

這個問題存在很久了,不過我一直都沒有去正視它,頂多只是看了很礙眼而已 ...


以往從 Windows 做好的檔案傳到 FreeBSD 後,用 vi 去檢視時會發現每一行的後面都多了一個 ^M,雖然修改時不會影響些什麼,但是看到很多 ^M 其實也蠻煩的。在酷學園看到解決的方法如下 ...

#vi 要編輯的檔案

:%s/^M//g (那個 ^ 是您要先按 Ctrl +V, 接下來M,要按 Ctrl +M)

See ! 煩人的 ^M 都不見了 .... (y)

[1] 酷學園 - ^M 如何消除

Bojack 發表在 痞客邦 留言(0) 人氣()

文章是在酷學園看到的,原文在這邊...The *BSDstats Project 這個網站似乎要揹負起 *BSD 的名聲 XD,先參考網站說明~


The mission of this site is to compile semi-accurate numbers for advocacy and marketing of the *BSD operating systems.

More specifically, we are trying to demonstrate to hardware and software vendors out there that *BSD should be viewed as a serious operating system, not just as a hobbyist system, for support (ie. hardware drivers) purposes.

We are designing the system so that FreeBSD, NetBSD, OpenBSD, and DragonFlyBSD can participate and benefit.

網站主要的用途是想要統計目前全世界使用 *BSD Operating System 的數量,更進一步的說呢,就是要告訴所有的軟硬體廠商 *BSD 不是一種只有少數人沈迷使用的 OS,而是要以很嚴謹的態度來正視 *BSD 這 OS ... 以獲得軟硬體廠商的青睞 ( 看來有些硬體的 Driver 仍不支援 *BSD )

Bojack 發表在 痞客邦 留言(0) 人氣()

今晚收集了一些 Blog ,而這些 Blog 都有 FreeBSD 的分類專欄 ~ 有興趣的人一起參考研究一下囉 :)


潛艦 | http://to2100.idv.tw , Network Lab@FreeBSD
rafan’s blog
Gea-Suan Lin’s BLOG
LCR’s BLOG
Jui-Nan Lin’s Blog
GD’s Blog
heath’s Daemon Castle
Joe Horn 的啟示錄
Real-Blog
FreeBSD Server Administration ( 外國 )


尋找 Blog 的過程中,意外找到這個 FindingBlog.com ,收集了不少分類,不知道台灣有沒有這樣類似的網站呢?

Bojack 發表在 痞客邦 留言(0) 人氣()

昨天讓我的 BSD 連上線後,發現每次要連線都要找一下 IP 變成多少,實在有些麻煩 ... 這時就要靠 DDNS 來解決囉 ~


常見的 DDNS 應該就是 No-IPDynDNS 吧 ( 我沒啥研究,就只有常看到這二家 ) ... 前面那家我有用過了 ( 這邊有 For Windows 的申請教學 )。後面這家第一次用,在王俊斌大哥這推薦使用它,那就試看看吧 ...

Bojack 發表在 痞客邦 留言(0) 人氣()

將電腦搬來金門後,第一次使用中華電信的 ADSL 呢 ~ 過去在家都是使用 Cable 上網,FreeBSD 只需要設定 DHCP 取得就可以上網了,但以 PPPoE 的方式一直沒有試過 ( 也沒辦法試 )。昨天中華電信終於來宿舍拉網路,剛好我最近也需要用 FreeBSD 來做一些測試,就順手將這篇基礎的文章也稍微記錄一下,以備不時之需

Bojack 發表在 痞客邦 留言(0) 人氣()

前幾天 Isaac 問我有關 MRTG 的問題 ~ 想要了解公司內部每台電腦流量使用的情形,若要用 MRTG 觀看,那每台電腦都要支援 SNMP ... 每一台電腦要去設定是件很累的事情,於是我推薦他二套。一個是 NTOP,另一套是 BandwidthD ~ 印象中好像 NTOP 需要性能較好的電腦來跑 Loading 才不會很重,所以我就主要推薦 BandwidthD


FreeBSD 上安裝它很簡單 ~


Shell > cd /usr/ports/net-mgmt/bandwidthd/
Shell > make install clean

Bojack 發表在 痞客邦 留言(0) 人氣()

剛剛試了一下,發現居然只要打入相對的路徑,目錄下的東西就被看光光了 ~


過去在 Apache 1.3 時曾經改過,還以為 Apache 2.x 預設是關閉的,看來是我想太多了 @@


搜尋一下 httpd.conf 找一下這一行


Options Indexes FollowSymLinks

把它裡面的 Indexes 去掉重新啟動 Apache 就好了

Bojack 發表在 痞客邦 留言(0) 人氣()

今晚更新了 portupgrade 後,然後再更新其它的 ports 發現怎麼都出現下列訊息
[Updating the pkgdb <format:bdb_btree> in /var/db/pkg ... /var/db/pkg/pkgdb.db: unexpected file type or format -- Invalid argument; rebuild needed] [Rebuilding the pkgdb <format:bdb_btree> in
/var/db/pkg ... /var/db/pkg/pkgdb.db: unexpected file type or format -- Invalid argument: Cannot update the pkgdb!]: Cannot update the pkgdb!] ...... 略

找了一些文章,大部份的人都會好心建議要去看 /usr/ports/UPDATING 的東西,不過我是不太會看這東西的傢伙 ... XD


20060703:
AFFECTS: users of sysutils/portupgrade
AUTHOR: sem@FreeBSD.org

Because portupgrade had a problem with detecting Berkley DB version 2
or newer, and the default database format is now set to use these
versions, you can end up with a portupgrade that does not work with
older databases. A quick fix is to remove the databases, type:
'rm /var/db/pkg/pkgdb.db /usr/ports/INDEX*.db'.
portupgrade will recreate them automatically. It does absolutely no harm.

If you do not want remove the databases, you should detect what database
type do you use, and set the port options for portupgrade accordingly.
Follow these instructions:

- run 'pkgdb -fu' *before* upgrading and take a look on the output.
You can see database format there as: format:XXX, where XXX is your
current database format.
- Go to portupgrade port directory and configure the port with
`make config' command. If you have bdb_* format, then turn on the BDB4
option. If you have bdb1_* format, then turn off BDB4 and turn on
the BDB1 option. If you have dbd_hash format, then turn off all options.
- Upgrade portupgrade.

Note: if you change database format with changing port options,
you should remove the ruby-bdb* port that you don't need anymore.
Alternatively, you can hard code database format in your pkgtools.conf.

解決的方法很簡單 ~

Shell > cd /var/pkg/db
Shell > rm pkgdb.db
Shell > pkgdb -fu

嘿 ~ 我的 portupgrade 又正常了 :D

Bojack 發表在 痞客邦 留言(0) 人氣()

若有天發現 Web Server 被 DoS / DDoS 怎麼辦,不外乎就是在 Router or Firewall 將它擋下來


Apache 上提供了一個 module ~ mod_evasive


引用一下 mod_evasive 的說明 :

mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, and etcetera. mod_evasive presently reports abuses via email and syslog facilities.

安裝還蠻簡單的,可以參考一下 README ~


有需要的人拿去裝看看 :D


Reference :


[1] mod_evasive
[2] 關於apache問題

Bojack 發表在 痞客邦 留言(0) 人氣()

常會遇到的情況,安裝 ports 裡某套件有時會跳出選單 ~


但是發現要重新安裝時選單不出來了 ~


採用下列方式就可以解決啦


Shell> make clean
Shell> make rmconfig
Shell> make install

Bojack 發表在 痞客邦 留言(0) 人氣()

酷學園總是能看到一些有趣的問題!


這篇永遠學不會所提問的問題,老闆問他在 Apache 裡有沒有辦法限制每個 user 的流量限制 ? 若問我的話一定掛在那,這個問題我倒是從來沒有想過 ~ 今晚就來實作一下


Apache 上要做到流量限制的套件有 mod_bandwidthmod_throttlemod_cband ~


前二個適用於 Apache 1.3.x 版本,不過我升級到 Apache 2.x 很久了,所以前二個套件就不研究了。取而代之在 Apache 2 可以 work 的套件就是 mod_cband


引用一下 The FreeBSD Ports Archive mod_cband 這篇文章:


mod_cband is an Apache 2 module provided to solve the problem of limiting virtualhosts bandwidth usage. When the configured virtualhost's transfer limit is exceeded, mod_cband will redirect all further requests to a location specified in the configuration file.

大概了解一下後,就可以開始來安裝套件 ~

Bojack 發表在 痞客邦 留言(0) 人氣()

過去我的機器常常被人掃 port ,並且使用一些字典攻擊法嘗試登入我的機器


那時解決的方式是架設防火牆,開放特定 IP 的白名單才能允許登入


不過隨著時間一久,發現偶爾總是要去修一下 rc.firewall 總是很麻煩


其實在 ssh 本身的設定檔就可以完成這個工作了


/etc/ssh/sshd_config 加入這幾行



# root 只能從 192.168.1.32 登入
AllowUsers root@192.168.1.32
# 也可設定多個 User,root 只能從 192.168.1.32 登入 and admin 隨時都可以登入\

AllowUsers root@192.168.1.32 admin


弄好之後存檔,重新啟動 SSH 就好囉 : )



參考 : OpenSSH

Bojack 發表在 痞客邦 留言(0) 人氣()

IT日記看到的,記錄一下 : )

利用 chpass 指令,在使用者的 Expire 地方加入日期就可以了

# chpass bojack

( 進入 vi 模式,修改下面這行存檔就好 )

Expire [month day year]: May 1, 2000 <- 比今天小就好了
只要設定在哪天過期,這個帳號就會停用了,其實還蠻方便的

若還有其它程式能自動清除過期帳號,那就更方便了

Bojack 發表在 痞客邦 留言(0) 人氣()

RelaxBSD 是一個基於 FreeBSD 的 LiveCD,一部分代碼來自於 FreeSBIE ,BSDinstaller 來自於 http://www.bsdinstaller.org ,所有 RelaxBSD 所作的代碼均以 BSD License 發布。其它大多數軟件都通過 FreeBSD ports 安裝。

未來如果要以 BSD 做為 Desktop 的話,或許可以考慮這一套 ~

下面展示畫面,目前已經有支援到正體中文了 :D




原文連結

Bojack 發表在 痞客邦 留言(0) 人氣()

今天在 PCZONE 的網站逛了一下,發現站長(以前應該是阿土伯)有幫人做一些主機架設的服務,用的是我最愛的 FreeBSD 喔 !!


裡面有關 Apache Server 的地方寫著「安裝網頁壓縮模組 (有效節省3~4成網站對外頻寬)」,這幾個字眼就吸引到我了 ~


於是上 Google 找了幾篇文章來拜讀一下,找到不少文章 ~

Bojack 發表在 痞客邦 留言(0) 人氣()

盼丫盼的,FreeBSD 6.1 終於在 5 / 8 日 Release 了 ~


引用一下 Scott Long 的話 A___A



It is my great pleasure and privilege to announce the availability of FreeBSD 6.1-RELEASE. This release is the next step in the development of the 6.X branch, delivering several performance improvements, many bugfixes, and a few new features. These include:

.Addition of a keyboard multiplexer. This allows USB and PS/2 keyboards to coexist without any special options at boot.
. Many fixes for filesystem stability. High load stress tests are now run successfully on a regular basis as part of the normal FreeBSD QA process.
. Automatic configuration for man Bluetooth devices, as well as automatic support for running WiFi access points.
.Addition of drivers for new ethernet and SAS and SATA RAID controllers.
. BIND updated to 9.3.2
.sendmail updated to 8.13.6

心動不如馬上行動,我已經在更新了 :p


By the way ~ PHP 5.1.4 也 Release 了喔

Bojack 發表在 痞客邦 留言(0) 人氣()