Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - BrianW

#1
19.1 Legacy Series / Re: CP Endpoints for White List
February 14, 2019, 09:11:16 PM
Thank you so much!

That did it.
#2
19.1 Legacy Series / Re: CP Endpoints for White List
February 13, 2019, 05:12:37 PM
Thank you for helping out the newb.

When I get https://10.15.1.227/api/captiveportal/settings/getzone/2dd820e7-0995-4174-8546-6fa66fb0bf5f

I get a big json object. If I post it right back to /setzone, no alteration, I get the error:

{"errorMessage":"Error at /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php:700 - strtolower() expects parameter 1 to be string, array given (errno=2)","errorTitle":"An API exception occured"}

I can pick out certain things and change successfully, like enable / disable, or description.

The relevant portion I would like to post is
{"zone":{"allowedMACAddresses":{"00:11:22:33:44:55":{"value":"00:11:22:33:44:55","selected":1},"aa:bb:cc:dd:ee:ff":{"value":"aa:bb:cc:dd:ee:ff","selected":1}}}}

but this generates the same error.

I can send
{"zone":{"allowedMACAddresses":"aa:bb:cc:dd:ee:ff"}}

Which works, but, expectedly, this replaces any MAC addresses on the list.

Thanks
#3
19.1 Legacy Series / Re: CP Endpoints for White List
February 08, 2019, 06:26:30 PM
Thanks. I don't know why I didn't think to examine the result of a get first. Exploring it now.

b.
#4
19.1 Legacy Series / Re: CP Endpoints for White List
February 07, 2019, 10:56:04 PM
Thank you. I am aware of that documentation, but it is rather sparse.

The only endpoint that makes sense to me for this purpose would be api/captiveportal/settings/setzone/ (I have acquired the uuid with searchzones).

I know that I should be including a JSON object in the body of the request, but there's nothing to indicate what it should contain. I've tried what seemed meaningful values for this and other endpoints, but the only response I ever receive is {"result":"failed"}

Is there more comprehensive documentation for the API, or somewhere that would give me an idea of what my JSON object should contain?

Thanks
#5
19.1 Legacy Series / CP Endpoints for White List
February 07, 2019, 06:52:54 PM
Can anyone point me to the endpoints for getting, adding, and deleting MAC address to the CP white list via the API?

Thanks
#6
19.1 Legacy Series / Re: API via Ruby
February 07, 2019, 04:35:18 PM
Awesome! That did it. Here's the code that works for any interested...

require 'net/http'
require 'openssl'
require 'json'

uri = URI('https://10.15.1.227/api/captiveportal/service/searchtemplates')

request = Net::HTTP::Get.new(uri)

request.basic_auth '123', 'abc'

result = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
http.request(request)
end

puts result.body
#7
19.1 Legacy Series / Re: API via Ruby
February 06, 2019, 10:08:06 PM
I've tried with and without http.verify_mode = OpenSSL::SSL::VERIFY_NONE with the same result.

Thanks
#8
19.1 Legacy Series / [solved]API via Ruby
February 06, 2019, 06:29:07 PM
I am running OPNsense 19.1.1 and attempting to access the API via Ruby

This code snippet:

require 'net/http'
require 'openssl'
require 'json'

uri = URI('https://10.15.1.227/api/captiveportal/service/searchtemplates')

request = Net::HTTP::Get.new(uri)

request.basic_auth '123', 'abc'

result = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.request(request)
end

puts result.body


produces the error:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I have confirmed that the key and secret are correct.

Am I doing it right?

Thanks
#9
18.7 Legacy Series / Re: MAC Authentication via RADIUS
January 22, 2019, 10:36:29 PM
That may work...

Thank you for your assistance.
#10
18.7 Legacy Series / Re: MAC Authentication via RADIUS
January 22, 2019, 08:57:30 PM
Thank you.

What I would like to happen is for OPNsense to check my RADIUS server with the MAC address of the device.

If not authenticated, redirect to our portal for sign up / activation.

I can use CP to redirect to our portal, but how do I tell OPNsense to check our RADIUS server first before invoking the CP.

Thanks,

Brian
#11
18.7 Legacy Series / Re: MAC Authentication via RADIUS
January 22, 2019, 04:27:52 PM
Thanks. I've gotten this far. If I use the default captive portal, I can key in the MAC address in the username field and it authenticates, but I do not want users to see this screen if their device has previously been authenticated.

Ideally, an authenticated device gets immediate Internet access. They should never see the captive portal. If it is not authenticated, they are redirected to my website where they can purchase service or authenticate with an activation code provided when they purchased service. This adds their MAC address to the RADIUS server.

Thanks,

Brian

#12
18.7 Legacy Series / MAC Authentication via RADIUS
January 21, 2019, 09:24:30 PM
I am running OPNsense 18.7.10-amd64.

I would like to authenticate users with MAC address via RADIUS or roll to a capture page if not authenticated.

Can this be done with OPNsense? Can someone point me in the right direction?

Thanks,

Brian