Monthly Archives: April 2008

Webmin pptp user synchronization

Webmin has this great feature that it can add users in several modules when a system user is added ( of course only when added from webmin ).

This feature can really be useful if you want for example to automatically add a system user to samba, mysql or other modules.

In order for this to work each modules that wants such a synchronization had to implement some standard functions and put them in a special file inside their module directory. Then when a system user is added, removed or updated the Useradmin module will look for a file named useradmin_update.pl in all modules installed in webmin. When it finds the file it will execute a function in the useradmin_update.pl corresponding to the action in useradmin module.

The pptp-server is a webmin module that is used for administrating a Point to Point Tunneling Protocol server , an easy way for creating VPNs to be used by windows or Linux machines. What I wanted was that when I added a system user webmin would also create a samba user and a pptp user so that the user could access the files over ftp or samba but over a more secure link so I wrote an useradmin_update.pl script for pptp

How to set it up?

get the script: useradmin_update.pl and place it into you pptp-server module folder on gentoo this is /usr/libexec/webmin/pptp-server a simple locate pptp-server should show you where it is.

Make sure you chmod 755 useradmin_update.pl

add the following lines to config.info in pptp-server :

sync_add=Add a pptp vpn server user when a Unix user is added,1,1-Yes,0-No
sync_change=Change the pptp vpn server user when a Unix user is changed,1,1-Yes,0-No
sync_delete=Delete the pptp vpn server user when a Unix user is deleted,1,1-Yes,0-No

remove the module.infos.cache file ( usually /etc/webmin/module.infos.cache ) and then restart webmin.
Now login to webmin as admin or root and go to Networking -> PPTP VPN Server -> Module config and check those 3 sync options .

To test it add a user using the webmin-> System -> Users and Groups admin then go to Webmin -> Networking -> PPTP VPN Server -> PPP Accounts and you should see the user there.

Proftpd: listen on single ip

I don't use ftp, I always use sftp/scp/rsync over ssh or even a fuse remote filesystem for transferring files but wordpress 2.5 comes with this nice feature to upgrade plugins automatically from the web admin interface that needs ftp.

the problem is I don't want to enable the ftp service and make it available to the rest of the world just for that.

So what are my options?

  1. I know I could just add a firewall rule and just not allow anyone else except for localhost to connect
  2. set proftpd to listent only on localhost ( 127.0.0.1)

The #1 depends on what firewall you have so I'm not going to discuss it here. You also may not want to do that because of some other reasons you might have.

#2 needs the following two options in proftpd.conf:

DefaultAddress 127.0.0.1
SocketBindTight                 on

Now restart proftpd and you're done.

MacOSX: adduser

I really needed an adduser like program on MacOSX  and after a few searches on the internet I found a script that works like the linux adduser program.

I remember I had to modify it to use bash ( my preferred shell ) as the default shell and I make it use the right path when copying the user template. I can't remember exactly where I found it so if you have seen this someplace else feel free to let me know and I'll be happy to give credit.

Here it is :

  1.  
  2. #!/bin/sh
  3. echo "Enter username:"
  4. read newuser
  5. echo "Enter the full name for user $newuser's:"
  6. read long_name
  7. echo "Will $newuser an Admin user (y/N)?"
  8. read is_admin
  9. new_uid=`nidump passwd . | awk -F: '{print $3f}' | sort -n|tail -1`
  10. new_uid=`expr $new_uid + 1`
  11. nicl . -create /users/$newuser
  12. nicl . -create /users/$newuser uid $new_uid
  13. nicl . -create /users/$newuser realname "$long_name"
  14. nicl . -create /users/$newuser passwd ""
  15. nicl . -create /users/$newuser gid 20
  16. nicl . -create /users/$newuser shell "/bin/bash"
  17. nicl . -create /users/$newuser home "/Users/$newuser"
  18. nicl . -create /users/$newuser _writers_passwd $newuser
  19. passwd $newuser
  20. ditto /System/Library/User\ Template/English.lproj /Users/$newuser
  21. chown -R $newuser:staff /Users/$newuser
  22. nicl . -read /users/$newuser
  23. if [ "$is_admin" = Y -o "$is_admin" = y ]
  24. then
  25. nicl . -append /groups/wheel users $newuser
  26. nicl . -append /groups/admin users $newuser
  27. nicl . -read /groups/wheel
  28. nicl . -read /groups/admin
  29. fi

