Archive for the 'Howto' Category

VMware 6.5.4 and Ubuntu vmnet compile problems and cursor flaw fix

VMware seems to go the Microsoft way of doing things; They create a flawed installer and no KB to fix this.
Fortunately there are some smart dudes who know their stuff and place it on the www. I was lazy to find out this time myself so this is some sort of "placeholder" for the next time when I run into this, or when VMware has sorted their stuff out with a new version, or fix.

Thanks to digital-scurf blog author; Sorry to copy this but this really makes sense. Short and clear:

I recently updated vmware on my desktop to workstation 6.5.4 having previously upgraded the machine to Ubuntu 10.04. This resulted in interesting issues so I thought I’d collate them all here.

1. vmware’s installer remains flawed wrt. output generated during module compile—to fix this, create a gcc wrapper script which removes the -W flags, e.g.

#!/usr/bin/python
import sys
import copy
import os
argv = copy.copy(sys.argv)
i = len(argv)
for i in range(i-1, 0, -1):
if len(argv[i]) > 4 and argv[i][:2] == "-W" and argv[i][3] != ",":
del argv[i]
argv[0] = "/usr/bin/gcc"
os.execv(argv[0], argv)

2. Pop that somewhere like /tmp/gcc and chmod +x it.
3. Run sudo env PATH=/tmp:$PATH sh /wherver/VMware-Installer.bundle
4. When the installer finishes, cd into /etc/vmware and add export VMWARE_USE_SHIPPED_GTK="force" to the bootstrap file. (This fixes the mouse-broken in fullscreen mode, two pointers visible, vmware losing grab blahblahblah problem)
5. cd into /usr/lib/vmware/modules/source
6. untar the vmci and vmnet tarballs
7. in vmci-only/include/pgtbl.h add compat_sched.h to the includes
8. in vmnet-only/vnetUserListener.c add compat_sched.h to the includes
9. tar those up again
10. run sudo vmware-modconfig—console—install-all
11. Assuming all is well, vmware will now work properly.

No Comments »

FastCGI process exceeded configured activity timeout

I found the solution here: http://forums.iis.net/t/1076662.aspx

Here is how to set the configuration with IIS 7.0:

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\php\php-cgi.exe'].activityTimeout:600

You need to change the 'C:\php\php-cgi.exe' to the actual location PHP that you registered with IIS.

If you want to make double-check that the configuration worked properly, you can check it like this:

%windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgi

No Comments »

How to change the DirectAdmin server IP address

#cd /usr/local/directadmin/scripts
#./ipswap.sh <oldip> <newip>

Now alle the directadmin config files are changed.
Now apache needs a restart to activate this.

No Comments »

SVN and Mac OSX hidden .DS_Store ._ .AppleDouble files

If you work on a mac (as i do) your directories get poluted with .DS_Store, ._ and .AppleDoubel files. Apple (this is THE missing Finder feature!) has no option to turn this crap off.
Now when you use svn, you will also import all these useless files.

Thank god there is a option in svn to globally ignore specific files.
Just edit the file:

~/subversion/config

Find the line global-ignores, uncomment it and make it something like this:

global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store .AppleDouble ._*

Whoot!

No Comments »

Iptables active and passive FTP in CentOS

This is how to make sure active AND passive FTP work flawlessly with IPtables, in this case, on CentOS. In this case it was for a DirectAdmin server.
You have to look up in your ftpd config which passive FTP ports your daemon uses and use those. In my case the portrange was 35000-35999.

This is /etc/sysconfig/iptables

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

#active and passiev ftp
-A RH-Firewall-1-INPUT -p tcp --syn --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp --syn --dport 20 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp --syn --dport 35000:35999 -j ACCEPT

#ssh only for me
-A RH-Firewall-1-INPUT -s 1.2.3.4 -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

#other useful ports available to the public
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2222 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

Now we have to make sure some iptables modules are loaded.
Edit /etc/sysconfig/iptables-config
Make sure this line is looking like this:

IPTABLES_MODULES="ip_conntrack_netbios_ns ip_nat_ftp ip_conntrack_ftp"

Restart your iptables and test your ftp connection. It should work as expected.

2 Comments »

Alternate PHP exec() function bypassing cmd.exe

