Stupid Webmin Tricks
posted in tech by jon on 2007-04-13
I've been working alot with webmin in the past view weeks, and learning a ton along the way. I'm sure that most of this is already well documented (like the rest of webmin) but I didn't know it, and that makes it important. :-)
first trick: custom, "unattended" installs. Webmin's main setup script calls two external (and by default non-existent) scripts during the install process. By creating these two scripts, and placing them in the webmin install directory, you can "pre-set" various options; any variable pre-set in this way won't be prompted for during install. This is great for maintaining a standard configuration across multiple systems.
The first script, setup-pre.sh is called at the beginning of the setup script, and is primarily useful for pre-setting variables.
My commented example:
####################################### 5-2005 ## # # setup-pre.sh: # # called by setup.sh. sets up pre-defined # variables that will be used as defaults # by webmin setup rather than prompting # the user. This allows for partially or # completely automated installs. Variables # declared here _won't_ be prompted for at # install. # # author: jon allie [ jon (at)jonallie(dot)com ################################################## ## $config_dir: directory for webmin to store it's config files # will be created by the installer if it doesn't exist. config_dir=/opt/freeware/webmin/config ## $var_dir: directory for webmin to store it's log files # will be created by the installer if it doesn't exist. var_dir=/opt/freeware/webmin/log ## $perl: full path to the perl executable. perl=/usr/bin/perl ## $os_type: os type, see os_list.txt for possible values os_type=aix ## $os_version: version number of os_type specified above os_version=5.2 ## $real_os_type real_os_type=IBM AIX ## $real_os_version real_os_version=5.2 ## $port: port for webmin server to listen on. port=10000 ## $login: webmin username login=admin ## $password: plain text password. don't use this #password= ## $crypt: pre-encrypted password. set this to 'x' to enable unix authentication crypt=x ## $ssl: whether or not to use ssl. 1 for yes, 0 for no # the Net::SSLeay library MUST be installed for # this to function. ssl=1 ## $atboot: whether or not to start webmin at boot. atboot=1
setup-post.sh is, of course, called at the end of the setup process, and can be used for just about anything. Here, I'm disabling the (stupidly default) options to remember passwords and to display the system hostname on the login page.
####################################### 5-2005 ## # # setup-post.sh: # # called by setup.sh. this script is called # as a final step before starting webmin # at the end of install. Used to set final # options. # # author: jon allie [ jon(at)jonallie(dot)com ] ################################################## ### set shorter name for location of global config file gconfig=$config_dir/config ## exit if global config isn't writable if [ ! -w $gconfig ]; then exit 0 fi ### set extra security options in global config ## disable the option to remember passwords echo "noremember=1" >> $gconfig ## disable display of hostname on login page echo "nohostname=1" >> $gconfig
Subscribe 