可以设置是否自动安装nftables

This commit is contained in:
GoEdgeLab
2022-09-17 21:04:45 +08:00
parent 703fb2de90
commit 0531dfeffb
4 changed files with 50 additions and 31 deletions

View File

@@ -80,14 +80,15 @@ func (this *IndexAction) RunGet(params struct {
} }
this.Data["cluster"] = maps.Map{ this.Data["cluster"] = maps.Map{
"id": cluster.Id, "id": cluster.Id,
"name": cluster.Name, "name": cluster.Name,
"installDir": cluster.InstallDir, "installDir": cluster.InstallDir,
"timeZone": cluster.TimeZone, "timeZone": cluster.TimeZone,
"nodeMaxThreads": cluster.NodeMaxThreads, "nodeMaxThreads": cluster.NodeMaxThreads,
"autoOpenPorts": cluster.AutoOpenPorts, "autoOpenPorts": cluster.AutoOpenPorts,
"clock": clockConfig, "clock": clockConfig,
"autoRemoteStart": cluster.AutoRemoteStart, "autoRemoteStart": cluster.AutoRemoteStart,
"autoInstallNftables": cluster.AutoInstallNftables,
} }
// 默认值 // 默认值
@@ -100,16 +101,17 @@ func (this *IndexAction) RunGet(params struct {
// RunPost 保存设置 // RunPost 保存设置
func (this *IndexAction) RunPost(params struct { func (this *IndexAction) RunPost(params struct {
ClusterId int64 ClusterId int64
Name string Name string
GrantId int64 GrantId int64
InstallDir string InstallDir string
TimeZone string TimeZone string
NodeMaxThreads int32 NodeMaxThreads int32
AutoOpenPorts bool AutoOpenPorts bool
ClockAutoSync bool ClockAutoSync bool
ClockServer string ClockServer string
AutoRemoteStart bool AutoRemoteStart bool
AutoInstallNftables bool
Must *actions.Must Must *actions.Must
}) { }) {
@@ -143,15 +145,16 @@ func (this *IndexAction) RunPost(params struct {
} }
_, err = this.RPC().NodeClusterRPC().UpdateNodeCluster(this.AdminContext(), &pb.UpdateNodeClusterRequest{ _, err = this.RPC().NodeClusterRPC().UpdateNodeCluster(this.AdminContext(), &pb.UpdateNodeClusterRequest{
NodeClusterId: params.ClusterId, NodeClusterId: params.ClusterId,
Name: params.Name, Name: params.Name,
NodeGrantId: params.GrantId, NodeGrantId: params.GrantId,
InstallDir: params.InstallDir, InstallDir: params.InstallDir,
TimeZone: params.TimeZone, TimeZone: params.TimeZone,
NodeMaxThreads: params.NodeMaxThreads, NodeMaxThreads: params.NodeMaxThreads,
AutoOpenPorts: params.AutoOpenPorts, AutoOpenPorts: params.AutoOpenPorts,
ClockJSON: clockConfigJSON, ClockJSON: clockConfigJSON,
AutoRemoteStart: params.AutoRemoteStart, AutoRemoteStart: params.AutoRemoteStart,
AutoInstallNftables: params.AutoInstallNftables,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -60,9 +60,10 @@ func (this *CreateAction) RunPost(params struct {
MatchDomainStrictly bool MatchDomainStrictly bool
// SSH相关 // SSH相关
GrantId int64 GrantId int64
InstallDir string InstallDir string
SystemdServiceIsOn bool SystemdServiceIsOn bool
AutoInstallNftables bool
// DNS相关 // DNS相关
DnsDomainId int64 DnsDomainId int64
@@ -130,6 +131,7 @@ func (this *CreateAction) RunPost(params struct {
HttpFirewallPolicyId: params.HttpFirewallPolicyId, HttpFirewallPolicyId: params.HttpFirewallPolicyId,
SystemServicesJSON: systemServicesJSON, SystemServicesJSON: systemServicesJSON,
GlobalServerConfigJSON: globalServerConfigJSON, GlobalServerConfigJSON: globalServerConfigJSON,
AutoInstallNftables: params.AutoInstallNftables,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -85,6 +85,13 @@
<p class="comment">当检测到节点离线时自动尝试远程启动前提是节点已经设置了SSH登录认证</p> <p class="comment">当检测到节点离线时自动尝试远程启动前提是节点已经设置了SSH登录认证</p>
</td> </td>
</tr> </tr>
<tr>
<td>自动安装nftables</td>
<td>
<checkbox name="autoInstallNftables" v-model="cluster.autoInstallNftables"></checkbox>
<p class="comment">在Linux系统中自动尝试安装<code-label>nftables</code-label>用于安全防御此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。</p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<submit-btn></submit-btn> <submit-btn></submit-btn>

View File

@@ -45,7 +45,7 @@
<td>节点安装目录</td> <td>节点安装目录</td>
<td> <td>
<input type="text" name="installDir" maxlength="100"/> <input type="text" name="installDir" maxlength="100"/>
<p class="comment">当节点没有单独设置安装目录时,默认使用此设置。如果集群和节点都没有设置安装目录,则使用<span class="ui label tiny">$登录用户HOME路径/edge-node</span> <p class="comment">当节点没有单独设置安装目录时,默认使用此设置。如果集群和节点都没有设置安装目录,则使用<code-label>$登录用户HOME路径/edge-node</code-label>
目录。</p> 目录。</p>
</td> </td>
</tr> </tr>
@@ -56,6 +56,13 @@
<p class="comment">加入后可以利用systemd对节点进程进行管理并可自动随开机启动。</p> <p class="comment">加入后可以利用systemd对节点进程进行管理并可自动随开机启动。</p>
</td> </td>
</tr> </tr>
<tr>
<td>自动安装nftables</td>
<td>
<checkbox name="autoInstallNftables" value="1"></checkbox>
<p class="comment">在Linux系统中自动尝试安装<code-label>nftables</code-label>用于安全防御此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。</p>
</td>
</tr>
</table> </table>
<h4>DNS设置选项 &nbsp;<span class="grey small">(可选)</span></h4> <h4>DNS设置选项 &nbsp;<span class="grey small">(可选)</span></h4>