-
Client Software Programmer
that's fine, its just going to be a command you have to run in terminal to start the perl service, its the same cross domain policy, also with that file path you are giving me, you are not on the root desktop.
do you ever login like
...enter details..
and than type:
to get to root desktop
-
Senior Member
Actually I have never logged into my RPi like that before..
Right now.. it is the current default login via Putty
u: pi
p: raspberry
I'm not clear on what this is doing again?
* I'd prefer NOT to have things on my desktop... but in the WAMP (LAMP) directory with all my other website assets.
* I tried to make a copy of the only the .swf and .html files on the desktop as a last ditch effort last night... (didnt work)..
-
Senior Member
I tried adding this line:
Code:
//Security.loadPolicyFile("xmlsocket://" + "127.0.0.1" + ":7777");
Security.loadPolicyFile("crossdomain.xml");
Which has this contents:
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket: //127.0.0.1 -->
<!-- Policy file for xmlsocket: //localhost -->
<cross-domain-policy>
<!-- This is a master socket policy file -->
<site-control permitted-cross-domain-policies="all"/>
<!-- Open Ports & Domain(s) -->
<allow-access-from domain="*" to-ports="*" secure="false"/>
</cross-domain-policy>
-
Client Software Programmer
Ok, I setup the rp, at the flash security settings page I got the same error path ///0/index.swf, so while running my perl server on a random port I saw that using file:///home/pi/desktop/index.swf fixed the security issue and I was able to connect and receive server data, but when connecting to socat it would disconnect rapidly because socat seems to be messing up during the tcp connections on some pi's it does better, so new solution when dealing with rp:
if you are using the arduino uno, just get the esp-13
when you mount it on your arduino uno it will broadcast a wifi, goto webpage: 192.168.4.1 you see it will give you a page to setup wifi name, password and socket port, default socket port 9000.
Now program your arduino uno without esp mounted:
PHP Code:
void setup() { Serial.begin(9600); } void loop() { Serial.println('hello'); Serial.print('\0'); delay(100); }
now when you mount the esp it will send anything you Serial.println() through the wifi.
when finished, connect rpi to your esp13 wifi and your swf can connect to 192.168.4.1:9000 to communicate with it, the connections pretty perfect.
remember to have file:///home/pi/desktop/index.swf in the flash security settings page
Only thing is the esp13 takes all the arduino uno pins but its only really using +,-,tx,rx pins, you can still use the other pins but you need to get your wires to the pins you want while being inbetween the boards.
I only have alittle bit of perl, if I new it better I would have gotten a good wired connection from arduino>rpi>swf but I barely use that language, so that's my best solution for rp, arduino>esp13>rpi>swf
Last edited by AS3.0; 02-07-2019 at 01:10 AM.
-
Client Software Programmer
can be any arduino really you just need 4 wires between the two if its a different arduino
even cheaper link but comes from china: link
Last edited by AS3.0; 02-07-2019 at 01:18 AM.
-
Senior Member
Well that stinks!
Appreciate your help though.
* not sure why keeping things in the /var/www/html directory wont work? (and it has to be on the desktop)
* the need of an ESP board
Although I get and like your solution, I was hoping to just use the UNO (or whatever), the RPi and the Flash app.
I'm still slowly reading and catching up on this socket/security policy stuff still.. (wasnt something I dealt with much before when I used to code in AS2)
Just talking out loud here:
* have local security/xmlcrossdomain policy/file in the root of same directory of my .swf (didnt seem to affect anything)
* have set 'global security' settings to 'white list' my .swf by browsing, and typing the full path/url manually (didnt seem to affect anything)
* when I did the Putty tests, everything was being sent and received correctly.. over and over, white out any timeouts/freezes... but this was bypassing/eliminating the Flash layer of the project (to test if the other aspects were in working order)
Question:
So your saying that when you set your file path to the .swf in the global security settings panel.. it started working for you? (but then socat eventually crashed on you? is that correct?)
I wonder what settings you have different that allowed it to work for you (before crashing).. How did you know it worked? Were you getting incoming serial data sent from the Arduino in your Flash app/stage?
-
Client Software Programmer
/var/www/html isn't a problem, just address them with file:// use file:///var/www/html/index.swf
yes global security settings use file:// for rp's
yes I got data from perl>flash only when adding file:///var/www/html/index.swf to global settings on rp.
esp13 is already a good solution but here is 1 last solution to save some money,
PHP Code:
apt-get install ser2net
do the ser2net tutorial,not the socat one on the lower part of the page... same global security,ttyUSB0 on config and test on putty and flash, use 9600 not 115200 on config line.
Last edited by AS3.0; 02-07-2019 at 01:51 AM.
-
Senior Member
I thought I tried that already....
I'm going to try it again though.
What are your thoughts on the crossdomain xml file? (doesnt seem to be loading it? or working at least.)
Does your pearl approach/solution take the place of this crossdomain security policy file stuff?
Were you feeding/loading the policy via PEARL when your above test was working briefly? (before crashing)
Last edited by whispers; 02-07-2019 at 01:43 AM.
-
Senior Member
I just tried again.
AS:
Code:
//Cross domain security policy load
//Security.loadPolicyFile("xmlsocket://" + "127.0.0.1" + ":7777");
Security.loadPolicyFile("crossdomain.xml");
var server = new XMLSocket();
//server.connect("127.0.0.1", 7777);
server.connect(null, 7777);
//server.connect('localhost', 7777);
server.onConnect = function(result){
if(result){
//connected
state_txt.text = "connected";
}else{
//not connected
state_txt.text = "not connected";
}
}
server.onClose = function(){
//disconnected
state_txt.text = "connection closed";
}
server.onXML = function(data){
//do whatever
incomingData_txt.text += data;
//close
//server.close();
}
powered on RPi..
It auto loads Chromium upon boot.... and loads localhost currently..
I get on my PC, use Putty to SSH into my RPi (using default username/password that comes out of the box)
I paste this:
Code:
socat -d -d -d -d -x TCP-LISTEN:7777,reuseaddr,fork FILE:/dev/ttyUSB0,b9600,raw
I see a TON of text (many lines) display... and it just sits there.. I am NOT returned to a command prompt (I assume this means SOCAT is running??)
Anyways... I refresh the webpage.. and eventually the .swf displays NOT CONNECTED still..
-
Client Software Programmer
yeah, you don't need crossdomain, just put in global security the path like this: file:///var/www/html/index.swf and my random non-policy perl server was able to give it data to be seen in the local swf, next if socat/ser2net solutions wont work best solutions the wifi method, socat worked good on my orangepi, a better understanding of perl would have helped for a wired connection.
-
Senior Member
ok.. I can try to remove the local Security.loadPolicyFile() call then.. didnt seem to do anything anyways
And -I DID- add: file:///var/www/html/index.swf
to the global security page... it didnt make a difference..
It eventually timed out and never connected.
-
Client Software Programmer
You aren't going to see the difference without the perl server but it worked, file:// is good, ill give you esp-13 for a dollar that's as low as I can post it, I have acouple wifi boards, doesn't matter. http://ebay.us/N5ejSa?cmpnId=5338273189
Last edited by AS3.0; 02-07-2019 at 12:24 PM.
-
Senior Member
I have a couple ESP-01's and I think an ESP-12.. plus Wemos or NodeMCU (cant recall which ATM)...
But is that to (sorta) create our own 'policy server'?
Hard to believe there is no other way.. what did people do before the ESP's?
Hell at this point.. I'm willing to pay someone a little cash to solve this security policy thing! LOL.. (without an ESP module...just like our initial approach)..
it totally killing the rest of the project if this step doesnt work!
haha
Anyways.. thanks for the help given so far!
-
Client Software Programmer
I see you have some wifi boards I like the wemos pretty good but I don't have tutorials for those,
If you want to test the security on your rp to get that off of your chest here:
instructions:
1. download perl server https://rpguy.weebly.com/uploads/2/0...550/server.rar and unzip it.
2. take everything you put in security settings out: global security settings
3. put server.pl in desktop & open terminal from desktop
4. run command:
PHP Code:
chmod u+x server.pl
and than run command:
5. It will open port 45055, now try your swf connect to 45055 and it wont connect.
6. now go to global security settings
7. add your swf to global security: file:///var/www/html/index.swf
8. exit perl window, and stop its background process by going to terminal and typing:
9. find the number your perl process is like maybe its 533 and type
to end the process.
10. now open terminal from desktop again and type command:
it will open 45055 again and test connect from swf to that and you will see it opened, so cross domain security is no longer an issue, now from there the best option is to get the board Ill send you for a dollar because its good chip to use for this until we get a better wired version for rp. buy
since you are going to use wifi method that means you cant use Ethernet port anymore, but there are tutorials to use Ethernet and wifi for rp at same time if you look it up.
Last edited by AS3.0; 02-09-2019 at 06:44 PM.
-
Senior Member
Thanks Alloy Bacon..
I'm not sure that is going to be an acceptable solution however.. (using another board)..
I am using an UNO right now, .. but in the end project that will be a Pro-Mini... (and even that was pushing it for more space beyond the RPi and the 3.5-5in HMDI display..
No more room, physically, and more boards/stuff to deal with.
I'm already starting to get a it overwhelmed with this security stuff.. and I have only done less than a handful of RPi project.. I mainly do Arduino based stuff..
I still need to research on how to get that SOCAT line to run at boot time automatically... (in the end there will be access to the project/hardware/software.. it just needs to power on and 'work')..
I do appreciate the SOCAT tip though.. (seems similar to using minicomm, but that never worked for me)..
I mean APACHE 'is' a server of sorts... cant it be configured to dish out this security policy file?
These two links, I need to study more:
https://www.adobe.com/devnet/flashpl...icy_files.html
https://www.adobe.com/devnet/flashpl..._security.html
There is a .zip file from Adobe in the first link:
https://download.adobe.com/pub/adobe...licyd_v0.6.zip
It has both Python and Pearl files in it? Dont know how to utilize them of course... or even if it can be applied to my project/situation! LOL
One thing I dont understand if why doesnt the local call work? From the Security.loadPolicyFile() action?
Flash Player also checks policy files every time the developer specifies a Security.loadPolicyFile() command within the code. Flash Player does not check for socket policy files for normal HTTP or HTTPS connections through the browser. Socket policy files apply only when the developer initiates a raw Socket or XMLSocket connection in ActionScript.
-
Client Software Programmer
Security.loadPolicyFile() for me works for non local usage, if I can not access lower 1024 ports like on a non rooted android, I use:
PHP Code:
Security.allowDomain("108.523.312.432"); Security.allowInsecureDomain("108.523.312.432"); Security.loadPolicyFile('xmlsocket://108.523.312.432:45055');
I don't think it will work for local (you can try), but it definitely helps for remote server, now instead of auto requesting from 843 it chooses 45055 to get the policy.
the client now automatically sends to server at 45055:
PHP Code:
<policy-file-request/>
with null byte ending you should remove during parsing.
now a snip of the server side responding with no nullbyte ending:
PHP Code:
var policy='<cross-domain-policy><allow-access-from domain="*" to-ports="45055" /><allow-access-from domain="127.0.0.1" to-ports="*" /></cross-domain-policy>'
if(parsedString=="<policy-file-request/>"){ e.currentTarget.writeUTFBytes(policy) e.currentTarget.flush(); e.currentTarget.close(); }
Last edited by AS3.0; 02-09-2019 at 10:07 PM.
-
Senior Member
LOL.. youre going to fast for me!! LOL (I'm old!)
Security.loadPolicyFile() for me works for non local usage
You're saying its working for you, using your ESP13 approach? but wont work for my LOCALHOST (no additional ESP13 board) setup?
I think this is all great information.. especially if anyone else (ever) comes looking...
but I am just getting more and more confused.. as I want to stick with my current approach first, until it can be 100% completely ruled out.
If we talk about Python or PEARL... I need to know/understand in what circumstances it is being used.. (like that Adobe link and those files for example)
It would be so much better if we were testing the same things here.. do you have LAMP installed on your RPi?
Being so new to this sever/security policy stuff.. its hard for me to understand what parts apply to MY project.
so to swing this back around for what applies to MY code/project/requests..
Code:
Security.allowDomain("108.523.312.432");
Security.allowInsecureDomain("108.523.312.432");
Security.loadPolicyFile('xmlsocket://108.523.312.432:45055');
Should be tried using.. what exactly?
The port being used -=SHOULD NOT BE=- the same port being used in the Arduino/SOCAT communication....right? (so NOT: 7777)
The port needs to be something that is prepared to respond with this security policy nonsense..
Code:
Security.allowDomain("127.0.0.1");
Security.allowInsecureDomain("127.0.0.1");
Security.loadPolicyFile('xmlsocket://127.0.0.1:xxxx');
-or-
Security.allowDomain("localhost");
Security.allowInsecureDomain("localhost");
Security.loadPolicyFile('xmlsocket://localhost:xxxx');
but this still wont solve or give any response.
I haver that .xml file sitting in the root of the same folder as the .swf is...
Perhaps this needs to be in a different directory in the LAMP install somewhere?
Also.. what are your thoughts on having a self signed certificate? So I can deliver the page as HTTPS? Then maybe less issues?
* I do not know to install a self-signed certificate.. but I'm sure I can find some steps on how to it..
** just not sure if that would help at all? I have seen HTTPS mentioned in many threads on this topic..
-
Client Software Programmer
Well I gave the best instruction I could to get it running, and it worked for me on rp, I would just reread the last 3 pages and follow it slowly, im not a good teacher but I just list it and if you can follow that's the best I can do... maybe sometime in this few months if I have time I will screen record on my rp and you just follow along the video, but I would take my esp13 soon or listing will end, Ill send your dollar through paypal back after you buy it.
-
Senior Member
Hi Alloy Bacon.
Dont get me wrong.. I 100% appreciate your efforts here..
You have already taught many new things..
I am just not ready to pursue a solution that needs its own 'hardware server' (ie: ESP13 or any ESP board for that matter) ...... YET!
Especially when there is LAMP running already.. (ie: a server in its own right)...
I might just call off the whole project.. =or= get desperate enough to use this extra board/set-up approach (ESP-13)
I'm not worried about the dollar! LOL... You helping me this for is worth at least that! haha
But as I mentioned, in the end project, I will no loner be using an UNO, but a Pro-Mini or perhaps a Nano at the biggest...
* Talking out loud here:
How did they do this in the past (using Flash XMLSocket.connect() in off-line applications or local host applications when Flash was still a relative web solution years ago?
Kiosks at malls, games, readers/scanners that interacted with Flash apps?
**Theres gotta be a way to set this up with a localhost/offline (and they were all using any ESP hardware/modules!)
I'll go buy your board now though!.. (just in case I cave in some day)
-
Senior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|