WebNull

Nov 28 2011

MSN Messenger encryption

I occasionally use Simp lite to encrypt MSN communication. Unfortunately, sometimes the whole encryption proxy dies for no obvious reason. The annoying thing about this is that I have to restart my box all the time to make it work again. Finally, I took some time and found a solution to re-launch the application without restarting. Here is the process:

  • Sign out of MSN (not required)*
  • Exit MSN
  • Close Outlook (hooks to MSN and doesn’t let to terminate the process)
  • Close IE (IE also has some addon hooks to MSN)
  • Close SIMP
  • Restart SIMP (Default path: C:\Program Files\Secway\SimpLite-MSN 2.5\SimpLite-MSN.exe)
  • Restart MSN/Sign in
  • Restart Outlook/IE as needed

*I usually disable automatic sign on to MSN. With this trick I can detect if MSN is really started as a new process. If sign on dialog appears I know it’s a fresh start.

Jun 16 2010

VPN (pptp) server on linux (centos)

It’s fairly simple to set up by this article: 

http://www.dotcomunderground.com/blogs/2010/04/10/poptop-pptp-centos5-installation-setup/

The only difference is that I used the following commands to config and save iptables:

iptables -A INPUT -i ppp0 -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT
iptables -A INPUT -i eth0 -s 10.10.1.0/24 -j ACCEPT
iptables -A FORWARD -i eth0 -s 10.10.1.0/24 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp —dport 1723 -j ACCEPT
iptables -A INPUT -i eth0 -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

/etc/init.d/iptables save

May 25 2010

Mercurial named branch

This is a note to self how to do mercurial named branch and merge:

Display current branch
hg branch

Display all branches
hg branches

Create branch newfeature
Edit files
hg branch newfeature
hg commit

Switch branch
hg update -C default
hg update -C newfeature

Merge
hg update -C default
hg merge -r (branch latest revision number)

More info: http://mercurial.selenic.com/wiki/NamedBranches

May 21 2010

Connecting to Access database on Windows Server 2008R2

I had to move an old site from Windows Server 2003, IIS5 to IIS 7.5. Sounded like an easy task until I found out it used an Access database with DSN connection. Something like this:

<add key=”ConnectionString” value=”DSN=mydb”/>

Nice old days when configuring a connection string had this extra unnecessary step.

I even felt clueless when I found out that there is no ODBC driver for ACCESS on Win2k8 64 bit. Or at least I couldn’t find one.

I won’t bore you with the details but the solution is here:

<add key=”ConnectionString” value=”Driver={Microsoft Access Driver (*.mdb)};Dbq=mypath\mydb.mdb;”/>


Jan 19 2010

My password management system

I hate passwords. I understand we haven’t come up with something better so I guess it’s here to stay.

There are a couple of reasons why I don’t like them.
- All systems require a new one. Re-usage is simply not an option. It would void the the entire idea of having a password to systems.
- They need to be stored somewhere unless you can remember a zillion of them.
- Vulnerable to key-logger attacks.

At some point in my life I decided I need to keep track of my passwords. I looked for a secure vault where I could store them all. (Of course paper is not an option.) Since I’m using many different machines and systems I was looking for a cross platform application to do the job for me.

Keepass (V1.xx) has solved this one for me on Windows and KeepassX has on OS X.

But what if I need a password fast for a new online system or something unsecure. Do I really want to generate a new password for every website? My answer is no. I come across this site: www.pwdhash.com. The idea is simple. Using a master password and a domain name I get a unique (hashed) password that I can recreate without my secure vault. All I need to do is remember my master password.

Ok but what if I don’t have a web browser and the Internet at hand?

That’s why I created pwdHash for iPhone. More here.

Jan 14 2010

Installing Mercurial hgwebdir.cgi on Windows 2003, Apache2

UPDATE:

Clay Lenhart sent me the following solution to the timeout issue:

cd \inetpub\AdminScripts\
cscript adsutil.vbs GET /W3SVC/CGITimeout
cscript adsutil.vbs SET /W3SVC/CGITimeout 3000

Thank you!

As I posted previously I had installed Mercurial cgi-bin on Windows 2003 and IIS 6. After some promising rounds I decided to use it in production. At least this was my idea.

No matter how many times I tried cloning one of my project (about 40MB)  the hg clone command (over https) always returned an error like this:

transaction abort!
rollback completed
abort: premature EOF reading chunk (got 36750 bytes, expected 131164)

I had no choice but to install Apache2.

Here is my walkthrough.

  1. Download and install Python 2.6.4 to C:\Mercurial\Python
  2. Download and install MiniGW 5.1.6
    • Choose the Download and Install Option.
    • Choose the Current Package Option to Install.
    • For the Components to Install Select the “Minimal” option. Install to C:\Mercurial\MinGW
  3. Add to path “C:\Mercurial\Python\Scripts;C:\Mercurial\Python;C:\Mercurial\MinGW\bin”
  4. Download and unzip Mercurial source to C:\Mercurial\Source
  5. Build Mercurial from command line:
    python setup.py build --force -c mingw32
    python setup.py install --force --skip-build
  6. Create default hgrc from command line type:
    cd %userprofile%
    copy con .hgrc
    [ui]
    username = Firstname Lastname <firstname.lastname@example.net>
    verbose = True
    • CTRL-Z
    • ENTER
  7. hg debuginstall should display “No problems detected”
  8. Download and install Apache2.2 + OpenSSL. Default settings are fine except path where use c:\Mercurial\httpd
  9. Open c:\Mercurial\httpd\conf\http.conf with a text editor.
    Replace
    Listen 80
    with
    Listen 8080
    Replace
    #LoadModule ssl_module modules/mod_ssl.so
    with
    LoadModule ssl_module modules/mod_ssl.so
    Replace
    #Include conf/extra/httpd-ssl.conf
    with
    Include conf/extra/httpd-ssl.conf
  10. Open c:\Mercurial\httpd\conf\extra\httpd-ssl.conf with a text editor.
    Replace
    Listen 443
    with
    Listen 8088
    Replace
    <VirtualHost _default_:443>
    with
    <VirtualHost _default_:8088>
    Replace
    SSLCertificateFile "C:/Mercurial/httpd/conf/server.crt"
    with
    SSLCertificateFile "C:/Mercurial/httpd/conf/localhost.cert"
    *use your domain instead of localhost
    Replace
    SSLCertificateKeyFile "C:/Mercurial/httpd/conf/server.key"
    with
    SSLCertificateKeyFile "C:/Mercurial/httpd/conf/localhost.key"
  11. Open a command prompt and type the following. When asked for common name use te actual domain (localhost in this example)
    cd  c:\Mercurial\httpd\bin
    openssl req -config ../conf/openssl.cnf -new -out localhost.csr -keyout 
    openssl rsa -in localhost.pem -out localhost.key
    openssl x509 -in localhost.csr -out localhost.cert -req -signkey localhost.key -days 365
    copy localhost.cert ..\conf
    copy localhost.key ..\conf
  12. Create a C:\Mercurial\Repositories directory
  13. Copy the hgwebdir.cgi file from the C:\Mercurial\Source to C:\Mercurial\httpd\cgi-bin\
  14. Create hgweb.config in C:\Mercurial\httpd\cgi-bin\
  15. Insert text in hgweb.config
    [paths]

    / = C:\Mercurial\Repositories\
  16. Create a test repository
    cd C:\Mercurial\Repositories
    md test
    cd test
    hg init
  17. Enable push for this repository
    • create hgrc file with notepad in cd C:\Mercurial\Repositories\test.hg
    • insert the following text
    [web]

    allow_push = *

  18. Open c:\Mercurial\httpd\cgi-bin\hgwebdir.cgi with a text editor able to handle unix style now line breaks. Replace
    #!/usr/bin/env python
    with
    #!C:/Mercurial/Python/python.exe
    Replace
    #sys.path.insert(0, "/path/to/python/lib")
    with
    #sys.path.insert(0, "C:/Mercurial/Python/Lib")
  19. This is an optional step. If you don’t want authentication skip to the next step.
    Open c:\Mercurial\httpd\conf\http.conf with a text editor
    Replace
    <Directory "C:/Mercurial/httpd/cgi-bin">

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

    </Directory>
    with
    <Directory "C:/Mercurial/httpd/cgi-bin">

    Order allow,deny

    Allow from all

    AuthName "frantic"

    AuthType Basic

    Require valid-user

    AuthUserFile "C:/mercurial/htpasswd"

    </Directory>

    Open a command prompt and type the following
    cd C:\Mercurial\httpd\bin
    htpasswd -c htpasswd YourUserName
    copy htpasswd c:\mercurial
  20. Test your newly configured website: eg. http://localhost:8088/cgi-bin/hgwebdir.cgi
Jan 05 2010

pwdHash for iPhone

pwdHash for iPhone, my first iPhone app is available on iTunes.

Check out the the details here http://iphone.borg.hu/pwdhash/

Dec 31 2009

Installing Mercurial hgwebdir.cgi on Windows 2003 IIS 6.0

This walk-through is based on the following stackoverflow article.

  1. Download and install Python 2.6.4 to C:\Mercurial\Python
  2. Download and install MiniGW 5.1.6
    • Choose the Download and Install Option.
    • Choose the Current Package Option to Install.
    • For the Components to Install Select the “Minimal” option. Install to C:\Mercurial\MinGW
  3. Add to path “C:\Mercurial\Python\Scripts;C:\Mercurial\Python;C:\Mercurial\MinGW\bin”
  4. Download and unzip Mercurial source to C:\Mercurial\Source
  5. Build Mercurial from command line:
    python setup.py build --force -c mingw32
    
    python setup.py install --force --skip-build
  6. Create default hgrc from command line type:
    cd %userprofile% 
    copy con .hgrc [ui]
    username = Firstname Lastname <firstname.lastname@example.net>
    verbose = True
    • CTRL-Z
    • ENTER
  7. hg debuginstall should display “No problems detected”
  8. Create C:\Mercurial\Web and C:\Mercurial\Repositories directories
  9. Copy the hgwebdir.cgi file from the C:\Mercurial\Source to C:\Mercurial\Web
  10. Create hgweb.config in C:\Mercurial\Web
  11. Insert text in hgweb.config
    [paths]
    / = C:\Mercurial\Repositories\
  12. Give IUSR_{ComputerName} Modify permissions for C:\Mercurial\Repositories
  13. Create a test repository
    cd C:\Mercurial\Repositories
    md test
    cd test
    hg init
  14. Enable push for this repository
    • create hgrc file with notepad in cd C:\Mercurial\Repositories\test.hg
    • insert the following text
    [web]
    allow_push = *
    push_ssl = false
  15. Start IIS Manager
    • Allow All Unknown CGI Extensions in Web Server Extensions.
    • Create virtual dir or new website with C:\Mercurial\Web path.
    • Grant website execute permission
    • In application configuration (Home Directory, Configuration button) add new extension. Executable:
      "C:\Mercurial\Python\python.exe" %s
      Extension:.cgi
  16. Test your newly configured website: eg. http://localhost/hgwebdir.cgi

TODO:

  • Don’t forget to configure authentication.
  • Change file system permissions accordingly.
  • Increase cgi timeout
cd \inetpub\AdminScripts\
cscript adsutil.vbs GET /W3SVC/CGITimeout
cscript adsutil.vbs SET /W3SVC/CGITimeout 3000
    Dec 29 2009

    PHP has encountered an Access Violation at 01C0AAAE

    I ran into this issue while I was trying to install Joomla on top of  PHP (5.2.12), IIS (6.0) and MySQL (5.1.39).

    phpinfo() worked fine, but when the Joomla install page tried to access the mysql database I got the following error message:

    PHP has encountered an Access Violation at 01C0AAAE

    Solution:

    I copied php5ts.dll AND libmysql.dll to my %systemroot%\system32 directory.

    This is strange since Path environment variable contains my php install directory.

    Dec 24 2009

    Testing an iPhone application without XCode

    I asked my friend to beta test an iPhone app I had made. The problem was that he didn’t have XCode nor he wanted to install it.

    Here is the solution:

    Prerequisite an iPhone dev account + iPhone developer membership.

    • Go to Apple Developer Connection - iPhone Developer Program here
    • Add you App ID if you haven’t done so.
    • Add you provisioning profile. Don’t forget to add the device you need to test your app on.
    • Download and install your certificates and the provisioning file. More details here.
    • Build your signed app.
    • Send or copy both .app and .mobileprovision files to the computer where the device is connected.
    • Use iTunes to copy the two files to your device.
    Page 1 of 2