Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#include <settings/ssh/ssh.hpp>
|
|
#include <syslog.h>
|
|
|
|
#define SSH_REQUIRED_STRING R"({"required":"[token,status]"})"
|
|
|
|
namespace api
|
|
{
|
|
namespace settings
|
|
{
|
|
namespace ssh
|
|
{
|
|
void set_ssh_status(bool new_ssh_status)
|
|
{
|
|
if (!new_ssh_status)
|
|
{
|
|
if (get_ssh_server() == DROPBEAR_SSH)
|
|
{
|
|
system("rc stop dropbear");
|
|
system("rc del dropbear");
|
|
}
|
|
else if (get_ssh_server() == OPENSSH_SSH) {
|
|
system("rc stop ssh");
|
|
system("rc del ssh");
|
|
}
|
|
syslog(LOG_INFO, "%s", "SSH is disabled");
|
|
}
|
|
else
|
|
{
|
|
if (get_ssh_server() == DROPBEAR_SSH)
|
|
{
|
|
system("rc start dropbear");
|
|
system("rc add dropbear");
|
|
}
|
|
else if (get_ssh_server() == OPENSSH_SSH) {
|
|
system("rc start ssh");
|
|
system("rc add ssh");
|
|
}
|
|
syslog(LOG_INFO, "%s", "SSH is enabled");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|