Commit 03fafcf8 authored by Lorenzo Martinico's avatar Lorenzo Martinico

Add custom useragent

This is an initial commit to improve anonimity in Nayuos R69+. It adds
the most common user agent string (Chrome R68 on Windows 10) to the
chromium process at startup.
This is also the first addition of a patching message to modify the
ChromiumOS code. It does not modify the chromium browser code, which
will be necessary for successive anonimity feature additions.

This patch compiles, but it has not been tested if the user agent is
actually modified when run on a board
parent ac0b832b
......@@ -99,7 +99,7 @@ context =
recipe = slapos.recipe.template:jinja2
template = {{ software_dir }}/scripts/cros_full_build.in
rendered = ${directory:run}/cros_full_build
md5sum = 2a64b5cc0314ec2221a949928956f5c0
md5sum = ff09ba2bda748af933c78de4df9149fc
mode = 0700
context =
key bash_path bin:bash
......@@ -111,6 +111,7 @@ context =
key keep_cache parameters:configuration.keep_cache
key ebuilds_dir nayuos-ebuilds:location
raw scripts_dir {{ software_dir }}/scripts
raw patches_dir {{ software_dir }}/patches
raw logo_dir {{ software_dir }}/logo
# packages to be copied from our overlay into ChromiuOS' overlay
# those packages will be marked as dependency of root filesystem
......
diff --git a/login_manager/chrome_setup.cc b/login_manager/chrome_setup.cc
index cbe93f471..bd72cbb09 100644
--- a/login_manager/chrome_setup.cc
+++ b/login_manager/chrome_setup.cc
@@ -341,6 +341,9 @@ void AddSystemFlags(ChromiumCommandBuilder* builder) {
// On developer systems, set a flag to let the browser know.
if (builder->is_developer_end_user())
builder->AddArg("--system-developer-mode");
+ //Modify user agent to improve anonimity by preventing fingerprinting
+ const char* useragent = "$USERAGENTSTRING"
+ builder->AddArg(base::StringPrintf("--user-agent=%s",useragent))
}
// Adds UI-related flags to the command line.
......@@ -152,6 +152,11 @@ increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/openssh-server-init/
sed -i -n '/src_install/q;p' $(latest_ebuild ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init)
increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/
# modify user agent to improve anonimity by preventing fingerprinting
# TODO: scrape https://techblog.willshouse.com/2012/01/03/most-common-user-agents/
NEWUSERAGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
sed -i "s!\$USERAGENTSTRING!${NEWUSERAGENT}!" {{patches_dir}}/user-agent.patch
patch {{ cros_location }}/{{ branch }}/src/platform2/login_manager/chrome_setup.cc {{patches_dir}}/user-agent.patch
# bashrc modifications
BASH_EBUILD_DIR="${PORTAGE_STABLE}/app-shells/bash"
......
......@@ -6,6 +6,7 @@ extends =
../../component/libexpat/buildout.cfg
../../component/libaio/buildout.cfg
../../component/boost-lib/buildout.cfg
../../component/patch/buildout.cfg
parts +=
slapos-cookbook
......@@ -13,6 +14,7 @@ parts +=
git
curl
thin-provisioning-tools
patch
versions = versions
......@@ -26,7 +28,7 @@ recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg
rendered = ${buildout:directory}/instance.cfg
mode = 0644
md5sum = 73f964d73367dbf280d904e408a7f9b8
md5sum = 30389eea4851d3e353466e1a2712c54e
context =
key software_dir :_profile_base_location_
key instance_dir buildout:directory
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment