Port forward translation

This commit is contained in:
Eduardo Silva 2025-04-16 11:31:08 -03:00
parent 3cb10b6ec4
commit 23c3dce14f
7 changed files with 301 additions and 110 deletions

View File

@ -1,6 +1,7 @@
import re
from django import forms
from django.utils.translation import gettext_lazy as _
from firewall.models import FirewallRule, FirewallSettings, RedirectRule
from wgwadmlibrary.tools import list_network_interfaces
@ -36,18 +37,24 @@ class RedirectRuleForm(forms.ModelForm):
wireguard_instance = cleaned_data.get('wireguard_instance')
port_forward = cleaned_data.get('port_forward')
if not port:
raise forms.ValidationError(_("Port is required."))
if port == 8000 and protocol == 'tcp':
raise forms.ValidationError("Port 8000 (tcp) is reserved for wireguard-webadmin.")
raise forms.ValidationError(_("Port 8000 (tcp) is reserved for wireguard-webadmin."))
if protocol == 'udp':
if WireGuardInstance.objects.filter(listen_port=port).exists():
raise forms.ValidationError("Port " + str(port) + " (udp) is already in use by a WireGuard instance.")
raise forms.ValidationError(_("Port %s is already in use by another WireGuard instance.") % port)
if not peer and not ip_address:
raise forms.ValidationError(_("Invalid Destination. Either Peer or IP Address must be informed."))
if peer and ip_address:
raise forms.ValidationError("Peer and IP Address cannot be selected at the same time.")
raise forms.ValidationError(_("Peer and IP Address cannot be selected at the same time."))
if ip_address and not wireguard_instance:
raise forms.ValidationError("IP Address cannot be used without selecting a WireGuard instance.")
raise forms.ValidationError(_("IP Address cannot be used without selecting a WireGuard instance."))
if peer:
cleaned_data['wireguard_instance'] = peer.wireguard_instance

View File

@ -3,6 +3,7 @@ from django.contrib.auth.decorators import login_required
from django.db.models import Max
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import gettext_lazy as _
from firewall.forms import FirewallRuleForm, FirewallSettingsForm, RedirectRuleForm
from firewall.models import FirewallRule, FirewallSettings, RedirectRule
@ -17,7 +18,7 @@ def view_redirect_rule_list(request):
if wireguard_instances.filter(legacy_firewall=True).exists():
return redirect('/firewall/migration_required/')
context = {
'page_title': 'Port Forward List',
'page_title': _('Port Forward List'),
'redirect_rule_list': RedirectRule.objects.all().order_by('port'),
'current_chain': 'portforward',
}
@ -28,7 +29,7 @@ def view_redirect_rule_list(request):
def manage_redirect_rule(request):
if not UserAcl.objects.filter(user=request.user).filter(user_level__gte=40).exists():
return render(request, 'access_denied.html', {'page_title': 'Access Denied'})
context = {'page_title': 'Manage Port Forward'}
context = {'page_title': _('Manage Port Forward')}
instance = None
uuid = request.GET.get('uuid', None)
if uuid:
@ -38,9 +39,9 @@ def manage_redirect_rule(request):
instance.wireguard_instance.pending_changes = True
instance.wireguard_instance.save()
instance.delete()
messages.success(request, 'Port Forward rule deleted successfully')
messages.success(request, _('Port Forward rule deleted successfully'))
else:
messages.warning(request, 'Error deleting Port Forward rule|Confirmation did not match. Port Forward rule was not deleted.')
messages.warning(request, _('Error deleting Port Forward rule|Confirmation did not match. Port Forward rule was not deleted.'))
return redirect('/firewall/port_forward/')
if request.method == 'POST':
@ -50,7 +51,7 @@ def manage_redirect_rule(request):
wireguard_instance.pending_changes = True
wireguard_instance.save()
form.save()
messages.success(request, 'Port Forward rule saved successfully')
messages.success(request, _('Port Forward rule saved successfully'))
return redirect('/firewall/port_forward/')
else:
form = RedirectRuleForm(instance=instance)

Binary file not shown.

View File

