mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-22 05:51:44 +03:00
feat(new tool): Firewalld Generator
This commit is contained in:
1 parent
368d088c7e
commit
eaa8b5b672
2 files changed
+71
No files matched your search
@@ -0,0 +1,58 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const zone = ref<string>('public');
|
||||||
|
const action = ref<string>('add');
|
||||||
|
const ruleType = ref<string>('service');
|
||||||
|
const value = ref<string>('http');
|
||||||
|
const permanent = ref<boolean>(true);
|
||||||
|
|
||||||
|
const ruleTypes = [
|
||||||
|
{ label: 'Service', value: 'service' },
|
||||||
|
{ label: 'Port', value: 'port' },
|
||||||
|
{ label: 'Protocol', value: 'protocol' },
|
||||||
|
{ label: 'Rich Rule', value: 'rich-rule' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const actions = [
|
||||||
|
{ label: 'Add', value: 'add' },
|
||||||
|
{ label: 'Remove', value: 'remove' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const command = computed(() => {
|
||||||
|
let result = `firewall-cmd --zone=${zone.value} --${action.value}-${ruleType.value}=${value.value}`;
|
||||||
|
if (permanent.value) {
|
||||||
|
result += ' --permanent';
|
||||||
|
}
|
||||||
|
result += ' && firewall-cmd --reload';
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<NForm label-width="120px" label-placement="left">
|
||||||
|
<NFormItem label="Zone:">
|
||||||
|
<NSelect v-model:value="zone" :options="[{ label: 'Public', value: 'public' }, { label: 'Home', value: 'home' }, { label: 'Work', value: 'work' }]" />
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem label="Action:">
|
||||||
|
<NSelect v-model:value="action" :options="actions" />
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem label="Rule Type:">
|
||||||
|
<NSelect v-model:value="ruleType" :options="ruleTypes" />
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem label="Value:">
|
||||||
|
<NInput v-model:value="value" placeholder="Enter the service/port/protocol" />
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem label="Permanent">
|
||||||
|
<NSelect v-model:value="permanent" :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }]" />
|
||||||
|
</NFormItem>
|
||||||
|
</NForm>
|
||||||
|
|
||||||
|
<c-card title="Generated fw command:" mt-2>
|
||||||
|
<textarea-copyable :value="command" />
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Firetruck } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'FW command line generator',
|
||||||
|
path: '/firewalld-generator',
|
||||||
|
description: 'Generate fw command lines',
|
||||||
|
keywords: ['firewalld', 'fw'],
|
||||||
|
component: () => import('./firewalld-generator.vue'),
|
||||||
|
icon: Firetruck,
|
||||||
|
createdAt: new Date('2025-04-21'),
|
||||||
|
category: 'Network',
|
||||||
|
});
|
||||||
Reference in new issue
Block a user