Upgraded wordpress to 2.5

I have finally upgraded wordpress to 2.5.

The old version was 2.3.1 ( yeah that old ) and the upgrade was pretty smooth.  I didn't use plugins like instant upgrade for this upgrade but I'm thinking of using for the next upgrades.

How did I do it?

I have my own method for this. It's very similar to what they descibe in the official upgrade docs but a bit modified.

Here are the 7 steps I followed:

  1. backup the database using the backup plugin
  2. remember ( write a list of) active plugins then deactivate all ( so if any plugin will not work in the new version you can still access the blog and the admin interface )
  3. make a backup of all files ( assuming current install is in public_html ):
    1. cp -rp public_html  wp-2.3.1_backup
  4. download and extract the new version ( it will create a wordpress folder so make sure you don't already have one cause it will overwrite the files in it ) :
    1. wget http://wordpress.org/latest.tar.gz
    2. tar -xzpf wordpress-2.5.tar.gz
  5. use rsync to copy the new files over the old files ( note the exclusion of wp-content to preserve the modifications you might have done to themes and plugins ) :
    1. sync -avz --exclude=wp-content wordpress/ public_html/
  6. call the upgrade.php script, go to : http://your_own_blog.tld/upgrade.php
  7. reactivate the plugins you had active before the upgrade

The whole thing took about 10 minutes and there were no problems encountered except for a few plugins that could not be reactivated because they were incompatible with the new version.

What I like about it?

I like the new interface,it seems friendlier, faster, more slick and  I was getting  bored of the old one.

I don't care much about the dashboard, but I love the way the WYSIWYG editor works.

I think the feature that I love the most is the automatic plugin upgrade but this is also the one that I think it needs more work ( of course there may be others that I did not notice yet )

what id didn't like?

Here are three problems I found with the automatic plugin upgrade:

  1. the first time I tired it id didn't seem to care that I selected "No" for the "Use SSL" option and it just told me it could not connect.
    This was because my ftp server did not have ssl enabled but it was impossible to know this was the cause because it was clear to me from the web interface that it was not using SSL until I went in the code and just run a print_r on the $credentials variable .
    I'm not sure why this happened, I guess a bug. I had to go into the database and manually edit the ftp_credentials option and set ssl to 0 and then the plugin upgrade worked.
  2. It doesn't remember the value of the "Use SSL" option. After I go in to upgrade another plugin the option is set to "yes" even thou in the database it is 0.
  3. it removes the old plugin first and then tries to install the other. If the new version install doesn't work for some reason you are left with no plugin and you will have to go in and install manually the old way. I think a bettwe approach would be to first deactivate the old plugin, make a backup copy, try to install the new one and if it doesn't work restore the old plugin.

Conclusions

Overall wp 2.5 brings good improvements and great new features but as with any new major version increase there are a few minor details not taken good care of. Waiting to see what the 2.5.1 version wil bring on he bug fixing side.

Have you upgraded yet?  what are your thoughts on the 2.5 version ?

Firefox 3 beta 5 released

Mozilla released the 5'th beta of the Firefox 3 browser a few hours ago.

The new beta brings enhancements in the bookmark organizer, operating system integration and most important to me the speed in the javascript engine that so many sites depends on these days.

There are just 750 improvements since the last beta version, 250 fewer then the number of improvements between beta 3 and beta 4.

I think this will probably be  the last beta version before a release candidate even thou the "known issues" list is a bit larger then the one of the previous beta.

Here are the release notes and here is the download page for those of you that want to give it a try.