We prohibit changing browser settings
Yesterday at work, I needed to configure Firefox browsers on the thin clients of our Internet cabinet so that users could not change some settings in the browser and surf the Internet bypassing the proxy. A search on the Internet and further tuning prompted me to write this article. Here I will tell you how you can block some browser settings from being changed by playful user handles.
Let's create a mozilla.txt file with something like this: The first line must be two slash characters (//). The names of the required parameters and their values can be viewed by typing about: config in the browser . In this example, I forbade users to change the settings of our proxy and the home page.
//
lockPref("browser.startup.homepage", "http://habrahabr.ru");
lockPref("network.proxy.type", 1);
lockPref("network.proxy.http", "192.168.1.1");
lockPref("network.proxy.http_port", 3128);
lockPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
Now you need to shift all characters of this file by 13 positions in the ASCII table and get the encrypted mozilla.cfg file.
To do this, use the online service Automatic Mozilla Configurator .
Under Windows, you can use ByteShifter , there is also a version for Linux, but it didn’t work for me. It is better to create such a perl script: Save the file as mozilla_byteshift.pl , make it executable: Put our mozilla.txt file in the folder with the script and execute it in the terminal: The resulting mozilla.cfg file must be put in the folder with the Firefox executable file: For Linux, usually : / usr / lib / firefox / For Windows usually:
#!/usr/bin/perl
# 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.txt
# To encode: moz-byteshift.pl -s 7 netscape.cfg
# Mozilla uses a byteshift of 13
# To decode: moz-byteshift.pl -s -13 mozilla.txt
# To encode: moz-byteshift.pl -s 13 mozilla.cfg
use strict;
use Getopt::Std;
use vars qw/$opt_s/;
getopts("s:");
die "Missing shift\n" if (!defined $opt_s);
my $buffer;
while(1) {
my $n=sysread STDIN, $buffer, 1;
last if ($n eq 0);
my $byte = unpack("c", $buffer);
$byte += 512 + $opt_s;
$buffer = pack("c", $byte);
syswrite STDOUT, $buffer, 1;
}
$ chmod +x mozilla_byteshift.pl
$ ./mozilla_byteshift.pl -s 13 mozilla.cfg
C: \ Program Files \ Mozilla Firefox \
Now open the ./greprefs subdirectory along this path and find the file all.js there . Open this file in a text editor and add the following line to the end:
pref("general.config.filename", "mozilla.cfg");
Save the changes.
We start Firefox and look:
All of our forbidden settings are now unavailable for change!