NinfG and Firewall
The latest version of NinfG (version 5.0) has a lot to offer in terms of allowing client-server connectivity. First, it introduces the invoke server module separating components used to invoke remote applications from the core. This does not only decouple NinfG from the Globus Toolkit like the previous versions, but it also allows the use of other middlewares such as SSH to execute remote commands. Since most Linux distributions already include some form of SSH, this makes the installation of NinfG more useful and a lot easier. You don’t have to install the Globus Toolkit just to install NinfG. The other feature I like is the communication proxy module, which tries to solve firewall-related problems. Unfortunately, NinfG currently only supports a communication proxy for the Globus Toolkit. If you don’t want to install the Globus Toolkit and only employ SSH invoke server, you are out of luck.
In this post, I would like to introduce a work-around of the firewall problem using only the SSH invoke server. The assumption is that the NinfG client and server applications are separated by a firewall. We would like also to assume that the client machine, where the client application is running, can connect to the server machine via SSH directly or via virtual private network. In this way, we can then use the SSH invoke server. If not, we are completely out of luck.
Although NinfG version 5 can now use SSH to invoke remote commands, it still has the same firewall problem inherent when using the Globus Toolkit. The reason is that the server application still needs to connect back to the client application. So if there is a firewall in-between client and server applications, this connection always fails and thus the entire application fails even if the client can connect to the server via SSH (since SSH connection is usually only allowed one way). This is further compounded if the client machine is in a NAT network.
To solve the problem, we should find a way such that the server application does not have to connect back directly to the client application, which causes the connection failure. My solution is therefore to use SSH port forwarding. Since we can connect to the server via SSH, we can instruct SSH to forward a port from the server machine to a local port in the client machine. We can then configure the server application to connect to this local port (in the server machine) instead of connecting directly to the client machine. At the same time, we can also configure the client application to listen to this specific local port.
Fortunately, NinfG allows us to do this using the configuration file. The specific section to use is the CLIENT section. The CLIENT section of the configuration file can look like this:
<CLIENT>
hostname localhost
listen_port 2222
</CLIENT>
This will trick the server application to connect to port 2222 in localhost (which is set to be the hostname of the connecting client). But local port 2222 in the server machine is forwarded to the client’s local port 2222 via SSH. So when the server application connects to this port, it is indirectly connected to the client application and thereby establishing the server and the client connection with SSH working in the background. The SSH command to achieve this is as follows (run from the client machine)
[user@client]$ ssh –R 2222:localhost:2222 remoteserver.com
For a more general setting, you can use a third machine which is globally accessible via SSH. You can then use SSH to forward a port from this third machine to a local port in the client machine and configure NinfG’s server applications to connect back to this machine in the forwarded port. The CLIENT section of the configuration file will now look like this assuming thirdserver.com is the hostname of the third machine.
<CLIENT>
hostname thirdserver.com
listen_port 2222
</CLIENT>
And the SSH command is
[user@client]$ ssh –R 2222:localhost:2222 thirdserver.com
This also assumes that you have an account in thirdserver.com machine. Or else, you will not be able to connect to it. In general, you should allow the forwarded port to be available to any machine, not just thirdserver.com. In this way, other server applications residing in other machines can connect to your client application via thirdserver.com. To do this, you can set GatewayPorts to yes in /etc/sshd_config in thirdserver.com.
Migrating phpWebsite 0.10.2 to PHP version 5
After changing my web hosting provider, I am faced with the task of migrating a couple of web sites to the new server. A couple of these web sites are phpWebsite-based. Unfortunately, the new server is using a version of PHP higher than 5, which is known to cause some problems with the version of phpWebsite (v 0.10.2) I am currently using. Left with no choice, I searched Google for available solutions. Luckily, the search results did come up with some possible solutions, although I could not find an official migration guide. So in this post, I will describe the problems I've encountered in migrating my phpWebsite 0.10.2 installation to a server running a PHP version higher than 5.
The first thing I did was to transfer all files and databases to the new server. After uploading everything, I also changed the configuration file (conf/config.php) to reflect the new server setup. This included changing the database and source directory settings. Then, the debugging part.
Migrating from Serendipity to Wordpress Using Windows Live Writer
After months of inactivity, myGUIDE is now back with a new look and running on a different weblog platform. Yes, you read it right, I changed my blog platform from Serendipity to WordPress. This means that although I have migrated all my previous posts to WordPress, previous links will no longer work since Serendipity and WordPress have different link structure. Now if you're looking for a particular post, you can still find it here. Just use the search box to locate it.
How did I do it? It was quite easy. Thanks to Windows Live Writer (WLW). But before taking this approach, be warned that this may not be appropriate for your case. This worked for me because myGUIDE is relatively new and has only a small number of blog entries and I've been using WLW to post entries to this blog. A Serendipity importer plugin is already available for WordPress. So maybe you're better off using the plugin. But if you want an alternative approach, you can try this one.
The first thing to do is to create a weblog account in WLW to access your Serendipity-based blog, if you have not done it yet. Then setup another account in WLW to access your WordPress blog. After doing this, you're ready to go. Simply read your blog entries, one at a time, from your old blog using WLW, then switch to your new blog, and click the Publish button to publish the entry you just retrieved. It is that easy! You can also use WLW to create the relevant categories in your new blog. You can even set the published date so that you can keep the original date of your posts.
But there are limitations to this approach. First, you will lose all your comments. WLW will not read the comments associated to each post. Second, WLW sometimes will not download the images in the post. Instead it will just get the link of the image from your original blog and use this link in the new one. Thus if you'll remove your old blog, the images will also disappear. Finally, if you have many entries, transferring all of them can take some time since you have to manually repeat the process of reading your previous posts from Serendipity then publishing it to WordPress. Luckily for me, I have only 15 entries so this was not an issue.
And that's it!
Search Philippines! A Google custom search engine
Interested in creating your own search engine? Try google custom search engine (CSE)! With google's CSE, you can customized your search experience, including in the search only sites that are relevant to you. You can also host both the search box and search results in your site. You can even create custom search engine on the fly. (For example, creating a search engine for sites included in your blogroll.) For those interested, you can visit this webpage on CSE's API.
It's really easy to configure but you need to have a google account. If you already have one, follow the link above, login, and start building your own search engine. I already made one and called it Search Philippines! SP! can be found in this URL: http://search.philippinestoday.net/ This search engine only includes Philippine-related websites (well, that's the target). For now, I have only a couple of websites included. I plan to include more Philippine news sites, pinoy blogs, etc. Here is the image of the site.
What is this for users? Since the number of sites to search are limited and focused (say, only for Philippine news sites), users will be able to get more relevant search results as compared to using the entire google search engine. For website owners, this will give more visibility to your website. For instance, search the term 'phpwebsite' in google. This blog (myguide.bagarinao.com) appears in the 5th page. Search it again in my custom search engine Search Philippines! This blog is now on the first page. This is because I included my blog in the list of websites for Search Philippines.
Any way, if you are interested in helping build Search Philippines! or want to include an SP! search box in your website or blog, drop me a note! It will be great to have our very own custom search engine.
Windows live writer’s "Invalid response document" error
In my previous post, I outlined my unsuccessful attempt to use windows live writer (WLW) to connect to the XmlRpc server of PhpWebsite's article manager module. I experimented using both the Metaweblog API and the Movable Type API but with no success. When attempting to post an entry, WLW always returned the following error message "The response to the metaWeblog.newPost method received from the weblog server was invalid: Invalid response document returned from XmlRpc server." However, the entry did get posted. Republishing the same entry would create a new post instead of replacing the one posted earlier. And each time, WLW gave the same error.
I searched the Internet for possible solutions. I found out that the problem is quite common and not unique to PhpWebsite (PWS). The same problem has also been observed in other blogging platforms such as wordpress. Luckily for wordpress users, there are already solutions posted in several blogs for some of the problems with WLW. Unfortunately for me, the solutions were not applicable for PWS. I could not even find other sites or blogs talking about PWS and WLW except this one. It seems I am the only soul trying to do this in the entire world wide web.
Since most of the websites I'm maintaining are powered by PWS, I thought it is worth the time and effort to figure out the cause of the problem. I am also in need of a good editing application that I can use with PWS. The provided text editor is only good for basic editing and not for more advanced formatting. For instance, using tables in entries can really take a lot of time. Anyway, since I am using WLW in my other blogs, I thought it would be great if I could also use it in my PWS-based websites.
