diff --git a/.github/workflows/linutil.yml b/.github/workflows/linutil.yml index 30f7f8ad..e801737b 100644 --- a/.github/workflows/linutil.yml +++ b/.github/workflows/linutil.yml @@ -1,40 +1,42 @@ -name: LinUtil Release - -on: - push: - branches: [ "main" ] - -permissions: - contents: write - packages: write - -env: - CARGO_TERM_COLOR: always - -jobs: - linutil_build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Cache Cargo registry - uses: actions/cache@v4 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-registry- - - name: Cache Cargo index - uses: actions/cache@v4 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-index- - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - - name: Build - run: cargo build --target-dir=build --release --verbose - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Commit Linutil - file_pattern: 'build/release/linutil' - if: success() +name: LinUtil Release + +on: + push: + branches: ["main"] + +permissions: + contents: write + packages: write + +env: + CARGO_TERM_COLOR: always + +jobs: + linutil_build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Cache Cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-registry- + - name: Cache Cargo index + uses: actions/cache@v4 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-index- + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-musl + - name: Build + run: cargo build --target-dir=build --release --verbose --target=x86_64-unknown-linux-musl + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Commit Linutil + file_pattern: "build/x86_64-unknown-linux-musl/release/linutil" + if: success() diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index f8e816c2..5a64da69 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -1,8 +1,8 @@ name: Pre-Release LinUtil permissions: - contents: write # Grant write permissions to contents - packages: write # Grant write permissions to packages + contents: write # Grant write permissions to contents + packages: write # Grant write permissions to packages on: workflow_dispatch: # Manual trigger added @@ -30,9 +30,9 @@ jobs: body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/${{ env.version }}/linutil)" append_body: false files: | - ./build/release/linutil + ./build/x86_64-unknown-linux-musl/release/linutil prerelease: true generate_release_notes: true env: version: ${{ env.version }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 02e81e5d..da9841f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.9" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" dependencies = [ "clap_builder", "clap_derive", @@ -173,9 +173,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" dependencies = [ "anstream", "anstyle", @@ -185,9 +185,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" dependencies = [ "heck", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index fa2dffae..cd718aa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] chrono = "0.4.33" -clap = { version = "4.5.9", features = ["derive"] } +clap = { version = "4.5.11", features = ["derive"] } crossterm = "0.27.0" ego-tree = "0.6.2" oneshot = "0.1.8" diff --git a/README.md b/README.md index 9fb867fb..1a9295b5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A distro-agnostic* toolbox which helps with everyday Linux tasks. It can help yo ## 💡 Usage -Open your terminal and paste this command +Open your terminal and paste this command: ```bash curl -fsSL https://christitus.com/linux | sh ``` diff --git a/build/release/linutil b/build/release/linutil index 93077bb0..4bc049fb 100755 Binary files a/build/release/linutil and b/build/release/linutil differ diff --git a/build/x86_64-unknown-linux-musl/release/linutil b/build/x86_64-unknown-linux-musl/release/linutil new file mode 100755 index 00000000..1bb72e99 Binary files /dev/null and b/build/x86_64-unknown-linux-musl/release/linutil differ diff --git a/src/commands/security/firewall-baselines.sh b/src/commands/security/firewall-baselines.sh new file mode 100644 index 00000000..b6153065 --- /dev/null +++ b/src/commands/security/firewall-baselines.sh @@ -0,0 +1,39 @@ +#!/bin/sh -e + +installPkg() { + echo "Install UFW if not already installed..." + if ! command_exists ufw; then + case ${PACKAGER} in + pacman) + sudo "${PACKAGER}" -S --noconfirm ufw + ;; + *) + sudo "${PACKAGER}" install -y ufw + ;; + esac + else + echo "UFW is already installed." + fi + echo -e "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}" + sudo ufw limit 22/tcp + echo "Limiting port 22/tcp (UFW)" + + sudo ufw allow 80/tcp + echo "Allowing port 80/tcp (UFW)" + + sudo ufw allow 443/tcp + echo "Allowing port 443/tcp (UFW)" + + sudo ufw default deny incoming + echo "Denying Incoming Packets by Default(UFW)" + + sudo ufw default allow outgoing + echo "Allowing Outcoming Packets by Default(UFW)" + + sudo ufw enable + echo -e "${GREEN}Enabled Firewall with Baselines!${RC}" + +} + +checkEnv +installPkg diff --git a/src/commands/system-setup/1-compile-setup.sh b/src/commands/system-setup/1-compile-setup.sh index 8f96aa8f..e2243d94 100755 --- a/src/commands/system-setup/1-compile-setup.sh +++ b/src/commands/system-setup/1-compile-setup.sh @@ -55,12 +55,12 @@ installDepend() { fi "$AUR_HELPER" --noconfirm -S "$DEPENDENCIES" ;; - apt) + apt-get|nala) COMPILEDEPS='build-essential' sudo "$PACKAGER" update sudo dpkg --add-architecture i386 sudo "$PACKAGER" update - sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS + sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS ;; dnf) COMPILEDEPS='@development-tools' @@ -76,7 +76,7 @@ installDepend() { sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit ;; *) - sudo "$PACKAGER" install -y "$DEPENDENCIES" + sudo "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based ;; esac } diff --git a/src/commands/system-update.sh b/src/commands/system-update.sh index 78393f70..05fc2396 100755 --- a/src/commands/system-update.sh +++ b/src/commands/system-update.sh @@ -78,7 +78,8 @@ updateSystem() { sudo "${PACKAGER}" upgrade -y ;; pacman) - sudo "${PACKAGER}" -Syu --noconfirm + sudo "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring + sudo "${PACKAGER}" -Su --noconfirm ;; zypper) sudo ${PACKAGER} ref diff --git a/src/list.rs b/src/list.rs index 3d7453d2..73ca21a1 100644 --- a/src/list.rs +++ b/src/list.rs @@ -76,7 +76,16 @@ impl CustomList { }, }, ListNode { - name: "Applications Setup", + name: "Security", + command: "" + } => { + ListNode { + name: "Firewall Baselines (CTT)", + command: with_common_script!("commands/security/firewall-baselines.sh"), + } + }, + ListNode { + name: "Titus Dotfiles", command: Command::None } => { ListNode {