Notices: This section not yet converted to new layout. Download stats are rolling back out.

This is not the latest version of osquery available.

osquery

2.11.0

Package test results are passing.

This package was approved as a trusted package on 1/12/2018.

osquery allows you to easily ask questions about your Linux, OSX, and
Windows infrastructure. Whether your goal is intrusion detection,
infrastructure reliability, or compliance, osquery gives you the ability
to empower and inform a broad set of organizations within your company.

### Package Parameters
* /InstallService - This creates a new windows service that will auto-start the daemon.

These parameters can be passed to the installer with the user of -params.
For example: -params '"/InstallService"'.

To install osquery, run the following command from the command line or from PowerShell:

C:\> choco install osquery --version 2.11.0

To upgrade osquery, run the following command from the command line or from PowerShell:

C:\> choco upgrade osquery --version 2.11.0

Files

Hide
  • tools\bin\osquery.zip Show
    md5: D3EC1206573EA09160ABF1D8D1439BAB | sha1: E3F282FD74411B2EF53F8791504AFA7118A1E1DE | sha256: 953732A9DDE3F7FFAF2A8B72E74AFEFF4D02F264F875962F03ECCBCD0C8FAA54 | sha512: 8562F3BDF0CC0D3E12AEF20EB8794FCC24C1BEE52D1E2F0C8EB0D05BD353B6033A17691623044DD121372DE8031D2E33E428DCEBAF51632EC680834B945904BC
  • tools\chocolateyBeforeModify.ps1 Show
    #  Copyright (c) 2014-present, Facebook, Inc.
    #  All rights reserved.
    #
    #  This source code is licensed under the BSD-style license found in the
    #  LICENSE file in the root directory of this source tree. An additional grant
    #  of patent rights can be found in the PATENTS file in the same directory.
    . "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\\osquery_utils.ps1"
    
    $serviceName = 'osqueryd'
    $progData = [System.Environment]::GetEnvironmentVariable('ProgramData')
    $targetFolder = Join-Path $progData "osquery"
    $daemonFolder = Join-Path $targetFolder $serviceName
    $extensionsFolder = Join-Path $targetFolder 'extensions'
    
    # Ensure the service is stopped and processes are not running if exists.
    if ((Get-Service $serviceName -ErrorAction SilentlyContinue) -and `
      (Get-Service $serviceName).Status -eq 'Running') {
      Stop-Service $serviceName
      # If we find zombie processes, ensure they're termintated
      $proc = Get-Process | Where-Object { $_.ProcessName -eq 'osqueryd' }
      if ($proc -ne $null) {
        Stop-Process -Force $proc -ErrorAction SilentlyContinue
      }
    }
    
    # Lastly, ensure that the Deny Write ACLs have been removed before modifying
    if (Test-Path $daemonFolder) {
      Set-DenyWriteAcl $daemonFolder 'Remove'
    }
    if (Test-Path $extensionsFolder) {
      Set-DenyWriteAcl $extensionsFolder 'Remove'
    }
    
  • tools\chocolateyinstall.ps1 Show
    #  Copyright (c) 2014-present, Facebook, Inc.
    #  All rights reserved.
    #
    #  This source code is licensed under the BSD-style license found in the
    #  LICENSE file in the root directory of this source tree. An additional grant
    #  of patent rights can be found in the PATENTS file in the same directory.
    . "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\\osquery_utils.ps1"
    
    $serviceName = 'osqueryd'
    $serviceDescription = 'osquery daemon service'
    $progData = [System.Environment]::GetEnvironmentVariable('ProgramData')
    $targetFolder = Join-Path $progData 'osquery'
    $daemonFolder = Join-Path $targetFolder 'osqueryd'
    $extensionsFolder = Join-Path $targetFolder 'extensions'
    $logFolder = Join-Path $targetFolder 'log'
    $targetDaemonBin = Join-Path $targetFolder 'osqueryd.exe'
    $destDaemonBin = Join-Path $daemonFolder 'osqueryd.exe'
    $packageParameters = $env:chocolateyPackageParameters
    $arguments = @{}
    
    # Ensure the service is stopped and processes are not running if exists.
    if ((Get-Service $serviceName -ErrorAction SilentlyContinue) -and `
      (Get-Service $serviceName).Status -eq 'Running') {
      Stop-Service $serviceName
      # If we find zombie processes, ensure they're termintated
      $proc = Get-Process | Where-Object { $_.ProcessName -eq 'osqueryd' }
      if ($proc -ne $null) {
        Stop-Process -Force $proc -ErrorAction SilentlyContinue
      }
    }
    
    # Lastly, ensure that the Deny Write ACLs have been removed before modifying
    if (Test-Path $daemonFolder) {
      Set-DenyWriteAcl $daemonFolder 'Remove'
    }
    if (Test-Path $extensionsFolder) {
      Set-DenyWriteAcl $extensionsFolder 'Remove'
    }
    
    # Now parse the packageParameters using good old regular expression
    if ($packageParameters) {
      $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- _\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))"
      $option_name = 'option'
      $value_name = 'value'
    
      if ($packageParameters -match $match_pattern ) {
        $results = $packageParameters | Select-String $match_pattern -AllMatches
        $results.matches | ForEach-Object {
          $arguments.Add(
            $_.Groups[$option_name].Value.Trim(),
            $_.Groups[$value_name].Value.Trim())
        }
      } else {
        Throw "Package Parameters were found but were invalid (REGEX Failure)"
      }
      if ($arguments.ContainsKey("InstallService")) {
        $installService = $true
      }
    } else {
      Write-Debug "No Package Parameters Passed in"
    }
    
    New-Item -Force -Type directory -Path $daemonFolder
    New-Item -Force -Type directory -Path $logFolder
    $packagePath = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\\bin\\osquery.zip"
    Get-ChocolateyUnzip -FileFullPath $packagePath -Destination $targetFolder
    
    # In order to run osqueryd as a service, we need to have a folder that has a
    # Deny Write ACL to everyone.
    Move-Item -Force -Path $targetDaemonBin -Destination $destDaemonBin
    Set-SafePermissions $daemonFolder
    
    if ($installService) {
      if (-not (Get-Service $serviceName -ErrorAction SilentlyContinue)) {
        Write-Debug 'Installing osquery daemon service.'
        # If the 'install' parameter is passed, we create a Windows service with
        # the flag file in the default location in \ProgramData\osquery\
        New-Service -Name $serviceName -BinaryPathName "$destDaemonBin --flagfile=\ProgramData\osquery\osquery.flags" -DisplayName $serviceName -Description $serviceDescription -StartupType Automatic
    
        # If the osquery.flags file doesn't exist, we create a blank one.
        if (-not (Test-Path "$targetFolder\osquery.flags")) {
          Add-Content "$targetFolder\osquery.flags" $null
        }
      }
      Start-Service $serviceName
    }
    
    # Add osquery binary path to machines path for ease of use.
    Add-ToSystemPath $targetFolder
    
  • tools\chocolateyuninstall.ps1 Show
    #  Copyright (c) 2014-present, Facebook, Inc.
    #  All rights reserved.
    #
    #  This source code is licensed under the BSD-style license found in the
    #  LICENSE file in the root directory of this source tree. An additional grant
    #  of patent rights can be found in the PATENTS file in the same directory.
    $progData = [System.Environment]::GetEnvironmentVariable('ProgramData')
    $targetFolder = Join-Path $progData "osquery"
    $serviceName = 'osqueryd'
    
    # Remove the osquery path from the System PATH variable. Note: Here
    # we don't make use of our local vars, as Regex requires escaping the '\'
    $oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
    if ($oldPath -imatch [regex]::escape($targetFolder)) {
      $newPath = $oldPath -replace [regex]::escape($targetFolder), $NULL
      [System.Environment]::SetEnvironmentVariable('Path', $newPath, 'Machine')
    }
    
    if ((Get-Service $serviceName -ErrorAction SilentlyContinue)) {
      Stop-Service $serviceName
      
      # If we find zombie processes, ensure they're termintated
      $proc = Get-Process | Where-Object { $_.ProcessName -eq 'osqueryd' }
      if ($proc -ne $null) {
        Stop-Process -Force $proc -ErrorAction SilentlyContinue
      }
    
      Set-Service $serviceName -startuptype 'manual'
      Get-CimInstance -ClassName Win32_Service -Filter "Name='osqueryd'" | Invoke-CimMethod -methodName Delete
    }
    
    if (Test-Path $targetFolder) {
      Remove-Item -Force -Recurse $targetFolder
    } else {
      Write-Debug 'osquery was not found on the system. Nothing to do.'
    }
    
  • tools\LICENSE.txt Show
    BSD License
    
    For osquery software
    
    Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
    
    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:
    
     * Redistributions of source code must retain the above copyright notice, this
       list of conditions and the following disclaimer.
    
     * Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
    
     * Neither the name Facebook nor the names of its contributors may be used to
       endorse or promote products derived from this software without specific
       prior written permission.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
  • tools\osquery_utils.ps1 Show
    #  Copyright (c) 2014-present, Facebook, Inc.
    #  All rights reserved.
    #
    #  This source code is licensed under the BSD-style license found in the
    #  LICENSE file in the root directory of this source tree. An additional grant
    #  of patent rights can be found in the PATENTS file in the same directory.
    
    # Helper function to add an explicit Deny-Write ACE for the Everyone group
    function Set-DenyWriteAcl {
      [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
      [OutputType('System.Boolean')]
      param(
        [string] $targetDir = '',
        [string] $action = ''
      )
      if (($action -ine 'Add') -and ($action -ine 'Remove')) {
        Write-Debug '[-] Invalid action in Set-DenyWriteAcl.'
        return $false
      }
      if ($PSCmdlet.ShouldProcess($targetDir)) {
        $acl = Get-Acl $targetDir
        $inheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
        $propagationFlag = [System.Security.AccessControl.PropagationFlags]::None
        $permType = [System.Security.AccessControl.AccessControlType]::Deny
    
        $worldSIDObj = New-Object System.Security.Principal.SecurityIdentifier ('S-1-1-0')
        $worldUser = $worldSIDObj.Translate([System.Security.Principal.NTAccount])
        $permission = $worldUser.Value, "write", $inheritanceFlag, $propagationFlag, $permType
        $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
        # We only support adding or removing the ACL
        if ($action -ieq 'add') {
          $acl.SetAccessRule($accessRule)
        } else {
          $acl.RemoveAccessRule($accessRule)
        }
        Set-Acl $targetDir $acl
        return $true
      }
      return $false
    }
    
    # A helper function to set "safe" permissions for osquery binaries
    function Set-SafePermissions {
      [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
      [OutputType('System.Boolean')]
      param(
        [string] $target = ''
      )
      if ($PSCmdlet.ShouldProcess($target)) {
        $acl = Get-Acl $target
    
        # First, to ensure success, we remove the entirety of the ACL
        $acl.SetAccessRuleProtection($true, $false)
        foreach ($access in $acl.Access) {
          $acl.RemoveAccessRule($access)
        }
        Set-Acl $target $acl
    
        $acl = Get-Acl $target
        $inheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
        $propagationFlag = [System.Security.AccessControl.PropagationFlags]::None
        $permType = [System.Security.AccessControl.AccessControlType]::Allow
    
        # "Safe" permissions in osquery entail the containing folder and binary both
        # are owned by the Administrators group, as well as no account has Write
        # permissions except for the Administrators group and SYSTEM account
        $systemSid = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-18')
        $systemUser = $systemSid.Translate([System.Security.Principal.NTAccount])
    
        $adminsSid = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
        $adminsGroup = $adminsSid.Translate([System.Security.Principal.NTAccount])
    
        $usersSid = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-545')
        $usersGroup = $usersSid.Translate([System.Security.Principal.NTAccount])
    
        $permGroups = @($systemUser, $adminsGroup, $usersGroup)
        foreach ($accnt in $permGroups) {
          $grantedPerm = ''
          if ($accnt -eq $usersGroup) {
            $grantedPerm = 'ReadAndExecute'
          } else {
            $grantedPerm = 'FullControl'
          }
          $permission = $accnt.Value, $grantedPerm, $inheritanceFlag, $propagationFlag, $permType
          $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
          $acl.SetAccessRule($accessRule)
        }
        $acl.SetOwner($adminsGroup)
        Set-Acl $target $acl
    
        # Finally set the Administrators group as the owner for all items
        $items = Get-ChildItem -Recurse -Path $target
        foreach ($item in $items) {
          $acl = Get-Acl -Path $item.FullName
          $acl.SetOwner($adminsGroup)
          Set-Acl $item.FullName $acl
        }
    
        return $true
      }
      return $false
    }
    
    # Helper function for running a .bat file from powershell
    function Invoke-BatchFile {
      param(
        [string]$path,
        [string]$parameters
      )
      $tempFile = [IO.Path]::GetTempFileName()
      cmd.exe /c " `"$path`" $parameters && set > `"$tempFile`" "
      Get-Content $tempFile | Foreach-Object {
        if ($_ -match '^(.*?)=(.*)$') {
          Set-Content "env:\$($matches[1])" $matches[2]
        }
      }
      Remove-Item $tempFile
    }
    
    # Constructs a chocolatey .nuspec file in the current directory
    function Write-NuSpec {
      param(
        [string] $packageName,
        [string] $version,
        [string] $authors,
        [string] $owners,
        [string] $projectSource,
        [string] $packageSourceUrl,
        [string] $copyright,
        [string] $license
      )
      $nuspec = @"
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
    <package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
      <metadata>
        <id>$packageName</id>
        <title>$packageName</title>
        <version>$version</version>
        <authors>$authors</authors>
        <owners>$owners</owners>
        <summary>$packageName</summary>
        <description>$packageName</description>
        <projectUrl>$projectSource</projectUrl>
        <packageSourceUrl>$packageSourceUrl</packageSourceUrl>
        <tags>$packageName</tags>
        <copyright>$copyright</copyright>
        <licenseUrl>$license</licenseUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
      </metadata>
      <files>
        <file src="local\**" target="local" />
      </files>
    </package>
    "@
      Out-File -Encoding "UTF8" -FilePath "$packageName.nuspec" -InputObject $nuspec
    }
    
    # Derive the location of the osquery build location
    function Get-OsqueryBuildPath {
      [OutputType('System.String')]
      param()
      $loc = Get-Location
      $toks = $loc -Split '\\'
      $ret = ''
      0..$toks.length | ForEach-Object {
        if (Test-Path "$($toks[0..$_] -Join '\')\tools\provision.ps1") {
          $ret = "$($toks[0..$_] -Join '\')\build"
        }
      }
      return $ret
    }
    
    # Helper function to add to the SYSTEM path
    function Add-ToSystemPath {
      param(
        [string] $targetFolder = ''
      )
    
      $oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
      if (-not ($oldPath -imatch [regex]::escape($targetFolder))) {
        $newPath = $oldPath
        if ($oldPath[-1] -eq ';') {
          $newPath = $newPath + $targetFolder
        } else {
          $newPath = $newPath + ';' + $targetFolder
        }
        [System.Environment]::SetEnvironmentVariable('Path', $newPath, 'Machine')
      }
    }
    
    # A helper function for starting and waiting on processes in powershell
    function Start-OsqueryProcess {
      param(
        [string] $binaryPath = '',
        [array] $binaryArgs = @(),
        [bool] $redirectOutput = $true
      )
      $pinfo = New-Object System.Diagnostics.ProcessStartInfo
      $pinfo.FileName = $binaryPath
      $pinfo.RedirectStandardError = $redirectOutput
      $pinfo.RedirectStandardOutput = $redirectOutput
      $pinfo.UseShellExecute = $false
      $pinfo.Arguments = $binaryArgs
      $pinfo.WorkingDirectory = Get-Location
      $p = New-Object System.Diagnostics.Process
      $p.StartInfo = $pinfo
      $p.Start()
      $p.WaitForExit()
    
      if ($redirectOutput) {
        $stdout = $p.StandardOutput.ReadToEnd()
        $stderr = $p.StandardError.ReadToEnd()
        $exit = $p.ExitCode
        [PSCustomObject] @{
          stdout = $stdout
          stderr = $stderr
          exitcode = $exit
        }
      } else {
        $exit = $p.ExitCode
        [PSCustomObject] @{
          exitcode = $exit
        }
      }
    }
    
  • tools\VERIFICATION.txt Show
    To verify the osquery binaries are valid and not corrupted, one can run one of the following:
    
    C:\Users\> Get-FileHash -Algorithm SHA256 .\build\windows10\osquery\Release\osqueryd.exe
    C:\Users\> Get-FileHash -Algorithm SHA1 .\build\windows10\osquery\Release\osqueryd.exe
    C:\Users\> Get-FileHash -Algorithm MD5 .\build\windows10\osquery\Release\osqueryd.exe
    
    And verify that the digests match one of the below values:
    SHA256: A49FF667C449734110AAA3FFF736407FE3D9EBD3BD217FFA7B3B2F2FA1797064
    SHA1: 4C767E72C6D7D977F3193A54425875A24BC6E206
    MD5: C9F5336B1486B81335C09F10AEA2572C
    
    

Virus Scan Results

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Dependencies

This package has no dependencies.

Package Maintainer(s)

Software Author(s)

  • Facebook

Copyright

Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

Tags

Release Notes

https://github.com/facebook/osquery/releases/tag/2.11.0

Version History

Version Downloads Last updated Status
osquery 3.3.2 5506 Monday, January 28, 2019 approved
osquery 3.3.1 43432 Tuesday, October 2, 2018 approved
osquery 3.3.0 2983 Monday, August 20, 2018 approved
osquery 3.2.9 74579 Monday, July 2, 2018 approved
osquery 3.2.6 52045 Monday, July 2, 2018 approved
osquery 3.2.4 2907 Friday, May 4, 2018 approved
osquery 2.11.2 5509 Monday, February 5, 2018 approved
osquery 2.11.0 1844 Friday, January 12, 2018 approved
osquery 2.10.4 1655 Sunday, December 3, 2017 approved
Show More

Discussion for the osquery Package

Ground rules:

  • This discussion is only about osquery and the osquery package. If you have feedback for Chocolatey, please contact the google group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or osquery, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.

comments powered by Disqus
Chocolatey.org uses cookies to enhance the user experience of the site.
Ok