Auteur Sujet: Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité  (Lu 1390 fois)

0 Membres et 1 Invité sur ce sujet

JeanV

  • Abonné Orange Fibre
  • *
  • Messages: 18
  • Toulon+83
Bonjour,

Après pas mal de galères à faire fonctionner l'ensemble et pioché des infos à différents endroits j'ai réussi à charger une configuration qui fonctionne (en IPV4 pour le moment)
La voici :

Citer
#    Port 1 : ONU
#    Port 2 - 5 : Home network

#Interfaces :

/interface bridge
add name=FTTH
add name=bridge

/interface vlan
add interface=ether1 name=VLAN832 vlan-id=832

/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN

/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik

#Authentication :

#    Replace xxxxxxx by the login fti/xxxxxxx in hexadecimal.

    /ip dhcp-client option
    add code=77 name=userclass value=0x2bzogzogzogzogzogzogzogzogzog
    add code=90 name=authsend value=0x00000000000000000000001zogzogzogzogzog

# configuration :

/ip pool
add name=default-dhcp ranges=192.168.1.10-192.168.1.254

/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=bridge name=defconf

/ip dhcp-server network
add address=192.168.1.0/24 dns-server=80.67.169.12,80.67.169.40 gateway=192.168.1.1 netmask=24

/interface bridge filter
add action=set-priority chain=output dst-port=67 ip-protocol=udp mac-protocol=ip new-priority=6 out-interface=VLAN832 passthrough=yes src-port=68

/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=FTTH interface=VLAN832

/ip neighbor discovery-settings
set discover-interface-list=LAN

/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=FTTH list=WAN

/ip address
add address=192.168.1.1/24 comment=defconf interface=bridge network=192.168.1.0

/ip dhcp-client
add dhcp-options=authsend,clientid,hostname,userclass disabled=no interface=FTTH

/ip

/ip dns
set allow-remote-requests=yes servers=1.1.1.1,1.0.0.1

/ip dns static
add address=172.6.0.254 comment=defconf name=router.lan

/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN

/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN to-addresses=0.0.0.0
add action=dst-nat chain=dstnat dst-port=21 in-interface=FTTH protocol=tcp to-addresses=192.168.1.21 to-ports=21


/system clock
set time-zone-name=Europe/Paris

/tool mac-server
set allowed-interface-list=LAN

/tool mac-server mac-winbox
set allowed-interface-list=LAN


#/ip service
#set telnet disabled=yes
#set ftp disabled=yes
#set ssh disabled=yes




J'aurais aimé savoir ce vous pensiez déjà de cette config et quelles règles je devrais rajouter dans le firewall, pour plus de sécurité.

pinomat

  • Abonné Bbox fibre
  • *
  • Messages: 213
  • THIONVILLE 57
Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité
« Réponse #1 le: 29 septembre 2023 à 13:31:43 »
Perso, je changerai le nom de tes bridges. Cela porte à confusion...

/interface bridge
[b]add name=br-wan
add name=br-lan[/b]

/interface vlan
add interface=ether1 name=VLAN832 vlan-id=832

/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN

/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik

#Authentication :

#    Replace xxxxxxx by the login fti/xxxxxxx in hexadecimal.

    /ip dhcp-client option
    add code=77 name=userclass value=0x2bzogzogzogzogzogzogzogzogzog
    add code=90 name=authsend value=0x00000000000000000000001zogzogzogzogzog

# configuration :

/ip pool
add name=default-dhcp ranges=192.168.1.10-192.168.1.254

/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=br-lan name=defconf

/ip dhcp-server network
add address=192.168.1.0/24 dns-server=80.67.169.12,80.67.169.40 gateway=192.168.1.1 netmask=24

/interface bridge filter
add action=set-priority chain=output dst-port=67 ip-protocol=udp mac-protocol=ip new-priority=6 out-interface=VLAN832 passthrough=yes src-port=68

/interface bridge port
add bridge=br-lan comment=defconf interface=ether2
add bridge=br-lan comment=defconf interface=ether3
add bridge=br-lan comment=defconf interface=ether4
add bridge=br-lan comment=defconf interface=ether5
add bridge=br-wan interface=VLAN832

/ip neighbor discovery-settings
set discover-interface-list=LAN

/interface list member
add comment=defconf interface=br-lan list=LAN
add comment=defconf interface=br-wan list=WAN

/ip address
add address=192.168.1.1/24 comment=defconf interface=br-lan network=192.168.1.0

/ip dhcp-client
add dhcp-options=authsend,clientid,hostname,userclass disabled=no interface=br-wan

/ip

/ip dns
set allow-remote-requests=yes servers=1.1.1.1,1.0.0.1

/ip dns static
add address=172.6.0.254 comment=defconf name=router.lan

/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN

/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN to-addresses=0.0.0.0
add action=dst-nat chain=dstnat dst-port=21 in-interface=br-wan protocol=tcp to-addresses=192.168.1.21 to-ports=21

/system clock
set time-zone-name=Europe/Paris

/tool mac-server
set allowed-interface-list=LAN

/tool mac-server mac-winbox
set allowed-interface-list=LAN

#/ip service
#set telnet disabled=yes
#set ftp disabled=yes
#set ssh disabled=yes