I had a problem running executables (like identify.exe and convert.exe from ImageMagick) from php under windows using the exec() funciton. The solution provided by others was kind off stupid... Give full permisions on cmd.exe to IURS... Like you wanna do that.....
I wrote a exec() replacement function using the bypass_shell option proc_open has. It works great for me. Do your favour with it.

 
<?php
 
	function executeCommand($cmd) {
 
		if(DEBUG === true) {
			echo "Command: ".$cmd;
			echo "<br>";
			echo "Tempdir: ".TEMP_DIR;
			echo "<br>";
		}
 
		$descriptorspec = array(
		   0 => array("pipe", "r"),
		   1 => array("pipe", "w"),
		   2 => array("pipe", "w")
		);
 
		$process = proc_open(
				$cmd,
				$descriptorspec,
				$pipes,
				TEMP_DIR,
				NULL,
				array('bypass_shell' => TRUE)
		);
 
		if(!is_resource($process)) {
			return false;
		}
 
		if(!$pipes[1]) {
			if(DEBUG === true) {
				echo "No STDOUT<br>";
			}
			return false;
		}
		$output = stream_get_contents($pipes[1]);
		fclose($pipes[1]);
		$err = stream_get_contents($pipes[2]);
		fclose($pipes[2]);
 
		$x = proc_get_status($process);
 
		$return_value = proc_close($process);
 
		if($return_value == 0) {
			if(DEBUG === true) {
				echo "Return value {$return_value}<br>";
				print_r($x);
				echo "<br><br><br>";
			}
			return explode("\n", str_replace("\r", '', $output));
		} else {
			if(DEBUG === true) {
				echo "Return value {$return_value}<br>";
				print_r($x);
				echo "Output: ".$output;
				echo "Error: ".$err;
				echo "<br><br><br>";
			}
			return false;
		}
 
	}
?>
 

2 Comments »

ClamAV 0.94 not working anymore in MailScanner

I had this issue, clamav worked perfectly on command line, but within MailScanner it seemed to stop working. I could not find out why. I checked every configuration file, everything seemed normal.

Today i was upgrading ClamAV from 0.94 to 0.94.1, and suddenly i saw these lines in my maillog:


Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --unzip
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --jar
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --tar
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --tgz
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --deb
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --unrar
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --arj
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --lha
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --unzoo
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --max-ratio
Nov 12 09:01:39 mx02 MailScanner[26358]: WARNING: Ignoring deprecated option --unrar

Hmmmm.. weird. I started googling and found this bug:
https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1213

They did this: Instead of hardfailing, clamd will print warnings.

Glad it is resolved now..

2 Comments »

How to make a shortcut in OSX

Because i keep forgetting this crap:

Press Shift-Alt-Apple then drag the folder to somewhere to create a shortcut.
This only works on the SAME disk/partition.

No Comments »

Automatic frame redirect (cloaking) with apache and PHP

Sometimes a customer wants redirection using a frame. What you as an ISP don't want to do is make webspace and a index.html file for each customer handling this. You want this automated somehow.
This is how i did it.

First set up redirection with apache.

 
<VirtualHost *:80>
    ServerName www.whatever.com
    ServerAdmin admin@whatever.com
    DocumentRoot /usr/local/www/apache22/data
    SetEnv FRAMEREDIRECTURL "http://www.to-where-ever.com/blah/blah"
    ServerAlias *.whatever.com whatever.com
</VirtualHost>
 

As you can see we set a environment variable containing the URL you want to redirect to.
Next you will need some PHP to generate the frameset. Create this in the documentroot you specified in the virtual host.

 
<html>
<frameset rows="100%">
<frame src="<?php echo $_SERVER['FRAMEREDIRECTURL'] ?>">
</frameset>
<noframes>
<body>Please follow <a href="<?php echo $_SERVER['FRAMEREDIRECTURL'] ?>">link</a>.</body>
</noframes>
</html>
 

This is it. Use this info if you can.
Cheers

No Comments »

Stop OSX from creating irritating dot files on network drives

To stop Max OSX from creating .DS_Store files on network drives (and prevent pissing of your co-workers) just type in this on a terminal and reboot:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

3 Comments »

Next »