[K12OSN] Locking down Mozilla and FireFox Preferencesa
Andy Rabagliati
andyr at wizzy.com
Fri Jan 21 14:47:29 UTC 2005
On Fri, 21 Jan 2005, Timothy Legge wrote:
> Hi All
>
> Based on Andy Rabagliati's post about lockpref I found some great
> documents on how to lock down browser preferences. You may have are
> read seen the LTSP Mozilla Lockdown HOWTO which basically tells you how
> to set the same preferences for all users:
>
> http://togami.com/~warren/guides/mozlockdown/
>
> The message at:
>
> http://lists.suse.com/archives/suse-linux-e/2004-Jul/2868.html
I attach the script I use.
all.js seems to move around a bit, so it may need tweaking.
It takes a single parameter - the proxy and home page (assumed the same).
Cheers, Andy!
-------------- next part --------------
#!/usr/bin/perl
# lock down browser homepage and proxy settings
# Andy Rabagliati <andyr at wizzy.com>
# http://wizzy.org.za/
use encoding 'latin1';
use strict;
sub usage() {
print "Usage: $0 <hostname>\n";
exit 1;
}
usage() if (@ARGV != 1);
my $hostname = $ARGV[0];
# Byteshifting program for mozilla's netscape.cfg files
# Old netscape 4.x uses a bytechift of 7
# To decode: moz-byteshift.pl -s -7 <netscape.cfg >netscape.cfg.txt
# To encode: moz-byteshift.pl -s 7 <netscape.cfg.txt >netscape.cfg
# Mozilla uses a byteshift of 13
# To decode: moz-byteshift.pl -s -13 <netscape.cfg >netscape.cfg.txt
# To encode: moz-byteshift.pl -s 13 <netscape.cfg.txt >netscape.cfg
# To activate the netscape.cfg file, place the encoded netscape.cfg file
# into your C:\Program Files\mozilla.org\Mozilla directory.
# Then add the following line to your
# C:\Program Files\mozilla.org\Mozilla\defaults\pref\all.js file :
# pref("general.config.filename", "mozilla.cfg");
my $buffer;
my $mozillacfg;
while ($_ = <DATA>) {
$_ =~ s/_WIZZY_HOSTNAME_/$hostname/g;
$buffer .= $_;
}
# lazy - but chop is convenient
$buffer = reverse ($buffer);
binmode(STDOUT, ":raw");
while(length($buffer)) {
my $byte = ord(chop($buffer));
$byte += 512 + 13;
$mozillacfg .= pack("c", $byte);
}
# calling all browsers ..
my @all = glob("/usr/lib/*/defaults/pref/all.js");
for my $f (@all) {
# read in file, skipping anything that mentions general.config.filename
open(FILE, $f) || die "Cannot read $f: $!";
undef ($buffer);
while ($_ = <FILE>) {
if ($_ !~ /general.config.filename/) {
$buffer .= $_;
}
}
close (FILE);
# add our version of general.config.filename
$buffer .= 'pref("general.config.filename","mozilla.cfg");//WIZZY' . "\n";
# write it out again
open (FILE, "> $f") || die "Cannot write to $f: $!";
print FILE $buffer;
close (FILE);
# get path to mozilla.cfg
$f =~ s:defaults/pref/all.js::;
$f .= 'mozilla.cfg';
# write it
open (FILE, "> $f") || die "Cannot write to $f: $!";
print FILE $mozillacfg;
close (FILE);
}
__DATA__
// Wizzy mozilla defaults lockdown for _WIZZY_HOSTNAME_
lockPref("browser.cache.disk.capacity", 0);
defaultPref("security.warn_entering_secure", false);
defaultPref("security.warn_submit_insecure", false);
lockPref("browser.cache.enable",false);
lockPref("network.proxy.type",1);
lockPref("network.proxy.ftp","_WIZZY_HOSTNAME_");
lockPref("network.proxy.ftp_port",8080);
lockPref("network.proxy.http","_WIZZY_HOSTNAME_");
lockPref("network.proxy.http_port",8080);
lockPref("network.proxy.ssl","_WIZZY_HOSTNAME_");
lockPref("network.proxy.ssl_port",8080);
lockPref("browser.startup.homepage","http://_WIZZY_HOSTNAME_/");
More information about the K12OSN
mailing list