ports downgrade in FreeBSD

Last week, i had a job migrating mail server from exim to postfix, but sadly, till now, this job unfinished yet :(. The main problem was synchronizing mail user from different engine to the new one. Thats the first problem. I wont discuss it in here. And, the second problem is, antispam. On my new mail server, antispam consist of spamassasin,Fuzzy-OCR,clamav,maia,and sane-security. Maia is a virus and spam management system built on SpamAssassin and amavisd-new scanner. It mainly supports scanning for viruses, spam, banned attachment types and invalid mail headers. It gives users control over their email accounts and the ability to manage their own content filtering settings through a web-based interface. Confirmed spam and ham are used to automatically train SpamAssassin’s Bayes engine and these recognitions can be automatically reported to spam-monitoring networks. Sounds interesting, isn’t it ? When i configuring maia using existing ports, i had an error on dependency file :(. Finally, i downgrade maia.
How to downgrade ports in FreeBSD ? here is it :

1. First, install portdowngrade program :
cd /usr/ports/ports-mgmt/portdowngrade
2. install it :
make DEFAULT_CVS_SERVER=\”:pserver:anoncvs@anoncvs.tw.freebsd.org:/home/ncvs\” install clean
3. downgrade your ports :
portdowngrade {PORTNAME}

pretty easy right ?


in this morning, i’ve make a simple script for copying files from server A to server B. When i try to use sshles password, my remote-server always asked me a password. i’ve give up configuring sshless password between server A to server B, so i try to use FTP. little bit tricky i think, but this is only the way. Here’s the simple script for uploading file via FTP in bash :

cd /backup/backup/db/
ls -lash
ftp -inv $HOST << EOF

# Call 2. Here the login credentials are supplied by calling the variables.

user $USER $PASS

# change to the FTP directory where you want to put or get
cd /tmp

# Upload A file to FTP server using put

put uji_coba-`date +%Y-%m-%d`.ypt
# or downloading file from ftp server
# get uji_coba-`date +%Y-%m-%d`.ypt

PF Rules for Passive FTP Connection

When you try to securing FTP server with firewall, you should concert about FTP mode. there’s 2 ftp modes, passive and active FTP.I’ve try to configuring pf rules for FTP passive mode with simple rule like this (default block on PF) :

pass in on $ext_if proto tcp to port 21

when servicing passive FTP connection, FTP server using high random ports for transfering data. So, you must passing all of those ports. PF rules will look like this :

pass in on $ext_if proto tcp to port 21
pass in on $ext_if proto tcp to port > 49151

Done 🙂


one days earliear than today with date

today, after christmas, i have a job, copying backup folder to surabaya. My backup format is dir-name-YYYY-MM-DD, and i want to copy all of file in that directory one day earliear from the current date. So, how i do that task ? after reading man pages of date, i’ve got a clue, here it is :

to get 1 day earlier than today, run this command :

date -v-1d +%Y-%m-%d

on my directory format (dir-name-YYYY-MM-DD), i run this command :

scp -r dir-name-$(date -v-1d +%Y-%m-%d) user_dest@xxx.xxx.xxx.xxx:/wew/



axel is another download tool on unix besides wget and fetch, etc. On freebsd, default downloader tool is using fetch. i’m very frustating when updating ports/installing package from ports using default downloader from freebsd. I want some tools like internet download manager like in windows. And then i found tools on UNIX who works like IDM, axel 🙂

installing axel quite simple in linux/BSD variant. on this documentation, i using FreeBSD.

installing axel :

#cd /usr/ports/ftp/axel

#make install clean

axel already installed on your BSD, but you must editing /etc/make.conf if you wanna use axel as your default downloader program when you installing program via ports. open /etc/make.conf and then add these lines  :


Try to installing packages via ports, and see the difference 😀

Directory Aliasing on nginx

last few day, i migrated web server from apache to nginx. Not a big problem when i configuring php with nginx, but the main problem is, how to configuring alias directory in nginx ?.

on apache, configuring alias directory is quite simple, like this :

Alias /wiki "/usr/local/www/mediawiki"
<Directory /usr/local/www/mediawiki>
Options FollowSymLinks
AllowOverride None
order deny,allow
deny from all
allow from xxxxxxx/y

but, in nginx ?  harder than using apache :D. Here’s example how to enabling alias directory in nginx

location /wiki {
alias //usr/local/www/mediawiki;
index index.php;
location ~ /wiki/.*\.php$ {
if ($fastcgi_script_name ~ /wiki(/.*\.php)$) {
set $valid_fastcgi_script_name $1;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/mediawiki$valid_fastcgi_script_name;
include fastcgi_params;

save nginx.conf and restart nginx.

done! :p