PHP

date_default_timezone_set for php5 date() fixation

Recent upgrade to php5 in appserv make me confuse when my friend ask me about this code :

print date(‘d-M-Y H:i:s’);

hour isn’t accurate

after googling I found about date_default_timezone_set

for full list of supported zone time see this link

http://www.php.net/manual/en/timezones.php

edit  the code into

date_default_timezone_set( "Asia/Jakarta" );

// date.timezone = "timezone_here"

print date(‘d-M-Y H:i:s’);

work well icon smile date default timezone set for php5 date() fixation

Unix

Options in FreeBSD ports

some useful options :

  • make config
  • make showconfig
  • make rmconfig

make rmconfig will remove old options saved.

If not work try to clean first icon smile Options in FreeBSD ports

Also useful switch in portupgrade :

  • portupgrade -aFrR (will download all required file without install)
  • -i, need your decision.

Unix

Maia-mailguard,clamav & Spamassasin working well

Recent mail server upgrade to new system (FreeBSD 6.2 stable) satisfy me icon smile Maia mailguard,clamav & Spamassasin working well

 Maia mailguard,clamav & Spamassasin working well

 Maia mailguard,clamav & Spamassasin working well

hmmm….

spamassasin rules grow to 379 rules from 41 rules.

very good.

I miss spam now icon wink Maia mailguard,clamav & Spamassasin working well

Speak

Quite busy for thesis preparation

Just did my seminar and busy for my final thesis icon smile Quite busy for thesis preparation

Wish me luck icon smile Quite busy for thesis preparation

Will post after have spare time icon wink Quite busy for thesis preparation

Unix

Migrating email accomplished (postfix+mysql+dovecot)

Fiuh, finally migrating email task is clear.

Almost 3500++ email account from vmailmgr based system moved to postfix with mysql backend and dovecot support.

thanks to Bendiken script that convert things magically icon smile Migrating email accomplished (postfix+mysql+dovecot)

Generally the steps are :

1. Rsync email to new server

2. Change to dovecot style with migration script, make it in looping.

Just combined with little script like this :

migrating.sh

#!/bin/sh

ls /email/domain.com/users | while read u1;

do /home/rasyid/tools/courier2dovecot.sh "/email/domain.com/users/$u1/" ;

done

write in one line and chmod +x to make it executeable.

3. Change ownership of email folder to postfix and symlink it to real place.

Done

I’ve try roundcube mail and working fine for me. But since more user complain about some feature that not working well (perhaps browser issue) I change webmail back to squirrelmail icon wink Migrating email accomplished (postfix+mysql+dovecot)

back to epsbed report.

 

Database

ERROR 2003: Can’t connect to MySQL server

I Need to add remote user for add, select, update and delete in mysql.

grant select,insert,update,delete on postfix.* to "postfix_rc"@"%" identified by "postfix_xxxxyyy" with grant option;

try to access :

-bash-2.05b$ mysql -upostfix_rc -p -h 172.88.1.5
Enter password:
ERROR 2003: Can’t connect to MySQL server on ’172.88.1.5′ (61)

according to this, that means no tcp/ip support.

checking firewall. OK.

after check for mysql

jedimaster# ps -ax | grep mysql
  739 con- I      0:00.01 /bin/sh /usr/local/bin/mysqld_safe –defaults-extra-file=/var/db/mysql/my.cnf –user=mysql –datadi
  834 con- S      0:04.86 /usr/local/libexec/mysqld –defaults-extra-file=/var/db/mysql/my.cnf –basedir=/usr/local –datadir
59745  p1  I      0:00.01 /bin/sh /usr/local/bin/mysqld_safe –defaults-extra-file=/var/db/mysql/my.cnf –user=mysql –datadi
59769  p1  S      0:04.98 /usr/local/libexec/mysqld –defaults-extra-file=/var/db/mysql/my.cnf –basedir=/usr/local –datadir
jedimaster# ee /var/db/mysql/my.cnf

check  this line :

#skip-networking

removing # will add security as connection only allowed from localhost but in my case I need tcp/ip so I put # back.

try again :

-bash-2.05b$ mysql -upostfix_rc -p -h 172.88.1.5
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 414 to server version: 5.0.45-log

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

make sure minimum mysql client : mysql-client-4.1.21 Multithreaded SQL database (client)

If I use from other server :

$ mysql -upostfix_rc -p -h 172.88.1.5
Enter password:
ERROR 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client
$

I use mysql 4.0.27 client icon smile ERROR 2003: Cant connect to MySQL server

got new mysql error icon smile ERROR 2003: Cant connect to MySQL server . My old friend is 127 error heheheheehehe.

Unix

Using Sanesecurity Signatures for pdf email

A lot of pdf mail arrive in mailbox and maia can’t detect that. After googling I found in howtoforge about Filtering PDF-/XLS-/Image-Spam With ClamAV (And ISPConfig) On Debian/Ubuntu.

I wanna try it for FreeBSD, after red last section I try to update the scripts.

Changing two lines as suggested based on clamav installation on FreeBSD 6.2

clam_sigs="/var/db/clamav/"

clam_user="vscan"

run the script :

jedimaster# sh ss-msrbl.sh
=================================
SaneSecurity SCAM Database Update
=================================

curl: not found

my bad, Installing curl first icon smile Using Sanesecurity Signatures for pdf email

jedimaster# cd /usr/ports/ftp/curl && make install

jedimaster# whereis curl
curl: /usr/local/bin/curl /usr/local/man/man1/curl.1.gz /usr/ports/ftp/curl
read more »

Unix

maia-mailguard and mimeDecode

[Sat Jul 28 13:59:10 2007] [error] [client 172.88.1.4] PHP Fatal error: 

require_once() [<a href="function.require">function.require</a>]:

Failed opening required ‘Mail/mimeDecode.php’

(include_path=’.:/usr/local/share/pear:/usr/local/share/smarty:./libs:’) in

/usr/local/www/maia-mailguard/mime.php on line 79, referer:    

http://172.88.1.5/maia-mailguard/welcome.php

try install pear mail

jedimaster# pear install mail
downloading Mail-1.1.14.tgz …
Starting to download Mail-1.1.14.tgz (17,537 bytes)
……done: 17,537 bytes
install ok: channel://pear.php.net/Mail-1.1.14
jedimaster# pear install mail_mime
Ignoring installed package pear/mail_mime
Nothing to install

Find other "mail" family :

jedimaster# pear search mime
Retrieving data…0%..Matched packages, channel pear.php.net:
=======================================
Package         Stable/(Latest) Local
Mail_Mime       1.5.2 (stable)  1.5.1 Mail_Mime provides classes to create mime messages.
Mail_mimeDecode 1.5.0 (stable)        Provides a class to decode mime messages.
MIME_Type       1.0.0 (stable)        Utility class for dealing with MIME types
jedimaster# pear install Mail_mimeDecode
downloading Mail_mimeDecode-1.5.0.tgz …
Starting to download Mail_mimeDecode-1.5.0.tgz (9,281 bytes)
…..done: 9,281 bytes
install ok: channel://pear.php.net/Mail_mimeDecode-1.5.0
jedimaster#

My bad icon smile maia mailguard and mimeDecode

Its Mail_mimeDecode

Unix

Migrating from courier-imap to dovecot

Our email system need to refresh icon smile Migrating from courier imap to dovecot

Vmailmgr + courier-imap + qmail no longer suitable

Mostly with increasing user and complex operation. I need database support to integrate with other system.

Need to migrating from courier-imap to dovecot system, googling lead me to this migration script.

Need to check it in FreeBSD 6.2 stable. I’ll let you know if it work in FreeBSD 6.2

See the code here : Bendiken
 

Database Unix

Migrating from mysql 4.0 to mysql 5.0 in FreeBSD

Final decision has been made, upgrade to mysql 5.0 is a must.

But how to do that?

How about user data?

After doing it by myself I found it’s easy. I try to share my experience in sbs (step by step) form icon smile Migrating from mysql 4.0 to mysql 5.0 in FreeBSD

Situation :

I have two server kongja and proxy :

Server kongja has mysql 4.0.27 installed

Server proxy don’t have mysql server installed.

I wanna try migration in server proxy before doing it in kongja.

Here’s the steps :

1. Install mysql40-server in proxy

cd /usr/ports/databases/mysql40-server/ && make install

2. Compress mysql directory in kongja

cd /var/db

tar cvzf mysql.tar.gz mysql

export this file (mysql.tar.gz) to proxy.

read more »

Unix

Adding tls support to pure-ftp in FreeBSD

Log for adding tls support in ure-ftp in FreeBSD :

>>>>=================  Make directory for certificate

edp# mkdir -p /etc/ssl/private

>>>>=================  Make certificate

edp# openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

Generating a 1024 bit RSA private key
……..++++++
……++++++
writing new private key to ‘/etc/ssl/private/pure-ftpd.pem’
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:ID
State or Province Name (full name) [Some-State]:Sumsel
Locality Name (eg, city) []:Palembang
Organization Name (eg, company) [Internet Widgits Pty Ltd]:PalComTech
Organizational Unit Name (eg, section) []:STMIK/POLTEK PalComTech
Common Name (eg, YOUR name) []:PalComTech
Email Address []:info@palcomtech.com

>>>>=================  chmod 600 certificate

edp# chmod 600 /etc/ssl/private/*.pem

>>>>=================  Restart  FTP Server

edp# /usr/local/etc/rc.d/pure-ftpd restart

==========================================================================================

Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -fftp -H -I15 -L2000:8 -m4 -s -U133:022 -u100 -k99 -Z -Y2

Y2 => TLS level 2

Testing from ftp client :

20———- Welcome to Pure-FTPd [TLS] ———- 
AUTH TLS 
234 AUTH TLS OK. 
TLSv1, cipher TLSv1/SSLv3 (AES256-SHA) – 256 bit
USER palcom 
331 User palcom OK. Password required 
PASS ********** 
230-User palcom has group access to:  palcom   
230 OK. Current restricted directory is / 

Good icon smile Adding tls support to pure ftp in FreeBSD