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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.