www.rzend.com

a blog about tech and geek stuff

Import/Export mysql file through ssh

Connect to server through ssh and type,

To Export,

mysqldump –opt -uusername -ppassword -h localhost dbname > backupfilename.sql

To Import,

mysql -u dbuser -p -h dbhost.yoursite.com dbname < /path/to/backup.sql

Zero byte file generate and upload using ncftp

When the only possibility of deleting a file in a remote host is to overwrite an existing file, we can generate a 0 byte file by the following way,

$> cat /dev/null > zero_byte.dat
$> ncftp -u host.server.com
(password)
$> put -z zero_byte.dat

Zimbra: Remove iSync from OSX

Type in a terminal window,
sudo /Library/PreferencePanes/Zimbra.prefPane/Contents/Resources/ZimbraHelper --uninstall

Zimbra CACert Install

Backup and Clean Current Certs
su - root
cd /opt/zimbra/ssl/zimbra/commercial/
tar -czvf /tmp/ssl.commercial.backup.tar.gz *
rm -rf *

Generate new csr (certificate request)
/opt/zimbra/bin/zmcertmgr createcsr comm -new

This uses the defaults, change according
/opt/zimbra/bin/zmcertmgr createcsr comm -new "/C=US/ST=TX/L=Somewhere/O=Company, Inc./OU=Department/CN=mail.domain.com"

Verify files presence,
ls -la

Should list,
commercial_ca.crt / commercial.csr / commercial.key

Cat the csr and submit to cacert.org,
cat /opt/zimbra/ssl/zimbra/commercial/commercial.csr

Result,
-----BEGIN CERTIFICATE REQUEST-----
[delete]CCAWwCAQAwgZkxCzAJBgNVBAYTAlVTMQwwCgYDVQQIEwNOL0ExDDAKBgNV
[delete]4vQTEjMCEGA1UEChMaWmltYnJhIENvbGxhYm9yYXRpb24gU3VpdGUxIzAh
[delete]AsTGlppbWJyYSBDb2xsYWJvcmF0aW9uIFN1aXRlMSQwIgYDVQQDExttYWls
[delete]nRlcm5hbC5ob21ldW5peC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
[delete]AOri9/m6RtM1vASBROPgLvkUYybwf2WDI2xTdKUuAMI0rTpMH1IzjPRP/J+m
[delete]RQTiJe1mRX3rJCy3qVooVzsLe2yJ1+rs3FzLSfQhazK6PqMD8GhpqHO0Y75
[delete]LEA/qdOCrTFjosO9C3j3WPCW8lutTxf/QsoKGkIVs5tjAgMBAAGgKTAnBgkq
[delete]0BCQ4xGjAYMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgXgMA0GCSqGSIb3DQEB
[delete]A4GBAKMLVFilRjI9xvU/vZmP69yReVZyxa5YVpF/cEvwFwbOU6E4USkdONGT
[delete]DRj1XxfzYD+CDf8TVuTY4tapaLvKPRUtdd/mM1PidY5t126QAObyKjHBRzy
[delete]RJFQeP+0ktxcYJ99+sfiescwR/qzPJM58i6daqmMamQBZi
-----END CERTIFICATE REQUEST-----

Paste the cert generated by cacert.org,
nano /opt/zimbra/ssl/zimbra/commercial/commercial.crt

Get cacert root.crt and class3.crt and cat both in one file
cat root.crt class3.crt > commercial_ca.crt

/opt/zimbra/bin/zmcertmgr verifycrt comm commercial.key ./commercial.crt ./commercial_ca.crt

If the output looks good, you can deploy the certificate via this command:

/opt/zimbra/bin/zmcertmgr deploycrt comm ./commercial.crt ./commercial_ca.crt

The final step would be to restart the zimbra services for the change to take effect.