ThomasWalpuski
TranslatedintoEnglishbyMikevanOpstalmvanopst@cs.umd.edu Forthefundamentalunderstandingofthispaper,knowledgeofIPsecisnotmandatory, butneverthelesshelpful.Asanintroductionit’srecommendedtoread: http://www.informatik.uni-bremen.de/grp/ag-sec/Seminar/WS00/ipsec.ps.ThefollowingpaperdescribesindetailtheconfigurationofanIPsecHost-to-Host connectionbetweenOpenBSDandWindowsXPProfessionalwithAuthenticationviaX.509v3Certificates.AVPNcanbeimplementedwithsimplemodifications.WindowsXPProfessional’sIPsecimplementationcorrespondsapproximatelytothatofWindows2000ProfessionalwiththeHighEncryptionServicePack(3DES).Mostsectionsofthispaper’sdescriptionscanalsobeusedwithWindows2000Professional. 1Preparation Beforewecanreallybeginwiththeconfiguration,wemustfirstproducethenecessaryRSAkeysandcertificates. 1.1RSA-KeyandCertificatefortheCA IfnoCertificateAuthorityisavailabletobeused,thefirststepistocreatetheRSAkeysfortheCA. #opensslgenrsa-out/etc/ssl/private/ca.key1024GeneratingRSAprivatekey,1024bitlongmodulus...............................++++++....++++++ eis65537(0x10001 ThenyouneedtocreateaCSR(CertificateSigningRequest)forthis. #opensslreq-new-key/etc/ssl/private/ca.key-out\\>/etc/ssl/private/ca.csr Usingconfigurationfrom/etc/ssl/openssl.cnf Youareabouttobeaskedtoenterinformationthatwillbeincorporatedintoyourcertificaterequest. WhatyouareabouttoenteriswhatiscalledaDistinguishedNameoraDN. TherearequiteafewfieldsbutyoucanleavesomeblankForsomefieldstherewillbeadefaultvalue,Ifyouenter’.’,thefieldwillbeleftblank.----- CountryName(2lettercode)[]:DE StateorProvinceName(fullname)[]:ThuringiaLocalityName(eg,city)[]:Jena OrganizationName(eg,company)[]:IPsecLabs OrganizationalUnitName(eg,section)[]:CertificationAuthorityCommonName(eg,fullyqualifiedhostname)[]:ca.ipseclabs.orgEmailAddress[]:ca@ipseclabs.org Pleaseenterthefollowing’extra’attributestobesentwithyourcertificaterequestAchallengepassword[]: Anoptionalcompanyname[]: ThisCSRwillbesignedwiththekeythattheCSRcreated. #opensslx509-req-days365-in/etc/ssl/private/ca.csr\\>-signkey/etc/ssl/private/ca.key-out/etc/ssl/ca.crtSignatureok subject=/C=DE/ST=Thuringia/L=Jena/O=IPsecLabs/OU=CertificationAuthority/CN=ca.ipseclabs.org/Email=ca@ipseclabs.orgGettingPrivate 1.2RSAKeys,Certificates,etc,fortheHosts FirstanRSAkeymustbecreated.Inourcasethekeymustbe1024bitslong,sinceas farasIknowWindowsXPcanonlydealwiththatlength. #opensslgenrsa-outlocal.key1024 GeneratingRSAprivatekey,1024bitlongmodulus .........................................................................++++++.++++++ eis65537(0x10001)ForthiskeywecreateaCSR.Thefieldsshouldbefilledoutbasedonanagreeduponconvention.Thiswillsaveyouproblemslater. #opensslreq-new-keylocal.key-outtyr.csrUsingconfigurationfrom/etc/ssl/openssl.cnf Youareabouttobeaskedtoenterinformationthatwillbeincorporatedintoyourcertificaterequest. WhatyouareabouttoenteriswhatiscalledaDistinguishedNameoraDN. TherearequiteafewfieldsbutyoucanleavesomeblankForsomefieldstherewillbeadefaultvalue,Ifyouenter’.’,thefieldwillbeleftblank. CountryName(2lettercode)[]:DE StateorProvinceName(fullname)[]:ThuringiaLocalityName(eg,city)[]:Jena OrganizationName(eg,company)[]:IPsecLabs OrganizationalUnitName(eg,section)[]:NetworkingCommonName(eg,fullyqualifiedhostname)[]:tyr.networking.ipseclabs.org EmailAddress[]:root@tyr.networking.ipseclabs.orgPleaseenterthefollowing’extra’attributestobesentwithyourcertificaterequestAchallengepassword[]: Anoptionalcompanyname[]: DenCSRlassenwirnunvonderCAsignieren. #opensslx509-req-days365-intyr.csr-CA\\>/etc/ssl/ca.crt-CAkey/etc/ssl/private/ca.key\\>-CAcreateserial-outtyr.crtSignatureok subject=/C=DE/ST=Thuringia/L=Jena/O=IPsecLabs/OU=Networking/CN=tyr.networking.ipse clabs.org/Email=root@tyr.networking.ipseclabs.orgGettingCAPrivateKeyWhenweusethisontheOpenBSDside,wemustaddasubjectAltNameextentiontothecertificatewithcertpatch.ThisshouldconfigureanIPaddress,FQDN,oraUFQDN.Inoursituation,we’readdinganFQDN. #certpatch-tfqdn-ityr.networking.ipseclabs.org\\>-k/etc/ssl/private/ca.keytyr.crttyr.crt Readingssleaycreatedcertificatetyr.crtandmodifyit CreatingSignature:PKEY_TYPE=RSA:X509_sign:128OKAYWritingnewcertificatetotyr.crt FortheWindowsXPHostwemustalsoaddaPKCS-12Bundle. #opensslpkcs12-export-intyr.crt-inkeylocal.key\\>-certfileca.crt-outtyr.p12EnterExportPassword: Verifyingpassword-EnterExportPassword:Theproceduremustnowbeexecutedagainforthereceiving station.OntheOpenBSDsideit’snotnecessarytocreatethePKCS-12Bundle. #ls-l/etc/isakmpd/* -rw-------1rootwheel1744Jan3018:34/etc/isakmpd/isakmpd.conf-rw-------1rootwheel128Jan2817:14/etc/isakmpd/isakmpd.policy/etc/isakmpd/ca:3 total2 -rw-------1rootwheel1001Jan2818:00ca.crt/etc/isakmpd/certs:total8 -rw-------1rootwheel1119Jan2818:06heimdal.programming.ipseclabs.org.crt -rw-------1rootwheel1094Jan2818:05tyr.networking.ipseclabs.org.crt/etc/isakmpd/keynote:/etc/isakmpd/private:total2 -rw-------1rootwheel887Jan2818:00local.keyThecertificateoftheWindowsXPHostsdoesnothavetobeavailable,becauseforsomereasonisakmpdcannotdetectit,soitmustbetransferredusingthemainmodebyWindowsXP. #cat/etc/isakmpd/isakmpd.conf[Phase1] 10.0.0.3=ISAKMP-peer-tyr[Phase2] Connections=IPsec-heimdall-tyr[ISAKMP-peer-tyr]Phase=1 Transport=udp Local-address=10.0.0.1Address=10.0.0.3ID=FQDN-heimdall #WindowsXPdoesn’tsendit,likePGPnet #subjectAltName,insteadofthe‘normal’Subject#Certificates.Meaningyoucan’tuseRemote-IDhere#Remote-ID=FQDN-tyr Configuration=Default-main-mode[FQDN-heimdall]ID-type=FQDN #Itsnecessarytomakesurethatthecertificatescan#befoundexactlythesameasthenames(+.crt)inthe#certs/directory. Name=heimdal.programming.ipseclabs.org#s.o. #[FQDN-tyr]#ID-type=FQDN 2ConfigurationoftheOpenBSDHosts #Name=tyr.networking.ipseclabs.org[IPsec-heimdall-tyr]Phase=2 ISAKMP-peer=ISAKMP-peer-tyr Configuration=Default-quick-modeLocal-ID=Host-heimdall4 Remote-ID=Host-tyr[Host-heimdall]ID-type=IPV4_ADDRAddress=10.0.0.1[Host-tyr] ID-type=IPV4_ADDRAddress=10.0.0.3[Default-main-mode]DOI=IPSEC EXCHANGE_TYPE=ID_PROTTransforms=3DES-MD5[Default-quick-mode]DOI=IPSEC EXCHANGE_TYPE=QUICK_MODE Suites=QM-ESP-3DES-MD5-SUITE[3DES-MD5] ENCRYPTION_ALGORITHM=3DES_CBCHASH_ALGORITHM=MD5 AUTHENTICATION_METHOD=RSA_SIGGROUP_DESCRIPTION=MODP_1024 #cat/etc/isakmpd/isakmpd.policyKeyNote-Version:2Authorizer:\"POLICY\" Licensees:\"DN:/C=DE/ST=Thuringia/L=Jena/O=IPsecLabs/\\OU=CertificationAuthority/CN=ca.ipseclabs.org/\\Email=ca@ipseclabs.org\" Conditions:app_domain==\"IPsecpolicy\"&&esp_present==\"yes\"&&mnesp_enc_alg!=\"null\"&& remote_id_type==\"ASN1DN\"&& remote_id==\"/C=DE/ST=Thuringia/L=Jena/\\O=IPsecLabs/OU=Networking/\\ CN=tyr.networking.ipseclabs.org/\\ Email=root@tyr.networking.ipseclabs.org\"->\"true\"; 3ConfigurationoftheWindowsXPHosts TheconfigurationofIPsecandcertificatebasedconnectionsaredoneinWindowsXPwithsnap-instotheManagementConsole(mmc).StartmmcatStart/Run… PressControl+MtobringuptheAdd/RemoveSnap-Insmanager.SelectAdd,andselecttheIPSecurityMonitor,IPSecurityPoliciesforthelocalcomputer,andCertificatesforthelocalcomputer. It’srecommendedthatyousaveyourconsolesettingsbypressingControl+S.RightclickingonIPSecurityPoliciesonLocalComputerbringsupamenu,fromwhichselectCreateIPSecurityPolicy. TheIPSecurityPolicyWizardshouldstart.InthiswizardwechooseameaningfulnameforthenewIPSecurityPolicy(suchasIPsecConnectionbetweentyrandheimdal).DeselecttheActivatetheDefaultResponseRuleoption.AtthecompletionofthewizardselectEditProperties,andthenFinish.NextweaddanewIPSecurityRule.ThiscreatesafilterforalltrafficfromourIPaddress(10.0.0.3)tothereceivingstation(10.0.0.1).SelectAdd(makesurethatoptionsforwizardareturnedoff),andselectAddagaintocreateanewIPFilterlist,andAddanewfilter.Thefilterwillnotworkunless“Mirrored.Alsomatchpacketswiththeexactoppositesourceanddestinationaddresses”isdeselected. ThenselectRequireSecurityasFilterAction. EditthedefaultAuthenticationmethodto“Useacertificatefromthiscertificationauthority”,andselectthecertificatefromourCA. AstunnelterminatingpointweconfiguretheIPAddressofthereceivingstation(10.0.0.1) Afterwehavefinishedthecreationofthefirstrule,wecreateasecond.Inthisruleweconfigurethefilterfromtheendpointtoouraddress,andgiveourIPaddressasthetunnelterminationpoint. 4TestoftheConfiguration OntheOpenBSDhoststartisakmpdindebugmodewiththeoption–L,whichwritestheIKEprocessin/var/run/isakmpd.pcapWithhelpfromtcpdumpyoucangetitinahumanreadableformat.#isakmpd-d-L TotesttheconnectiongotoStart/Run,andrunthecommandprompt(cmd)andpingthedestination. Iftherearenoproblemsyoucansettheisakmpd_flagsin/etc/rc.confto“”. 因篇幅问题不能全部显示,请点此查看更多更全内容