lazyufw 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "lazyufw",
3
+ "version": "1.0.0",
4
+ "description": "The lazier way to manage UFW firewall — Lazydocker-style terminal UI with SSH protection and sudoless setup",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "bin": {
8
+ "lazyufw": "dist/index.js"
9
+ },
10
+ "type": "module",
11
+ "files": [
12
+ "dist",
13
+ "scripts",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "author": "ronakmaheshwari",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/ronakmaheshwari/lazyufw.git"
21
+ },
22
+ "license": "MIT",
23
+ "keywords": [
24
+ "ufw",
25
+ "firewall",
26
+ "tui",
27
+ "terminal",
28
+ "lazydocker",
29
+ "cli",
30
+ "linux",
31
+ "security",
32
+ "ssh"
33
+ ],
34
+ "engines": {
35
+ "node": ">=18.0.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsup",
39
+ "prepublishOnly": "npm run build",
40
+ "test": "bun test",
41
+ "start": "node dist/index.js"
42
+ },
43
+ "devDependencies": {
44
+ "@types/blessed": "^0.1.27",
45
+ "@types/bun": "latest",
46
+ "@types/node": "^26.4.1",
47
+ "tsup": "^8.5.1",
48
+ "typescript": "^5.0.0"
49
+ },
50
+ "dependencies": {
51
+ "blessed": "^0.1.81",
52
+ "commander": "^15.0.0",
53
+ "zod": "^3.22.4"
54
+ }
55
+ }
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SUDOERS_FILE="/etc/sudoers.d/lazyufw-nopasswd"
5
+ TARGET_USER="${SUDO_USER:-$USER}"
6
+
7
+ UFW_PATH=""
8
+ for candidate in /usr/sbin/ufw /usr/bin/ufw /sbin/ufw; do
9
+ if [ -x "$candidate" ]; then
10
+ UFW_PATH="$candidate"
11
+ break
12
+ fi
13
+ done
14
+
15
+ if [ -z "$UFW_PATH" ]; then
16
+ echo "ufw not found on this system. Install ufw first." >&2
17
+ exit 1
18
+ fi
19
+
20
+ if [ "$(id -u)" -ne 0 ]; then
21
+ echo "Run this installer with sudo." >&2
22
+ exit 1
23
+ fi
24
+
25
+ echo "$TARGET_USER ALL=(root) NOPASSWD: $UFW_PATH" > "$SUDOERS_FILE"
26
+ chmod 0440 "$SUDOERS_FILE"
27
+
28
+ if ! visudo -c -f "$SUDOERS_FILE" >/dev/null 2>&1; then
29
+ echo "Generated sudoers file failed validation, removing it." >&2
30
+ rm -f "$SUDOERS_FILE"
31
+ exit 1
32
+ fi
33
+
34
+ echo "lazyufw: passwordless sudo enabled for $TARGET_USER on $UFW_PATH"
35
+ echo "lazyufw: set UFW_PATH=$UFW_PATH in your environment if it's not auto-detected"
@@ -0,0 +1,8 @@
1
+ # lazyufw.install
2
+ post_install() {
3
+ bash /usr/share/lazyufw/scripts/install.sh
4
+ }
5
+
6
+ pre_remove() {
7
+ bash /usr/share/lazyufw/scripts/uninstall.sh
8
+ }
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SUDOERS_FILE="/etc/sudoers.d/lazyufw-nopasswd"
5
+
6
+ if [ "$(id -u)" -ne 0 ]; then
7
+ echo "Run this uninstaller with sudo." >&2
8
+ exit 1
9
+ fi
10
+
11
+ if [ -f "$SUDOERS_FILE" ]; then
12
+ rm -f "$SUDOERS_FILE"
13
+ echo "lazyufw: removed $SUDOERS_FILE"
14
+ else
15
+ echo "lazyufw: no sudoers drop-in found, nothing to remove"
16
+ fi