Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Thu Apr 18, 2024 1:14 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Jan 16, 2008 12:41 pm 
Offline
Newbie

Joined: Wed Jan 02, 2008 12:33 pm
Posts: 23
Hey,

Some of our computers in our office are actually setup behind a firewall from the rest of the office, running on one of our customer's LAN. As such, we can't audit them from our 'open audit server' per se. I did not want to expose our Open-Audit installation to the world either, so I decided to use our reverse-proxy server and expose JUST the relevant "add" page so audit.vbs could submit its changed. Simple enough, right? I should also mention here that our reverse proxy server is used to server HTTPS content, using our own "root", self-signed certificate. It's only for us, so no reason to give any money to Verisign for this.

Turns out the submit code in audit.vbs doesn't like these certificate errors. To fix this, I had to change the following code:

[code]
if online = "yesxml" then
url = non_ie_page
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Call objHTTP.Open("POST", url, FALSE)
objHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
if utf8 = "y" then
objHTTP.Send "add=" + urlEncode(form_total + vbcrlf)
else
objHTTP.Send "add=" + escape(Deconstruct(form_total + vbcrlf))
end if

' if verbose = "y" then
' WScript.Echo(objHTTP.ResponseText)
' end if
end if
[/code]

to

[code]
if online = "yesxml" then
url = non_ie_page
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.SetOption 2, 13056 ' Ignore all SSL errors
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
if utf8 = "y" then
objHTTP.Send "add=" + urlEncode(form_total + vbcrlf)
else
objHTTP.Send "add=" + escape(Deconstruct(form_total + vbcrlf))
end if

if verbose = "y" then
wscript.Echo "XML sent to server: " & objHTTP.status & " (" & objHTTP.statusText & ")"
end if
end if
[/code]

That's it. (The change looks scarier than it is -- it's just two lines, really, but I've also changed the output to show the status response from the server, which was sorely missing)

Hope this helps someone out there.

Steph


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 16, 2008 9:45 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
I like this idea, how exactly does the reverse proxy work, (what is it, and how have you limited access to just the OA add page).

I assume the change you have made doesn't break the standard submit dialog, in other words I can use it universally, i.e. both locally and through the proxy.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 16, 2008 9:53 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
That seems to work a treat... added at SVN 951.

I would still like to know how your reverse proxy idea works though. :D

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 16, 2008 10:53 pm 
Offline
Open-AudIT Fellow

Joined: Thu May 17, 2007 5:47 pm
Posts: 568
Location: Italy
[quote="A_Hull"]That seems to work a treat... added at SVN 951.

For me it's not posting data: to make it working, I had to revert to the original object
[code]
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
[/code]
The OA site uses SSL on IIS6 (2K3 SP2) and a wildcard self-signed certificate.

_________________
Edoardo


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 16, 2008 11:02 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
[quote="ef"][quote="A_Hull"]That seems to work a treat... added at SVN 951.

For me it's not posting data: to make it working, I had to revert to the original object
[code]
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
[/code]
The OA site uses SSL on IIS6 (2K3 SP2) and a wildcard self-signed certificate.

Would this work in all cases?

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 17, 2008 2:35 am 
Offline
Contributor

Joined: Fri Sep 28, 2007 12:07 am
Posts: 189
[quote="A_Hull"][quote="ef"][quote="A_Hull"]That seems to work a treat... added at SVN 951.

For me it's not posting data: to make it working, I had to revert to the original object
[code]
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
[/code]
The OA site uses SSL on IIS6 (2K3 SP2) and a wildcard self-signed certificate.

Would this work in all cases?

Has/will this been corrected in SVN?

Jason

