-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
ASA Template: Object-Groups Getting Mixed Up #55
Comments
Hi, Try this template:
it gives these results:
Key difference is using dynamic path to encode object type as well:
In you original template lines
matched under
which translates to same regular expression. TTP processes top |
…een words, now instead of matching '\\ +' only TTP accounts for tabs between words as well '[ \t]+'
That makes sense, and I can actually see where I could use more dynamic pathing for some other templates. Thank you for taking the time to create that and explain it! |
Quick follow-up: is possible to combine matched items into a new object? For example, objects in ASA configs can also appear as IPs and subnets:
So I create a template item under the group like this:
But what would be really nice for my purposes is to concatenate Ideally, I would be able to add a backslash to have an IP in full CIDR notation like this: 192.168.168.1/24. Is that possible? I haven't yet found documentation on something like this yet. |
Have a look at to_ip function
|
That's perfect. Thank you. That said, in general is it possible to concatenate matches? |
There is |
I'll check that out. Thanks again. |
I might have closed this early. I can't seem to make this work.
Using this input:
I put the above template into this template:
I get an error from the Python ipaddress module:
What I don't understand is why Once again, appreciate your help with this. Definitely learning a lot about |
Was able to get the IP prefix to work by adding a variable with a regex pattern of words to exclude, then using that in the template to exclude. Is this the right approach?
|
Yes, that one of the options. You need to apply match filtering here, either using regexes or pattern check, for instance this should do the trick as well |
I echo what @consentfactory is saying.. i have learnt a lot from this thread.. @consentfactory : are you able to share the final template that you are using? |
@SudarshanVK would you mind sharing more info on these:
|
Yes, I have a template for the ASA, but I can't share it yet due to a project I'm working on. I'll update this thread with it when I upload the template*. |
@dmulyalin : i am not able to share the configuration file unfortunately. But, here is the template i am using so far. PS: I started looking into TTP only 4 days ago.
|
@SudarshanVK That template of yours is quiet sophisticated, looks like you picked up quiet a bit of TTP so far. What is the problem with above template, what exactly does not work in it for you? Also, would strongly advise against sharing any actual devices configs here, good idea is to anonymize them before doing so. Will need sample data with template and desired results structure to help with building the template, without it cannot do much apart from general advice. If you Guys finish doing the template for ASA, mind to think about contributing them to TTP Templates repo, if you think that it would be good for other people to benefit from your work. structure that would be easy to output to a spreadsheet - that structure should be a list of dictionaries in that case, make sure to align your templates toward that format. |
@dmulyalin i have a 80 context firewall to migrate.. I am still developing the template and absolutely i am keen to share it with everyone once i have everything working.. I might reach-out over here in case i run into issues with the rest of the configuration that I am trying to Parse... Thank you thus far... |
I would be more than happy to help contribute to the templates. That said, the most difficult problem I face with ASA configs is the access-list configurations. I'm not sure if there are issues with the way my template is written (possible), or if the configs are just that complicated because there are lots, and I mean lots, of variations in how the configuration can be written, and I'm not sure I've captured all of them ( I think I have ~100 lines of variations, not including another set of lines that append these lines with 'log debugging'). Would be great to open-source that for someone else to take a look and improve them. |
Here is the ASA template I've put together: |
@consentfactory I'm having some errors trying to load your template. This is even before I pass it any configs to parse.
The resulting error:
Any ideas? |
^Ignore. I closed my laptop up for the day and went home. Once home, I re-did everything and it is all now working. 🤷 Operator error? possibly. |
Have a strange issue with an ASA template that I suspect is likely related to my template, but I'm unsure.
The gist is that I'm trying to get service and network object-groups into json, and generally they work, but I seem to have this issue where network group-objects end up in the service group objects.
Any tips on what I'm doing wrong (and how to improve it) would be great. Thanks in advance.
The code:
The text was updated successfully, but these errors were encountered: