-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate brave branded omaha #179
Comments
Working on https://github.com/simonhong/omaha/tree/brave_omaha for customizing. |
Still debugging the failure with test server. |
Had some progress with http update url (https://github.com/simonhong/omaha/tree/brave_omaha) |
Installation(not update) in user-mode is success! :) |
Installation test is succeeded in user mode and admin mode by ignoring some assert. Need to debug about it. I think there is more to do during the startup for update. Assert failure is |
Setup build environment
There are some documents about how to build/customize google omaha.
I think all of above guides give good advice to start.
Among them, I recommend first one(Developer Setup Guide).
If you follow that instruction w/o missing anything, build will be completed.
About Visual Studio 2015 installation, refer to crystalnix's document about How to install Visual Studio 2015 about which components must be included.
About third party, you just need to clone breakpad and googletest to its folder in the ./omaha/third_party.
I installed libraries and tools like below.
When you finish required tools installation , you need to modify
omaha/hammer.bat
to reflect install locations on local machine.In my case, I changed only below variables. Others are same with upstream configurations.
set OMAHA_PSEXEC_DIR=C:\pstools
set OMAHA_ATL_SERVER_DIR=C:\atl
set OMAHA_WTL_DIR=C:\wtl
If you installed WIX v3.11, you need to modify
OMAHA_WIX_DIR
.set OMAHA_WIX_DIR=%ProgramFiles(x86)%\Wix Toolset v3.11\bin
.Then, let's start by run
hammer
inomaha
folder that includeshammer.bat
.If you see
VisualStudioVersion variable is not set.
Have you run vcvarsall.bat before running this script?
message, you should execute that scriptC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
before runninghammer
.Instead of running
vcvarsall.bat
explicitly, you can addcall "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
tohammer.bat
.Or, use
Developer Command Prompt for VS2015
instead ofCommand Prompt
.If build stops w/o showing specific error log, just try
hammer
again.When build is completed, you can see below log.
Troubleshooting guide
1. 'uuidgen.exe' is not recognized
When you see this error, Visual Studio 2015 might not be installed properly.
You can quickly check by running
uuidgen
in the Developer Command Prompt For VS2015. If it fails, please check about installed components of Visual Studio 2015 and refer again above crystalnix's VS2015 install guide.2. error: WTL requires WINVER >= 0x0501
When you see this version error, you downloaded latest WTL. Latest WTL(V10) added this version check.
If you use WTL 9.1, you will not see this error.
To fix this, you need to modify
WINVER
value from0x0500
to0x0501
inomaha/omaha/main.scon
.3. error C2059: syntax error: 'bad suffix on number'
I think most of you would not see this error. When I had an error of
uuidgen
, I statically added generated strings toproxy_clsid_utils.py
. It caused invalidproxy_clsids.txt
generation. Then that txt file isn't refreshed after I fixuuidgen
error.If you meet this kind of error, erase
omaha/proxy_clsids.txt
.Unit tests
After build completes, we can run unit tests.
To run, some settings are needed. Check this.
On my local machine, 26 tests are failed.
Omaha Overview
Most of contents comes from Omaha docs.
The Omaha project provides a shared auto-update and install system for Windows client products at Google that works on multiple Windows platforms, including Windows Vista.
Objectives
Background
High level scenario(ex, Chrome)
Three principal parts
For first install, user downloads an metainstaller called
ChromeSetup.exe
from chrome download site. It's actually the Omaha meta installer with data tag(micro reference to Chrome). Execution ofChromeSetup.exe
installs Omaha. Then, Omaha reads data tag and Chrome installer is downloaded and executed on the PC. After that, Omaha periodically checks for updates of Chrome.For secondary install, document said that google website detects that Omaha client is installed, and instead of delivering a downloadable EXE or MSI such as
ChromeSetup.exe
, it vends an application micro-reference via an ActiveX object. In this case, download should start instead of going through any complicated download steps.In the document, there are three mode when user clicks download link in google app download page.
When I tested in chrome download page, it seems only None mode is used. That means, browser always downloaded tagged metainstaller called
ChromeSetup.exe
instead of using OneClick mode. When I executeChromeSetup.exe
, UAC dialog told thatGoogleUpdateSetup.exe
with tags wants to change my device.Q1) Still confusing... what is metainstaller? ChromeSetup.exe or GoogleUpdateSetup.exe?
A1) As TaggedMetainstaller said,
GoogleUpdateSetup.exe
is metainstaller andChromeSetup.exe
is tagged metainstaller. As you can see in the below Tagging subsection, they are almost identical except tagged metainstaller store more data in PE Certificates Directory.Q2) Why and how
GoogleUpdateSetup.exe
is used instead ofChromeSetup.exe
by UAC? I executedChromeSetup.exe
notGoogleUpdateSetup.exe
.A2) When user executes
ChromeSetup.exe
, it extracts installable files from payload.dll to temp dir. After that, it copies itself to that temp dir asGoogleUpdateSetup.exe
. Then, it tries to spawns new process with adminGoogleUpdateSetup.exe
ifChromeSetup.exe
runs in user mode.Q3) GoogleUpdateSetup.exe is the installer of Omaha client?
A3) Right. it installs Omaha client on local machine.
Tagging
Tag bytes are stored in the PE "Certificates Directory" by
ApplyTag
tool.ApplyTag
tool usage isApplyTag <signed_file> <outputfile> <tag> [append]
.It adds tag byte to the Certificates Directory in the signed_file and rename it to outputfile.
For test, I created BraveSetup.exe by
ApplyTag GoogleUpdateSetup.exe BraveSetup.exe "appguid={C38B7539-CD23-4954-BDC8-FCE21B2543AE}&appname=Brave%20Browser&needsadmin=prefers&lang=en"
.When I execute
BraveSetup.exe
, it shows same update process and UI asChromeSetup.exe
did.For more information about Tag, see
apply_tag.cc
,apply_tag_tool.cc
andextractor.cc
files in Omaha project.Client
The Omaha client is a Windows application, installed by a custom Windows installer.
It performs:
When last application using Omaha client is uninstalled by the user, Omaha client will uninstall itself.
Client runtime
The runtime functionality is divided between a couple of processes for robustness, running code with the least privilege and resource management.
They consisted with a core process and many worker process.
The execution model for the runtime code depends on how Omaha is actually installed.
The process execution model is almost identical, in both machine and user cases. For the most part, the machine and user instances of Omaha run in isolated security contexts and they share nothing.
Q1) What is Windows service ? is it core process?
A) That is the admin previledged process that runs in background with pre-defined policies and it's not core process.
Q2) In current user mode, goopdate worker process always runs to check update without core process?
A) Yes, that worker process runs by registered task scheduler in that mode.
Q3) goopdate is the name of worker process? Or only used in user mode?
A) goopdate is library name that implemented whole omaha features.
The Omaha core runs in a local system process for the machine, and one process for each logged in user. Typically, there will be two core processes running.
The machine Omaha core process is started at boot time by a system service that terminates soon after. The user Omaha core process is started by the shell from the user's run key.
Q1) What is system service that starts machine Omaha core process?
A) The registered BraveSoftwareUpdateTaskMachineCore task starts core process.
Q2) What is user Omaha core process and how execute it?
A)
In my system, Google Update Core is registered as startup task(Checked by task manager's Startup tab) and GoogleUpdateCore.exe is located in
C:\Users\simon\AppData\Local\Google\Update\1.3.33.7
.It's source code is in
omaha/core
.Q1) Who registers it as as startup task?
A) GoogleUpdateSetup.exe registers task that executes GoogleUpdateCore.exe in startup task.
Customization
To use Omaha by brave, manual customization is needed.
Omaha customization repo is https://github.com/simonhong/omaha/tree/brave_omaha
Create tagged metainstaller
For Omaha installation test, we need to make tagged metainstaller by using
ApplyTag.exe
.After build with above repo, execute below. appguid in tag is just example id. It should be replaced brave guid later.
ApplyTag.exe BraveUpdateSetup.exe BraveBrowserSetup.exe "appguid={C38B7539-CD23-4954-BDC8-FCE21B2543AE}&appname=Brave%20Browser&needsadmin=prefers&lang=en"
ApplyTag.exe is in scones-out/dbg-win/obj/tools/ApplyTag.
Intall BraveUpdate update client
Execute
BraveBrowserSeup.exe
.You can see Dialog with "Unable to connect to the Internet...". I assume that invalid update server and appid in installer.
Admin mode
It installs itself in
.../Program Files (x86)/Brave/Update
Two services are registered.
Two tasks are registered.
Registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Brave\Update
.User mode
It installs itself in
.../AppData/Local/Brave/Update
.Startup task is registered.
Two tasks are registered.
Registry key:
HKEY_CURRENT_USER\Software\Brave\Update
.Test omaha server
Crystalnix tutorial.
Intaller
The text was updated successfully, but these errors were encountered: