Skip to content

Commit

Permalink
Many changes:
Browse files Browse the repository at this point in the history
- Deleted deprecated component code.
- Some client bugfixes.
- Approvals work with the relational DB.
- All Selenium tests now test both data stores at the same time.
- Replaced a deprecated release notes URN.
  • Loading branch information
grrrrrrrrr committed Apr 12, 2018
1 parent 5b2fefd commit 641a7b9
Show file tree
Hide file tree
Showing 126 changed files with 4,737 additions and 3,197 deletions.
2 changes: 1 addition & 1 deletion debian/grr-server.postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ esac
echo "#################################################################"
echo "Install complete."
echo "If upgrading, make sure you read the release notes:"
echo "https://github.com/google/grr-doc/blob/master/releasenotes.adoc"
echo "https://grr-doc.readthedocs.io/en/latest/release-notes.html"
echo "#################################################################"
1 change: 0 additions & 1 deletion grr/client/grr_response_client/client_actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from grr_response_client import actions
from grr_response_client.client_actions import admin
from grr_response_client.client_actions import cloud
from grr_response_client.client_actions import components
from grr_response_client.client_actions import enrol
from grr_response_client.client_actions import file_finder
from grr_response_client.client_actions import file_fingerprint
Expand Down
6 changes: 1 addition & 5 deletions grr/client/grr_response_client/client_actions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,8 @@ class GetClientStatsAuto(GetClientStats):
"""This class is used to send the reply to a well known flow on the server."""

def Send(self, response):
if isinstance(response, rdf_client.ClientStats):
# TODO(hanuszczak): It seems like it is not doing anything. Downsampling
# method returns a new protobuf so this is a no-op.
response.DownSample()
self.grr_worker.SendReply(
response,
rdf_client.ClientStats.Downsampled(response),
session_id=rdfvalue.SessionID(queue=queues.STATS, flow_name="Stats"),
response_id=0,
request_id=0,
Expand Down
100 changes: 0 additions & 100 deletions grr/client/grr_response_client/client_actions/components.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __init__(self, params):
self.params = params.modification_time

def Check(self, stat):
min_mtime = self.params.min_last_modified_time.AsSecondsFromEpoch()
max_mtime = self.params.max_last_modified_time.AsSecondsFromEpoch()
min_mtime = self.params.min_last_modified_time.AsSecondsSinceEpoch()
max_mtime = self.params.max_last_modified_time.AsSecondsSinceEpoch()
return min_mtime <= stat.GetModificationTime() <= max_mtime


Expand All @@ -74,8 +74,8 @@ def __init__(self, params):
self.params = params.access_time

def Check(self, stat):
min_atime = self.params.min_last_access_time.AsSecondsFromEpoch()
max_atime = self.params.max_last_access_time.AsSecondsFromEpoch()
min_atime = self.params.min_last_access_time.AsSecondsSinceEpoch()
max_atime = self.params.max_last_access_time.AsSecondsSinceEpoch()
return min_atime <= stat.GetAccessTime() <= max_atime


Expand All @@ -87,8 +87,8 @@ def __init__(self, params):
self.params = params.inode_change_time

def Check(self, stat):
min_ctime = self.params.min_last_inode_change_time.AsSecondsFromEpoch()
max_ctime = self.params.max_last_inode_change_time.AsSecondsFromEpoch()
min_ctime = self.params.min_last_inode_change_time.AsSecondsSinceEpoch()
max_ctime = self.params.max_last_inode_change_time.AsSecondsSinceEpoch()
return min_ctime <= stat.GetChangeTime() <= max_ctime


Expand Down
2 changes: 1 addition & 1 deletion grr/client/grr_response_client/client_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _Send(self):
self._should_send = False
self._last_send_time = rdfvalue.RDFDatetime.Now()
stats.STATS.SetGaugeValue("grr_client_last_stats_sent_time",
self._last_send_time.AsSecondsFromEpoch())
self._last_send_time.AsSecondsSinceEpoch())

def _ShouldSend(self):
delta = rdfvalue.RDFDatetime.Now() - self._last_send_time
Expand Down
50 changes: 18 additions & 32 deletions grr/config/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@
help="Set this to a class name that sanity checks your client "
"config at repacking time.")

