Jacob Bachmeyer [Sun, 12 Mar 2023 01:10:00 +0000 (19:10 -0600)]
Add support for whole-keyring export to mock gpg tool
Jacob Bachmeyer [Fri, 10 Mar 2023 04:14:14 +0000 (22:14 -0600)]
Add --batch option to mock gpg tool
Jacob Bachmeyer [Fri, 10 Mar 2023 04:12:49 +0000 (22:12 -0600)]
Add support for key revocation in mock gpg tool
Jacob Bachmeyer [Sat, 21 Jan 2023 02:59:59 +0000 (20:59 -0600)]
Add mock gpg tool for listing and manipulating keyrings
Jacob Bachmeyer [Fri, 16 Dec 2022 03:08:21 +0000 (21:08 -0600)]
Move infrastructure for failure tracking to common "mock" tool init file
Jacob Bachmeyer [Tue, 6 Dec 2022 03:09:21 +0000 (21:09 -0600)]
Revise mock tool testsuite to prepare for additional tests
A mock GPG for handling keyrings will soon be added to support testing the
keymaster tool currently under early development.
Jacob Bachmeyer [Wed, 30 Nov 2022 02:20:44 +0000 (20:20 -0600)]
Change default GNUPGHOME in mock signature verification tool
This reduces the possibility of confusion, and will be more important when
a mock GPG is implemented to support testing the keymaster tool.
Jacob Bachmeyer [Fri, 13 Jan 2023 04:42:48 +0000 (22:42 -0600)]
Tidy whitespace
Jacob Bachmeyer [Fri, 13 Jan 2023 04:42:28 +0000 (22:42 -0600)]
Remove "pgpg" helper script
Jacob Bachmeyer [Fri, 13 Jan 2023 04:38:22 +0000 (22:38 -0600)]
Merge from upstream
Ian Kelling [Tue, 10 Jan 2023 09:57:11 +0000 (04:57 -0500)]
minor: punctuation
Ian Kelling [Tue, 10 Jan 2023 09:32:24 +0000 (04:32 -0500)]
minor: README
Ian Kelling [Tue, 10 Jan 2023 09:31:11 +0000 (04:31 -0500)]
make README be a basic overview of this package
Ian Kelling [Tue, 10 Jan 2023 06:48:40 +0000 (01:48 -0500)]
add license header to tiny scripts for completeness
Ian Kelling [Tue, 10 Jan 2023 06:44:27 +0000 (01:44 -0500)]
add overlooked ftp-rmkey.sh file
Jacob Bachmeyer [Wed, 23 Nov 2022 03:38:50 +0000 (21:38 -0600)]
Preserve error string during rename checks at initialization
The test file is unlinked if a rename call fails; this could reset $! to
indicate success, so the initial value of $! is saved first.
Jacob Bachmeyer [Wed, 23 Nov 2022 03:31:42 +0000 (21:31 -0600)]
Rename "in-stage" directory to "scratch" directory
Jacob Bachmeyer [Wed, 23 Nov 2022 03:31:00 +0000 (21:31 -0600)]
Rename "incoming" directory to "inbox" directory
Jacob Bachmeyer [Wed, 23 Nov 2022 00:42:30 +0000 (18:42 -0600)]
Reorganize log message patterns in testsuite
This groups the message patterns by processing phase.
Prior to committing, this was validated with:
(DIFF='git diff --cached';
comm -3 <($DIFF | grep ^- | sed -e 's/^-//' | sort) \
<($DIFF | grep ^+ | sed -e 's/^+//' | sort) )
The output shows only a blank line and diff headers. To replicate, change
the "git diff" command to compare this commit with its parent.
Jacob Bachmeyer [Tue, 22 Nov 2022 04:58:48 +0000 (22:58 -0600)]
Remove another piece of testsuite scaffolding
Jacob Bachmeyer [Tue, 22 Nov 2022 04:32:16 +0000 (22:32 -0600)]
Remove testsuite scaffolding for verification during execution phase
All signatures are now verified before the execution phase begins.
Jacob Bachmeyer [Tue, 22 Nov 2022 04:24:16 +0000 (22:24 -0600)]
Remove testsuite scaffolding for the validation phase
Jacob Bachmeyer [Tue, 22 Nov 2022 04:16:32 +0000 (22:16 -0600)]
Remove testsuite logic that supported email outside of report phase
All email messages are now sent during the report phase.
Jacob Bachmeyer [Tue, 22 Nov 2022 04:07:07 +0000 (22:07 -0600)]
Remove obsolete message pattern from testsuite
Jacob Bachmeyer [Tue, 22 Nov 2022 03:56:35 +0000 (21:56 -0600)]
Add tests for inbox and scratch cleanup
Jacob Bachmeyer [Sun, 20 Nov 2022 04:10:21 +0000 (22:10 -0600)]
Reorganize gatekeeper to reflect processing phases
Prior to committing, this was validated with:
(DIFF='git diff --cached';
comm -3 <($DIFF | grep ^- | sed -e 's/^-//' | sort) \
<($DIFF | grep ^+ | sed -e 's/^+//' | sort) )
The output shows only blank lines, diff headers, POD structure, and the
addition of a forward declaration for verify_clearsigned_message as a
temporary measure ahead of a call that will eventually be removed, after
all lines are sorted and paired for analysis. To replicate, change the
"git diff" command to compare this commit with its parent.
Jacob Bachmeyer [Sun, 20 Nov 2022 03:40:50 +0000 (21:40 -0600)]
Remove obsolete comment
Jacob Bachmeyer [Sun, 20 Nov 2022 03:20:20 +0000 (21:20 -0600)]
Move directive archival to report phase
Each successfully processed directive is sent to a public archival list,
but directives not signed with a known key or with invalid syntax are only
sent to the internal report inbox.
This commit also reverts the testsuite changes from the previous
commit
f9e77b3dd2d94986ff095abd4c50fb957196b05b.
Jacob Bachmeyer [Fri, 18 Nov 2022 04:39:39 +0000 (22:39 -0600)]
Refactor install_files as execute_install
This also moves staging files and validating that the "replace" option is
set if needed to top-level.
Jacob Bachmeyer [Fri, 18 Nov 2022 04:14:24 +0000 (22:14 -0600)]
Factor move_filepair out of install_files
Jacob Bachmeyer [Fri, 18 Nov 2022 03:58:17 +0000 (21:58 -0600)]
Merge execute_commands into top-level
Jacob Bachmeyer [Fri, 18 Nov 2022 03:54:55 +0000 (21:54 -0600)]
Factor symlink operations out of execute_commands
Jacob Bachmeyer [Fri, 18 Nov 2022 03:09:23 +0000 (21:09 -0600)]
Proofread POD
Jacob Bachmeyer [Fri, 18 Nov 2022 03:09:00 +0000 (21:09 -0600)]
Convert section heading comments to POD section headings
This commit also removes some leftover comments.
Jacob Bachmeyer [Fri, 18 Nov 2022 02:53:29 +0000 (20:53 -0600)]
Update internal documentation to reflect improvements
Jacob Bachmeyer [Fri, 18 Nov 2022 02:43:51 +0000 (20:43 -0600)]
Add checks to avoid removing backup files in scan_incoming
Also update internal documentation and adjust testsuite to properly cover
the new edge case.
Jacob Bachmeyer [Thu, 17 Nov 2022 04:04:40 +0000 (22:04 -0600)]
Revise calls to ftp_syslog
The ftp_syslog procedure now requires exactly two arguments and all calls
have been changed to use Perl's fat comma and its implicit quoting for the
syslog severity keywords.
Jacob Bachmeyer [Thu, 17 Nov 2022 03:54:40 +0000 (21:54 -0600)]
Add POD block for ftp_syslog
Jacob Bachmeyer [Thu, 17 Nov 2022 03:54:25 +0000 (21:54 -0600)]
Rename local variable in ftp_syslog
This change of terms aligns with RFC3164.
Jacob Bachmeyer [Thu, 17 Nov 2022 03:43:44 +0000 (21:43 -0600)]
Fixup oversights in recent commits
Jacob Bachmeyer [Thu, 17 Nov 2022 03:41:21 +0000 (21:41 -0600)]
Rename ftp_abort to abort
Jacob Bachmeyer [Thu, 17 Nov 2022 03:38:58 +0000 (21:38 -0600)]
Explain intended use of ftp_abort
Jacob Bachmeyer [Thu, 17 Nov 2022 03:38:48 +0000 (21:38 -0600)]
Reindent ftp_abort
Jacob Bachmeyer [Thu, 17 Nov 2022 03:35:10 +0000 (21:35 -0600)]
Revise calls to ftp_abort
Since ftp_abort is used as an alternative to the die builtin for certain
severe errors, the calls are regularized to omit parentheses.
Jacob Bachmeyer [Thu, 17 Nov 2022 03:31:13 +0000 (21:31 -0600)]
Revise some abort messages
These are minor changes for consistency and to report errors.
Jacob Bachmeyer [Thu, 17 Nov 2022 03:28:36 +0000 (21:28 -0600)]
Revise ftp_abort and add POD block
The second argument is no longer used and is redundant with the
$AbortExitCode global variable, so it is removed.
Jacob Bachmeyer [Thu, 17 Nov 2022 03:18:56 +0000 (21:18 -0600)]
Add POD block for report_upload_to_archive procedure
Jacob Bachmeyer [Thu, 17 Nov 2022 03:14:42 +0000 (21:14 -0600)]
Remove quasi-global %info hash
Jacob Bachmeyer [Thu, 17 Nov 2022 03:11:16 +0000 (21:11 -0600)]
Revise mail to remove use of quasi-global %info hash
Jacob Bachmeyer [Thu, 17 Nov 2022 02:52:11 +0000 (20:52 -0600)]
Revise reporting of replaced files
Jacob Bachmeyer [Thu, 17 Nov 2022 02:17:45 +0000 (20:17 -0600)]
Fix message describing replacement of a file
This message is written to the log before the file has even been moved to
the staging directory, therefore it should not be past tense.
Jacob Bachmeyer [Wed, 16 Nov 2022 03:37:22 +0000 (21:37 -0600)]
Add detail when reporting inability to exec GPG
Jacob Bachmeyer [Wed, 16 Nov 2022 01:01:46 +0000 (19:01 -0600)]
Improve reporting of overwrites when installing files
The reported name is now the logical name in the published tree instead of
the actual name on the server's filesystem.
Jacob Bachmeyer [Wed, 16 Nov 2022 00:52:30 +0000 (18:52 -0600)]
Rename debug procedure to reflect its actual usage and simplify call
Jacob Bachmeyer [Wed, 16 Nov 2022 00:45:45 +0000 (18:45 -0600)]
Tidy configured email address
Jacob Bachmeyer [Wed, 16 Nov 2022 00:45:24 +0000 (18:45 -0600)]
Rename variables holding email addresses to better describe their uses
Jacob Bachmeyer [Wed, 16 Nov 2022 00:26:42 +0000 (18:26 -0600)]
Merge success_upload and success_directive into top-level
Jacob Bachmeyer [Wed, 16 Nov 2022 00:14:45 +0000 (18:14 -0600)]
Move all collection of email addresses to top-level
The 'email' and 'package' keys in the quasi-global %info hash remain as
implicit arguments to mail for the time being.
Jacob Bachmeyer [Wed, 16 Nov 2022 00:10:50 +0000 (18:10 -0600)]
Add target directory to directive_syntax exceptions
This will allow the exception handling to easily look up the email
addresses that are to be notified, since a directive_syntax exception can
be thrown before the normal processing collects this information.
Jacob Bachmeyer [Tue, 15 Nov 2022 23:13:45 +0000 (17:13 -0600)]
Remove directive text parameter to interpret_directive
Jacob Bachmeyer [Tue, 15 Nov 2022 04:27:28 +0000 (22:27 -0600)]
Improve error handling when running gpgv
This commit harmonizes the exit status used when the child process fails
to exec gpgv with that used by posix_spawn, and ensures that the child
process is reaped when the exec fails.
Jacob Bachmeyer [Sun, 13 Nov 2022 05:53:35 +0000 (23:53 -0600)]
Rename validate_commands to validate_directive
A new validate_commands procedure is planned that runs during VL phase.
Jacob Bachmeyer [Sun, 13 Nov 2022 05:38:28 +0000 (23:38 -0600)]
Fix error message for future signature timestamp
Jacob Bachmeyer [Sun, 13 Nov 2022 05:30:20 +0000 (23:30 -0600)]
Add test for rejection of uploaded file with future timestamp
Jacob Bachmeyer [Sun, 13 Nov 2022 05:28:08 +0000 (23:28 -0600)]
Factor signature timestamp validation out of check_replay
The main code now also checks the signature timestamp on an uploaded file;
previously this was not checked at all.
Jacob Bachmeyer [Sun, 13 Nov 2022 05:12:33 +0000 (23:12 -0600)]
Fix search/replace error
Jacob Bachmeyer [Sun, 13 Nov 2022 05:08:23 +0000 (23:08 -0600)]
Add checks that the rename builtin works as expected
The tool assumes that the Perl rename builtin can atomically move files
from the inbox to the scratchpad directory and among the staging, public,
and archive directories. This commit extends the configuration checks
to confirm that the system can actually move files as expected.
Jacob Bachmeyer [Sun, 13 Nov 2022 04:17:17 +0000 (22:17 -0600)]
Change storage of other mode flags to constants
This eliminates the global variables previously used to indicate if the
--help and/or --version flags had been specified and allows the relevant
conditionals to be resolved during the compilation phase.
Jacob Bachmeyer [Sun, 13 Nov 2022 04:11:22 +0000 (22:11 -0600)]
Change current zone from a global variable to a constant
Only one zone is processed on each run of the tool, and the zone does not
change after the command arguments are parsed, so this is appropriate.
Jacob Bachmeyer [Sun, 13 Nov 2022 04:06:00 +0000 (22:06 -0600)]
Change terminology: "style" is now "zone"
The zone definitions will eventually be sections in a configuration file,
instead of being hardwired in the tool. Backwards compatibility at the
command line for the old short option (which was used at the GNU FTP site)
has been preserved for now, although this support is undocumented and
therefore deprecated.
Jacob Bachmeyer [Sat, 12 Nov 2022 05:14:15 +0000 (23:14 -0600)]
Simplify return sequence in signature verification
Jacob Bachmeyer [Sat, 12 Nov 2022 05:06:27 +0000 (23:06 -0600)]
Factor out similar code for spawning gpgv subprocess
Jacob Bachmeyer [Sat, 12 Nov 2022 04:29:33 +0000 (22:29 -0600)]
Rename automake_tests to check_automake_vulnerabilities and simplify
This also moves the checks for known GNU Automake CVE issues to the
top-level, and eliminates the now-otherwise-useless check_vulnerabilities
and check_files procedures. The major impetus for this simplification
of the call graph was the observation that check_vulnerabilities, while
named generically, was associated with a log message citing specifically
CVE-2009-4029 and CVE-2012-3386, combined with noticing that all other
functionality had been factored out of check_files.
Jacob Bachmeyer [Sat, 12 Nov 2022 04:03:44 +0000 (22:03 -0600)]
Factor uploaded file signature check up to top-level
Jacob Bachmeyer [Sat, 12 Nov 2022 03:21:56 +0000 (21:21 -0600)]
Use new detached signature verification
Jacob Bachmeyer [Sat, 12 Nov 2022 03:21:30 +0000 (21:21 -0600)]
Add verify_detached_signature
Jacob Bachmeyer [Sat, 12 Nov 2022 02:28:16 +0000 (20:28 -0600)]
Factor analysis out of verify_clearsigned_message
This is in preparation for also using --status-fd when verifying detached
signatures for uploaded files.
Jacob Bachmeyer [Sat, 12 Nov 2022 02:24:28 +0000 (20:24 -0600)]
Add check for scalar context in find_directive_elements
This avoids building a list when the only important detail is whether a key
is present in the directive.
Jacob Bachmeyer [Wed, 9 Nov 2022 00:45:56 +0000 (18:45 -0600)]
Add check for existence when removing a symlink
While the later check to verify that the symlink to be removed actually is
a symlink will also fail if no such file exists, this produces a message
that confusingly reports a refusal to remove a non-symlink file.
Jacob Bachmeyer [Wed, 9 Nov 2022 00:43:10 +0000 (18:43 -0600)]
Remove use of Cwd module
Since all file manipulations now use absolute file names, there is no
longer any need to query the current working directory.
Jacob Bachmeyer [Sat, 5 Nov 2022 22:46:56 +0000 (17:46 -0500)]
Remove use of chdir
All file manipulations now use absolute file names.
Jacob Bachmeyer [Sat, 5 Nov 2022 22:46:23 +0000 (17:46 -0500)]
Use File::Spec when reading directive file at top-level
Jacob Bachmeyer [Sat, 5 Nov 2022 22:45:35 +0000 (17:45 -0500)]
Use File::Spec in success_upload and success_directive
Jacob Bachmeyer [Sat, 5 Nov 2022 22:44:55 +0000 (17:44 -0500)]
Revise and document cleanup_dir and cleanup
Jacob Bachmeyer [Sat, 5 Nov 2022 22:07:48 +0000 (17:07 -0500)]
Remove leftover variable in execute_commands
Jacob Bachmeyer [Sat, 5 Nov 2022 22:05:05 +0000 (17:05 -0500)]
Tidy comment left when removing fatal
Jacob Bachmeyer [Sat, 5 Nov 2022 22:03:50 +0000 (17:03 -0500)]
Revise exception handling
The directive processed is now still emailed if a simple exception
terminates processing a packet. Previously, the directive text was only
emailed during normal processing or if a structured exception was thrown.
Jacob Bachmeyer [Sat, 5 Nov 2022 22:01:21 +0000 (17:01 -0500)]
Remove fatal
The uses of fatal have been entirely converted to simple and structured
exceptions, allowing the gatekeeper to continue processing after a bad
upload is encountered.
Jacob Bachmeyer [Sat, 5 Nov 2022 21:52:52 +0000 (16:52 -0500)]
Normalize simple exception messages
Jacob Bachmeyer [Sat, 5 Nov 2022 21:52:24 +0000 (16:52 -0500)]
Remove remaining calls to fatal
These reflect system errors and are replaced with simple exceptions.
Jacob Bachmeyer [Sat, 5 Nov 2022 21:28:00 +0000 (16:28 -0500)]
Use structured exception to report an unsigned directive
Jacob Bachmeyer [Sat, 5 Nov 2022 21:14:16 +0000 (16:14 -0500)]
Use structured exceptions in execute_commands
Jacob Bachmeyer [Sat, 5 Nov 2022 21:13:12 +0000 (16:13 -0500)]
Fix incorrect error messages for empty directives
Jacob Bachmeyer [Sat, 5 Nov 2022 21:02:36 +0000 (16:02 -0500)]
Revise install_files
- eliminate unneeded intermediate variable
- add separate variable for external public file name
- adjust layout
- replace call to fatal with structured exception
The message produced for an existing file is changed and shortened;
the testsuite is adjusted accordingly.
Jacob Bachmeyer [Sat, 5 Nov 2022 20:48:12 +0000 (15:48 -0500)]
Rearrange comment to match pattern
Jacob Bachmeyer [Sat, 5 Nov 2022 20:34:43 +0000 (15:34 -0500)]
Use new mkdir_p helper in install_files
Instead of using File::Path or invokgin the system mkdir, we now emulate
"mkdir -p" using about 5 lines of Perl elsewhere in the script.
Jacob Bachmeyer [Sat, 5 Nov 2022 20:33:11 +0000 (15:33 -0500)]
Tidy split line that now fits on one line
Jacob Bachmeyer [Sat, 5 Nov 2022 20:31:15 +0000 (15:31 -0500)]
Fix example given in comment
Jacob Bachmeyer [Sat, 5 Nov 2022 04:20:08 +0000 (23:20 -0500)]
Revise archive procedure in gatekeeper
- a structured exception for general processing errors is added
- the archive sub is renamed to archive_filepair
- a file and its detached signature are now archived together
- the archived filename now contains an extra number beyond the timestamp
only if actually needed for uniqueness
- the extra number, if used, matches between a file and its signature
- the archived filename is claimed by creating an "archive stamp" file
- the option to archive and overwrite a file using "replace" now handles
the file and its signature as a pair
- the system mkdir(1) and mv(1) commands are no longer invoked here
- the testsuite is adjusted accordingly
Jacob Bachmeyer [Sat, 5 Nov 2022 04:09:45 +0000 (23:09 -0500)]
Add helper procedure implementing "mkdir -p" in Perl