@ -6,9 +6,10 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-16 10:17-0300\n"
"POT-Creation-Date: 2025-04-16 11:25-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -67,10 +68,11 @@ msgid "Secondary DNS"
msgstr "DNS Secundário"
#: dns/forms.py:25 dns/forms.py:67 dns/forms.py:109
#: templates/firewall/manage_redirect_rule.html:85
#: templates/wireguard/wireguard_manage_ip.html:42
#: templates/wireguard/wireguard_manage_peer.html:170
#: templates/wireguard/wireguard_peer_list.html:166 user_manager/forms.py:49
#: user_manager/forms.py:180 vpn_invite/forms.py:193 vpn_invite/forms.py:327
#: user_manager/forms.py:180 vpn_invite/forms.py:192 vpn_invite/forms.py:326
msgid "Back"
msgstr "Voltar"
@ -79,11 +81,12 @@ msgid "Resolver Settings"
msgstr "Resolução de DNS"
#: dns/forms.py:37 dns/forms.py:83 dns/forms.py:134
#: templates/firewall/manage_redirect_rule.html:84
#: templates/wireguard/wireguard_manage_ip.html:41
#: templates/wireguard/wireguard_manage_peer.html:168
#: templates/wireguard/wireguard_manage_server.html:130
#: user_manager/forms.py:98 user_manager/forms.py:205 vpn_invite/forms.py:192
#: vpn_invite/forms.py:326
#: user_manager/forms.py:98 user_manager/forms.py:205 vpn_invite/forms.py:191
#: vpn_invite/forms.py:325
msgid "Save"
msgstr "Salvar"
@ -92,11 +95,15 @@ msgid "Hostname"
msgstr "Endereço do Host"
#: dns/forms.py:66 templates/dns/static_host_list.html:18
#: templates/firewall/manage_redirect_rule.html:43
#: templates/firewall/manage_redirect_rule.html:67
#: templates/firewall/manage_redirect_rule.html:68
#: templates/wireguard/wireguard_status.html:45
msgid "IP Address"
msgstr "Endereço IP"
#: dns/forms.py:68 dns/forms.py:110
#: templates/firewall/manage_redirect_rule.html:86
#: templates/wireguard/wireguard_manage_ip.html:43
#: templates/wireguard/wireguard_peer_list.html:185 user_manager/forms.py:48
#: user_manager/forms.py:181
@ -114,6 +121,8 @@ msgid "Name"
msgstr "Nome"
#: dns/forms.py:112 templates/dns/static_host_list.html:69
#: templates/firewall/manage_redirect_rule.html:18
#: templates/firewall/manage_redirect_rule.html:19
msgid "Description"
msgstr "Descrição"
@ -211,6 +220,55 @@ msgstr "Lista de Filtro de DNS não habilitada | Nenhum host válido encontrado"
msgid "DNS Filter List disabled successfully"
msgstr "Lista de Filtro de DNS desabilitada com sucesso"
#: firewall/forms.py:41
msgid "Port is required."
msgstr "Porta é obrigatória."
#: firewall/forms.py:44
msgid "Port 8000 (tcp) is reserved for wireguard-webadmin."
msgstr "Porta 8000 (tcp) é reservada para o wireguard-webadmin."
#: firewall/forms.py:48
#, python-format
msgid "Port %s is already in use by another WireGuard instance."
msgstr "Porta %s já está em uso por uma instância do WireGuard."
#: firewall/forms.py:51
msgid "Invalid Destination. Either Peer or IP Address must be informed."
msgstr "Destino inválido. Ou Peer ou Endereço IP devem ser informados."
#: firewall/forms.py:54
msgid "Peer and IP Address cannot be selected at the same time."
msgstr "Peer e Endereço IP não podem ser selecionados ao mesmo tempo."
#: firewall/forms.py:57
msgid "IP Address cannot be used without selecting a WireGuard instance."
msgstr "Endereço IP não pode ser usado sem selecionar uma instância do WireGuard."
#: firewall/views.py:21
msgid "Port Forward List"
msgstr "Lista de Encaminhamento de Porta"
#: firewall/views.py:32
msgid "Manage Port Forward"
msgstr "Gerenciar Encaminhamento de Porta"
#: firewall/views.py:42
msgid "Port Forward rule deleted successfully"
msgstr "Regra de Encaminhamento de porta excluída com sucesso"
#: firewall/views.py:44
msgid ""
"Error deleting Port Forward rule|Confirmation did not match. Port Forward "
"rule was not deleted."
msgstr ""
"Erro ao excluir a regra de Encaminhamento de porta|Confirmação inválida. A "
"regra de Encaminhamento de porta não foi excluída."
#: firewall/views.py:54
msgid "Port Forward rule saved successfully"
msgstr "Regra de Encaminhamento de porta salva com sucesso"
#: intl_tools/forms.py:11 templates/accounts/login.html:36
msgid "Language"
msgstr "Idioma"
@ -235,13 +293,13 @@ msgstr ""
"que isto é um erro."
#: templates/accounts/login.html:14 templates/user_manager/list.html:8
#: user_manager/forms.py:13 vpn_invite/forms.py:282
#: user_manager/forms.py:13 vpn_invite/forms.py:281
msgid "Username"
msgstr "Usuário"
#: templates/accounts/login.html:23
#: templates/vpn_invite/invite_settings.html:19 user_manager/forms.py:14
#: vpn_invite/forms.py:283
#: vpn_invite/forms.py:282
msgid "Password"
msgstr "Senha"
@ -258,8 +316,8 @@ msgid "Login again"
msgstr "Acessar novamente"
#: templates/base.html:112 templates/dns/static_host_list.html:72
#: vpn_invite/forms.py:79 vpn_invite/forms.py:80 vpn_invite/forms.py:81
#: vpn_invite/forms.py:82 vpn_invite/forms.py:83
#: vpn_invite/forms.py:78 vpn_invite/forms.py:79 vpn_invite/forms.py:80
#: vpn_invite/forms.py:81 vpn_invite/forms.py:82
msgid "Status"
msgstr "Estado"
@ -268,7 +326,7 @@ msgid "User Manager"
msgstr "Configurar Usuários"
#: templates/base.html:176 templates/wireguard/wireguard_peer_list.html:195
#: vpn_invite/views.py:36
#: vpn_invite/views.py:37
msgid "VPN Invite"
msgstr "Convite para VPN"
@ -350,6 +408,142 @@ msgstr "Editar"
msgid "Add Filter List"
msgstr "Adicionar Lista de Filtro"
#: templates/firewall/firewall_nav_tabs.html:11
msgid "Port Forward"
msgstr "Encaminhamento de Porta"
#: templates/firewall/firewall_nav_tabs.html:15
msgid "Default Policy"
msgstr "Política Padrão"
#: templates/firewall/manage_redirect_rule.html:22
#: templates/firewall/redirect_rule_list.html:13
msgid "Protocol"
msgstr "Protocolo"
#: templates/firewall/manage_redirect_rule.html:30
#: templates/firewall/redirect_rule_list.html:14
#: templates/wireguard/wireguard_status.html:47 vpn_invite/forms.py:284
msgid "Port"
msgstr "Porta"
#: templates/firewall/manage_redirect_rule.html:35
msgid "Destination Port"
msgstr "Porta de Destino"
#: templates/firewall/manage_redirect_rule.html:40
msgid "Destination Type"
msgstr "Tipo de Destino"
#: templates/firewall/manage_redirect_rule.html:42
#: templates/firewall/manage_redirect_rule.html:48
#: templates/vpn_invite/invite_settings.html:17 user_manager/forms.py:178
msgid "Peer"
msgstr "Peer"
#: templates/firewall/manage_redirect_rule.html:57
msgid "WireGuard Instance"
msgstr "Instância do WireGuard"
#: templates/firewall/manage_redirect_rule.html:74
msgid "Add Forward Rule (allow)"
msgstr "Adicionar Regra na Forward (permitir)"
#: templates/firewall/manage_redirect_rule.html:80
#: templates/firewall/redirect_rule_list.html:17
msgid "Masquerade Source"
msgstr "Mascarar Origem"
#: templates/firewall/manage_redirect_rule.html:91
msgid ""
"\n"
" <h5>Default Ports</h5>\n"
" <p>The default <code>docker-compose.yml</code> file "
"specifies the <b>TCP</b> port range <b>8080-8089</b>. If you wish to change "
"the port forwarding to a different range, you must manually edit the "
"<code>docker-compose.yml</code> file and rerun the Docker Compose step "
"outlined in the <a href=\"https://github.com/eduardogsilva/"
"wireguard_webadmin?tab=readme-ov-file#deployment\">deployment instructions</"
"a>.</p>\n"
" <h5>Destination Type: Peer</h5>\n"
" <p>Port redirection will prioritize the first Peer "
"IP address assigned a priority of Zero.</p>\n"
" <h5>Destination Type: IP Address</h5>\n"
" <p>Port forwarding rules will redirect to the "
"specified IP address. Remember to allocate the IP address or network to a "
"Peer.</p>\n"
" <h5>Adding a Forward Rule</h5>\n"
" <p>Automatically generates a forwarding rule to "
"accommodate stricter firewall settings.</p>\n"
" <h5>Masquerade Source</h5>\n"
" <p>This serves as a temporary solution when a peer "
"does not use the VPN as its default gateway. It's important to note that "
"this configuration is not recommended, as it alters the source address of "
"all connections to match the IP address of the WireGuard instance.</p>\n"
" "
msgstr ""
"\n"
" <h5>Portas Padrão</h5>\n"
" <p>O arquivo padrão <code>docker-compose.yml</code> "
"especifica o intervalo de portas <b>TCP</b> <b>8080-8089</b>. Se você deseja "
"alterar o redirecionamento de portas para um intervalo diferente, é "
"necessário editar manualmente o arquivo <code>docker-compose.yml</code> e "
"executar novamente a etapa do Docker Compose descrita nas <a href=\"https://"
"github.com/eduardogsilva/wireguard_webadmin?tab=readme-ov-"
"file#deployment\">instruções de implantação</a>.</p>\n"
" <h5>Tipo de Destino: Peer</h5>\n"
" <p>O redirecionamento de porta dará prioridade ao "
"primeiro endereço IP do Peer com prioridade Zero.</p>\n"
" <h5>Tipo de Destino: Endereço IP</h5>\n"
" <p>As regras de encaminhamento de porta "
"redirecionarão para o endereço IP especificado. Lembre-se de alocar o "
"endereço IP ou rede para um Peer.</p>\n"
" <h5>Adicionando uma Regra de Encaminhamento</h5>\n"
" <p>Gera automaticamente uma regra de encaminhamento "
"para acomodar configurações de firewall mais restritivas.</p>\n"
" <h5>Mascarar Fonte</h5>\n"
" <p>Isto serve como uma solução temporária quando um "
"peer não utiliza a VPN como gateway padrão. É importante notar que esta "
"configuração não é recomendada, pois altera o endereço de origem de todas as "
"conexões para corresponder ao endereço IP da instância do WireGuard.</p>\n"
" "
#: templates/firewall/manage_redirect_rule.html:143
msgid "To delete this rule, please type:"
msgstr "Para excluir esta regra, digite:"
#: templates/firewall/redirect_rule_list.html:12
msgid "Instance"
msgstr "Instância"
#: templates/firewall/redirect_rule_list.html:15
msgid "Destination"
msgstr "Destino"
#: templates/firewall/redirect_rule_list.html:16
msgid "Allow Forward"
msgstr "Permitir Encaminhamento"
#: templates/firewall/redirect_rule_list.html:46
msgid ""
"This serves as a temporary solution when a peer does not use the VPN as its "
"default gateway. It's important to note that this configuration is not "
"recommended, as it alters the source address of all connections to match the "
"IP address of the WireGuard instance."
msgstr ""
"Isto serve como uma solução temporária quando um peer não usa a VPN como seu "
"gateway padrão. É importante notar que essa configuração não é recomendada, "
"pois altera o endereço de origem de todas as conexões para corresponder ao "
"endereço IP da instância do WireGuard."
#: templates/firewall/redirect_rule_list.html:58
msgid "Create Port forwarding Rule"
msgstr "Criar Regra de Encaminhamento de Porta"
#: templates/firewall/redirect_rule_list.html:59
msgid "Firewall Settings"
msgstr "Configuração de Firewall"
#: templates/user_manager/list.html:9 user_manager/forms.py:20
msgid "User Level"
msgstr "Nível de Acesso"
@ -412,10 +606,6 @@ msgstr "Instância do WireGuard"
msgid "Users"
msgstr "Usuários"
#: templates/vpn_invite/invite_settings.html:17 user_manager/forms.py:178
msgid "Peer"
msgstr "Peer"
#: templates/vpn_invite/invite_settings.html:18
msgid "Expiration"
msgstr "Expira em"
@ -428,7 +618,7 @@ msgstr "Remover convite para VPN do peer"
msgid "No active VPN invitations"
msgstr "Nenhum convite para VPN ativo"
#: templates/vpn_invite/invite_settings.html:49 vpn_invite/views.py:76
#: templates/vpn_invite/invite_settings.html:49 vpn_invite/views.py:77
msgid "Email Settings"
msgstr "Configurações de Email"
@ -773,10 +963,6 @@ msgstr "Tráfego da Instância"
msgid "Public Address"
msgstr "Endereço Público"
#: templates/wireguard/wireguard_status.html:47 vpn_invite/forms.py:285
msgid "Port"
msgstr "Porta"
#: user_manager/forms.py:15
msgid "Password Confirmation"
msgstr "Confirmação de Senha"
@ -981,170 +1167,170 @@ msgstr ""
msgid "Please type the username to proceed."
msgstr "Por favor, digite o nome de usuário para prosseguir."
#: vpn_invite/forms.py:50 vpn_invite/forms.py:295
#: vpn_invite/forms.py:49 vpn_invite/forms.py:294
msgid "Enabled"
msgstr "Habilitado"
#: vpn_invite/forms.py:50
#: vpn_invite/forms.py:49
msgid "Disabled"
msgstr "Desabilitado"
#: vpn_invite/forms.py:69 vpn_invite/forms.py:70 vpn_invite/forms.py:71
#: vpn_invite/forms.py:72 vpn_invite/forms.py:73
#: vpn_invite/forms.py:68 vpn_invite/forms.py:69 vpn_invite/forms.py:70
#: vpn_invite/forms.py:71 vpn_invite/forms.py:72
msgid "URL"
msgstr "URL"
#: vpn_invite/forms.py:74 vpn_invite/forms.py:75 vpn_invite/forms.py:76
#: vpn_invite/forms.py:77 vpn_invite/forms.py:78
#: vpn_invite/forms.py:73 vpn_invite/forms.py:74 vpn_invite/forms.py:75
#: vpn_invite/forms.py:76 vpn_invite/forms.py:77
msgid "Text"
msgstr "Texto"
#: vpn_invite/forms.py:84
#: vpn_invite/forms.py:83
msgid "Web Page Instructions"
msgstr "Página Web de Instruções"
#: vpn_invite/forms.py:85
#: vpn_invite/forms.py:84
msgid "Email Subject"
msgstr "Assunto do Email"
#: vpn_invite/forms.py:86
#: vpn_invite/forms.py:85
msgid "Email Message"
msgstr "Mensagem do Email"
#: vpn_invite/forms.py:87
#: vpn_invite/forms.py:86
msgid "Email Enabled"
msgstr "Email Habilitado"
#: vpn_invite/forms.py:88
#: vpn_invite/forms.py:87
msgid "WhatsApp Message"
msgstr "Mensagem do WhatsApp"
#: vpn_invite/forms.py:89
#: vpn_invite/forms.py:88
msgid "WhatsApp Enabled"
msgstr "WhatsApp Habilitado"
#: vpn_invite/forms.py:90
#: vpn_invite/forms.py:89
msgid "Text Message"
msgstr "Mensagem de Texto"
#: vpn_invite/forms.py:91
#: vpn_invite/forms.py:90
msgid "Expiration (minutes)"
msgstr "Expira em (minutos)"
#: vpn_invite/forms.py:92
#: vpn_invite/forms.py:91
msgid "Random Password"
msgstr "Senha Aleatória"
#: vpn_invite/forms.py:93
#: vpn_invite/forms.py:92
msgid "Invite URL"
msgstr "Endereço do Convite"
#: vpn_invite/forms.py:94
#: vpn_invite/forms.py:93
msgid "Required User Level"
msgstr "Nível de Acesso Requerido"
#: vpn_invite/forms.py:95
#: vpn_invite/forms.py:94
msgid "Default Password"
msgstr "Senha Padrão"
#: vpn_invite/forms.py:96
#: vpn_invite/forms.py:95
msgid "Random Password Length"
msgstr "Tamanho da Senha Aleatória"
#: vpn_invite/forms.py:97
#: vpn_invite/forms.py:96
msgid "Random Password Complexity"
msgstr "Complexidade da Senha Aleatória"
#: vpn_invite/forms.py:104
#: vpn_invite/forms.py:103
msgid "General Settings"
msgstr "Configuração Geral"
#: vpn_invite/forms.py:126
#: vpn_invite/forms.py:125
msgid "Download Buttons"
msgstr "Botões de Download"
#: vpn_invite/forms.py:159
#: vpn_invite/forms.py:158
msgid "Message templates"
msgstr "Modelos de Mensagem"
#: vpn_invite/forms.py:166
#: vpn_invite/forms.py:165
msgid "Email Message Template"
msgstr "Modelo de Mensagem de Email"
#: vpn_invite/forms.py:177
#: vpn_invite/forms.py:176
msgid "WhatsApp Message Template"
msgstr "Modelo de Mensagem do WhatsApp"
#: vpn_invite/forms.py:184
#: vpn_invite/forms.py:183
msgid "Text Message Template"
msgstr "Modelo de Mensagem de Texto"
#: vpn_invite/forms.py:206
#: vpn_invite/forms.py:205
msgid "Invite URL must start with 'https://'."
msgstr "Endereço do convite deve começar com 'https://'."
#: vpn_invite/forms.py:208
#: vpn_invite/forms.py:207
msgid "Invite URL must end with '/invite/'."
msgstr "Endereço do convite deve terminar com '/invite/'."
#: vpn_invite/forms.py:214
#: vpn_invite/forms.py:213
msgid "Expiration (minutes) must be between 1 and 1440."
msgstr "Tempo de expiração (minutos) deve estar entre 1 e 1440."
#: vpn_invite/forms.py:223
#: vpn_invite/forms.py:222
msgid "Default password must not be provided when random password is enabled."
msgstr ""
"Senha padrão não deve ser fornecida quando a senha aleatória está habilitada."
#: vpn_invite/forms.py:225
#: vpn_invite/forms.py:224
msgid "Random password length must be at least 6 characters."
msgstr "Senha aleatória deve ter pelo menos 6 caracteres."
#: vpn_invite/forms.py:230
#: vpn_invite/forms.py:229
msgid "Default password must be provided when random password is disabled."
msgstr ""
"Senha padrão deve ser fornecida quando a senha aleatória está desabilitada."
#: vpn_invite/forms.py:232
#: vpn_invite/forms.py:231
msgid "Default password must be at least 6 characters long."
msgstr "Senha padrão deve ter pelo menos 6 caracteres."
#: vpn_invite/forms.py:242
#: vpn_invite/forms.py:241
msgid "Text field must not be empty when download button is enabled."
msgstr ""
"Campo de texto não deve estar vazio quando o botão de download está "
"habilitado."
#: vpn_invite/forms.py:244
#: vpn_invite/forms.py:243
msgid "URL field must not be empty when download button is enabled."
msgstr ""
"Campo de URL não deve estar vazio quando o botão de download está habilitado."
#: vpn_invite/forms.py:253
#: vpn_invite/forms.py:252
msgid ""
"Default password must not be contained in any message template. Found at: "
msgstr ""
"Senha padrão não deve estar contida em nenhum modelo de mensagem. Encontrado "
"em: "
#: vpn_invite/forms.py:260
#: vpn_invite/forms.py:259
#, python-brace-format
msgid "The template must include the placeholder '{invite_url}'."
msgstr "O modelo deve incluir o espaço reservado '{invite_url}'."
#: vpn_invite/forms.py:284
#: vpn_invite/forms.py:283
msgid "Host"
msgstr "Endereço"
#: vpn_invite/forms.py:286
#: vpn_invite/forms.py:285
msgid "Encryption"
msgstr "Criptografia"
#: vpn_invite/forms.py:287
#: vpn_invite/forms.py:286
msgid "From Address"
msgstr "Endereço de Origem"
#: vpn_invite/forms.py:338
#: vpn_invite/forms.py:337
msgid "SMTP port must be between 1 and 65535."
msgstr "Porta SMTP deve ser entre 1 e 65535."
@ -1219,19 +1405,17 @@ msgstr ""
msgid "WireGuard VPN Invite"
msgstr "Convite para VPN WireGuard"
#: vpn_invite/views.py:52
#: vpn_invite/views.py:53
msgid "Invite Settings|Settings saved successfully."
msgstr "Configurações de Convite|Configurações salvas com sucesso."
#: vpn_invite/views.py:56
#: vpn_invite/views.py:57
msgid "VPN Invite Settings"
msgstr "Configurações de Convite para VPN"
#: vpn_invite/views.py:72
#, fuzzy
#| msgid "Invite Settings|Settings saved successfully."
#: vpn_invite/views.py:73
msgid "Email Settings|Settings saved successfully."
msgstr "Configurações de Convite|Configurações salvas com sucesso."
msgstr "Configurações de Email|Configurações salvas com sucesso."
#: wireguard/forms.py:11
msgid "Display Name"