config_lib.DEFINE_bool("Client.fleetspeak_enabled", False,
"Whether the client uses Fleetspeak to communicate "
"with the server.")
config_lib.DEFINE_bool(
"Client.fleetspeak_enabled", False,
"Whether the client uses Fleetspeak to communicate "
"with the server.")

config_lib.DEFINE_bool("ClientBuilder.fleetspeak_enabled", False,
"Whether the client will use Fleetspeak to communicate "
"with the server.")
config_lib.DEFINE_bool(
"ClientBuilder.fleetspeak_enabled", False,
"Whether the client will use Fleetspeak to communicate "
"with the server.")

config_lib.DEFINE_string(
"Client.fleetspeak_service_name", "FleetspeakService",
Expand Down Expand Up @@ -91,8 +93,8 @@ def __init__(self, must_exist=True, **kwargs):
def Validate(self, value):
value = super(PathTypeInfo, self).Validate(value)
if self.must_exist and not os.access(value, os.R_OK):
raise type_info.TypeValueError("Path %s does not exist for %s" %
(value, self.name))
raise type_info.TypeValueError(
"Path %s does not exist for %s" % (value, self.name))

return value

Expand Down Expand Up @@ -427,22 +429,6 @@ def FromString(self, string):
default="%(Client.name)",
help="The debian package name.")

config_lib.DEFINE_option(
PathTypeInfo(
name="ClientBuilder.components_source_dir",
default=(
"%(grr_response_client.components"
"|module_path)"),
help="The directory that contains the component source."))

config_lib.DEFINE_option(
PathTypeInfo(
name="ClientBuilder.components_dir",
must_exist=False,
default=("%(grr-response-templates@grr-response-templates|resource)"
"/components"),
help="The directory that contains the components."))

config_lib.DEFINE_string(
name="ClientBuilder.build_time",
default=time.ctime(),
Expand Down Expand Up @@ -613,15 +599,15 @@ def FromString(self, string):
config_lib.DEFINE_integer("Template.version_release", None,
"Release number of client template.")

config_lib.DEFINE_string("Template.version_string",
"%(version_major).%(version_minor)."
"%(version_revision).%(version_release)",
"Version string of the client template.")
config_lib.DEFINE_string(
"Template.version_string", "%(version_major).%(version_minor)."
"%(version_revision).%(version_release)",
"Version string of the client template.")

config_lib.DEFINE_integer("Template.version_numeric",
"%(version_major)%(version_minor)"
"%(version_revision)%(version_release)",
"Version string of the template as an integer.")
config_lib.DEFINE_integer(
"Template.version_numeric", "%(version_major)%(version_minor)"
"%(version_revision)%(version_release)",
"Version string of the template as an integer.")

config_lib.DEFINE_string("Template.arch", None,
"The architecture of the client template.")
89 changes: 35 additions & 54 deletions grr/config/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from grr.lib.rdfvalues import crypto

# General Client options.
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "
"name to generate many other default parameters such "
"as binary names and service names. Note that on "
"Linux we lowercase the name to confirm with most "
"linux naming conventions.")
config_lib.DEFINE_string(
"Client.name", "GRR", "The name of the client. This will be used as a base "
"name to generate many other default parameters such "
"as binary names and service names. Note that on "
"Linux we lowercase the name to confirm with most "
"linux naming conventions.")

config_lib.DEFINE_string("Client.binary_name", "%(Client.name)",
"The name of the client binary.")
Expand All @@ -35,9 +35,10 @@
config_lib.DEFINE_string("Client.deploy_time", "Unknown",
"The time the client was deployed.")

config_lib.DEFINE_string("Client.build_environment", None,
"The output of Uname.FromCurrentSystem.signature() "
"on the system the client was built on.")
config_lib.DEFINE_string(
"Client.build_environment", None,
"The output of Uname.FromCurrentSystem.signature() "
"on the system the client was built on.")

config_lib.DEFINE_integer("Client.rsa_key_length", 2048,
"The key length of the client keys in bits.")
Expand All @@ -47,11 +48,6 @@
default=r"%(SystemRoot|env)\\System32\\%(name)\\%(Template.version_string)",
help="Where the client binaries are installed.")

