Tag Archives: linux

vpnc ssh problem

Crazy story. Had SSH working over VPN (cisco, vpnc client, Ubuntu). After a while it just stopped. My employer didn’t change their VPN setup. Just stopped working. We checked logs, tried all kinds of stuff, nothing. Then one day, it started working again, but stopped a few hours later. So my guess is that I was connected to a different WiFi. Tried mobile hotspot using 3G, all fine. And I started to blame my router, tried to setup some forwarding, still nothing. Then I went on to check with my ISP, considering I have a custom router, and all the routers it was working on were their “official” routers. No luck, which isn’t a surprise, considering the usual ISP customer support. And then I ended up at these 2 topics:

http://stackoverflow.com/questions/25341773/cisco-ssh-key-exchange-fails-from-ubuntu-14-04-client-dh-key-range-mismatch
http://www.held.org.il/blog/2011/05/the-myterious-case-of-broken-ssh-client-connection-reset-by-peer

So what made it work for me is:

ssh -v -o KexAlgorithms=diffie-hellman-group14-sha1 -c aes256-ctr me@some.server

Drove me nuts, since the same machine works with different internet connection. I have no idea how the key exchange algorithm and the cipher specification make it work. And still don’t know the exact culprit, but my guess is it’s either the router or the ISP. My machine receives messages from the SSH server (when i run it without -0 -c), and then just times out on debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP.

Tagged , , , , , ,

Mounting USB in VirtualBox VM

Had problems mounting USB on a FreeNAS VM while running some Linux distro? Well, just add yourself to the vboxusers group.

sudo usermod -aG vboxusers <username>
Tagged , ,

Apache mod_rewrite setup

This module provides a rule-based rewriting engine to rewrite requested URLs on the fly. Let’s see how to set it up and working in a few steps.

It comes bundled with Apache HTTP Server. To install Apache server on Linux:

apt-get install apache2

or

yum install apache2

then enable the mod (not enabled by default)

a2enmod rewrite

Now we are going to enable application specific settings on the apache server.

  1. Go to /etc/apache2/sites-available/
  2. Open default for editing.
  3. Replace AllowOverride None with AllowOverride All
<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Order allow,deny
	allow from all
</Directory>

All left is to check if it’s working. Since we’re going to need PHP install it and restart apache.

apt-get install php5 libapache2-mod-php5
/etc/init.d/apache2 restart

Enter the root directory of the web app you want to use mod_rewrite with.
Make index.php:

<?php
	echo "http://" . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'];
?>

Open/Make a file .htaccess and add the following lines:

RewriteEngine on
RewriteRule ^.*$ index.php

This rule will redirect everything that comes to your web app to index.php inside the same app, and print the full address.

E.g.
A good mod_rewrite cheat sheet can be found here. (courtesy of AddedBytes)

Tagged , ,