View File

@ -1,3 +1,4 @@
{% load i18n %}
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link {% if current_chain == "forward" %}active{% endif %}" href="/firewall/rule_list/?chain=forward" role="tab">Forward</a>
@ -7,11 +8,11 @@
<a class="nav-link {% if current_chain == "postrouting" %}active{% endif %}" href="/firewall/rule_list/?chain=postrouting" role="tab">Post Routing</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_chain == "portforward" %}active{% endif %}" href="/firewall/port_forward/" role="tab">Port Forward</a>
<a class="nav-link {% if current_chain == "portforward" %}active{% endif %}" href="/firewall/port_forward/" role="tab">{% trans 'Port Forward' %}</a>
</li>
{% if current_chain == 'forward' %}
<li class="nav-item ml-auto">
<a class="nav-link" role="">Default Policy: <b>{{ firewall_settings.get_default_forward_policy_display }}</b></a>
<a class="nav-link" role="">{% trans 'Default Policy' %}: <b>{{ firewall_settings.get_default_forward_policy_display }}</b></a>
</li>
{% endif %}

View File

@ -1,11 +1,12 @@
{% extends 'base.html' %}
{% load i18n %}
{% block content %}
<div class="container mt-3">
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">{{ form.instance.pk|yesno:"Edit User,Create New User" }}</h3>
<h3 class="card-title">{{ page_title }}</h3>
</div>
<div class="card-body">
<div class="row">
@ -14,11 +15,11 @@
<form method="post">
{% csrf_token %}
<div class="form-group">
<label for="id_description">Description</label>
<input type="text" class="form-control" id="id_description" name="description" placeholder="Description" value="{{ form.description.value|default_if_none:'' }}">
<label for="id_description">{% trans 'Description' %}</label>
<input type="text" class="form-control" id="id_description" name="description" placeholder="{% trans 'Description' %}" value="{{ form.description.value|default_if_none:'' }}">
</div>
<div class="form-group">
<label for="id_protocol">Protocol</label>
<label for="id_protocol">{% trans 'Protocol' %} *</label>
<select class="form-control" id="id_protocol" name="protocol">
<option value="tcp" {% if form.protocol.value == "tcp" %}selected{% endif %}>TCP</option>
<option value="udp" {% if form.protocol.value == "udp" %}selected{% endif %}>UDP</option>
@ -26,25 +27,25 @@
</div>
<div class="form-group">
<label for="id_port">Port</label>
<label for="id_port">{% trans 'Port' %} *</label>
<input type="number" class="form-control" id="id_port" name="port" value="{{ form.port.value|default_if_none:'' }}">
</div>
<div class="form-group">
<label for="id_port_forward">Destination Port</label>
<label for="id_port_forward">{% trans 'Destination Port' %}</label>
<input type="number" class="form-control" id="id_port_forward" name="port_forward" value="{{ form.port_forward.value|default_if_none:'' }}">
</div>
<div class="form-group">
<label for="destinationType">Destination Type</label>
<label for="destinationType">{% trans 'Destination Type' %} *</label>
<select class="form-control" name="destinationType" id="destinationType">
<option value="peer">Peer</option>
<option value="ipAddress" {% if instance.ip_address %}selected{% endif %}>IP Address</option>
<option value="peer">{% trans 'Peer' %}</option>
<option value="ipAddress" {% if instance.ip_address %}selected{% endif %}>{% trans 'IP Address' %}</option>
</select>
</div>
<div class="form-group">
<label for="id_peer">Peer</label>
<label for="id_peer">{% trans 'Peer' %} *</label>
<select class="form-control" id="id_peer" name="peer">
<option value="">---------</option>
{% for peer in form.fields.peer.queryset %}
@ -53,7 +54,7 @@
</select>
</div>
<div class="form-group">
<label for="id_wireguard_instance">WireGuard Instance</label>
<label for="id_wireguard_instance">{% trans 'WireGuard Instance' %} *</label>
<select class="form-control" id="id_wireguard_instance" name="wireguard_instance">
{% comment %}<option value="">---------</option>{% endcomment %}
{% for instance in form.fields.wireguard_instance.queryset %}
@ -62,45 +63,42 @@
</select>
</div>
<div class="form-group">
<label for="id_ip_address">IP Address</label>
<input type="text" class="form-control" id="id_ip_address" name="ip_address" placeholder="IP Address" value="{{ form.ip_address.value|default_if_none:'' }}">
<label for="id_ip_address">{% trans 'IP Address' %} *</label>
<input type="text" class="form-control" id="id_ip_address" name="ip_address" placeholder="{% trans 'IP Address' %}" value="{{ form.ip_address.value|default_if_none:'' }}">
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="id_add_forward_rule" name="add_forward_rule" {% if form.add_forward_rule.value %}checked{% endif %}>
<label class="form-check-label" for="id_add_forward_rule">Add Forward Rule (allow)</label>
<label class="form-check-label" for="id_add_forward_rule">{% trans 'Add Forward Rule (allow)' %}</label>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="id_masquerade_source" name="masquerade_source" {% if form.masquerade_source.value %}checked{% endif %}>
<label class="form-check-label" for="id_masquerade_source">Masquerade Source</label>
<label class="form-check-label" for="id_masquerade_source">{% trans 'Masquerade Source' %}</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
<a href="/firewall/port_forward/" class="btn btn-outline-secondary">Back</a>
{% if instance %}<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>Delete Rule</a>{% endif %}
<button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
<a href="/firewall/port_forward/" class="btn btn-outline-secondary">{% trans 'Back' %}</a>
{% if instance %}<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>{% trans 'Delete' %}</a>{% endif %}
</form>
</div>
<div class="col-md-8">
{% blocktrans %}
<h5>Default Ports</h5>
<p>The default <code>docker-compose.yml</code> file specifies the <b>TCP</b> port range <b>8080-8089</b>. If you wish to change the port forwarding to a different range, you must manually edit the <code>docker-compose.yml</code> file and rerun the Docker Compose step outlined in the <a href="https://github.com/eduardogsilva/wireguard_webadmin?tab=readme-ov-file#deployment">deployment instructions</a>.</p>
<h5>Destination Type: Peer</h5>
<p>Port redirection will prioritize the first Peer IP address assigned a priority of Zero.</p>
<h5>Destination Type: IP Address</h5>
<p>Port forwarding rules will redirect to the specified IP address. Remember to allocate the IP address or network to a Peer.</p>
<h5>Adding a Forward Rule</h5>
<p>Automatically generates a forwarding rule to accommodate stricter firewall settings.</p>
<h5>Masquerade Source</h5>
<p>This serves as a temporary solution when a peer does not use the VPN as its default gateway. It's important to note that this configuration is not recommended, as it alters the source address of all connections to match the IP address of the WireGuard instance.</p>
{% endblocktrans %}
</div>
</div>
</div>
@ -141,7 +139,7 @@
<script>
function openCommandDialog(element) {
var command = element.getAttribute('data-command');
var confirmation = prompt("Please type '{{ instance.protocol }}{{ instance.port }}' to remove this rule.");
var confirmation = prompt("{% trans 'To delete this rule, please type:' %} '{{ instance.protocol }}{{ instance.port }}'");
if (confirmation) {
var url = "?uuid={{ instance.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation);
window.location.href = url;

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load i18n %}
{% block content %}
<div class="card card-primary card-outline">
<div class="card-body">
@ -9,12 +9,12 @@
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Instance</th>
<th>Protocol</th>
<th>Port</th>
<th>Destination</th>
<th>Allow Forward</th>
<th>Masquerade Source</th>
<th>{% trans 'Instance' %}</th>
<th>{% trans 'Protocol' %}</th>
<th>{% trans 'Port' %}</th>
<th>{% trans 'Destination' %}</th>
<th>{% trans 'Allow Forward' %}</th>
<th>{% trans 'Masquerade Source' %}</th>
<th><i class="far fa-edit"></i></th>
</tr>
</thead>
@ -43,7 +43,7 @@
<td>
{% if redirect_rule.masquerade_source %}
<i class="fas fa-check"></i>
<i class="fas fa-exclamation-triangle" title="This serves as a temporary solution when a peer does not use the VPN as its default gateway. It's important to note that this configuration is not recommended, as it alters the source address of all connections to match the IP address of the WireGuard instance."></i>
<i class="fas fa-exclamation-triangle" title="{% trans "This serves as a temporary solution when a peer does not use the VPN as its default gateway. It's important to note that this configuration is not recommended, as it alters the source address of all connections to match the IP address of the WireGuard instance." %}"></i>
{% else %}
<i class="fas fa-times"></i>
{% endif %}
@ -55,8 +55,8 @@
{% endfor %}
</tbody>
</table>
<a href="/firewall/manage_port_forward_rule/" class='btn btn-primary'>Create Port forwarding Rule</a>
<a href="/firewall/firewall_settings/?chain=porforward" class='btn btn-outline-primary'>Firewall Settings</a>
<a href="/firewall/manage_port_forward_rule/" class='btn btn-primary'>{% trans 'Create Port forwarding Rule' %}</a>
<a href="/firewall/firewall_settings/?chain=porforward" class='btn btn-outline-primary'>{% trans 'Firewall Settings' %}</a>
</div>
</div>
</div>