Skip to content

Commit 44adfce

Browse files
authored
Final touches before the 3490 release. (#1125)
* Minor fixes in the client builder logic. * Version bumped to 3490, CHANGELOG updated. * Further RRG development.
1 parent 4b19726 commit 44adfce

File tree

19 files changed

+65
-64
lines changed

19 files changed

+65
-64
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Added
99

10+
### Removed
11+
12+
### Changed
13+
14+
## [3.4.9.0] - 2025-02-27
15+
16+
### Added
17+
1018
* Added support for listing `%SystemDrive%\Users` as a supplementary mechanism
1119
for collecting user profiles on Windows (additionally to using data from the
1220
registry).

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
- ./docker_config_files/mysql/init.sh:/docker-entrypoint-initdb.d/init.sh
2929
- db_data:/var/lib/mysql:rw
3030
ports:
31-
- "3306:3306"
31+
- "3306:3306"
3232
expose:
3333
- "3306"
3434
networks:

grr/client_builder/grr_response_client_builder/client_build.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ def BuildTemplate(self, context=None, output=None):
213213
# The repacker uses this context to chose the .msi extension for the
214214
# repacked installer.
215215
context.append("Target:WindowsMsi")
216+
if "Target:Darwin" in context:
217+
if not grr_config.CONFIG.Get(
218+
"ClientBuilder.install_dir", context=context
219+
):
220+
raise ValueError("ClientBuilder.install_dir must be set on Darwin.")
221+
if not grr_config.CONFIG.Get(
222+
"ClientBuilder.fleetspeak_plist_path", context=context
223+
):
224+
raise ValueError(
225+
"ClientBuilder.fleetspeak_plist_path must be set on Darwin."
226+
)
216227

217228
template_path = None
218229
# If output is specified, place the built template file there, otherwise
@@ -422,24 +433,6 @@ def main(args):
422433
logger.handlers = [handler]
423434

424435
if args.subparser_name == "build":
425-
if grr_config.CONFIG.ContextApplied("Platform:Darwin"):
426-
# We know that the client builder is run on Darwin, so we can check that
427-
# the required config options are set. But the builder config options use
428-
# the "Target:Darwin" context, as they care about the target system that
429-
# the template is built for, not the system that the builder is run on.
430-
# The fact that we build macOS templates on Darwin is technically
431-
# an implementation detail even though it is impossible to build macOS
432-
# templates on any other platform.
433-
if not grr_config.CONFIG.Get(
434-
"ClientBuilder.install_dir",
435-
context=[contexts.TARGET_DARWIN],
436-
):
437-
raise RuntimeError("ClientBuilder.install_dir must be set.")
438-
if not grr_config.CONFIG.Get(
439-
"ClientBuilder.fleetspeak_plist_path",
440-
context=[contexts.TARGET_DARWIN],
441-
):
442-
raise RuntimeError("ClientBuilder.fleetspeak_plist_path must be set.")
443436
TemplateBuilder().BuildTemplate(context=context, output=args.output)
444437
elif args.subparser_name == "repack":
445438
if args.debug_build:

grr/proto/grr_response_proto/api/signed_commands.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ message ApiCommand {
2626

2727
// Whether the command should allow execution with arbitrary
2828
// standard input without it being pre-signed.
29-
bool unsigned_stdin = 7;
29+
bool unsigned_stdin_allowed = 7;
3030
}
3131
}
3232

grr/proto/grr_response_proto/rrg/action/execute_signed_command.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package rrg.action.execute_signed_command;
1010
import "google/protobuf/duration.proto";
1111
import "grr_response_proto/rrg/fs.proto";
1212

