Skip to content

Commit

Permalink
Use cloyster::addStringToFile
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Gracioso <[email protected]>
  • Loading branch information
lbgracioso committed Jul 4, 2024
1 parent 18c9405 commit a981593
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/services/fail2ban.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ void fail2ban::install()
void fail2ban::configure()
{
// Create the local configuration file for fail2ban
cloyster::runCommand(
"cat > /etc/fail2ban/jail.local << EOF\n"
cloyster::addStringToFile("/etc/fail2ban/jail.local",
"[DEFAULT]\n"
"# Ban IP/hosts for 24 hour ( 24h*3600s = 86400s):\n"
"bantime = 86400\n"
Expand All @@ -37,8 +36,7 @@ void fail2ban::configure()
" \n"
"# Enable sshd protection\n"
"[sshd]\n"
"enabled = true\n"
"EOF");
"enabled = true\n");
}

void fail2ban::enable() { cloyster::runCommand("systemctl enable fail2ban"); }
Expand Down

0 comments on commit a981593

Please sign in to comment.