Doing a blanketblockofahofPort 22 maynotreallymaking a lotofsenseinthesecurity.
Theworldofsecurity, basically, withtheideas.
Ifyou'regoingtodo a blanketblockof a service, well, thenwhynotsimplyremovethatservicefromyourserver?
Ifyou'regoingto a blanketblockofssshforeverybodyintheentireworldcomingoverthroughthenetwork, thenthequestionis, Well, whydon't youjustdisablethat s s a serviceorsimplyuninstalledtheSSservicewherethefirewallreallybecomespowerfulisbecauseyoucangoinandyoucanspecifythingssuchascertain I P addressesareabletohaveaccesstoserveimportsorevencertainentiresubnetscanhaveaccesstocertainports.
Nowyoudon't wanttodo a blanketblockofsshhbecauseifyouhavetoremotelyadministeryourserverandyoublockall I P addressesfrombeingabletoremoteremotelyadministeryourserver, thatmeansyou'lldefactonotbeabletoconnectit, sir.
Sothat's notgood.
Butyoudon't necessarilywant S H tobeopentotheentireworldbecausethepeopleinChina, Norwayandwho's BeccaStanwilltrytobetryingtohackintoyoursystem.
Sooneofthingsthatyoucandealwith U of W.
Isyoucansay I wantmyspecific I P addresstobeabletoaccessSSeightontheserver, butliterallynobodyelse.
Sothismaybevaluable, especiallyin a businessenvironmentsuit.
Let's sayyouhave a serverroom.
Youknow, a fewLennoxPottsisrunningthatserverroomandyouwanttobeabletosshhendtothoselegsboxesagainjusttodobasicadministration.
Take a lookatbasiclogfiles.
Well, whatyoucandioisyoucanallowaccessforyourspecific I p addresstouse s s saketothoseLennoxboxes.
Sothatallowsyoutobe a bitremotelyadministerthosesystemsevenwithinthewithinthebuilding.
Butagain, peoplefromtheoutsideworldorother I p addressesinthebuildingthatliterallywillnotbeabletoaccessthe S s exports.
Sowhat I'm goingtoshowyouhowtodotodayis I'm goingtoshowyouhowtoenableyouhave w on a bondtoagainyouhave w comeswithyourbondtoyousoyoudon't evenhavetoinstallit.
I'm goingtoshowyouhowtolookatthestatusof U F.
W.
I'm goingtoshowyouhowtoaddrulestoo.
Youhave w deleterulesfrom U F W andbasicallygiveyoutheoverofviewofhowtousethisintherealworld.
Now, oneofthethingsthat I hadtodoinordertomaketheeyepiecespecificrulesactuallyworkonthevirtualmachinethat I'm showingyouis I actuallyhadtouse a hardwiredconnection.
Soagain, I useahMacoperatingsystem.
I havevirtualboxinstalledonthatMacoperatingsystem.
Andthen I haveyoubeentowithin a virtualmachinewithinvirtualboxnowsomethingthatwasveryinterestingwithus.
Andagain.
Oneofthoseweirdquirksinthenetworkingworldisif I allowedeverybodyintheworldtoehaveaccessto a certainportwhen I wasonmyWiFiconnection.
Sobasically I usedWiFi, and I simplyusethebrakeadapterwithinvirtualboxtouseWiFi.
Sowhen I usemyWiFinetworkingcardwithinmyMacbookPro, um, and I allowedeverybodyaccesstocertainimport 22 21.
TheweirdpartWaasisthatif I specified a specific I P addresses.
So I said, I onlywantthis I P addresstobeabletoconnecttotheLenoxserverforthisparticularpork, and I wasusingtheWiFinetworkhardintheMacbookProthatliterallydidnotwork.
Tothevirtualmachine, itdidnotworkatallWhat I found.
I honestly I'm notsurewhy, Butwhen I use a thunderbolt, a wirednetworkconnectionand I startusingthatasthenetworkcardforthatbridgedadapterinthevirtualmachine, thenallofus, when I typedinthespecific I p addressthenthatactuallydidwork.
SothisisjustsomethingtorealizeIfyou'reusing U F W onitsownboxes, youhaveyourownphysicalserver.
Youinstallloopontoontothatphysicalserverandthenyoustartplayingaroundwith U F.
W andnetworking.
Youshouldhavenoissuesatall.
I willtellyouifyou'redoingthesedemonstrations.
Ifyou'redoingtheselabsin a virtualizedenvironment, especiallyonceyoustartdealingwiththefirewallsandspecificrulesandfirewalls, youmayhavetodosomeadditionaltroubleshootingtotrytofigureoutwhatthehellisgoingon.
And I can't necessarilytellyouwhatalltheanswers, maybebecause I'm sittingheretalkingintoagain.
Soanyways, withthat, let's goovertothecomputerandwe'llgowiththisdemonstrationand I'llshowyouhowyou F W workson a bun.
SohereweareatmyMacbookproagain, as I thoughtaboutbefore, I havevirtualboxinstalled.
I justwanttogoovertothesettingsfor a secondshow.
Youclickhereonsettingsforthevirtualmachine.
Wegoovertothenetwork.
Wecannowseethat I stillhavethebridgedidafter, Sothisisstillthebridgedidaftersettingthat I'vebeenusingfortheselastfewdemonstrations.
Butifwegodownheretothename, wehave a thunderbolt, eh?
FernetversustheWiFi.
Soagain, formetobeabletodothedemonstrationsthat I'm showingyoutoday, I needed a hardwirenetworkconnectionIf I triedtousetheWiFiandafterfortheBridgetadapter, itjustitjustfailedout.
I reallyhonestlycan't tellyouwhy.
Sothismightbesomethingyouhavetogointrouble.
Shoot.
Soifyou'rehavingissues, trytodouse a wirednetworkconnectionunderbrakingadapterandseeifthatworksforyou, eh?
Ifyou'reusingScentOSoranotherLennoxdistribution, youcanliterallyjustyoucaninstallyou f w andtheneverythingelsethat I showyoushouldwork.
Letmelogin.
We'regonnagotoBob.
And 123456 on.
We'regoingtohit, Enterandwe'rehere.
Soletmeclearthescreen.
Andtherewego.
Sohereweareatthestandardcommandline.
Now, oneofthingsthat I wanttodois I justwanttobringupfilesillahere.
Sojusttokindofshowyoufromfrom a networkingstandpointtoshowyouhowthisworks.
EsoCurrently I canputin 10 014 Thatisthe I.
P.
Addressofthesoupontheserver.
I canputinthenameBob.
I putin a password.
123456 AndsothisisthewholeFTPsetup.
But I did a differentdemonstration.
I canYouquickconnectisgonnaaskme.
It's notsecure.
I'm justgoingtosayOK, thisis a labenvironment.
Okay, sonowwecanseethat I wasabletoconnecttothetotheFTPserver.
Nobigdeal, Noproblem.
Sothereisnofirewallatthispoint.
I canconnect s.
Sothenwhatwe'regonnadonowiswe'regonnadosudososuperuserdoandthen I justwanttocheckthestatusof U F W sousedputin U F W.
Andthenwecanaskwhatthestatusof U F.
W isputinthepasswordon 23456 Andwecanseethatthestatusfor U.
F.
W iscurrentlyinactive.
Sorightatthispoint, I havenofirewallrunning.
Sossshworksperfectly.
FTPworstperfectplay.
Anyothernetworkservicethat I wouldputonthesuitbonetoboxwouldfunction.
I wouldn't havetodoanyfurtherconfigurations, butwe'reworriedaboutsecurityhere, solet's actuallyenableyou f w Sowhatwe'regonnadoisgonnadosuperUser D'oh!
Doyouhave a W?
Andthenit's simply a again.
Wedonothavetoinstallyou f w atall.
It's alreadybuiltinThioto 18.4.
Thenwe'regonnahitenter.
Andsonowfirewallisactiveandenabledonthesystem.
Ifwegobackhereandifyou'requickconnectagain, wecanseeistryingtoconnectuphereandbasicallyitisnowfailingoutbecauseyou f W isnowrunningUgoanduse a differentusername.
Sothedefaultwhenyouturnon a u f w isdenyallincoming.
Sothisisveryinboardrightofyou.
Ifyouhave a webserverandyouenableyouhave w knowwhat, he's goingtobeabletogettothatwebserveruntilyoustartallowingpoor 80 toactuallyhaveaccesstothewebsite.
SothisisoneofthewaysthatyoucanscrewyourselfupReallybadisyoudecidetosecureyourLennoxbox, youenableyouhave W.
Ifyouhave S S h andftpanSMTPandhttp, allthosenetworkingprotocolsyouhavetogoinandyouactuallyhavetospecificallyallowthosesothatpeoplecanhaveaccessfromtheoutsideworld.
Soagain, thisisimportantthingtothinkaboutFrom a securitystandpoint, thisliterallymeansanybodythathas a networkconnectionthatcanactuallygettoyourserveroverthenetwork.
Youhave a Webserverthatyouwantpeopleinyourcompanytoehaveaccessto.
Butyoudon't wantpeoplefromtheoutsideworldhaveaccesstosobasically, youcoulddomoreorlessthesame A cup a cup, man, thatlooks a lotthesameandallowaccessforanentiresubnetto a particularpork.
Soagain, let's sayPort 22 again.
Sowe'regonnadoisgonnasay, SuperuserdoSoo, doyou f w you'regonnasayallowAndthenwe'regonnasayfromAndnowherewe'regoingtogive a subnet.
We'regonnagive a networkinsteadof a specific I p address.
Andsowe'regonnasay 10 0.0 dot 1.0.
Soagain, soforthewholesubnet.
It's gonnabezero.
You'renotgonnaput a specific I P addresshere.
Thenyou'regoingtoforwardslashandthenyou'regoingtogivewhateverthesubjectmaskit's soifit's a Class C, it's a slash 24.
It's a Class B is a slash 16 ofhisclass A.
It's a slasheight, andyouweredoingsomewackyassomethingthat, eveninyourenvironment, willbe a slashhowevermanyoctetyou'reusinginordertocreateyoursubnetmaskfromtherejusttodoinanyport 22 justlikewedidbefore.
So, basically, thisisthedifferencebetween a specific I p addressand a subnetmask.
Soyoudo 10.0 that 1.0 thatrepresentsthisentirenetworkat a slash 24 toanyport 22 wehit.
EnterRuleadded, wegobacks, youdo, uh, w statusforboatsandwetake a look.
Andokay, sonowwecanseeagainpoor 20 tothespecific I P addressesareabletohaveaccessonthenforport 22.
Youcanalsodoforthisentiresubnetrightnow.
Beyondthat, insteadofputting a specificpoor, youcanalsousethenameoftheservicethatyoudohavetoknowwhatthenameoftheservice's s.
Solet's saywewanttoallowaccesstoFTP.
Soinsteadofsayingport 21 wesimplywanttosay F T P s.
YoucoulddoSueDioOh, you f w allow.
Andtheninsteadofsaying a specificpoor, wecansimplyputFTPherewecanhit, enterTherulehasbeenadded.
Wegobackandwetake a lookatthestatusagain, andnowwecanseetheport 21.
Sothesethesehavebeenaddedhere, Sothat's that's usingFTPinsteadofusingtheactualportnumber 21 youcanusethatfor f D.
P canusethatforSSeight.
Youcanusethatforhttp, I wouldargue, especiallyifyou'renew.
Youliterallydon't have a keyboard, youdon't have a mouse, youdon't have a monitor.
Plugintoit.
It's justoffseatingand 1/4 somewhereandthenusesomethinglike s S h anFTPtogo.
Andactually, Minister, it s Oh, that's a greatThat's a greatthingabouttheLenoxworld.
Butifyoudon't lockdownas a sage, ftp, whateverotherprotocolswereusingwithsomethinglike a firewall, thatcouldbeanabsolutelymassivevulnerabilityforyoursystem.
Andso, byusingthefirewall, thisis a waytogiveyourselfremoteaccesstothesystem, butthenalsotryingtolockdownthesecurity a littlebit.
Youknowwhat I showedyouwith U F W Ifeverythingisworkingouthowit's supposedtowork, ifyournetworkisworkinghowit's supposedtowork, alltheroutingisdoingwhatit's supposedtodiothenlearningyou f w shouldberelativelysimple, right?
Basically, you'rejustusing I P addresses.
Hereyouhave a have a basicunderstandingofsubnetmasksand, youknow, figureoutwhattheportnumbersare.
ifyoudon't have a networkthat's workingperfectlycorrectly, orifyou'rerunningintosomecourtsagaininordertoshowyouthedemonstrationthat I showedyoutoday, forwhateverreason, whateverreason, I hadtoconnectmyThunderboltNetworkadapterintomymouth.
Butproconnectedhardwiredtothephysicalnetwork.
Andthenonce I didthat, thenthespecific I P addressruleswouldwork.
But I'm tellingyou, before I didthatwhen I wasusingmywife, I, asthebrigadapterforthisvirtualmachineagainif I openedthepoorcompletelytotheentireworld, if I didallowfor 22 that's all I didthatthatworkedfine.
Allmycomputerswereabletoaccessthevirtualmachineassoonas I saidallowfrom, youknow, whateverthe I P addressestothespecificporkwheneveryouhadthatspecific I P addressorspecificsumthatmaskinthere, itjustsimplywouldnotworkwhen I usethebrakesadapterformywirelesscard.
Andsoitonlyworksif I usedthehardwireconnection.
SothisiswherewestartgettingintotheworldwhereThebasicconceptofwhat I'm showingyouissimple, andyoucanexplainit a coupleofminutes.
Butifyoustarthavinganyproblemsthattherehastobeanykindoftroubleshooting, that's wherethingscanget a littlebitcomplicated.
Andthat's whyyouhavetohave a broaderviewoftechnologyenvironment.
Youknowwhat a suddenthatmaskishowtofindthesetypesofthingsbecauseinordertogoanyfurther, youwillhavetobeabletoknowthatinformationandbeabletodoyourowntroubleshootingtofigureoutwhysomethingisn't working.
Butanyways, youhave.
W itselfisprettysimple.
Thereareotherfirewall.
There's otherfirewalloptionsoutthere, butthisis a nice, basicsimpleonethatthatyoucanuse, especiallyinthebeginning, whenyou'rejusttryingtospendsomethingupandplayaroundwithit.