Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffie-Hellman Group 20 is missing in config parser for Cisco IOS #7987

Closed
empusas opened this issue Feb 1, 2022 · 0 comments · Fixed by #7994
Closed

Diffie-Hellman Group 20 is missing in config parser for Cisco IOS #7987

empusas opened this issue Feb 1, 2022 · 0 comments · Fixed by #7994

Comments

@empusas
Copy link

empusas commented Feb 1, 2022

Device is a cisco router with IOS-XE version 15.5

Config section:

crypto map CMAP-CVG 10 ipsec-isakmp
 set peer 172.17.211.55
 set transform-set TS-CVG
 set pfs group20
 set ikev2-profile PROF-CVG 
 match address CVG-IPSEC

Error Message

org.batfish.common.BatfishException: Could not convert to DiffieHellmanGroup: group20\n\tat org.batfish.grammar.cisco.CiscoControlPlaneExtractor.convError(CiscoControlPlaneExtractor.java:1542)\n\tat org.batfish.grammar.cisco.CiscoControlPlaneExtractor.toDhGroup(CiscoControlPlaneExtractor.java:9397)\n\tat org.batfish.grammar.cisco.CiscoControlPlaneExtractor.exitCrypto_map_t_ii_set_pfs(CiscoControlPlaneExtractor.java:4182)\n\tat org.batfish.grammar.cisco.CiscoParser$Crypto_map_t_ii_set_pfsContext.exitRule(CiscoParser.java)\n\tat org.batfish.grammar.BatfishParseTreeWalker.exitRule(BatfishParseTreeWalker.java:42)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:30)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.batfish.grammar.cisco.CiscoControlPlaneExtractor.processParseTree(CiscoControlPlaneExtractor.java:9312)\n\tat org.batfish.job.ParseVendorConfigurationJob.parseFile(ParseVendorConfigurationJob.java:438)\n\tat org.batfish.job.ParseVendorConfigurationJob.parse(ParseVendorConfigurationJob.java:538)\n\tat org.batfish.main.Batfish.getOrParse(Batfish.java:2622)\n\tat org.batfish.main.Batfish.lambda$serializeNetworkConfigs$44(Batfish.java:2700)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n\tat java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:952)\n\tat java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:926)\n\tat java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327)\n\tat java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)\n\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\n\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\n\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\n\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\n\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\n

Code Segment from CiscoControlPlaneExtractor.java:

  private DiffieHellmanGroup toDhGroup(Dh_groupContext ctx) {
    if (ctx.GROUP1() != null) {
      return DiffieHellmanGroup.GROUP1;
    } else if (ctx.GROUP14() != null) {
      return DiffieHellmanGroup.GROUP14;
    } else if (ctx.GROUP15() != null) {
      return DiffieHellmanGroup.GROUP15;
    } else if (ctx.GROUP16() != null) {
      return DiffieHellmanGroup.GROUP16;
    } else if (ctx.GROUP19() != null) {
      return DiffieHellmanGroup.GROUP19;
    } else if (ctx.GROUP2() != null) {
      return DiffieHellmanGroup.GROUP2;
    } else if (ctx.GROUP21() != null) {
      return DiffieHellmanGroup.GROUP21;
    } else if (ctx.GROUP24() != null) {
      return DiffieHellmanGroup.GROUP24;
    } else if (ctx.GROUP5() != null) {
      return DiffieHellmanGroup.GROUP5;
    } else {
      throw convError(DiffieHellmanGroup.class, ctx);
    }
  }

Definition of DH Groups:

Diffie-Hellman groups 5,14,19,20, or 24 for encryption or authentication algorithms with a 128-bit key,
Diffie-Hellman group 21 for encryption or authentication algorithms with a key length of 256 bits or greater.

Diffie-Hellman group 1 - 768 bit modulus
Diffie-Hellman group 2 - 1024 bit modulus
Diffie-Hellman group 5 - 1536 bit modulus
Diffie-Hellman group 14 - 2048 bit modulus
Diffie-Hellman group 19 - 256 bit elliptic curve
Diffie-Hellman group 20 - 384 bit elliptic curve
Diffie-Hellman group 21 - 521 bit elliptic curve
Diffie-Hellman group 24 - modular exponentiation group with a 2048-bit modulus and 256-bit prime order subgroup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant