diff --git a/Sites/Linux Management/Fixlets/Fixlets/Apache Commons Text detection scan (Linux).bes b/Sites/Linux Management/Fixlets/Fixlets/Apache Commons Text detection scan (Linux).bes new file mode 100644 index 000000000..ea8c31062 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Apache Commons Text detection scan (Linux).bes @@ -0,0 +1,104 @@ + + + + + Apache Commons Text detection scan (Linux) + This is Community Content. When you use these solutions, it is incumbent on your organization to test any solutions provided across the broadest available system base including various OS, storage solutions, and application inventory. +

+

Please see the Community Solution Testing Statement

+

This Task performs a filesystem scan on Linux systems to attempt detecting Apache Commons Text versions vulnerable to CVE-2022-42889.

+ +

 

+

This Task performs a filesystem search across all fixed disks on Linux platforms, to locate Apache Commons Text JAR files, either directly on the filesystem or embedded in a .WAR archive file.  In the case any .WAR file is found on the system, the 'unzip' utility is used to perform a listing of files inside the archive to locate Apache Commons Text-related JAR files.  Specifically, this Task searches for any versions of commons-text-X.X.X.jar.

+

Scan results are stored in a "Scans" subdirectory beneath the "BES Client" folder. 'apache-commons-text.log' contains the full script output for potential debugging or diagnosis, and 'apache-commons-text.txt' contains a listing of detected files in one of the forms

+
    +
  • /tmp/commons-text/1.4/commons-text-1.4.jar +
  • /tmp/commons-text.war::commons-text/1.10.0/commons-text-1.10.0.jar
+

The first sample entry indicates a detected .jar file directly in the filesystem, while the second entry indicates a detected .jar file embedded within a .WAR archive.

+

This Task has several known limitations:

+

+
    +
  • Archives are not extracted recursively - only .JAR files contained directly within a .WAR archive are found; archives embedded within multiple layers of .WAR archives are not detected. +
  • There is no option to throttle the scan in terms of processor or disk i/o usage.  Scans should be executed during non-critical hours, and staggered over time especially where multiple systems share a storage resource, such as a SAN or virtual machine storage pool.
+

This detection method uses Linux Bash script with external dependencies on 'df', 'find', 'sed', and 'unzip'.  Results of the scan may be retrieved using the related Analysis.

]]>
+ name of operating system as lowercase contains "linux" + (if exists property "in proxy agent context" then not in proxy agent context else true) + Internal + 2022-03-31 + + x-fixlet-modification-time + Thu, 20 Oct 2022 22:52:18 +0000 + + BESC + + + Click + here + to deploy this action. + + = "9" as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of parent folder of client folder of site "actionsite"))}/Scans" +folder create "{parameter "ScansFolder"}" +parameter "output"="{pathname of folder (parameter "ScansFolder")}/apache-commons-text.txt" +parameter "exec_output"="{pathname of folder (parameter "ScansFolder")}/apache-commons-text.log" +delete "{parameter "output"}" +delete "{parameter "exec_output"}" + +delete __createfile +createfile until EOF_EOF_EOF_EOF +#!/bin/sh + +# Enable trace output from script +set -o xtrace + +OUTPUT_FILE={parameter "output"} + +handle_file() {{ + echo Handling $1 + case $1 in + *.war|*.zip|*.ear|*.WAR|*.ZIP|*.EAR) + echo "${{1} is an archive, searching content via unzip"; + for embeddedfile in `unzip -Z -1 "$1" *commons-text-*.jar -x *-sources.jar *-javadoc.jar *-tests.jar` + do + echo ${{1}::${{embeddedfile}>>${{OUTPUT_FILE} + done +;; + *) + echo ${{1}>>${{OUTPUT_FILE} +;; +esac +} + + + +for j in `df -l --output=target -x tmpfs -x devtmpfs | sed 1d` + + do echo "searching $j" + for targetfile in `find $j -xdev \( -name "commons-text-*.jar" -o -name "*.war" \) -a ! \( -name "*-sources.jar" -o -name "*-javadoc.jar" -o -name "*-tests.jar" \)` + do handle_file "$targetfile" + done + +done + + + +EOF_EOF_EOF_EOF + +delete run_scan.sh +copy __createfile run_scan.sh +wait chmod +x run_scan.sh +wait /bin/sh -x -c "./run_scan.sh > '{parameter "exec_output"}' 2>&1" +]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Change local user account password - Linux - BETA (21688).bes b/Sites/Linux Management/Fixlets/Fixlets/Change local user account password - Linux - BETA (21688).bes new file mode 100644 index 000000000..976867695 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Change local user account password - Linux - BETA (21688).bes @@ -0,0 +1,96 @@ + + + + + Change local user account password - Linux - BETA + +

+
+

]]>
+ = "9.0"]]> + (unix of operating system) OR (name of operating system starts with "Linux") + ( exists files whose(name of it as lowercase = "chpasswd") of (folders it) of unique values of (it as trimmed string) of substrings separated by (";";":") of values of (variables "PATH" of it; (if (windows of operating system) then (x64 variables "PATH" of it) else NOTHINGS) ) of environments ) + Accounts + Internal + jbt8, spg14, jgs194 + 2013-05-03 + + bigfixme-added-time + Fri, 06 Dec 2013 12:12:45 GMT + + + bigfixme-modification-time + Fri, 06 Dec 2013 12:12:45 GMT + + + bigfixme-keywords + + + + bigfixme-ID + 3673 + + + x-fixlet-modification-time + Wed, 21 Sep 2016 22:14:16 +0000 + + BESC + + + + Change +  specified local user account password. + + action parameter query "username" with description "Please specify the name of an existing local user account" + +// verify the user exists already before continuing +continue if{ 2 = number of lines whose(it as lowercase starts with ( ( parameter "username" ) as lowercase ) ) of (files "shadow" of it; files "passwd" of it) of folders "/etc" } + +wait sh -c "echo "{parameter "username" of action}:{parameter "secret" of action}" | chpasswd" + + + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Fix _etc_nologin (3870).bes b/Sites/Linux Management/Fixlets/Fixlets/Fix _etc_nologin (3870).bes new file mode 100644 index 000000000..665852ab5 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Fix _etc_nologin (3870).bes @@ -0,0 +1,40 @@ + + + + + Fix /etc/nologin + + exists file "/etc/redhat-release" whose (exists line whose (exists match (regex "Red Hat Enterprise Linux (Client|Server) release 5") of it) of it) AND NOT exists file "/etc/vmware-release" whose (exists line whose (it contains "VMware ESX") of it) AND not exists file "/etc/enterprise-release" whose (exists line whose (it contains "Enterprise Linux Enterprise Linux") of it) AND (if exists property "in proxy agent context" then (not in proxy agent context) else true) AND (if exists property "android" of type "operating system" then (not android of operating system) else true) + = "7.2.4.75"]]> + not exists lines whose (it starts with "/bin/rm -f /etc/nologin") of file "/etc/rc.d/rc.local" + Internal + 2013-07-30 + + x-fixlet-first-propagation + Tue, 20 Sep 2011 03:22:23 +0000 + + + x-fixlet-modification-time + Tue, 05 Aug 2014 12:29:09 +0000 + + BESC + + + Click + here + to initiate the deployment process. + + > /etc/rc.d/rc.local]]> + + + diff --git a/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Removing SUID permissions on pkexec - WITH MITIGATION (26905).bes b/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Removing SUID permissions on pkexec - WITH MITIGATION (26905).bes new file mode 100644 index 000000000..fdc5fc933 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Removing SUID permissions on pkexec - WITH MITIGATION (26905).bes @@ -0,0 +1,41 @@ + + + + + Run: PwnKit mitigation - Removing SUID permissions on pkexec - WITH MITIGATION +
+

This task will remove the SUID-bit from pkexec file.
It is a generic command that can be deployed on all Linux-based endpoints
chmod 0755 /usr/bin/pkexec

+

You should favor patching the OS with the security update released by the vendor for any supported system, and only when this is not a viable solution, to use the mitigation approach.

+

Removing the SUID-bit form the pkexec file may have a negative impact on any applications.
Use this task to perform mitigation with care and test thoroughly in your environment.

]]>
+ exists file "/usr/bin/pkexec" and mode of file "/usr/bin/pkexec" as string != "rwxr-xr-x" + Workaround + Community Content + 2022-01-28 + Important + CVE-2021-4034 + + x-fixlet-modification-time + Tue, 01 Feb 2022 14:35:27 +0000 + + BESC + + + Click + here + to deploy this action. + + // Enter your action script here +wait "/bin/bash" -c "chmod 0755 /usr/bin/pkexec" + + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Restore default permissions on pkexec - UNDO MITIGATION (26904).bes b/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Restore default permissions on pkexec - UNDO MITIGATION (26904).bes new file mode 100644 index 000000000..ee0ad5051 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Run_ PwnKit mitigation - Restore default permissions on pkexec - UNDO MITIGATION (26904).bes @@ -0,0 +1,41 @@ + + + + + Run: PwnKit mitigation - Restore default permissions on pkexec - UNDO MITIGATION +
+

This task restore the default permission on the pkexec file, that is. -rwsr-xr-x
It is a generic command that can be deployed on all Linux-based endpoints
chmod u+s /usr/bin/pkexec

+

This task can be used in case the PwnKit mitigation task damaged an application running on the target endpoint. It will restore the default permissions on the pkexec file that were modified by the mitigation task.
Use this task with care and test thoroughly in your environment

+

NOTE: The task restores the default (-rwsr-xr-x) to the pkexec file.

]]>
+ exists file "/usr/bin/pkexec" and mode of file "/usr/bin/pkexec" as string != "rwsr-xr-x" + Workaround + Community Content + 2022-01-28 + Important + CVE-2021-4034 + + x-fixlet-modification-time + Tue, 01 Feb 2022 14:35:36 +0000 + + BESC + + + Click + here + to deploy this action. + + // Enter your action script here +wait "/bin/bash" -c "chmod u+s /usr/bin/pkexec" + + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Set Timezone - Red Hat (2612).bes b/Sites/Linux Management/Fixlets/Fixlets/Set Timezone - Red Hat (2612).bes new file mode 100644 index 000000000..5d2c147af --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Set Timezone - Red Hat (2612).bes @@ -0,0 +1,105 @@ + + + + + Set Timezone - Red Hat + This fixlet will set the timezone on the endpoint. A few popular timezones have been preset but if you need a custom timezone, use the timezones available in /usr/share/zoneinfo. 

]]>
+ name of operating system contains "Red Hat Enterprise Server 5" + Internal + 2013-10-08 + + x-fixlet-modification-time + Tue, 08 Oct 2013 20:09:46 +0000 + + BESC + + + + Set to Eastern Time. + + + appendfile ZONE="America/New_York" +appendfile UTC=true +appendfile ARC=false + +delete /etc/sysconfig/clock +copy ./__appendfile /etc/sysconfig/clock + +wait ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime + + + + + + Set to custom timezone. +   + + +action parameter query "Timezone" with description "Please type the timezone that you'd like to set. You need to use the relative path from /usr/share/zoneinfo ex. America/New_York" + +appendfile ZONE="{parameter "Timezone" of action}" +appendfile UTC=true +appendfile ARC=false + +delete /etc/sysconfig/clock +copy ./__appendfile /etc/sysconfig/clock + +wait ln -sf /usr/share/zoneinfo/{parameter "Timezone" of action} /etc/localtime + + + + + + Set to Central Time. + + + appendfile ZONE="America/Chicago" +appendfile UTC=true +appendfile ARC=false + +delete /etc/sysconfig/clock +copy ./__appendfile /etc/sysconfig/clock + +wait ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime + + + + + Set to Mountain Time. + + + appendfile ZONE="America/Denver" +appendfile UTC=true +appendfile ARC=false + +delete /etc/sysconfig/clock +copy ./__appendfile /etc/sysconfig/clock + +wait ln -sf /usr/share/zoneinfo/America/Denver /etc/localtime + + + + + Set to Pacific Time. + + + appendfile ZONE="America/Los_Angeles" +appendfile UTC=true +appendfile ARC=false + +delete /etc/sysconfig/clock +copy ./__appendfile /etc/sysconfig/clock + +wait ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux - Upgrade Operating System to Version 9.0 (TEMPLATE) (25555).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux - Upgrade Operating System to Version 9.0 (TEMPLATE) (25555).bes new file mode 100644 index 000000000..5b17c8fa0 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux - Upgrade Operating System to Version 9.0 (TEMPLATE) (25555).bes @@ -0,0 +1,131 @@ + + + + + Tiny Core Linux - Upgrade Operating System to Version 9.0 (TEMPLATE) + + + + +
+

Official support for version 9.0 of Tiny Core Linux is coming soon to BigFix. For now, 9.0 seems to work even in 9.5.9 BigFix environments. This fixlet can aid in your testing of it.

This Fixlet can upgrade the operating system of all the instances of the Tiny Core Virtual Relays on the targeted computers to Version 9.0. It has been tested on Tiny Core Linux 7.X and 8.X.

+

WARNING:  This fixlet is not meant to be run as-is. There is no way to predict when the Tiny Core Linux team will change the "*.tcz" files used by this fixlet, so actions started with this fixlet will likley encounter download problems in the future. The recommended way to handle this is to create a custom copy of this action where the prefectch lines in the action script are edited for the current files served by Tiny Core, then manually pre-cache those files on the bigfix server.

+

How do I manually cache a file on the BigFix Server?
https://www-01.ibm.com/support/docview.wss?uid=swg21506037

+

make-prefetch, a Python tool to generate prefetch statements for downloads in BigFix Action Script:
https://github.com/bigfix/make-prefetch

+

Note:  If VMware Tools are already installed on the target computer, they will be upgraded automatically.

+
Note:  Before running this Fixlet, ensure that the BigFix Client Version installed on the Tiny Core Virtual Relays is 9.5.8 or higher.

+
+

File Size:

19.19 MB
]]>
+ exists (operating system) whose (it as string starts with "Linux TinyCore") + + Upgrade + IBM AVP + 2018-09-28 + Informational + + x-fixlet-modification-time + Fri, 28 Sep 2018 18:19:36 +0000 + + BESC + + + Click + here +   to upgrade the operating system  to Version 9.0 + + +// operating system +prefetch core.gz sha1:47af60d5dabbcb7e9e23d48b43d0802585fd73a1 size:8730363 http://distro.ibiblio.org/tinycorelinux/9.x/x86/release/distribution_files/core.gz sha256:f259129b3ee4bb234e2d08750d38e7387b0a583e95ac34ff13c7e7c9a0a1962d +prefetch vmlinuz sha1:6b91a5385d8a92768817a5c14038c2ca9a3e1704 size:4106416 http://distro.ibiblio.org/tinycorelinux/9.x/x86/release/distribution_files/vmlinuz sha256:b21fa905a7bf4738a876878fe6390fb06e653b00129fc46cb48e4212a4c876c2 +prefetch acl.tcz sha1:f7a224b1236e5e077b9f430bbeaf0305b22901cb size:40960 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/acl.tcz sha256:38c3ef85257cb251328e3e5fa28dba047f636ec2924ec1888875b24e581c8e5f +prefetch libattr.tcz sha1:ec94e3cecf7d8374881e47ab49bdbb2e6b7c9edc size:8192 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/libattr.tcz sha256:f1f7c1e335f8b0cad853302f95db7c1497e355ef5eeabb2acda41bd37fe99687 +prefetch syslinux.tcz sha1:70039319eb5a364c83d9410bd0e1d2b24583f1b5 size:2691072 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/syslinux.tcz sha256:09dd0099f09d4d4cab3a3b515b63078321181a783a7c7b78fe341878f3cbda61 +prefetch nspr.tcz sha1:dfe8210919f0b0022a2aac4f73b6aa363a78ffd5 size:118784 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/nspr.tcz sha256:f7aeb200e8a45d316ea7d3c3f17a416a0b83ca50826b464250045c310b1fd685 +prefetch nss.tcz sha1:859f03667ddf4d8909d0766cd3cb3184871bb914 size:1736704 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/nss.tcz sha256:ff648292da16a675a3e3513a5f27936fe5e77a37373f0c1ee9b33865bd2edd93 +prefetch popt.tcz sha1:3eb68d46c9c8216a9b40ebeae16795a5946c3d6f size:28672 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/popt.tcz sha256:f62025f8111477454433711d85d5becc6cf3d708f1d3fe4bb6328f76066dd12f +prefetch sqlite3.tcz sha1:d7c2aa6a6feadb8eeba58a3c47250d3faa0ead58 size:503808 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/sqlite3.tcz sha256:0ae2b0873f48e76215bfa55d99f54110ca0cb5ccda0c821536d57e806c073153 +prefetch tzdata.tcz sha1:5521f4b41d4f4b083e2fa8de0ae92a6ea342c5b5 size:524288 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/tzdata.tcz sha256:290f5ae1f4738ad9d0c0cf39d72dcbc8743e50e1355bd1b2c1cec3aa46991526 + +// operating system +continue if {exists file "__Download/core.gz"} +continue if {exists file "__Download/vmlinuz"} +delete "/mnt/sda1/tce/boot/core.gz" +delete "/mnt/sda1/tce/boot/vmlinuz" +move __Download/core.gz "/mnt/sda1/tce/boot/core.gz" +move __Download/vmlinuz "/mnt/sda1/tce/boot/vmlinuz" + +// virtual relay prerequisites +continue if {exists file "__Download/acl.tcz"} +continue if {exists file "__Download/libattr.tcz"} +continue if {exists file "__Download/syslinux.tcz"} +continue if {exists file "__Download/nspr.tcz"} +continue if {exists file "__Download/nss.tcz"} +continue if {exists file "__Download/popt.tcz"} +continue if {exists file "__Download/sqlite3.tcz"} +continue if {exists file "__Download/tzdata.tcz"} +delete "/mnt/sda1/tce/optional/acl.tcz" +delete "/mnt/sda1/tce/optional/libattr.tcz" +delete "/mnt/sda1/tce/optional/syslinux.tcz" +delete "/mnt/sda1/tce/optional/nspr.tcz" +delete "/mnt/sda1/tce/optional/nss.tcz" +delete "/mnt/sda1/tce/optional/popt.tcz" +delete "/mnt/sda1/tce/optional/sqlite3.tcz" +delete "/mnt/sda1/tce/optional/tzdata.tcz" + +move __Download/acl.tcz "/mnt/sda1/tce/optional/acl.tcz" +move __Download/libattr.tcz "/mnt/sda1/tce/optional/libattr.tcz" +move __Download/syslinux.tcz "/mnt/sda1/tce/optional/syslinux.tcz" +move __Download/nspr.tcz "/mnt/sda1/tce/optional/nspr.tcz" +move __Download/nss.tcz "/mnt/sda1/tce/optional/nss.tcz" +move __Download/popt.tcz "/mnt/sda1/tce/optional/popt.tcz" +move __Download/sqlite3.tcz "/mnt/sda1/tce/optional/sqlite3.tcz" +move __Download/tzdata.tcz "/mnt/sda1/tce/optional/tzdata.tcz" + +// vmware tools prerequisites +if {exists file "/opt/bigFix/status/vmwareToolsReady"} + prefetch fuse.tcz sha1:bb36663427f2abd429bf77b16d2d8d11e82a51ef size:188416 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/fuse.tcz sha256:e4d8796b7133182e880f280eef447dd3b7467c287ef286a893af989bf4b18e98 + prefetch glib2.tcz sha1:26d8371a138e1c97801e7a88e8e57e0bbc5e5ef8 size:1232896 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/glib2.tcz sha256:d869632e7ab351745633fb592e38e551aff2a574a7a1f4c0af495e1ad1e1b72c + prefetch libdnet.tcz sha1:20b44cb00ac4fbe225c6fe19ba673967467c4140 size:36864 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/libdnet.tcz sha256:036e53e5acf74d473415c56b0bd808f4dfd02406b8f8e0aa55e6c9716195cf37 + prefetch openssl.tcz sha1:115e630569705492eb870201eb14c91b783962fe size:1163264 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/openssl.tcz sha256:2d1b9cf8a5fe2494da08e147651dc30557e0cde26f8b52bdcc0c8e4acda7bafb + prefetch gamin.tcz sha1:4b776007149e95f3b189f6c7760c14633ddc7cb7 size:16384 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/gamin.tcz sha256:08ccde4512884a5c02b564fd4f7c479bf20e77897e62a7d09cc05a35f7f5a1d5 + prefetch libffi.tcz sha1:791fcc837b3bf31c73fe1bcd935e0a30d48a402d size:16384 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/libffi.tcz sha256:f0eaa2d644beab0929ca14f93e7bd2e23350d14e49019b9fb727cb8949887a99 + prefetch open-vm-tools.tcz sha1:adfda038cfdddbf0debc078732c7cbccc28c03f3 size:458752 http://distro.ibiblio.org/tinycorelinux/9.x/x86/tcz/open-vm-tools.tcz sha256:2d198e65a036db6045fe0684f3ba9e62ea95b6b12b336da5470e22e95d21151c + + continue if {exists file "__Download/fuse.tcz"} + continue if {exists file "__Download/glib2.tcz"} + continue if {exists file "__Download/libdnet.tcz"} + continue if {exists file "__Download/openssl.tcz"} + continue if {exists file "__Download/gamin.tcz"} + continue if {exists file "__Download/libffi.tcz"} + continue if {exists file "__Download/open-vm-tools.tcz"} + delete "/mnt/sda1/tce/optional/fuse.tcz" + delete "/mnt/sda1/tce/optional/glib2.tcz" + delete "/mnt/sda1/tce/optional/libdnet.tcz" + delete "/mnt/sda1/tce/optional/openssl.tcz" + delete "/mnt/sda1/tce/optional/gamin.tcz" + delete "/mnt/sda1/tce/optional/libffi.tcz" + delete "/mnt/sda1/tce/optional/open-vm-tools.tcz" + + move __Download/fuse.tcz "/mnt/sda1/tce/optional/fuse.tcz" + move __Download/glib2.tcz "/mnt/sda1/tce/optional/glib2.tcz" + move __Download/libdnet.tcz "/mnt/sda1/tce/optional/libdnet.tcz" + move __Download/openssl.tcz "/mnt/sda1/tce/optional/openssl.tcz" + move __Download/gamin.tcz "/mnt/sda1/tce/optional/gamin.tcz" + move __Download/libffi.tcz "/mnt/sda1/tce/optional/libffi.tcz" + move __Download/open-vm-tools.tcz "/mnt/sda1/tce/optional/open-vm-tools.tcz" +endif + +run sudo reboot + + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux Relay - Upgrade to version 14.0 (6.1.2-tinycore) (27010).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux Relay - Upgrade to version 14.0 (6.1.2-tinycore) (27010).bes new file mode 100644 index 000000000..5cd5b393f --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Linux Relay - Upgrade to version 14.0 (6.1.2-tinycore) (27010).bes @@ -0,0 +1,351 @@ + + + + + Tiny Core Linux Relay - Upgrade to version 14.0 (6.1.2-tinycore) +

This fixlet will upgrade relays running TinyCore 12.0 to TinyCore 14.0.  The OS, kernel, and extensions will be upgraded. 

This fixlet used files manually cached on the root server. You can do the upgrade without caching the files useing the tce-update and associated 'tce-' commands, however that will require a rework of the action and shell script. The cached files in this fixlet are up-to-date as of 10/23/2023.

If version rollback is needed, all files are backed up to "/home/tc/v12_backup/".

Upgrade Log: /var/log/v14_upgrade.log

The following extensions will be updated:

  • libdnet
  • ncursesw
  • nspr
  • nss
  • openssl-1.1.1
  • open-vm-tools
  • perl5
  • tzdata

Exit Codes:

# Exit Code 90 = The upgrade backup folder does not exist and failed to create
# Exit Code 91 = A v12 extension failed to copy to the backup folder
# Exit Code 92 = A v12 boot file failed to copy to the backup folder
# Exit Code 93 = A v14 file is missing from /home/tc/v14_files
# Exit Code 94 = A v14 boot file failed to copy to /mnt/sda1/tce/boot/
# Exit Code 95 = A boot file mismatch found.  core.gz and vmlinuz are not either both v14 or both v12.  Restoring to v12.
]]>
+ (if exists property "in proxy agent context" then ( not in proxy agent context ) else true ) + name of operating system contains "TinyCore" + version of operating system = "12.0" + = "11.0.0")]]> + not (it as string = "Linux TinyCore 14.0 (6.1.2-tinycore)") of operating system + Internal + 2023-10-25 + + x-fixlet-modification-time + Thu, 17 Sep 2026 21:06:02 +0000 + + BESC + + + Click + here + to deploy this action. + + > $LOGFILE +exec 2>&1 + +# Logging Function +log_write() +{ + echo "$(date) - $1" +} + +# Kill processes +kill_proc() +{ + # If no PID is passed, exit function + if [ -z "$1" ]; then + return 1 + fi + kill $1 && log_write "Stopping $2" +} + +# Kill crond and automated scripts to avoid interference +log_write "************************************************************" +log_write "Checking for running processes..." +kill_proc "$CROND_PID" "crond" + + +# Cleanup Function +cleanup() +{ + log_write "Executing Cleanup..." + # Capture the MD5 of the current core.gz and vmlinuz + boot_coregz_MD5=$(md5sum ${{BOOT_DIR}/core.gz | cut -d " " -f1) + boot_vmlinuz_MD5=$(md5sum ${{BOOT_DIR}/vmlinuz | cut -d " " -f1) + # If one of the boot files is v14 and the other is v12, restore both v12 files. A mismatch will cause the system not to boot properly. + if [ "$boot_coregz_MD5" == "$v14_coregz_MD5" ] && [ "$boot_vmlinuz_MD5" != "$v14_vmlinuz_MD5" ]; then + cp -f ${{v12_BKP}/core.gz "${{BOOT_DIR}/" + cp -f ${{v12_BKP}/vmlinuz "${{BOOT_DIR}/" + log_write "Boot file mismatch found. core.gz is v14 while vmlinuz is v12. Restoring to v12." + fi + if [ "$boot_coregz_MD5" != "$v14_coregz_MD5" ] && [ "$boot_vmlinuz_MD5" == "$v14_vmlinuz_MD5" ]; then + cp -f ${{v12_BKP}/core.gz "${{BOOT_DIR}/" + cp -f ${{v12_BKP}/vmlinuz "${{BOOT_DIR}/" + log_write "Boot file mismatch found. core.gz is v12 while vmlinuz is v14. Restoring to v12." + fi + log_write "Cleaning up the v14 file downloads..." + rm -rf $v14_FILES +} + +# Final Cleanup Function +final_cleanup() +{ + log_write "Executing Cleanup..." + log_write "Cleaning up the v14 file downloads..." + rm -rf $v14_FILES + # Capture the MD5 of the current core.gz and vmlinuz + boot_coregz_MD5=$(md5sum ${{BOOT_DIR}/core.gz | cut -d " " -f1) + boot_vmlinuz_MD5=$(md5sum ${{BOOT_DIR}/vmlinuz | cut -d " " -f1) + # If one of the boot files is v14 and the other is v12, restore both v12 files. A mismatch will cause the system not to boot properly. + if [ "$boot_coregz_MD5" == "$v14_coregz_MD5" ] && [ "$boot_vmlinuz_MD5" != "$v14_vmlinuz_MD5" ]; then + cp -f ${{v12_BKP}/core.gz "${{BOOT_DIR}/" + cp -f ${{v12_BKP}/vmlinuz "${{BOOT_DIR}/" + log_write "Boot file mismatch found. core.gz is v14 while vmlinuz is v12. Restoring to v12. Exiting script now - EC 95" + exit 95 + fi + if [ "$boot_coregz_MD5" != "$v14_coregz_MD5" ] && [ "$boot_vmlinuz_MD5" == "$v14_vmlinuz_MD5" ]; then + cp -f ${{v12_BKP}/core.gz "${{BOOT_DIR}/" + cp -f ${{v12_BKP}/vmlinuz "${{BOOT_DIR}/" + log_write "Boot file mismatch found. core.gz is v12 while vmlinuz is v14. Restoring to v12. Exiting script now - EC 95" + exit 95 + fi +} + +# Signal Trap +trap 'sig_rec; exit' 1 2 3 6 15 +sig_rec() +{ + log_write "One of the following signals has been caught: 1 2 3 6 15" + cleanup + log_write "Exiting now." +} + +# Exit if missing the specific v14 download +exit_missing_file() +{ + cleanup + echo "$(date) - ERROR - The following file is missing from ${{v14_FILES}: '$1' Exiting now! - EC 93" + exit 93 +} + +# Extension backup and verification - exit script if extension fails to copy +tcz_bkp() +{ + # Validate that there is only one argument + if [ $# -ne 1 ]; then + log_write "ERROR - tcz_bkp was called either without any arguments OR with 2 or more arguments. A single argument is required with the name of the extension that needs to be backed up." + return 1 + fi + # Validate that the argument is not empty + if [ -z "$1" ]; then + log_write "ERROR - tcz_bkp was called with an empty argument. A single argument is required with the name of the extension that needs to be backed up." + return 1 + fi + + # copy the specified extension and ancillary files to the backup folder (the extension, md5 file, dep file, (md5 and dep may not exist)) + cp -f ${{TCZ_DIR}/${{1}.tcz* "${{v12_BKP}/" + + # Check that the extension was copied successfully and exit the script if it wasn't + # Every extensions needs to be successfully backed up before proceeding with the upgrade + if [ -f "${{v12_BKP}/${{1}.tcz" ]; then + log_write "'$1' has been successfully copied to ${{v12_BKP}." + else + cleanup + log_write "ERROR - '$1' backup failed. Exiting script now! - EC 91" + exit 91 + fi +} + +# Upgraded extension copy and verification +tcz_upgrade() +{ + # Validate that there is only one argument + if [ $# -ne 1 ]; then + log_write "ERROR - tcz_upgrade was called either without any arguments OR with 2 or more arguments. A single argument is required with the name of the extension that needs to be upgraded." + return 1 + fi + # Validate that the argument is not empty + if [ -z "$1" ]; then + log_write "ERROR - tcz_upgrade was called with an empty argument. A single argument is required with the name of the extension that needs to be upgraded." + return 1 + fi + + # Store md5sum of v14 file to use later + TCZ_MD5_PRE=$(md5sum ${{v14_FILES}/${{1}.tcz | cut -d " " -f1) + + # copy the specified extension and ancillary files to the persistent extension folder TCZ_DIR (the extension, md5 file, dep file, (md5 and dep may not exist)) + cp -f ${{v14_FILES}/${{1}.tcz* "${{TCZ_DIR}/" + + # Check that the extension was copied successfully + TCZ_MD5_POST=$(md5sum ${{TCZ_DIR}/${{1}.tcz | cut -d " " -f1) + if [ "$TCZ_MD5_PRE" == "$TCZ_MD5_POST" ]; then + log_write "'$1' has been successfully copied to ${{TCZ_DIR}." + else + log_write "ERROR - '$1' upgrade failed." + fi +} + +# OS and Kernel backup and verification - exit script if files fail to copy +boot_bkp() +{ + # Validate that there is only one argument + if [ $# -ne 1 ]; then + log_write "ERROR - boot_bkp was called either without any arguments OR with 2 or more arguments. A single argument is required with the name of the file that needs to be backed up." + return 1 + fi + # Validate that the argument is not empty + if [ -z "$1" ]; then + log_write "ERROR - boot_bkp was called with an empty argument. A single argument is required with the name of the file that needs to be backed up." + return 1 + fi + + # copy the specified file to the backup folder + cp -f ${{BOOT_DIR}/${{1} "${{v12_BKP}/" + + # Check that the file was copied successfully and exit the script if it wasn't + # Every boot file needs to be successfully backed up before proceeding with the upgrade + if [ -f "${{v12_BKP}/${{1}" ]; then + log_write "'$1' has been successfully copied to ${{v12_BKP}." + else + cleanup + log_write "ERROR - '$1' backup failed. Exiting script now! - EC 92" + exit 92 + fi +} + +# Upgraded boot file copy and verification +boot_upgrade() +{ + # Validate that there is only one argument + if [ $# -ne 1 ]; then + log_write "ERROR - boot_upgrade was called either without any arguments OR with 2 or more arguments. A single argument is required with the name of the file that needs to be upgraded." + return 1 + fi + # Validate that the argument is not empty + if [ -z "$1" ]; then + log_write "ERROR - boot_upgrade was called with an empty argument. A single argument is required with the name of the file that needs to be upgraded." + return 1 + fi + + # Validate that the boot file exists and exit if not + [ ! -f "${{v14_FILES}/${{1}" ] && exit_missing_file "$1" + + # Store md5sum of v14 file to use later + BOOT_MD5_PRE=$(md5sum ${{v14_FILES}/${{1} | cut -d " " -f1) + + # copy the specified file to the BOOT_DIR + cp -f ${{v14_FILES}/${{1} "${{BOOT_DIR}/" + + # Check that the extension was copied successfully + BOOT_MD5_POST=$(md5sum ${{BOOT_DIR}/${{1} | cut -d " " -f1) + if [ "$BOOT_MD5_PRE" == "$BOOT_MD5_POST" ]; then + log_write "'$1' has been successfully copied to ${{BOOT_DIR}." + else + cleanup + log_write "ERROR - '$1' upgrade failed. Exiting script now! - EC 94" + exit 94 + fi +} + +log_write "Starting Tiny Core v14 upgrade..." + +# Check that the v14 OS and kernel were successfully downloaded and moved to $v14_FILES - Exit script if either file is missing +[ ! -f "${{v14_FILES}/core.gz" ] && exit_missing_file "core.gz" +[ ! -f "${{v14_FILES}/vmlinuz" ] && exit_missing_file "vmlinuz" + +# Create the backup folder if it does not exist +log_write "Starting upgrade backup folder check." +[ ! -d "$v12_BKP" ] && log_write "The upgrade backup folder does not exist. Creating '$v12_BKP' now." && mkdir "$v12_BKP" + +# Ensure the backup folder exists and exit the script if it doesn't +if [ -d "$v12_BKP" ]; then + log_write "The upgrade backup folder exists - '$v12_BKP'" +else + cleanup + log_write "ERROR - The upgrade backup folder failed to create. Exiting script now - EC 90" + exit 90 +fi + +# Backup the v12 OS and 5.10.3 Kernel +log_write "Starting backup of v12 OS and 5.10.3 kernel..." +boot_bkp "core.gz" +boot_bkp "vmlinuz" +log_write "Backup of v12 OS and 5.10.3 kernel complete!" + +# Backup the v12 extensions and ancillary files +log_write "Starting backup of extensions and ancillary files..." +[ -f "${{TCZ_DIR}/libdnet.tcz" ] && tcz_bkp "libdnet" || log_write "The extension 'libdnet' does not exist. Skipping backup of 'libdnet'." +[ -f "${{TCZ_DIR}/ncursesw.tcz" ] && tcz_bkp "ncursesw" || log_write "The extension 'ncursesw' does not exist. Skipping backup of 'ncursesw'." +[ -f "${{TCZ_DIR}/nspr.tcz" ] && tcz_bkp "nspr" || log_write "The extension 'nspr' does not exist. Skipping backup of 'nspr'." +[ -f "${{TCZ_DIR}/nss.tcz" ] && tcz_bkp "nss" || log_write "The extension 'nss' does not exist. Skipping backup of 'nss'." +[ -f "${{TCZ_DIR}/openssl-1.1.1.tcz" ] && tcz_bkp "openssl-1.1.1" || log_write "The extension 'openssl-1.1.1' does not exist. Skipping backup of 'openssl-1.1.1'." +[ -f "${{TCZ_DIR}/open-vm-tools.tcz" ] && tcz_bkp "open-vm-tools" || log_write "The extension 'open-vm-tools' does not exist. Skipping backup of 'open-vm-tools'." +[ -f "${{TCZ_DIR}/perl5.tcz" ] && tcz_bkp "perl5" || log_write "The extension 'perl5' does not exist. Skipping backup of 'perl5'." +[ -f "${{TCZ_DIR}/tzdata.tcz" ] && tcz_bkp "tzdata" || log_write "The extension 'tzdata' does not exist. Skipping backup of 'tzdata'." +log_write "Backup of extensions and ancillary files complete!" + +# Copy in the v14 OS and 6.1.2 kernel +log_write "Starting upgrade of the v14 OS and 6.1.2 kernel" +boot_upgrade "core.gz" +boot_upgrade "vmlinuz" +log_write "Upgrade of the v14 OS and 6.1.2 kernel complete!" + +# Copy in the updated v14 extensions +log_write "Starting upgrade of the v14 extensions" +[ -f "${{TCZ_DIR}/libdnet.tcz" ] && tcz_upgrade "libdnet" || log_write "The extension 'libdnet' does not exist. Skipping upgrade of 'libdnet'." +[ -f "${{TCZ_DIR}/ncursesw.tcz" ] && tcz_upgrade "ncursesw" || log_write "The extension 'ncursesw' does not exist. Skipping upgrade of 'ncursesw'." +[ -f "${{TCZ_DIR}/nspr.tcz" ] && tcz_upgrade "nspr" || log_write "The extension 'nspr' does not exist. Skipping upgrade of 'nspr'." +[ -f "${{TCZ_DIR}/nss.tcz" ] && tcz_upgrade "nss" || log_write "The extension 'nss' does not exist. Skipping upgrade of 'nss'." +[ -f "${{TCZ_DIR}/openssl-1.1.1.tcz" ] && tcz_upgrade "openssl-1.1.1" || log_write "The extension 'openssl-1.1.1' does not exist. Skipping upgrade of 'openssl-1.1.1'." +[ -f "${{TCZ_DIR}/open-vm-tools.tcz" ] && tcz_upgrade "open-vm-tools" || log_write "The extension 'open-vm-tools' does not exist. Skipping upgrade of 'open-vm-tools'." +[ -f "${{TCZ_DIR}/perl5.tcz" ] && tcz_upgrade "perl5" || log_write "The extension 'perl5' does not exist. Skipping upgrade of 'perl5'." +[ -f "${{TCZ_DIR}/tzdata.tcz" ] && tcz_upgrade "tzdata" || log_write "The extension 'tzdata' does not exist. Skipping upgrade of 'tzdata'." +log_write "Upgrade of the v14 extensions is complete!" + +# Disable Multi-Gen LRU (MGLRU) on boot - Leaving this enabled will cause memory page reclamation issues +log_write "Disabling MGLRU on boot via bootlocal.sh..." +echo "echo 0 > /sys/kernel/mm/lru_gen/enabled" >> /opt/bootlocal.sh + +final_cleanup +log_write "Tiny Core v14 upgrade is complete!" + +endofscript + +delete /var/opt/BESClient/v14_upgrade.sh +move __createfile /var/opt/BESClient/v14_upgrade.sh +wait chmod 555 /var/opt/BESClient/v14_upgrade.sh +wait /bin/sh /var/opt/BESClient/v14_upgrade.sh + +continue if {exit code of action = 0} + +run sudo reboot]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Deploy Log Rotation (26988).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Deploy Log Rotation (26988).bes new file mode 100644 index 000000000..f2cf35f7f --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Deploy Log Rotation (26988).bes @@ -0,0 +1,186 @@ + + + + + Tiny Core Relay - Deploy Log Rotation + Deploys a script that will rotate specified logs once they reach a certain size.  This will run once per day.

Log Size Threshold: 200KB

Logs Rotated (configured in external file):

 







 

Note: LogRotate.tcz will be available in TCL v13. 

]]>
+ (exists relay service) + ((if exists property "in proxy agent context" then ( not in proxy agent context ) else true )) + name of operating system contains "Linux TinyCore" + not exists file "/home/tc/scripts/log_rotation.sh" + Internal + 2022-12-07 + + x-fixlet-modification-time + Thu, 17 Sep 2026 21:06:02 +0000 + + BESC + + + Click + here + to deploy this action. + + "$TMPLIST" +#validate logs in loglist.conf +for F in $LOGS +do + if [ -r "$F" ]; then + echo "$F" >> $TMPLIST + else + logger "$(date) - ERROR - Log Rotation Failed for "$F". File Not Found" + fi +done + +#Store validated logs line by line +VALIDATED_LOGS=$(cat "$TMPLIST") + +#rotate_logfile function (max= max rotations. The actual number of rotations will be one higher than specified) +rotate_logfile() +{ + max=4 + #seq command - count backwards from max by an increment of 1 until it reaches 1 + seq="$(seq "${{max}" -1 1)" + for s in $seq + do + #add one to the current seq value + d=$(($s +1)) + OLDFILE="$LOG_BASE".$s.log + NEWFILE="$LOG_BASE".$d.log + #rotate existing 'rotated' logs - .1.log will become .2.log etc... + quiet mv -f $OLDFILE $NEWFILE + done + #rotate the active log + mv -f $FILE ${{LOG_BASE}.1.log +} + +#output suppression function +quiet() +{ +"$@" > /dev/null 2>&1 +} + +#Rotate Logs + +for FILE in $VALIDATED_LOGS +do + #LOG_BASE removes .log from file + LOG_BASE=$(expr ${{FILE} | awk -F '.' '{{ print $1 }') + #SIZE pulls file size in bytes + SIZE=$(ls -l ${{FILE} | awk '{{ print $5}') + #file exists and is greater than or equal to 200KB + if [ -f "$FILE" ] && [ $SIZE -ge 200000 ]; then + rotate_logfile + > "$FILE" + fi +done + +endofscript1 + +delete /home/tc/scripts/log_rotation.sh +move __createfile /home/tc/scripts/log_rotation.sh +wait chmod 750 /home/tc/scripts/log_rotation.sh + +//Create log list conf file +delete __createfile +createfile until endofscript2 +# DO NOT DELETE FILE! +# Conf file that defines what logs are to be rotated. This file is used by /home/tc/scripts/log_rotation.sh. +# This file can be updated on all relays using the fixlet: PM - Tiny Core Relay - Update Log Rotation Settings +# Insert one log file per line using the absolute path. The file must end in .log + +//INSERT LOGS TO BE ROTATED HERE +endofscript2 + +delete /home/tc/scripts/loglist.conf +move __createfile /home/tc/scripts/loglist.conf +wait chmod 660 /home/tc/scripts/loglist.conf + +//create file to use for crontab + +if {not exists file "/var/spool/cron/crontabs/root"} + +delete __appendfile +appendfile 12 0 * * * /bin/sh /home/tc/scripts/log_rotation.sh + +if {exists file "/home/tc/newcrontab"} +delete "/home/tc/newcrontab" +endif + +continue if {not exists file "/home/tc/newcrontab"} + +move __appendfile /home/tc/newcrontab + +continue if {exists file "/home/tc/newcrontab"} + +endif + +//create script to add cronjob to crontab, add /var/spool/cron/crontabs directory to filetool.lst, add starting the cron service to bootlocal, and backup + +delete __appendfile +appendfile #!/bin/sh + +if {exists file "/var/spool/cron/crontabs/root"} +appendfile echo "12 0 * * * /bin/sh /home/tc/scripts/log_rotation.sh" >> "/var/spool/cron/crontabs/root" +else +appendfile sudo crontab /home/tc/newcrontab +endif + +if {not exists lines whose (it contains "var/spool/cron/crontabs/") of file "/opt/.filetool.lst"} +appendfile echo "var/spool/cron/crontabs/" >> /opt/.filetool.lst +endif + +if {not exists lines whose (it contains "/sbin/syslogd") of file "/opt/bootlocal.sh"} +appendfile echo "/sbin/syslogd" >> /opt/bootlocal.sh +endif + +if {not exists lines whose (it contains "/etc/init.d/services/crond start") of file "/opt/bootlocal.sh"} +appendfile echo "/etc/init.d/services/crond start" >> /opt/bootlocal.sh +endif + +appendfile sudo filetool.sh -b +appendfile sudo reboot + +delete /var/opt/BESClient/logrotate_config.sh +move __appendfile /var/opt/BESClient/logrotate_config.sh +wait chmod 750 /var/opt/BESClient/logrotate_config.sh +run /bin/sh /var/opt/BESClient/logrotate_config.sh + +]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - FillDB DMZ Monitoring (26991).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - FillDB DMZ Monitoring (26991).bes new file mode 100644 index 000000000..9d8f41722 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - FillDB DMZ Monitoring (26991).bes @@ -0,0 +1,224 @@ + + + + + Tiny Core Relay - FillDB DMZ Monitoring + Deploys a script that will run every 30 minutes on DMZ VRAs. 