J'ai un drop final dans la chain forward après toutes les règles autorisée pour interdire tout échange de mes VLAN vers mes VLAN. A activer avec précaution !
add action=drop chain=forward comment="Drop all other packets from LAN to LAN" in-interface-list=ALL_LAN out-interface-list=ALL_LAN
Je n'autoriserai que ce qui est nécessaire pour l'accès au routeur (chain=input). Dans ton cas, toutes les machines sont autorisées à accéder au routeur sur tous les ports. Le strict minimun, en général, c'est d'autoriser DNS, DHCP. Ensuite on a l'ICMP, IGMP (utiles pour la TV d'Orange), SSH, WinBox, HTTP(S) et dans ton cas.

J'ai ajouté un ensemble de règles RAW conseillée par Mikrotik ainsi que des règles pour autoriser les interfaces en provenance des WAN (VPN + ISP) / LAN ainsi que les règles pour les paquets IGMP (utiles pour TV d'orange). Du fait de mon setup firewall, certaines règles sont en double, mais c'est normal.
add action=accept chain=prerouting comment="Accept DHCP from ALL_LAN" dst-address=255.255.255.255 dst-port=67 in-interface-list=ALL_LAN protocol=udp src-address=0.0.0.0 src-port=68
add action=accept chain=prerouting comment="Accept UDP multicast flow from OrangeIGMP" dst-address=224.0.0.0/4 dst-port=8200,8202 in-interface=OrangeIGMP protocol=udp
add action=accept chain=prerouting comment="Accept IGMP from OrangeBoxTV/SmartAndTV" in-interface=SmartAndTV protocol=igmp src-address-list=OrangeBoxTV
add action=accept chain=prerouting comment="Accept IGMP from OrangeIGMP" in-interface=OrangeIGMP protocol=igmp
add action=drop chain=prerouting comment="Drop bad source packets" src-address-list=def_bad_ipv4
add action=drop chain=prerouting comment="Drop bad destination packets" dst-address-list=def_bad_ipv4
add action=drop chain=prerouting comment="Drop bad source packets" src-address-list=def_bad_src_ipv4
add action=drop chain=prerouting comment="Drop bad destination packets" dst-address-list=def_bad_dst_ipv4
add action=drop chain=prerouting comment="Drop bad source packets from WAN" in-interface-list=WAN src-address-list=def_not_global_ipv4
add action=drop chain=prerouting comment="Drop bad udp packets" port=0 protocol=udp
add action=accept chain=prerouting comment="Accept all the rest from WAN network" in-interface=vps0
add action=accept chain=prerouting comment="Accept all the rest from ALL_LAN network" in-interface-list=ALL_LAN
add action=accept chain=prerouting comment="Accept all the rest from WAN network" in-interface-list=WAN
add action=drop chain=prerouting comment="Drop all other packets to the router"

J'ai une question, quelle est l'utilité de
/ip dns static
add address=172.6.0.254 comment=defconf name=router.lan

Bon courage !

artemus24

  • Abonné SFR fibre FttH
  • *
  • Messages: 784
  • Montignac Lascaux (24)
Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité
« Réponse #2 le: 29 septembre 2023 à 16:57:09 »
Salut à tous.

/ip dns static
add address=172.6.0.254 comment=defconf name=router.lan
Ça ne serait pas plutôt 172.16.0.254 ?

JeanV

  • Abonné Orange Fibre
  • *
  • Messages: 18
  • Toulon+83
Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité
« Réponse #3 le: 30 septembre 2023 à 16:22:12 »
Merci pour tes réponses, je suis méga noob sur Mikrotik et il y a pas mal de choses que je ne saisi pas encore, j'ai trouvé un tuto sur le net qui correspondait à ma config et c'est comme ça que j'ai réussi à la faire fonctionner.

Par exemple aucune idée de la fonction de ça  ;D
/ip dns static
add address=172.6.0.254 comment=defconf name=router.lan

Je n'utilise pas la TV d'orange je peux virer tout ce qui est en relation avec  ICMP, IGMP ?

pinomat

  • Abonné Bbox fibre
  • *
  • Messages: 213
  • THIONVILLE 57
Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité
« Réponse #4 le: 30 septembre 2023 à 22:05:18 »
Je n'utilise pas la TV d'orange je peux virer tout ce qui est en relation avec ICMP, IGMP ?

L'objectif de la commande ip dns est de répondre à une requête DNS et de dire que router.lan pointe vers l'adresse 172.6.0.254. Donc si tu n'as aucun serveur avec cette adresse IP, ça ne sert strictement à rien...

L'ICMP c'est autre chose, c'est principalement le ping. Tu supprimes le ICMP, tu ne pourras plus "pinger" ton routeur, cela est parfois utilisé par des appareils connectés pour vérifier la connectivité réseau (même si en pratique, le ping ne veut pas dire que tout le réseau fonctionne). Je garderai le ping et supprimer effectivement toutes les règles relatives à l'IGMP.

JeanV

  • Abonné Orange Fibre
  • *
  • Messages: 18
  • Toulon+83
Routeur Mikrotik HeX S + ONT LEOX LXT-010G-D questions sécurité
« Réponse #5 le: 02 octobre 2023 à 08:13:48 »
ok merci pour les précisions