Skip to content

A Graphic User Interface for Linux's Iptables Firewall. Made with Cockpit for CentOS

License

Notifications You must be signed in to change notification settings

CrazyKidJack/guiptables

 
 

Repository files navigation

guiptables

🇧🇷 Manual em Português 🔗

Uma interface gráfica para o Firewall do Linux, Iptables. Feito usando Cockpit para CentOS.

🇺🇸 English Manual 🔗

A Graphic User Interface for Linux's Iptables Firewall. Made with Cockpit for CentOS.

Instruções

1. Instalando o guiptables

O guiptables pode ser instalado usando o pacote RPM disponível na seção Releases.

Depois de baixado o pacote, basta executar:

rpm -i guiptables<versao>.rpm

Você também pode optar por baixar o código fonte diretamente. Nesse caso é preciso armazená-lo no diretório de aplicativos do Cockpit em sua máquina.

Nota: O diretório de aplicativos desenvolvidos para Cockpit geralmente corresponde à /usr/share/cockpit/ em sistemas RHEL-like. Os pacotes RPM disponíveis assumem que este seja o diretório existente. Em caso de problemas para instalar, a segunda opção supracitada deverá funcionar.

Dependências necessárias:

  • Cockpit >= 224.2
  • bash
  • yum (usado para instalar o Iptables no caso de não estar)

2. Instalando o Iptables via Cockpit

Soaria incomum, mas caso o Iptables não esteja instalado, você poderia fazê-lo via Cockpit ao executar o guiptables pela primeira vez:

image

Após a instalação você será solicitado para recarregar a página.

3. Listando as regras

A interface básica do guiptables é mostrar as regras aplicadas nas tabelas do firewall.

image

Cada regra aplicada aparecerá em sua respectiva tabela, numa linha com um conjunto de informações:

  • Quantidade de pacotes trafegados
  • Porção de dados trafegados
  • Cadeia em que pertence (chain)
  • Ação que desempenha (job/action/target)
  • Os protocolos que se aplicam
  • Opções avançadas
  • Interface de entrada
  • Interface de saída
  • Endereço de entrada
  • Endereço de saída

Todas as regras mostradas são recuperadas da memória do sistema. Isso significa que regras aplicadas fora do guiptables também serão exibidas.

Por padrão, são exibidas todas as regras de uma tabela (Show all), mas é possível filtrar pela cadeia (chain), usando o dropdown no topo da tabela de maneira que mostre como o Iptables exibiria em linha de comando.

4. Adicionando uma regra

Nova regra

Para criar uma nova regra, primeiro é preciso escolher uma das cadeias disponíveis para a tabela no dropdown. Em seguida, clicar no botão azul ➕ Add rule. Uma janela será aberta com as opções disponíveis para que sua regra seja criada:

image

Ao clicar em aplicar, uma nova regra será adicionada no fim da tabela. Uma mensagem de erro será disparada, caso sejam aplicadas opções inválidas para a regra.

Inserir nova regra em uma posição

Como a ordem das regras é importante, você pode aplicar uma regra em uma ordem especifica. Para isso, escolha uma cadeia no dropdown, em seguida, clique no botão menor ➕ Add rule à esquerda de uma das regras da lista.

Dessa forma você aplicaria uma nova regra sobre a regra escolhida.

Ou seja, a nova regra ocupará a posição da regra escolhida.

A regra escolhida ficará um posição adiante, abaixo da nova regra.

5. Excluindo regras

Para excluir uma regra, basta clicar no botão de lixeira 🗑️ em vermelho na lista de regras, à direita.

Você pode optar também por excluir TODAS as regras de TODAS as cadeias de uma tabela de uma vez. Basta clicar no botão Flush Table 🗑️ acima da tabela desejada.

6. Salvando e carregando o estado das tabelas

Criando um backup

Você pode salvar o estado das tabelas em um arquivo de backup.

Essa opção usa internamente o comando iptables-save.

Para manualmente gravar o conteúdo atual das tabelas do serviço Iptables, basta ir nas configurações clicando no botão de engrenagem ⚙️ azul, no topo da página.

Você pode especificar um caminho para salvar ou deixar o padrão. Em seguida, clique em Save current state.

image

Não confundir com o botão Save no canto inferior.

O botão Save guardará as alterações feitas nessa tela de configuração, como o caminho de logs e a opção de auto-salvar.

A função auto-salvar

Você pode optar por auto-salvar o estado das tabelas no arquivo especificado, toda vez que uma regra for inserida. Lembre-se que o arquivo não guardará histórico, será sempre sobrescrito.

Restaurando um backup

Para restaurar um arquivo de backup, basta especifica-lo no mesmo campo e clicar no botão Restore from this. Após isso será solicitado que a página seja recarregada.

7. Consultando logs

Você pode checar as últimas operações realizadas dentro do guiptables clicando no botão com ícone de jornal 📰.

O que é salvo?

Registra-se log, toda vez que:

  • uma regra for inserida ou deletada
  • um erro ocorreu tentando inserir ou deletar uma regra
  • uma tabela foi limpa (Flush table)
  • ocorreu um erro ao limpar uma tabela
  • o Iptables foi instalado via Cockpit
  • ocorreu um erro ao instalar o Iptables
  • alterou-se o arquivo de configuração
  • ocorreu um erro ao alterar o arquivo de configuração

Você pode alterar o caminho em que o arquivo texto dos logs é salvo, nas configurações ⚙️.

Nota easteregg: guiptables não é o trabalho do Gui.


Instructions

1. Installing guiptables

guiptables may be installed using one of the RPM packages available on the Releases section.

After downloading the package, simply run:

rpm -i guiptables<version>.rpm

You may also choose to download the source code directly. In this case you must store it in the Cockpit's applications directory on your server.

Note: The directory intented for applications developed for Cockpit, usually is /usr/share/cockpit/ on RHEL-like systems. The available RPM packages assume that this is the existing directory. In case of installation problems, the above second option should work.

Required dependencies:

  • Cockpit >= 224.2
  • bash
  • yum (used to install Iptables in case it is not)

2. Installing Iptables via Cockpit

It would sound unusual, but if Iptables is not installed, you could do it via Cockpit when running guiptables for the first time:

image

After installation you will be asked to reload the page.

3. Rules list

The basic interface of guiptables shows the rules applied in the firewall tables.

image

Each applied rule will appear in its respective table, in a line with a set of information:

  • Number of packets trafficked
  • Portion of data trafficked
  • Chain which it belongs
  • Action it performs (job / action / target)
  • The protocols that apply
  • Advanced options
  • Input interface
  • Output interface
  • Origin address
  • Destination address

All rules shown are retrieved from system memory. This means that any rule applied outside guiptables will also be exhibited.

By default, all the rules for a table are displayed, but it is possible to filter by chain, using the dropdown at the top of the table so that it shows how Iptables would display on the command line.

4. Adding a rule

New rule at the end

To create a new rule, you must first choose one of the available chains for the table at the dropdown. Then click on the blue ➕ Add rule button. A window will open with the options available for your rule to be created:

image

Insert new rule at position

Since the order of the rules is important, you can apply a rule in a specific order. To do this, choose a chain from the dropdown, then click the smaller button ➕ Add rule to the left of one of the rules in the list.

That way you would apply a new rule over the chosen rule.

That is, the new rule will occupy the position of the chosen rule.

The chosen rule will be placed one position below the new rule.

5. Deleting rules

To delete a rule, simply click the red trash can button 🗑️ in the list of rules on the right.

You can also decide to delete ALL rules from ALL chains in a table at once. Just click on the Flush Table 🗑️ button above the desired table.

6. Saving and loading the tables state

Creating a backup

You may save the tables state in a external backup file.

This option uses the iptables-save command internally.

To manually store the current content of the tables, go to the config. screen by clicking on the blue gear ⚙️ button at the top of the page.

You may specify the save path or leave it with the default setting. Then, click on Save current state.

image

Do not confuse with the Save button at the bottom.

The Save button will keep any changes made at this screen, such as log path or auto-save.

Autosave feature

You may choose to autosave the tables state on the specified save file every time a new rule is added. Just remember that the save file will not keep history, will be always overwritten.

Recovering a backup file

In order to restore a save file, just specify it on the same Save path field and then click on Restore from this. After that you will be requested to reload the page.

7. Checking logs

You may check the last operations done inside guiptables by clicking on the journal iconned button 📰.

What is logged?

Log is recorded every time:

  • a rule is inserted or deleted
  • an error occurred while trying to insert or delete a rule
  • a table has been flushed
  • an error occurred while flushing a table
  • Iptables was installed via Cockpit
  • an error occurred while installing Iptables
  • the configuration file has been changed
  • an error occurred while saving chnages on the configuration file

At the settings ⚙️, you may change the path where the log text file is saved.

Easteregg note: guiptables is not Gui's work.

About

A Graphic User Interface for Linux's Iptables Firewall. Made with Cockpit for CentOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • SCSS 38.2%
  • Less 37.8%
  • JavaScript 16.0%
  • HTML 7.1%
  • CSS 0.9%