_________________
OA Deployment:
Windows 2003 with XAMPP install
80 Windows Servers
250 Windows workstations (mixed XP and 2000)
5 MACs
Multiple printers, switches, routers, firewalls, and other servers (ESX, AIX etc.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 17, 2008 2:46 am 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
If I dont receive confirmation this second change works for both cases, I may have to revert back to the previous version, as this works for most of us.

Meantime, SVN 952 contains the second change, try it please..

If I haven't had a reply by mid day tomorrow, I will revert back... seems fair to me. :?

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 17, 2008 5:44 pm 
Offline
Open-AudIT Fellow

Joined: Thu May 17, 2007 5:47 pm
Posts: 568
Location: Italy
In my case, the current SVN works also for a OA site on XAMPP without SSL.

_________________
Edoardo


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 17, 2008 8:20 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
I'm using Xampp with SSL and it works fine, but we still need to know it works with SSL on IIS6 (2K3 SP2) and a wildcard self-signed certificate, as per Steph's original post. Well Steph ? :?

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 18, 2008 8:26 am 
Offline
Newbie

Joined: Wed Jan 02, 2008 12:33 pm
Posts: 23
Hello,

Sorry should've checked back sooner, didn't actually expect anyone else to try it out.

No, using the original line does not work in all cases. It would work (for me) ONLY if I had already imported the offending certificate, in which case my change is irrelevant since there would be no errors in the first place. Since I did not want to force the import of the certificate, particularly for VMs on my LAN, I went this route. I'm sure we can get it to run, I just need to be able to repro the problem here...

Were you running in verbose mode, ef, or anyone else that ran into problems? What was the status message returned?

As for how the reverse proxy is setup:

<my dev machine> | <reverse-proxy apache2 server> | firewall | da weeb

my dev machine is running XAAMPP, with the default settings (probably some self-signed SSL as well).
the reverse-proxy apache2 server only serves HTTPS traffic, and I've got a reverse proxy set up to only serve the "add" pages:

[code]
ProxyPass /openaudit/admin_pc_add_1.php https://salma/openaudit/admin_pc_add_1.php
ProxyPass /openaudit/admin_pc_add_2.php https://salma/openaudit/admin_pc_add_2.php
ProxyPass /openaudit/admin_nmap_input.php https://salma/openaudit/admin_nmap_input.php
ProxyHTMLURLMap https://salma/openaudit/ /openaudit/

<Location /openaudit/>
RequestHeader set Front-End-Https "On"
# Turn off deflate requests...
RequestHeader unset Accept-Encoding
</Location>
[/code]

The reverse proxy is very rough, and the add_1.php comes up without images. I don't mind/care, as all my audits have been going through the add_2.php page. It's also a bit "out there", people from NZ could be adding computers to our setup this way, but I'm still in the exploratory phase. Once I've got everything working as I want, I'll dump the MySQL database from my dev box, setup a VM to run OA on, and reload the contents of the MySQL there. I then just update the reverse proxy to point to this new VM, and all my audited PCs are none-the-wiser.

I'll try the current SVN tonight, hopefully, and report back.

Steph.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 18, 2008 12:24 pm 
Offline
Newbie

Joined: Wed Jan 02, 2008 12:33 pm
Posts: 23
As I feared, current SVN version does not work with my setup. Not surprising, though :(

Here's what I propose:

audit.config:
[code]
...
printer_detect = "y"
software_audit = "y"
uuid_type = "mac"
UseServerXMLHTTP = "y"
[/code]

audit.vbs:
[code]
Dim sql
Dim comment
Dim net_mac_uuid

Dim UseServerXMLHTTP

'
' (AJH) Moved the file read-write-append constants to here, they were defined much later.
[/code]

[code]
if online = "yesxml" then
url = non_ie_page

if UseServerXMLHTTP <> "y" Then
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
Else
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.SetOption 2, 13056 ' Ignore all SSL errors
End If

objHTTP.Open "POST", url, False
[/code]

This of course avoids the problem, but I cannot fix what I cannot reproduce :(. If ef can debug why ServerXMLHTTP doesn't work on his setup it would be even better.

Steph


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 18, 2008 7:59 pm 
Offline
Open-AudIT Fellow

Joined: Thu May 17, 2007 5:47 pm
Posts: 568
Location: Italy
[quote="srouleau"]This of course avoids the problem, but I cannot fix what I cannot reproduce :(. If ef can debug why ServerXMLHTTP doesn't work on his setup it would be even better.

Hi Steph,
obviously I use verbose = "y" in audit.config. The issue seems regarding audit.vbs only when run from a XP SP2 box (the Open method of the MSXML2.ServerXMLHTTP.3.0 object returns the following generic description for Err.number -2147221231
[quote]
ClassFactory cannot supply requested class

Our XP Sp2 workstations have IE7, MSXML 6.0 parser, MDAC 2.81.1117.0 and Office 2003 SP2 installed, every available MS HFs are daily checked. When audit.vbs is run from a 2K3 server, it works fine.
Does anyone else have the same issue with a similar configuration?
Anyway, it could be OK adding the UseServerXMLHTTP option to audit.config

_________________
Edoardo


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 18, 2008 8:10 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
I have no issue with either method, however if we could avoid yet another config entry that would be nice.

If we cant find a one size fits all solution, we could have the script try method 1, and if it fails, method 2, that way we needn't worry about having to add new config lines. Every time I add another config option, it seems to break everybody else's setup, so I am trying to do so sparingly.

If this is not a workable solution, then by all means, add the new config option.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 19, 2008 12:00 am 
Offline
Newbie

Joined: Wed Jan 02, 2008 12:33 pm
Posts: 23
ef, can you try using "MSXML2.ServerXMLHTTP.6.0" instead of .3.0?

I'm running this on a XP SP2 w/o XML 6. From what I'd read XML3 was the preferred fallback by MS, since it was installed, and updated, on every Windows box from Win2k SP4 onwards.

I tried last night to do a 'fallback' but I'll admit that my vbscript are sorely lacking. Stuff like:

[code]
On Error Resume Next
Dim objHTTP
Set objHTTP = WScript.CreateObject("...)
if objHTTP = Nothing Then
Set objHTTP = ...
End If
[/code]
And for some reason it would report everything as "Nothing" and nothing would get done. Dunno if you're allowed to do multiple 'Set' in vbscript or not. Someone with more vb-skillz and some time should probably do something like:

MSXML2.ServerXMLHTTP.6.0
MSXML2.ServerXMLHTTP.3.0
MSXML2.XMLHTTP

in that order; note that the 'setOption' for SSL certificates is only available on the ServerXMLHTTP interface.

Now that I think about it though, perhaps just the CreateObject isn't enough -- we probably need to create the object, if it works attempt to send it, and if that works fallback to the next option.

Steph

Steph


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 19, 2008 2:04 am 
Offline
Open-AudIT Fellow

Joined: Thu May 17, 2007 5:47 pm
Posts: 568
Location: Italy
Steph, tomorrow I will try on the affected systems a de-escalation like this:
[code]
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.6.0")
if IsObject(objHTTP) then
objHTTP.SetOption 2, 13056 ' Ignore all SSL errors
else
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.3.0")
if IsObject(objHTTP) then
objHTTP.SetOption 2, 13056 ' Ignore all SSL errors
else
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
end if
end if
[/code]
It should allow all of us to successfully post xml data without new options in audit.config, regardless of what xml parser version is installed.

_________________
Edoardo


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group