If the FillDB file count or folder size reaches 70 percent or greater of its maximum value, an alert will be emailed.

All events will be logged: /var/log/filldb_alerts.log

]]>
+ exists relay service + name of operating system contains "Linux TinyCore" + ((dns name as lowercase contains ".dmz.") | FALSE) + not exists file "/home/tc/scripts/filldb_mon.sh" + Internal + 2022-11-16 + + x-fixlet-modification-time + Thu, 17 Sep 2026 21:06:02 +0000 + + BESC + + + Click + here + to deploy this action. + + > $LOGFILE + sendEmail -f $HOSTNAME@BigFixAlerts.INSERTDOMAIN -t {(parameter "EmailAddresses" of action as string as lowercase)} -u "FillDB Alert: CLEARED - $HOSTNAME" -o message-file=$EMAILALLCLEAR -s smtp.INSERTDOMAIN:25 >> $LOGFILE 2>&1 + rm -f $ALERTFILE + rm -f $EMAILFILE + echo "$(date) - FillDB Alert Cleanup Process Complete!" >> $LOGFILE + fi +#If FIllDB IS above threshold +else +#If persistent lock file already exists do nothing and exit. + if [ -f $ALERTFILE ]; then + exit +#ELSE if the lock file DOES NOT exist - sleep for two min to ensure its not a transient spike + else + sleep 120 +#Run threshold check again - if still above threshold create the alert (logging, , email file, sendEmail, and create persistent alert file) + SIZE=$(du -sm /var/opt/BESRelay/FillDBData/BufferDir/ForwardingBufferDir/ | cut -f1) + COUNT=$(ls -l /var/opt/BESRelay/FillDBData/BufferDir/ForwardingBufferDir/ | wc -l) + if pgrep -x BESRelay > /dev/null 2>&1; then + RELAYSTAT="Running" + else + RELAYSTAT="Not Running" + fi + if pgrep -x BESClient > /dev/null 2>&1; then + CLIENTSTAT="Running" + else + CLIENTSTAT="Not Running" + fi + if [ $SIZE -ge 7 ] || [ $COUNT -ge 7000 ]; then + touch $LOGFILE + echo "$(date) - FillDB Alerting Now - Starting Notification Process..." >> $LOGFILE + touch $ALERTFILE + printf "***FillDB is Alerting*** + +Hostname: $HOSTNAME +FillDB Folder Size: $SIZE MB +FillDB File Count: $COUNT +BESRelay Status: $RELAYSTAT +BESClient Status: $CLIENTSTAT + +Relay Settings: + +PostResults_ParentRelay: $POSTRELAYURL +BufferDirectoryMaxSize: $BUFFERDIRECTORYMAXSIZE + +NOTE: Review "${{LOGFILE}" for additional details. + +Alerts are generated when the FillDB folder size or file count exceed 70 percent of their maximum value. +An all clear notification will be sent once values drop below the threshold. FillDB is audited every 30 minutes. +" > $EMAILFILE + if [ $? -eq 0 ]; then + sendEmail -f $HOSTNAME@BigFixAlerts.INSERTDOMAIN -t {(parameter "EmailAddresses" of action as string as lowercase)} -u "FillDB Alert: $HOSTNAME" -o message-file=$EMAILFILE -s smtp.INSERTDOMAIN:25 >> $LOGFILE 2>&1 + echo "$(date) - FillDB Alerting Now - Notification Process Complete!" >> $LOGFILE + else + echo "$(date) - ERROR - Notification Process. Failed to create $EMAILFILE" >> $LOGFILE + fi + fi + fi +fi +endofscript1 + +delete /home/tc/scripts/filldb_mon.sh +move __createfile /home/tc/scripts/filldb_mon.sh +wait chmod 750 /home/tc/scripts/filldb_mon.sh + +//Create All Clear Email Message File + +delete __createfile +createfile until endofscript2 +***FillDB Alert Has Cleared*** + +Hostname: {computer name} + +The FillDB folder and file size have dropped below the threshold. + +NOTE: Review "/var/log/filldb_alerts.log" for additional details. +endofscript2 + +delete /home/tc/scripts/filldb_all_clear_message +move __createfile /home/tc/scripts/filldb_all_clear_message +wait chmod 640 /home/tc/scripts/filldb_all_clear_message + +//create file to use for crontab + +if {not exists file "/var/spool/cron/crontabs/root"} + +delete __appendfile +appendfile */30 * * * * /bin/sh /home/tc/scripts/filldb_mon.sh + +if {exists file "/home/tc/newcrontab"} +delete "/home/tc/newcrontab" +endif + +continue if {not exists file "/home/tc/newcrontab"} + +move __appendfile /home/tc/newcrontab + +continue if {exists file "/home/tc/newcrontab"} + +endif + +//create script to add cronjob to crontab, add /var/spool/cron/crontabs directory to filetool.lst, add starting the cron service to bootlocal, and backup + +delete __appendfile +appendfile #!/bin/sh + +if {exists file "/var/spool/cron/crontabs/root"} +appendfile echo "*/30 * * * * /bin/sh /home/tc/scripts/filldb_mon.sh" >> "/var/spool/cron/crontabs/root" +else +appendfile sudo crontab /home/tc/newcrontab +endif + +if {not exists lines whose (it contains "var/spool/cron/crontabs/") of file "/opt/.filetool.lst"} +appendfile echo "var/spool/cron/crontabs/" >> /opt/.filetool.lst +endif + +if {not exists lines whose (it contains "/sbin/syslogd") of file "/opt/bootlocal.sh"} +appendfile echo "/sbin/syslogd" >> /opt/bootlocal.sh +endif + +if {not exists lines whose (it contains "/etc/init.d/services/crond start") of file "/opt/bootlocal.sh"} +appendfile echo "/etc/init.d/services/crond start" >> /opt/bootlocal.sh +endif + +if {not exists file "/mnt/sda1/tce/optional/sendEmail.tcz"} +appendfile mv -f {(concatenations ("\ ") of substrings separated by " " of it) of (pathname of folder "__Download" of client folder of current site & "/sendEmail.tcz*")} /mnt/sda1/tce/optional/ +appendfile mv -f {(concatenations ("\ ") of substrings separated by " " of it) of (pathname of folder "__Download" of client folder of current site & "/perl5.tcz*")} /mnt/sda1/tce/optional/ +appendfile echo "ln -s /usr/local/bin/perl /usr/bin" >> /opt/bootlocal.sh +appendfile echo "sendEmail.tcz" >> /mnt/sda1/tce/onboot.lst +endif + +appendfile sudo filetool.sh -b +appendfile sudo reboot + +delete /var/opt/BESClient/filldbmonconfig.sh +move __appendfile /var/opt/BESClient/filldbmonconfig.sh +wait chmod 555 /var/opt/BESClient/filldbmonconfig.sh +run /bin/sh /var/opt/BESClient/filldbmonconfig.sh +]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Modify Cron Logging (26985).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Modify Cron Logging (26985).bes new file mode 100644 index 000000000..bf82f8416 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Modify Cron Logging (26985).bes @@ -0,0 +1,93 @@ + + + + + Tiny Core Relay - Modify Cron Logging + On VRAs where frequent cronjobs are run, the sys log will fill up with cron entries making the sys log more difficult to parse. 

By default Cron logs all messages to /var/log/messages. This fixlet will change the cron message location to a separate file.

Implementation:

- This is only relevant on VRAs that already have crond set to start on boot.
- Creates a new file: /var/log/cron.log
- Edits the crond init script to set the new log location
- Adds the crond init script to the filetool
- Runs a filetool backup

]]>
+ (exists relay service) + ((if exists property "in proxy agent context" then ( not in proxy agent context ) else true )) + name of operating system contains "Linux TinyCore" + exists lines whose (it contains "/etc/init.d/services/crond") of file "/opt/bootlocal.sh" + not exists lines whose (it contains "crond -L /var/log/cron.log") of file "/etc/init.d/services/crond" + Internal + 2022-12-06 + + x-fixlet-modification-time + Thu, 17 Sep 2026 21:06:02 +0000 + + BESC + + + Click + here + to deploy this action. + + /dev/null 2>&1 +} + +#Create Log File + +touch $LOGFILE + +#Edit Crond Init Script - Add options to crond start command + +quiet sed -i 's/^\s*crond/\t\tcrond -L \/var\/log\/cron.log/' /etc/init.d/services/crond + +#Add Crond Init Script to Filetool.lst + +echo "etc/init.d/services/crond" >> /opt/.filetool.lst + +#Run Filetool backup + +quiet sudo filetool.sh -b + +#Restart crond + +if [ -n "$CRONDSTAT" ]; then + quiet /etc/init.d/services/crond stop + quiet /etc/init.d/services/crond start +else + quiet /etc/init.d/services/crond start +fi +endofscript1 + +delete /var/opt/BESClient/cronlogconfig.sh +move __createfile /var/opt/BESClient/cronlogconfig.sh +wait chmod 550 /var/opt/BESClient/cronlogconfig.sh +wait /bin/sh /var/opt/BESClient/cronlogconfig.sh +]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Upload Manager Cleanup Script Deployment (26990).bes b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Upload Manager Cleanup Script Deployment (26990).bes new file mode 100644 index 000000000..1d3e7a5c5 --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/Tiny Core Relay - Upload Manager Cleanup Script Deployment (26990).bes @@ -0,0 +1,257 @@ + + + + + Tiny Core Relay - Upload Manager Cleanup Script Deployment + This deploys a script on TinyCore relays that will run every hour and do the following:

Removes all files older than 72 hours in "var/opt/BESRelay/UploadManagerData/BufferDir/Temp".

