https://github.com/ssddontop/rust-ufw-app-profile
UFW app profile dependency for rust.
https://github.com/ssddontop/rust-ufw-app-profile
ufw ufw-app-profile ufw-profile
Last synced: 6 months ago
JSON representation
UFW app profile dependency for rust.
- Host: GitHub
- URL: https://github.com/ssddontop/rust-ufw-app-profile
- Owner: ssddOnTop
- Created: 2023-01-16T04:32:45.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-30T13:44:02.000Z (almost 2 years ago)
- Last Synced: 2025-04-02T19:08:17.645Z (7 months ago)
- Topics: ufw, ufw-app-profile, ufw-profile
- Language: Rust
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README


# About Project
UFW app profile written in pure rust.
## Implementation:
```toml
ufwprofile = "" #check latest version above
```Or
```
cargo add ufwprofile
```# Example
```rust
fn main() -> anyhow::Result<()> {
if ufwprofile::UFWConf::check_write_permission() {
//checks if ufw exists and the path /etc/ufw/applications.d is writable
let conf = ufwprofile::UFWConf::init("AppName", "Title", "Description")?
.append_ports("80", "")?
.append_ports("81:82", "tcp")?
.append_ports("84", "udp")?
.append_ports("83", "")?
.append_ports("8000", "tcp")?;if ufwprofile::UFWConf::is_root() {
// check if the app has root permission.
println!("{}", conf.try_adding_to_ufw(true).unwrap());
} else {
println!("{}", conf.try_write_with_sudo(true).unwrap());
}
} else {
println!("Unable to write");
}
Ok(())
}
```# Drawbacks
### This is hardcoded dependency
1. The config file is hardcoded.
2. The path is assumed to be `/etc/ufw/applications.d`# Changelog
check [CHANGELOG.md](CHANGELOG.md)