Merge branch 'main' of ssh://github.com/christitustech/linutil into cleanup

This commit is contained in:
afonsofrancof 2024-07-30 21:55:53 +01:00
commit ccf22dec89
No known key found for this signature in database
11 changed files with 108 additions and 57 deletions

View File

@ -1,40 +1,42 @@
name: LinUtil Release name: LinUtil Release
on: on:
push: push:
branches: [ "main" ] branches: ["main"]
permissions: permissions:
contents: write contents: write
packages: write packages: write
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
linutil_build: linutil_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Cache Cargo registry - name: Cache Cargo registry
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry- restore-keys: ${{ runner.os }}-cargo-registry-
- name: Cache Cargo index - name: Cache Cargo index
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-index- restore-keys: ${{ runner.os }}-cargo-index-
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- name: Build with:
run: cargo build --target-dir=build --release --verbose targets: x86_64-unknown-linux-musl
- uses: stefanzweifel/git-auto-commit-action@v5 - name: Build
with: run: cargo build --target-dir=build --release --verbose --target=x86_64-unknown-linux-musl
commit_message: Commit Linutil - uses: stefanzweifel/git-auto-commit-action@v5
file_pattern: 'build/release/linutil' with:
if: success() commit_message: Commit Linutil
file_pattern: "build/x86_64-unknown-linux-musl/release/linutil"
if: success()

View File

@ -1,8 +1,8 @@
name: Pre-Release LinUtil name: Pre-Release LinUtil
permissions: permissions:
contents: write # Grant write permissions to contents contents: write # Grant write permissions to contents
packages: write # Grant write permissions to packages packages: write # Grant write permissions to packages
on: on:
workflow_dispatch: # Manual trigger added 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)" body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/${{ env.version }}/linutil)"
append_body: false append_body: false
files: | files: |
./build/release/linutil ./build/x86_64-unknown-linux-musl/release/linutil
prerelease: true prerelease: true
generate_release_notes: true generate_release_notes: true
env: env:
version: ${{ env.version }} version: ${{ env.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

12
Cargo.lock generated
View File

@ -163,9 +163,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.9" version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -173,9 +173,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.9" version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -185,9 +185,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.8" version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",

View File

@ -5,7 +5,7 @@ edition = "2021"
[dependencies] [dependencies]
chrono = "0.4.33" chrono = "0.4.33"
clap = { version = "4.5.9", features = ["derive"] } clap = { version = "4.5.11", features = ["derive"] }
crossterm = "0.27.0" crossterm = "0.27.0"
ego-tree = "0.6.2" ego-tree = "0.6.2"
oneshot = "0.1.8" oneshot = "0.1.8"

View File

@ -11,7 +11,7 @@ A distro-agnostic* toolbox which helps with everyday Linux tasks. It can help yo
## 💡 Usage ## 💡 Usage
Open your terminal and paste this command Open your terminal and paste this command:
```bash ```bash
curl -fsSL https://christitus.com/linux | sh curl -fsSL https://christitus.com/linux | sh
``` ```

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -55,12 +55,12 @@ installDepend() {
fi fi
"$AUR_HELPER" --noconfirm -S "$DEPENDENCIES" "$AUR_HELPER" --noconfirm -S "$DEPENDENCIES"
;; ;;
apt) apt-get|nala)
COMPILEDEPS='build-essential' COMPILEDEPS='build-essential'
sudo "$PACKAGER" update sudo "$PACKAGER" update
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
sudo "$PACKAGER" update sudo "$PACKAGER" update
sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
;; ;;
dnf) dnf)
COMPILEDEPS='@development-tools' COMPILEDEPS='@development-tools'
@ -76,7 +76,7 @@ installDepend() {
sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit 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 esac
} }

View File

@ -78,7 +78,8 @@ updateSystem() {
sudo "${PACKAGER}" upgrade -y sudo "${PACKAGER}" upgrade -y
;; ;;
pacman) pacman)
sudo "${PACKAGER}" -Syu --noconfirm sudo "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring
sudo "${PACKAGER}" -Su --noconfirm
;; ;;
zypper) zypper)
sudo ${PACKAGER} ref sudo ${PACKAGER} ref

View File

@ -76,7 +76,16 @@ impl CustomList {
}, },
}, },
ListNode { 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 command: Command::None
} => { } => {
ListNode { ListNode {