Sziasztok!
Packetfence-el "jatszom" az alabbit szeretnem megvalositani:
Adott 10+ darab HP/Aruba switch vegyesen. Hozza kapcsolnam a Packetfence-hez ezeket (Radius,snmp belove). Szeretnem azt, hogy a Packetfence jelezze (MAC cim alapjan) ha uj eszkoz kerult radugasra, ezeket egy adott VLAN poolba tegye, mondjuk egy "deny-all"-ba alapbol. (ezeket a vlanokat a Packetfence-ben szeretnem definialni ) en a MAC-ek alapjan szinten tudjam VLAN-okba rendezni az eszkozoket, a switchekre ne is kelljen belepnem, a Packetfence intezze a vlanozast. (Pl ha kihuznak egy portbol egy folvett eszkozt, akkor tegye azt a portot automatikusan ujra a "deny all" vlanba es ahova ujra bedugjak, egy masik swichen pedig vegye fel a sajat vlan-jat, amit mar en allitottam be neki)
A kerdes, alkalmas egyaltalan erre a Packetfence, ha pedig nem, akkor mi az, ami igen?
A captive portal / AD autch 802.1X alapjan nekem mar csak "hab lenne a tortan" alapbol a fonti lenne jo, ha osszejonne.
- 644 megtekintés
Hozzászólások
Itt akadok el:
Port-security and SNMP
Relies on the port-security SNMP Traps. A fake static MAC address is assigned to all the ports this way any MAC address will generate a security violation and a trap will be sent to PacketFence. The system will authorize the MAC and set the port in the right VLAN. VoIP support is possible but tricky. It varies a lot depending on the switch vendor. Cisco is well supported but isolation of a PC behind an IP Phone leads to an interesting dilemma: either you shut the port (and the phone at the same time) or you change the data VLAN but the PC doesn’t do DHCP (didn’t detect link was down) so it cannot reach the captive portal.
Aside from the VoIP isolation dilemma, it is the technique that has proven to be reliable and that has the most switch vendor support.
Ez megvan (snmp trap beallitva a Packetfence serverre, az Aruba switchen) illetve be van allitva az adott porta a fake MAC is. a gond, hogy rohadtul nem kuld a servernek semmit, ha rakotok egy eszkozt... es sajnos nem jovok ra, miert.
Switch config:
A RADIUS meg nincs beallitva, de ha jol ertem, az ehhez a funkciohoz meg nem kell.
Running configuration:
; JL357A Configuration Editor; Created on release #YC.16.02.0012
; Ver #0e:01.b0.ef.74.47.fc.68.f3.8c.fc.e3.ff.37.2f:70
hostname "Aruba-2540-48G-PoEP-4SFPP"
module 1 type jl357a
port-security 10 learn-mode static
port-security 10 mac-address 020000-000010
port-security 10 action send-alarm
ip default-gateway 10.51.0.100
snmp-server community "public"
snmp-server community "private" unrestricted
snmp-server host 10.51.39.3 community "public" trap-level not-info
no snmp-server enable traps link-change 1-52
vlan 1
name "DEFAULT_VLAN"
untagged 1-52
ip address 10.51.1.18 255.255.252.0
exit
- A hozzászóláshoz be kell jelentkezni
Egy lepessel kozelebb :)
Packetfence oldalon definialni kell az uplink portot a switchen, mert ha dinamikusra teszem, azt nem ismeri...
Most mar eljutok oda, hogy felismeri a klienset, fel is veszi a node-ok koze, viszont mikor atirna a fake MAC-et, akkor dob egy ilyet a logba
Aug 28 16:48:30 hun400-33v pfqueue: pfqueue(9004) ERROR: [mac:80:ee:73:d9:8e:15] SNMP error tyring to perform auth of 80:ee:73:d9:8e:15 Error message: Received badValue(3) error-status at error-index 2 (pf::Switch::HP::Procurve_2500::authorizeMAC)
- A hozzászóláshoz be kell jelentkezni
Szia!
802.1X (dot1x) - be kell kapcsolni azokra a portokra.
802.1X (dot1x) - Úgy működik amit akarsz:
Bedugják az eszközt valameiyk végpontra - switchport inaktív mert nincs auth. - ha az eszköz auth-t ( tanusítvány ; felhasználónév+jelszó ) - akkor aktív lesz a switchport.
(Tanusítvány esetén előtte telepíteni kell az eszközre/kliensre)
Switchen a dot1x paramétereknél meg kell adni a "reauth" opciót, hogy bizonyos időközönként a már "auth" -portokat újra kell ellenőríznie, ebből következően nincs szükség MAC/PortSec -re:
-Ha már auth.-t egy port, akkor többször nem engedi "becsatlakozni" azt az eszközt/klienst - (ehhez a switchen a dot1x paramétereket kell megnézni ) - esetleg annyi, hogy a PortSec-nél 1db MAC/switchport lehet maximum.
VLAN-ra több opció van:
-Statikus: Switchen portonként dot1x vlan paramétereket megadod: " unauth; guest; auth.;" - switchportonként ez lehet más és más.
-Dinamikus:RADIUS paraméterként meg tudod adni vlan opciókat - (sok minden egyéb mást is) - ehhez meg kell nézni hogy az adott switch/firmware milyen paraméterezést vár.
Mindkét opció esetén kell egy Radius szerver - Packetfence-be alapból FreeRadius van.
Ha AD-alapú környezet van, akkor a Microsoft "Network Policy Server" szolgáltatást kell telepíteni valamelyik szerverre - ez lényegében egy RADIUS szerver.
"Dinamikus" -t nem javaslom, mivel sok a "szoftveres bug" - szívás lesz vele: pl.: switch firmware-ként más paraméterezés kell, egyszerűen nem működik/beragad a port.
(A FreeRadius -t lehet úgy paraméterezni hogy AD-ból vegye a felhasználókat egyéb paramétereket a FreeRadius-ból)
Amit fejlebb írtál azt a szerintem a "dummy" switchekhez írják packetfence-nél, ahol nincsen dot1x támogatás - csak ezek a "dummy" switchek egy már "dot1x/PortSec" funkcióra képes switchez van csatlakoztatva.
- A hozzászóláshoz be kell jelentkezni
Ertem, megnezem, amit irtal! Esetleg arra van otleted, hogy snmp miert nem tudja modositani a macet a porton? Mert elso korben, mar annak is orulnek, ha igy menne...
- A hozzászóláshoz be kell jelentkezni
Nem egészen értem.
Ha "write" SNMP community is van beállítva, akkor se módósítható minden a switchen lévő paraméter.
Szeretnem azt, hogy a Packetfence jelezze (MAC cim alapjan) ha uj eszkoz kerult radugasra ...
Ehhez hozzá kell adni a switch konfighoz, hogy küldje el a MAC címeket a Packetfence-nek, fenti konfigba amit küldtél nincs benne olyan sor, gondolom ez kell még bele:
snmp-server enable traps mac-notify
snmp-server enable traps mac-notify mac-move
snmp-server enable traps mac-notify trap-interval 0
PecketFence megkapja az összes MAC -címet, ezekből honnan fogja tudni,hogy melyik az "idegen" azt nem tudom.
- A hozzászóláshoz be kell jelentkezni
Innen tudja:
port-security 10 learn-mode static
port-security 10 mac-address 020000-000010
port-security 10 action send-alarm
snmp-server host 10.51.39.3 community "public" trap-level not-info
Tehat beallitok egy kamu mac-et alapbol a portra. radugok egy eszkozt az snmp trap-al elkuldi a servernek, hogy blokkolt egy mac-et ezen a porton (hiszen nem egyezik a kamuval) majd megprobalja atirni az engedelyezett mac-et snmp-vel.
Alapbol a portot egy olyan vlan ba taggeli at egybol ezek utan, ahonnan nem er el semmit (deny all) majd ez utan mar te kezzel olyan rule-t huzol ra, amilyet akarsz. Vagy persze mar elore felveheted a mac-et packetfence-ben es akkor egybol amikor erzekeli be is allitja a megfelelo rule-okat.
Addig szepen eljutok , hogy a mac megjelenik a packetfence-ben, viszont az mar nem megy, hogy atirja a helyesre a switchen: itt a packetfence teljes idevago logja:
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] secureMacAddrViolation trap received on 10.51.1.18 ifIndex 10 for 80:ee:73:d9:8e:15 (pf::task::pfsnmp::handleSecureMacAddrViolationTrap)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] node 80:ee:73:d9:8e:15 does not yet exist in PF database. Adding it now (pf::task::pfsnmp::node_update_PF)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] Instantiate profile default (pf::Connection::ProfileFactory::_from_profile)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] Instantiate profile default (pf::Connection::ProfileFactory::_from_profile)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] is of status unreg; belongs into registration VLAN (pf::role::getRegistrationRole)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) INFO: [mac:80:ee:73:d9:8e:15] authorizing 80:ee:73:d9:8e:15 (old entry 02:00:00:00:00:10) at new location 10.51.1.18 ifIndex 10 (pf::task::pfsnmp::handleSecureMacAddrViolationTrap)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) ERROR: [mac:80:ee:73:d9:8e:15] SNMP error tyring to perform auth of 80:ee:73:d9:8e:15 Error message: Received badValue(3) error-status at error-index 2 (pf::Switch::HP::Procurve_2500::authorizeMAC)
Aug 28 16:59:01 hun400-33v pfqueue: pfqueue(9004) ERROR: [mac:80:ee:73:d9:8e:15] Unable to authorize 80:ee:73:d9:8e:15 (old entry 02:00:00:00:00:10) at new location 10.51.1.18 ifIndex 10 (pf::task::pfsnmp::handleSecureMacAddrViolationTrap)
Aug 28 16:59:02 hun400-33v pfipset[6144]: t=2020-08-28T16:59:02+0200 lvl=info msg="No Inline Network bypass ipsets reload" pid=6144
Aug 28 16:59:11 hun400-33v pfqueue: pfqueue(10694) WARN: [mac:80:ee:73:d9:8e:15] Unable to pull accounting history for device 80:ee:73:d9:8e:15. The history set doesn't exist yet. (pf::accounting_events_history::latest_mac_history)
Ez amugy a 2500-as switch packetfence altal tamogatott hivatalos metodusa. Lasd: https://packetfence.org/doc/PacketFence_Network_Devices_Configuration_G…
- A hozzászóláshoz be kell jelentkezni
Lényegében PacketFence-nek SNMP-vel kellene írnia ("private") community a switchen ezt a sort:
--> port-security 10 mac-address 020000-000010
--> port-security 10 mac-address 80:ee:73:d9:8e:15
Szerintem hozzá kellene adni a konfighoz: "version v2c"
snmp-server community "public" version v2c
snmp-server community "private" version v2c unrestricted
- A hozzászóláshoz be kell jelentkezni
We've got reports that the HP ProCurve's 5412zl and 8212zl work correctly with this module.
Some clients report that 802.1x and Mac Authentication should work, however we did not test it lab.
We are also not sure about the VoIP using 802.1X/Mac Auth.
:D
Azért így elég vicces, rohadtul le se tesztelték.
Az lesz a a baja, hogy az OID száma/formátuma más a HP 2540 switchen lévő firmware-nek - ez nem 5412zl / 8212zl - azok teljesen mások.
https://github.com/inverse-inc/packetfence/blob/541c6c8545195881b136bc55edb7cd531594061d/lib/pf/Switch/HP/Procurve_2500.pm
my $OID_hpSecCfgStatus
= '1.3.6.1.4.1.11.2.14.2.10.4.1.4'; #HP-ICF-GENERIC-RPTR
my $OID_hpSecPtIntrusionFlag
= '1.3.6.1.4.1.11.2.14.2.10.3.1.7'; #HP-ICF-GENERIC-RPTR
my $hpSecCfgAddrGroupIndex = 1;
...
my @oid_value;
if ($deauthMac) {
my $MACDecString = mac2dec($deauthMac);
my $completeOid
= "$OID_hpSecCfgStatus.$hpSecCfgAddrGroupIndex.$ifIndex.$MACDecString";
push @oid_value, ( $completeOid, Net::SNMP::INTEGER, 6 );
}
if ($authMac) {
my $MACDecString = mac2dec($authMac);
my $completeOid
= "$OID_hpSecCfgStatus.$hpSecCfgAddrGroupIndex.$ifIndex.$MACDecString";
push @oid_value, ( $completeOid, Net::SNMP::INTEGER, 4 );
}
Tehát
1.3.6.1.4.1.11.2.14.2.10.4.1.4 - $OID_hpSecCfgStatus
1 - $hpSecCfgAddrGroupIndex
10 - $ifIndex
128.238.115.217.142.21 - $MACDecString (80:ee:73:d9:8e:15)
=> 1.3.6.1.4.1.11.2.14.2.10.4.1.4.1.10.128.238.115.217.142.21
$> snmpset -v 2c -c private 10.51.1.18 -i 1.3.6.1.4.1.11.2.14.2.10.4.1.4.1.10.128.238.115.217.142.21
Erre át kell,hogy írja a switchen lévő konfigot:
port-security 10 mac-address 80:ee:73:d9:8e:15
Mivel nem jó a fenti OID - ez a logbol látszik:
=> Received badValue(3) error-status at error-index 2 (pf::Switch::HP::Procurve_2500::authorizeMAC)
Meg kell keresni melyik a jó OID:
snmpwalk / snmpget
Ha ez megvan, akkor át kell írni a .pm fájlba is, akkor fog működni.
- A hozzászóláshoz be kell jelentkezni
Lekertem az oid-ket snmpwalk-al de grep-el sem talalok semmit, ami a hpSecCfgStatus oid-jat tartalmazza...
Probaltam, beallitani 2c re az snmp verziot, de a parancsodra azt dobja vissza, hogy a "version" kapcsolot nem ismeri...
ha Packetfence et v2 re allitom, ez a hiba jon vissza:
Aug 29 02:39:06 hun400-33v pfqueue: pfqueue(29445) ERROR: [mac:80:ee:73:d9:8e:15] SNMP error tyring to perform auth of 80:ee:73:d9:8e:15 Error message: Received inconsistentValue(12) error-status at error-index 2 (pf::Switch::HP::Procurve_2500::authorizeMAC)
- A hozzászóláshoz be kell jelentkezni
Szia!
Most ránéztem, az ARUBA oldaláról le lehet tölteni a MIB fájlokat amik tartalmazzák ezt.
Letöltöttem, kicsomagoltam rápróbáltam ("MIBS-Apr-2020")
snmptranslate -M $PWD -m all 1.3.6.1.4.1.11.2.14.2.10.4.1.4
HP-ICF-OID::icfHub.10.4.1.4
Rákerestem .mib fájlokba nem találtam "icfHub"-ra olyat amibe ilyen PORTSEC-et lehetne állítani.
Azt kellene csinálnod, hogy a Switchen beállítod azt a MAC címet "80:ee:73:d9:8e:15", majd snmpwalk -al megkeresed.
Ha megvan, akkor ilyen "string-változó" -ba lesz valahol, azt a meg berakod az snmptranslate -be ami megmondja mi a helyes OID, azt kell átírni a PakcetFence .pm fájlba.
snmptranslate -M $PWD -m all -0n string-valtozo
Az is lehet, hogy SNMP-vel ezt nem lehet állítani - akkor viszont valami SSH scriptet kell írni rá.
- A hozzászóláshoz be kell jelentkezni
Ezeket talaltam:
(A mac-re kerestem deciamalba)
A tippem, hogy az utolso, nem?
iso.3.6.1.2.1.17.4.3.1.2.128.238.115.217.142.21 = INTEGER: 10
iso.3.6.1.2.1.17.4.3.1.3.128.238.115.217.142.21 = INTEGER: 5
iso.3.6.1.2.1.17.7.1.2.2.1.2.1.128.238.115.217.142.21 = INTEGER: 10
iso.3.6.1.2.1.17.7.1.2.2.1.3.1.128.238.115.217.142.21 = INTEGER: 5
iso.3.6.1.2.1.17.4.3.1.1.128.238.115.217.142.21 = Hex-STRING: 80 EE 73 D9 8E 15
Szerk: nem lesz jo... ha atorirom egy random mac-re, nem talal semmit, sem decimalisban sem mashogy... Vagyis a feni ertekek biztos nem a mac-sec-re vonatkoznak (lehet csak log, vagy ilyesmi...)
- A hozzászóláshoz be kell jelentkezni
Viszont nemi eredmeny!!
Linkupdown-al mukodik! eleg "basic" megoldas, de ha a switch nem tud tobbet, akkor ez van... majd jovo heten kiprobalom elesben.
Elso radugas:
Aug 30 13:49:14 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] up trap received on 10.51.1.18 ifIndex 10 (pf::task::pfsnmp::handleUpTrap)
Aug 30 13:49:14 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] setting 10.51.1.18 port 10 to Registration VLAN (pf::task::pfsnmp::handleUpTrap)
Aug 30 13:49:14 hun400-33v pfqueue: pfqueue(7192) WARN: [mac:] couldn't get MAC at ifIndex 10. This is a problem. (pf::Switch::_getMacAtIfIndex)
Aug 30 13:49:14 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Should set 10.51.1.18 ifIndex 10 to VLAN 199 but it is already in this VLAN -> Do nothing (pf::Switch::setVlan)
Aug 30 13:49:14 hun400-33v pfqueue: pfqueue(7192) WARN: [mac:] couldn't get MAC at ifIndex 10. This is a problem. (pf::Switch::_getMacAtIfIndex)
Aug 30 13:49:17 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] node 80:ee:73:d9:8e:15 does not yet exist in PF database. Adding it now (pf::task::pfsnmp::node_update_PF)
Aug 30 13:49:17 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Instantiate profile default (pf::Connection::ProfileFactory::_from_profile)
Aug 30 13:49:17 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Instantiate profile default (pf::Connection::ProfileFactory::_from_profile)
Aug 30 13:49:17 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] is of status unreg; belongs into registration VLAN (pf::role::getRegistrationRole)
Aug 30 13:49:17 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Should set 10.51.1.18 ifIndex 10 to VLAN 199 but it is already in this VLAN -> Do nothing (pf::Switch::setVlan)
Aug 30 13:49:27 hun400-33v pfqueue: pfqueue(10257) WARN: [mac:80:ee:73:d9:8e:15] Unable to pull accounting history for device 80:ee:73:d9:8e:15. The history set doesn't exist yet. (pf::accounting_events_history::latest_mac_history)
Node athelyezese a megfelelo rule-ba:
Aug 30 13:54:41 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Instantiate profile default (pf::Connection::ProfileFactory::_from_profile)
Aug 30 13:54:41 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] Username was NOT defined or unable to match a role - returning node based role 'default' (pf::role::getRegisteredRole)
Aug 30 13:54:41 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] PID: "default", Status: reg Returned VLAN: (undefined), Role: default (pf::role::fetchRoleForNode)
Aug 30 13:54:41 hun400-33v pfqueue: pfqueue(7192) INFO: [mac:] setting VLAN at 10.51.1.18 ifIndex 10 from 199 to 1 (pf::Switch::setVlan)
Szerk:
Ip helper belove switchen, igy mar alakul a dolog!
https://i.imgur.com/d9EUIHb.png
Koszonom a segitseget!
- A hozzászóláshoz be kell jelentkezni
Vegere szuperul osszeallt.
Lett egy "registering" vlan, amibe minden beesik alapol (csak a packetfence servert erik el innen a node-ok semmi mast) ha ide bekerul egy gep, akkor vagy kezzel adom hozza a megfelelo rulehoz packetfence alatt (PLC-k, nyomtatok, stb...), vagy ha PC, akkor be tud az AD userevel loggolni (Rule alapjan (AD folder-re mutatva) a megfelelo vlan-ba is teszi egybol a login utan, pl "net" "no_net" "production" stb...)
Barmelyik switch barmelyik portjara dugom, "viszi magaval" a configot. A nem hasznalt portok kihuzas utan a registering vlan ba allnak vissza.
- A hozzászóláshoz be kell jelentkezni