13-
message SignedCommand {
13+
message Command {
1414
// Path to the executable file to execute.
1515
rrg.fs.Path path = 1;
1616

@@ -29,18 +29,18 @@ message SignedCommand {
2929

3030
// Whether the command should allow execution with arbitrary
3131
// standard input without it being pre-signed.
32-
bool unsigned_stdin = 5;
32+
bool unsigned_stdin_allowed = 5;
3333
}
3434
}
3535

3636
message Args {
37-
// Serialized `SignedCommand` message to execute.
37+
// Serialized `Command` message to execute.
3838
bytes command = 1;
3939

4040
// Standard input to pass to the executed command.
4141
//
4242
// For this option to work, the command that has been signed has to allow
43-
// arbitrary standard input by having the `unsigned_stdin` flag set.
43+
// arbitrary standard input by having the `unsigned_stdin_allowed` flag set.
4444
bytes unsigned_stdin = 2;
4545

4646
// An [Ed25519][1] signature of the command.

grr/proto/grr_response_proto/signed_commands.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ message Command {
1616
repeated EnvVar env_vars = 3;
1717
oneof stdin {
1818
// Whether the stdin of the command is unsigned.
19-
bool unsigned_stdin = 4;
19+
bool unsigned_stdin_allowed = 4;
2020
// The stdin of the command, if it is signed.
2121
bytes signed_stdin = 5;
2222
}

grr/server/grr_response_server/bin/command_signer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def _GetCommandSigner() -> command_signer.AbstractCommandSigner:
4141

4242
def _ConvertToRrgCommand(
4343
command: api_signed_commands_pb2.ApiCommand,
44-
) -> execute_signed_command_pb2.SignedCommand:
44+
) -> execute_signed_command_pb2.Command:
4545
"""Converts a GRR command to a RRG command."""
46-
rrg_command = execute_signed_command_pb2.SignedCommand()
46+
rrg_command = execute_signed_command_pb2.Command()
4747

4848
rrg_command.path.raw_bytes = command.path.encode("utf-8")
4949
rrg_command.args.extend(command.args)
@@ -52,7 +52,7 @@ def _ConvertToRrgCommand(
5252
if command.HasField("signed_stdin"):
5353
rrg_command.signed_stdin = command.signed_stdin
5454
else:
55-
rrg_command.unsigned_stdin = command.unsigned_stdin
55+
rrg_command.unsigned_stdin_allowed = command.unsigned_stdin_allowed
5656
return rrg_command
5757

5858

grr/server/grr_response_server/bin/command_signer_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def testConvertToRrgCommand(self):
1818

1919
rrg_command = command_signer._ConvertToRrgCommand(command)
2020

21-
expected = execute_signed_command_pb2.SignedCommand()
21+
expected = execute_signed_command_pb2.Command()
2222
expected.path.raw_bytes = b"foo"
2323
expected.args.extend(["bar", "baz"])
2424
expected.env["FOO"] = "bar"

grr/server/grr_response_server/command_signer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class AbstractCommandSigner(metaclass=abc.ABCMeta):
1414
"""A base class for command signers."""
1515

1616
@abc.abstractmethod
17-
def Sign(self, command: execute_signed_command_pb2.SignedCommand) -> bytes:
17+
def Sign(self, command: execute_signed_command_pb2.Command) -> bytes:
1818
"""Signs a command and returns the signature."""
1919

2020
@abc.abstractmethod
2121
def Verify(
2222
self,
2323
signature: bytes,
24-
command: execute_signed_command_pb2.SignedCommand,
24+
command: execute_signed_command_pb2.Command,
2525
) -> None:
2626
"""Validates a signature for given data with a verification key.
2727

grr/server/grr_response_server/command_signer_test_mixin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ class CommandSignerTestMixin:
1111
signer: command_signer.AbstractCommandSigner
1212

1313
def testVerifySignatureCanSignAndVerify(self): # pylint: disable=invalid-name
14-
command = execute_signed_command_pb2.SignedCommand()
14+
command = execute_signed_command_pb2.Command()
1515
command.path.raw_bytes = b"/bin/ls"
1616
command.args.append("-l")
1717
command.env["PATH"] = "/usr/bin"
18-
command.unsigned_stdin = True
18+
command.unsigned_stdin_allowed = True
1919

2020
signature = self.signer.Sign(command)
2121
self.assertLen(signature, 64)
2222

2323
self.signer.Verify(signature, command)
2424

2525
def testVerifySignatureRaisesWhenSignatureIsInvalid(self): # pylint: disable=invalid-name
26-
command = execute_signed_command_pb2.SignedCommand()
26+
command = execute_signed_command_pb2.Command()
2727
command.path.raw_bytes = b"/bin/ls"
2828

2929
signature = b"invalid signature"

0 commit comments

Comments
 (0)