oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Create PfSenseHttps model

Open glance- opened this issue 4 years ago • 7 comments

Pre-Request Checklist

  • [x] Passes rubocop code analysis (try rubocop --auto-correct)
  • [x] Tests added or adapted (try rake test)
  • [x] Changes are reflected in the documentation
  • [x] User-visible changes appended to CHANGELOG.md

Description

This adds a simple model to use the web ui on PfSense machines to download the configuration. I use this in situations where I use oxidized to backup config from remote PfSense machines where I only have access to the web UI.

This is a RFC. I'm probably abusing a lot of code here, and I should write both documentation and some explaining about the model but I'm throwing this out there for some early feedback.

glance- avatar Jun 10 '20 19:06 glance-

Codecov Report

Merging #2126 (aaa3011) into master (a36aece) will increase coverage by 0.04%. The diff coverage is n/a.

:exclamation: Current head aaa3011 differs from pull request most recent head 3c14cea. Consider uploading reports for the commit 3c14cea to get more accurate results

@@            Coverage Diff             @@
##           master    #2126      +/-   ##
==========================================
+ Coverage   63.28%   63.32%   +0.04%     
==========================================
  Files          30       30              
  Lines        1498     1497       -1     
==========================================
  Hits          948      948              
+ Misses        550      549       -1     
Impacted Files Coverage Δ
lib/oxidized/source/http.rb 40.81% <0.00%> (+0.81%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0eecddb...3c14cea. Read the comment docs.

codecov-commenter avatar Jun 11 '20 07:06 codecov-commenter

Oxidized offers an http input type which should support https. Is there any benefit to relying on mechanized directly instead of that input here?

wk avatar Jun 11 '20 15:06 wk

This is way more "scraping" than what the http input can do. This needs Mechanize to handle session cookies, csrf-tokens and such.

glance- avatar Jun 12 '20 09:06 glance-

Here is mechinize model: https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/cambium.rb

ytti avatar Jun 12 '20 11:06 ytti

I didn't see any sane way of using the existing @main_page / :login Mechanize functionally here , where I needed to set OpenSSL::SSL::VERIFY_NONE and a custom https-port. Also, I was a bit afraid of breaking the world if I tried to introduce those flags in http.

That was why I did it the way I did.

It's pretty easy to refactor this code if someone could point me in the right direction on how to get the http model working as needed.

glance- avatar Jun 17 '20 11:06 glance-

Please process the checklist

mortzu avatar Jan 26 '22 20:01 mortzu

Please fix the merge conflicts

mortzu avatar May 01 '22 02:05 mortzu

Now I've fixed the merge conflicts in the changelog file.

glance- avatar Nov 09 '22 13:11 glance-