Wednesday, December 12, 2012

apache2+fcgi+redmine

### apache2+fcgi+redmine ###

refer earlier post for redmine installation

apt-get install libapache2-mod-fcgid

### install fast-cgi (for ruby) ###

wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0.
./configure
make
make install
gem install fcgi

### apache-configuration ###
in /etc/apache2/conf.d create a file redmine with content

Alias /redmine /var/www/redmine/public ##optional

SetEnV RAILS_ENV production
AllowOverride all
Options +ExecCGI FollowSymLinks
AddHandler fcgid-script .fcgi
#AddHandler cgi-script .cgi
Order allow,deny
Allow from all


In /var/www/redmine/public/.htaccess
a. make suitable changes for fcgi
b. enable rewritebase (if needed)
c. restart apache /etc/init.d/apache2 restart

chown -R www-data:www-data /var/www/redmine

now point your browser to your.server.com/redmine Hope thats it

Nagios with oreon ???? --on fly

apt-get install apache2
apt-get install build-essential
apt-get install libgd2-xpm-dev
apt-get install php5-common php5 libapache2-mod-php5
apt-get install upgrade distro
apt-get install nagios2 :(



is it nagios-php, phpnagios or lilac..? http://www.lilacplatform.com/trac/wiki

http://www.ubuntugeek.com/nagios-configuration-tools-web-frontends-or-gui.html

Lilac ..?

apt-get install mysql-server
apt-get install php-pear
apt-get install curl
apt-get install php5-mysql
chown -R www-data:www-data /var/www/directory
apt-get install php5-curl
/etc/init.d/apache2 restart
apt-get install nmap

http://localhost/directory/install.php

Failed to import database schema. Make sure the mysql binary is in the search path for the web user.
...?

.. to be continued nale nodona

Oracle migration tips

[15:53:36] ۩۞۩๑日満主๑۩۞۩: To implement the solution, please execute the following steps:

1. Check which Unix user owns the ORACLE_HOME:

% echo $ORACLE_HOME
/u01/app/oracle/product/9.2.0

% ls -ld $ORACLE_HOME
drwxr-xr-x 58 oramigts dba 1024 Jan 2 2004 9.2.0

The ORACLE_HOME is owned by Unix user "oramigts" and Unix group "dba"

2. Check the $ORACLE_HOME/rdbms/lib/config.s file

[If your platform has config.c: Due to the way different compilers under different architectures generate assembler code, it's not possible to give a universal rule.]

It shows OSDBA group as "g680" (whereas the output from step 1 shows the Unix group "dba")

3. Modifiy the config.s so that it references the correct group. Change the line:

.ascii "g680\0"

to

.ascii "dba\0"

4. Rename the config.o file:

mv config.o config.o.bak

5. Regenerate the config.o file and the 'oracle' binary

make -f ins_rdbms.mk config.o ioracle

6. Check the file config.o is created at $ORACLE_HOME/rdbms/lib

ls -al $ORACLE_HOME/rdbms/lib/config.o

7. Verify that you can now connect to the database as SYSDBA using SQL*Plus

8. Try to upgrade the database again using DBUA

logical volume creation

lvdisplay
lvcreate -n /var/www/sw -size 500g my
lvcreate -n var-www-sw --size 500g my
mkfs.ext3 /dev/my/var-www-sw
mkdir /var/www/sw
mount /dev/my/var/www/sw /var/www/sw

check /etc/fstab
add entry as follows if not exists
/dev/mapper/my-var-www-sw /var/www/sw ext3 defaults 0 2

server migration -Tips and notes

April 15th 7:04
ssh into the computer
apt-get install apache2
apt-get install mysql-server-5.0
apt-get install php5
apt-get install php5-mysql
--

April 16th 2:58

apt-get update
apt-get upgrade
wget http://downloads.sourceforge.net/project/typo3/TYPO3%20Source%20and%20Dummy/TYPO3%204.3.3/typo3_src-4.3.3.tar.gz?use_mirror=space

wget http://downloads.sourceforge.net/project/typo3/TYPO3%20Source%20and%20Dummy/TYPO3%204.3.3/typo3_src%2Bdummy-4.3.3.zip?use_mirror=nchc

apt-get install zip
apt-get install imagemagick
unzip typo3+dummy....zip

April 27th

mv typo3_dumm.. yourname
cd prion/typo3conf

admin/adminpass

chown -R www-data:www-data typo3temp/
chown -R www-data:www-data typo3conf
chown -R www-data:www-data uploads
chown -R www-data:www-data fileadmin
chown -R www-data:www-data typo3/ext/

### for suhosin patch for php5
apt-get install php5-suhosin
/etc/init.d/apache2 restart

apt-get install php5-gd

vim /etc/php5/apache2/php.ini
vim /etc/php5/conf.d/suhosin.ini
/etc/init.d/apache2 restart


# not needed below
apt-get install dpkg-dev build-essential
cd /usr/src
apt-get source php5
wget http://www.hardened-php.net/hardened-php-signature-key.asc
gpg --import < hardened-php-signature-key.asc
wget http://www.hardened-php.net/suhosin/_media/suhosin-patch-5.2.0-0.9.6.2.patch.gz
gunzip suhosin-patch-5.2.0-0.9.6.2.patch.gz
cd php5-5.2.0
patch -p 1 -i ../suhosin-patch-5.2.0-0.9.6.2.patch
dpkg-buildpackage
### Till here


May 10th

Generating SSL
http://www.akadia.com/services/ssh_test_certificate.html

openssl genrsa -des3 -out server.key 1024
************

openssl req -new -key server.key -out server.csr


cp server.key server.key.org
cp server.key server.key.orig

openssl rsa -in server.key.org -out server.key

mkdir /etc/apache2/ssl
cp server.crt /etc/apache2/ssl/
cp server.key /etc/apache2/ssl/

a2enmod rewrite
a2enmod ssl

add the following lines in virtual host entry

RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://your.domain.com$1 [L,R]
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 2

SSLEngine on
SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key

rsync from *nx machine to windows machine

This document describes how to setup a ssh+rsync on windows such that a *nx machine can backup/copy files using rsync


Install cygwin you need opnessh and rsync components
once it is installed
add CYGWIN=ntsec tty as system variable
add path of cygwin in PATH varialble (usally it is c:\cygwin\bin)
Open a cygwin terminal and type
ssh-host-config
(manually answer Yes to all questions except)
If the script says "This script plans to use cyg_server, Do you want to use a different name? Answer no.
now type
cyglsa-config
Restart
You can add the system users by typing
mkgroup -l >> ../etc/group
mkpasswd -l >> ../etc/passwd


You can add keys (consider your security environment)

Now you are ready to use rsync from your *nx backup server to the windows machine.

References:
http://pigtail.net/LRP/printsrv/cygwin-sshd.html
http://sysblogd.wordpress.com/2008/01/07/ubuntu-connect-to-your-windows-machine-securely-using-vnc-and-ssh-with-little-installation/
http://blog.myownserver.info/2010/04/how-to-install-cwrsync-for-windows-vista7-tutorial/

Notes: To allow port 22 in windows firewall the following commands are useful.

netsh advfirewall firewall add rule name=”Opensshd” dir=in action=allow protocol=TCP localport=22

netsh firewall add portopening tcp 22 "opensshd"

sieve filtering Howto

STEP 1 Write a script as follows:

## test script to work on folders
require "fileinto";
if header :contains ["Received"] ["gmail.com"] {discard;} This line is to block gmail
if header :contains ["Received"] ["FALSE"] [".domain.A","Domain.B","Domain.C","Domain.D"] {discard;} ### this is supposedly block all the mails apart from our domain.A/B/C/D
save this as a file block_gmail

STEP 2

Login to seive shell and put the script

sieveshell --auth=manager --user=manager localhost
put scriptname
quit


STEP 3
cyradm -u manager localhost
mboxconfig shared/test_seive seive block_gmail

(for all shared folder)
mboxconfig shared/* seive block_gmail

info shared.somefolder

sources:
http://wiki.kolab.org/index.php/Filtering_Emails_on_the_Server
http://www.cmu.edu/computing/doc/email/sieve/developing.html
http://www.cs.cmu.edu/~help/mail_news/corvid/sieve_intro.html
http://wiki.bath.ac.uk/display/bucstech/Sieve+scripts


Currently stuck at :(
localhost> mboxcfg shared/test_seive seive block_gmail
mboxconfig: Permission denied