config_lib.DEFINE_string(
name="Client.component_path",
default=r"%(Client.install_path)/components",
help="Where the client components are installed on the client.")

config_lib.DEFINE_string(
name="Client.rekall_profile_cache_path",
default=r"%(Client.install_path)\\rekall_profiles",
Expand All @@ -60,9 +56,10 @@
config_lib.DEFINE_list(
name="Client.server_urls", default=[], help="Base URL for client control.")

config_lib.DEFINE_list("Client.control_urls", [],
"DEPRECATED List of URLs of the controlling server. "
"Use server_urls instead.")
config_lib.DEFINE_list(
"Client.control_urls", [],
"DEPRECATED List of URLs of the controlling server. "
"Use server_urls instead.")

config_lib.DEFINE_integer("Client.http_timeout", 100,
"Timeout for HTTP requests.")
Expand All @@ -86,9 +83,10 @@
config_lib.DEFINE_float("Client.poll_max", 600,
"Maximum time between polls in seconds.")

config_lib.DEFINE_float("Client.error_poll_min", 60,
"Minimum time between polls in seconds if the server "
"reported an error.")
config_lib.DEFINE_float(
"Client.error_poll_min", 60,
"Minimum time between polls in seconds if the server "
"reported an error.")

config_lib.DEFINE_list(
name="Client.proxy_servers",
Expand All @@ -101,18 +99,19 @@
config_lib.DEFINE_integer("Client.max_out_queue", 51200000,
"Maximum size of the output queue.")

config_lib.DEFINE_integer("Client.foreman_check_frequency", 1800,
"The minimum number of seconds before checking with "
"the foreman for new work.")
config_lib.DEFINE_integer(
"Client.foreman_check_frequency", 1800,
"The minimum number of seconds before checking with "
"the foreman for new work.")

config_lib.DEFINE_float("Client.rss_max", 1000,
"Maximum memory footprint in MB (soft limit). "
"Exceeding this will result in an orderly shutdown.")
config_lib.DEFINE_float(
"Client.rss_max", 1000, "Maximum memory footprint in MB (soft limit). "
"Exceeding this will result in an orderly shutdown.")

config_lib.DEFINE_float("Client.rss_max_hard", 2000,
"Maximum memory footprint in MB (hard limit). "
"Exceeding this will result in aborting the current "
"client action and restarting.")
config_lib.DEFINE_float(
"Client.rss_max_hard", 2000, "Maximum memory footprint in MB (hard limit). "
"Exceeding this will result in aborting the current "
"client action and restarting.")

config_lib.DEFINE_string(
name="Client.tempfile_prefix",
Expand Down Expand Up @@ -219,35 +218,17 @@
"%(Client.name)service.exe",
help="The executable name of the nanny binary.")

config_lib.DEFINE_integer("Nanny.unresponsive_kill_period", 60,
"The time in seconds after which the nanny kills us.")
config_lib.DEFINE_integer(
"Nanny.unresponsive_kill_period", 60,
"The time in seconds after which the nanny kills us.")

config_lib.DEFINE_integer("Network.api", 3,
"The version of the network protocol the client "
"uses.")
config_lib.DEFINE_integer(
"Network.api", 3, "The version of the network protocol the client "
"uses.")

# Installer options.
config_lib.DEFINE_string(
name="Installer.logfile",
default="%(Logging.path)/%(Client.name)_installer.txt",
help=("A specific log file which is used for logging the "
"installation process."))

config_lib.DEFINE_list("Installer.old_key_map", [
"HKEY_LOCAL_MACHINE\\Software\\GRR\\certificate->Client.private_key",
"HKEY_LOCAL_MACHINE\\Software\\GRR\\server_serial_number"
"->Client.server_serial_number",
], """
A mapping of old registry values which will be copied to new values. The old
value location must start with a valid hive name, followed by a key name, and
end with the value name. The source location must be separated from the new
parameter name by a -> symbol.
This setting allows to carry over settings from obsolete client installations to
newer versions of the client which may store the same information in other
locations.
For example:
HKEY_LOCAL_MACHINE\\Software\\GRR\\certificate -> Client.private_key
""")
Loading

0 comments on commit 641a7b9

Please sign in to comment.