Removes all files older than 72 hours in "/var/opt/BESRelay/UploadManagerData/BufferDir/sha1/" and restarts the relay service if files are present.

 

]]>
+ exists relay service + name of operating system contains "Linux TinyCore" + not exists file "/home/tc/scripts/upload_manager_cleanup.sh" + Internal + 2022-10-24 + + x-fixlet-modification-time + Thu, 17 Sep 2026 21:06:02 +0000 + + BESC + + + Click + here + to deploy this action. + + > $LOGFILE + echo "$(date) - $HOSTNAME - Files with a modification time greater than 72 hours have been found in ${{TMPDIR}. Starting Temp folder cleanup process..." >> $LOGFILE + +#Loop through all 72 hour+ files and remove from the sha1 folder + COUNTERTMP=0 + for T in $EXPIREDTMP + do + rm -f $T + if [ $? -eq 0 ]; then + COUNTERTMP=$((COUNTERTMP + 1)) + else + echo "$(date) - ERROR - $T failed to delete!" >> $LOGFILE + fi + done + + if [ $COUNTERTMP -eq 1 ]; then + echo "$(date) - 1 file has been deleted from ${{TMPDIR}." >> $LOGFILE + elif [ $COUNTERTMP -ge 2 ]; then + echo "$(date) - $COUNTERTMP files have been deleted from ${{TMPDIR}." >> $LOGFILE + fi + + echo "$(date) - $HOSTNAME - Upload Manager Temp Folder Cleanup process complete!" >> $LOGFILE + + fi + +#Check the sha1 folder for any file that is 72 hours old or greater + + EXPIREDSHA1=$(find ${{SHA1DIR} -type f -mmin +4320) + if [ "$EXPIREDSHA1" ]; then + echo "$(date) - $HOSTNAME - ##################################################################" >> $LOGFILE + echo "$(date) - $HOSTNAME - Files with a modification time greater than 72 hours have been found in ${{SHA1DIR}. Starting SHA1 folder cleanup process..." >> $LOGFILE + +#Loop through all 72 hour+ files and remove from the sha1 folder + COUNTER=0 + for F in $EXPIREDSHA1 + do + rm -f $F + if [ $? -eq 0 ]; then + COUNTER=$((COUNTER + 1)) + else + echo "$(date) - ERROR - $F failed to delete!" >> $LOGFILE + fi + done + + if [ $COUNTER -eq 1 ]; then + echo "$(date) - 1 file has been deleted from ${{SHA1DIR}." >> $LOGFILE + elif [ $COUNTER -ge 2 ]; then + echo "$(date) - $COUNTER files have been deleted from ${{SHA1DIR}." >> $LOGFILE + fi + + +#Restart the BESRelay process + + /etc/init.d/besrelay restart + pid=`pidof $prog` + if [ ! -z "$pid" ]; then + echo "$(date) - $HOSTNAME - BESRelay process restarted successfully." >> $LOGFILE + else + echo "$(date) - $HOSTNAME - BESRelay process FAILED to restart!" >> $LOGFILE + fi + + echo "$(date) - $HOSTNAME - Upload Manager SHA1 Folder Cleanup process complete!" >> $LOGFILE + + fi + +fi +endofscript1 + +delete /home/tc/scripts/upload_manager_cleanup.sh +move __createfile /home/tc/scripts/upload_manager_cleanup.sh +wait chmod 750 /home/tc/scripts/upload_manager_cleanup.sh + +//Create Email Notification Script + +delete __createfile +createfile until endofscript2 +#!/bin/sh + +# Email Notification Script +# Run as a cronjob once per day +#jules.miller@va.gov + +LOGFILE=/var/log/upload_manager_cleanup.log +UPLOADEMAIL=/home/tc/scripts/email_message_upload.txt + +#Upload Manager Cleanup Email Notification + +CURRENTDATE=$(date | awk '{{print $1 $2 $3 $6}') +LOGDATE=$(tail -n 5 $LOGFILE | awk '{{print $1 $2 $3 $6}' | uniq) + +if [[ "$LOGDATE" == *$CURRENTDATE* ]]; then + + sendEmail -f $HOSTNAME@BigFixAlerts.INSERTDOMAIN -t {(parameter "EmailAddresses" of action as string as lowercase)} -u "Alert: Upload Manager File Age Threshold Reached - $HOSTNAME" -o message-file=$UPLOADEMAIL -a $LOGFILE -s smtp.INSERTDOMAIN:25 + +fi +endofscript2 + +delete /home/tc/scripts/email_notify.sh +move __createfile /home/tc/scripts/email_notify.sh +wait chmod 750 /home/tc/scripts/email_notify.sh + +//create the email message file +delete __createfile +createfile until endofscript3 +**THIS IS AN INFORMATIONAL MESSAGE ONLY** + +Uploads in the SHA1 or Temp folder have reached the 72 hour age limit on {computer name}. The offending files have been removed. See the attached log for details. + +NOTE: The BESRelay process will have been restarted if relevant uploads were found in the SHA1 folder. This will be reflected in the log. +endofscript3 + +delete /home/tc/scripts/email_message_upload.txt +move __createfile /home/tc/scripts/email_message_upload.txt +wait chmod 640 /home/tc/scripts/email_message_upload.txt + +//create file to use for crontab + +if {not exists file "/var/spool/cron/crontabs/root"} + +delete __appendfile +appendfile 0 * * * * /bin/sh /home/tc/scripts/upload_manager_cleanup.sh +appendfile 30 23 * * * /bin/sh /home/tc/scripts/email_notify.sh + +if {exists file "/home/tc/newcrontab"} +delete "/home/tc/newcrontab" +endif + +continue if {not exists file "/home/tc/newcrontab"} + +move __appendfile /home/tc/newcrontab + +continue if {exists file "/home/tc/newcrontab"} + +endif + +//create script to add cronjob to crontab, add /var/spool/cron/crontabs directory to filetool.lst, add starting the cron service to bootlocal, and backup + +delete __appendfile +appendfile #!/bin/sh + +if {exists file "/var/spool/cron/crontabs/root"} +appendfile echo "0 * * * * /bin/sh /home/tc/scripts/upload_manager_cleanup.sh" >> "/var/spool/cron/crontabs/root" +appendfile echo "30 23 * * * /bin/sh /home/tc/scripts/email_notify.sh" >> "/var/spool/cron/crontabs/root" +else +appendfile sudo crontab /home/tc/newcrontab +endif + +if {not exists lines whose (it contains "var/spool/cron/crontabs/") of file "/opt/.filetool.lst"} +appendfile echo "var/spool/cron/crontabs/" >> /opt/.filetool.lst +endif + +if {not exists lines whose (it contains "/sbin/syslogd") of file "/opt/bootlocal.sh"} +appendfile echo "/sbin/syslogd" >> /opt/bootlocal.sh +endif + +if {not exists lines whose (it contains "/etc/init.d/services/crond start") of file "/opt/bootlocal.sh"} +appendfile echo "/etc/init.d/services/crond start" >> /opt/bootlocal.sh +endif + +if {not exists file "/mnt/sda1/tce/optional/sendEmail.tcz"} +appendfile mv -f {(concatenations ("\ ") of substrings separated by " " of it) of (pathname of folder "__Download" of client folder of current site & "/sendEmail.tcz*")} /mnt/sda1/tce/optional/ +appendfile mv -f {(concatenations ("\ ") of substrings separated by " " of it) of (pathname of folder "__Download" of client folder of current site & "/perl5.tcz*")} /mnt/sda1/tce/optional/ +appendfile echo "ln -s /usr/local/bin/perl /usr/bin" >> /opt/bootlocal.sh +appendfile echo "sendEmail.tcz" >> /mnt/sda1/tce/onboot.lst +endif + +appendfile sudo filetool.sh -b +appendfile sudo reboot + +delete /var/opt/BESClient/uploadcleanconfig.sh +move __appendfile /var/opt/BESClient/uploadcleanconfig.sh +wait chmod 555 /var/opt/BESClient/uploadcleanconfig.sh +run /bin/sh /var/opt/BESClient/uploadcleanconfig.sh +]]> + +
+
diff --git a/Sites/Linux Management/Fixlets/Fixlets/reboot if needed - Ubuntu (20640).bes b/Sites/Linux Management/Fixlets/Fixlets/reboot if needed - Ubuntu (20640).bes new file mode 100644 index 000000000..2a54d062d --- /dev/null +++ b/Sites/Linux Management/Fixlets/Fixlets/reboot if needed - Ubuntu (20640).bes @@ -0,0 +1,40 @@ + + + + + reboot if needed - Ubuntu + + exists files "/var/run/reboot-required" + 3*day) of operating systems]]> + Internal + 2016-05-16 + + x-fixlet-modification-time + Tue, 17 May 2016 01:21:27 +0000 + + BESC + + + Click + here + to deploy this action. + + +restart 60 + +// http://askubuntu.com/questions/164/how-can-i-tell-from-the-command-line-whether-the-machine-requires-a-reboot +// http://askubuntu.com/questions/50815/see-computers-uptime-and-history + + + + + diff --git a/Sites/Linux Management/Fixlets/digest.xml b/Sites/Linux Management/Fixlets/digest.xml index b5146008a..1a853e348 100644 --- a/Sites/Linux Management/Fixlets/digest.xml +++ b/Sites/Linux Management/Fixlets/digest.xml @@ -1,7 +1,7 @@ - = "7.2"]]> + = "7.2" and name of operating system as lowercase starts with "linux"]]> PT5M PT5M