Connecting to a local socket server from SWF on remote page - actionscript-3

I have a Kiosk that connects to a local socket server so it can access some hardware. If the kiosk code is stored locally, it can access the socket perfectly.
However, and I know for good reason, if the kiosk code is hosted on a remote server, it can not access the local socket server because of a sandbox violation.
The problem is that all of these kiosks are hosted on AppEngine, so when I am done making changes, it takes hours to render out to a single HTML file, and change all the css/js location links.
Is there anyway possible for the allow the SWF file to access the local socket server when it is hostel remotely?
Also,
The socket server is a Java app that I dont have the source to. I run it locally through the terminal

I've had the same problem.
The thing is that with Flash player 10 security with sockets has become much stricter. Just placing crossdomain.xml on the server won't do anything - you actually have to send the crossdomain policy file to any client who connects.
The simplest solution is provided by Adobe - they've provided a couple of scripts, one perl and one python, which will set up a policy file server. You can find them here:
Setting up a socket policy server

Related

Finding MySQL localhost URL and/or accessing phpmyadmin

Going around in circles. Please help, I enter http://localhost into safari on my mac and receive: It works!
However, I cannot figure out how using MySQL workbench I can find the URL. I am looking to code JSON in xCode to retrieve data from my local MySQL database, however, I do not even know the URL to access it.
My port is on 3306. I have tried http://127.0.0.1:3306 - and get a failed to open.
Do I need myphpadmin or can I go direct to MySQL?
I have tried saving a copy of MyPhPAdmin under Users>MyUserName> but this did not work when I ran: http://localhost/myphpadmin
Should the file be saved elsewhere? When I worked on Python weeks ago I run it under a different location then was recommended (Under the Python X.X cache folder) whereas online people simply ran it from their Users>MyUserName> folder. I am on the latest Catalina OS X.
Tried http://localhost/usr/local/mysql-8.0.20-macos10.15-x86_64/phpmyadmin/ - 404 not found
With MySQL, you can connect via localhost "socket" or networking "TCP/IP" connections. The user accounts in MySQL exist separately from each other, so if your user account exists with host value 'localhost' the TCP/IP connection probably won't work for you. Also note that, depending on how you installed MySQL and how it's configured, it might not even listen for network connections. Normally, localhost is preferred if you are on the same machine.
In MySQL Workbench, you need to give the hostname or IP address when selecting "Standard (TCP/IP)" from the "Connection Method" dropdown. This is simply the hostname or IP address, not a complete URL or web site. So you'd set the hostname to "127.0.0.1" or "192.168.9.34" or whatever. Again, Local Socket/Pipe is usually a better choice in most cases.
MySQL uses its own networking port (3306) and communication protocol, so using http://127.0.0.1 is incorrect as it isn't using the http protocol. Likewise, if you would need to change the port for some reason, specify that in the port field rather than as a part of the hostname.
As for phpMyAdmin, you would install that to a folder that is handled by your web server, then access it through the URL/path exposed by the web server — by default, your user home directory is not shared to the web (and rightly so, I don't want all of my documents and files shared with the world!). Put the phpMyAdmin folder in your web root and you'll have better success. Which folder that is probably depends a lot on which webserver you are running, how it is installed, and how you configured it.
I won't comment on the Python scripts you've run in the past, as my experience with serving Python to the web requires adjusting some settings in my nginx configuration and I won't want to confuse you compared to the tutorials you're following.

PHP MyAdmin Azure App Services - (HY000/2002): An attempt was made to access a socket in a way forbidden by its access permissions

When attempting to connect to the Azure App Services (ASP.NET) MySQL database (Navigating to the Manage link) the Page info returned from PHPMyAdmin prevents me from moving forward. I cannot seem to find the location of the log for the app within Kudu and navigating to the MYSQLCONNSTR_*.ini file did not provide me with the information that I needed.
I've attempted to use the connection strings for the database for both the scm and the web app but neither work. I have also attempted to use the public-facing IP within the Kudu environment variable without any luck.
I cannot seem to find the information I need to connect to my instance of PHPMyAdmin, and am now quite lost.
The solution to my problem was here: https://stackoverflow.com/a/57545678/4212591
The free tier of the Azure Web Service does not allow for the always-on feature. Thus my inability to connect to the service.
I’m unsure on the exact location/path you are looking for that file, the connection string is stored at D:\home\data\mysql\MYSQLCONNSTR_localdb.txt.
If you wish to customize the database, username and password, after you have created a new database, add new username or update password, simply modify:
D:\home\data\mysql\MYSQLCONNSTR_localdb.ini , remove D:\home\data\mysql\MYSQLCONNSTR_localdb.txt and restart the WebApps.
Furthermore, the connection string flows to your application as an env variable MYSQLCONNSTR_localdb. The env is added to the main site process. For Kudu site, one may read the same info from D:\home\data\mysql\MYSQLCONNSTR_localdb.txt file. Beware that we are not using the default MySql port (3306). In fact, the port number may vary for each application life cycle depending on its availability at startup time. The port info is also available as an env variable WEBSITE_MYSQL_PORT to your site.
Ensure that MySQL process is running. Check in your web app application settings if there is a connection string. PHPmyadmin uses MYSQLCONNSTR_ to connect to the MySQL server. If you have a connection string in application setting change the connection string type to Custom , so you can still have the information if needed or delete it. This will force PHPmyadmin to access MYSQLCONNSTR_localdb and connect to the MySQL in-app server.
As a side note, on Azure WebApps Sandbox - Connection attempts to local addresses (e.g. localhost, 127.0.0.1) and the machine's own IP will fail, except if another process in the same sandbox has created a listening socket on the destination port.
To rule out, application code or the client library leaking TCP socket handles or burst load of requests opening too many TCP socket connections at once, scale-up Azure App Service Plan and see if that makes any difference.

PhpStorm vsftpd issue: 500 Illegal PORT command

I've setup an vsftpd on my Ubuntu 16.04 using this tutorial.
I can connect to server using FileZilla but not through PhpStorm. It issues this error when I try to upload a file to server:
Failed to transfer file 'C:\xampp\htdocs\sherkat\artisan.php': cant open output connection for file "ftps://SERVER-IP/artisan.php". Reason: "500 Illegal PORT command.".
What's wrong with my config?
The FTP protocol supports two modes for the data connection. In the traditional mode, called "active" (which is the default), on each command sent by the client the server creates a connection back to the client and uses it to send the response. This is impossible on the most setups nowadays (actually, in the past 20+ years) because of firewalls.
There is another mode, called "passive", where the data connection for the response is also initiated by the client. It works through firewalls without problems.
Press the "Advanced options..." button, check the "Passive mode" option and you're good to go!
As a side note, a better way is to use the SFTP protocol. If you can connect through SSH to your Ubuntu box, most probably you can also use SFTP to transfer files to it, without any other setup. FTP is an old and convoluted protocol. SFTP uses a secure connection (maybe it's not that important for you), and a simpler protocol.

simulate as3 crossdomain behavior in localhost

I am writing an action script 3.0 client that has to communicate with a remote server. In localhost environment everything works fine, but if I test the client in the real internet environment there is no connection.
My guess is that it has to do with the cross domain policy file, but calling
Security.loadPolicyFile("xmlsocket://"+targetIP);
does not send the <policy file request\> message to the server on the default 843 port, or any port for that matter. I think it might be because flash recognises that the address is local and omits the request. But I need to receive it to be able to implement the answer on the server. Otherwise I'd be coding blindly.
Is there a way to force the flash client to behave as if it was in a different domain while still being in localhost so I can troubleshoot this issue without involving a remote host? I don't have many resources in that regard.
Try running the client on 'localhost', and load the policy file from '127.0.0.1'.
They should be seen as different 'domains'.

Flash Sockets, securityerror in same domain?

I am trying to connect a flash socket client to a c++ socket server ( using boost::asio ). I always run the server app on the distant server listening on port 7171.
The connection works fine if I run the flash socket client on my local machine ( directly inside CS5.5 ).
After this successful test, I decided to upload my swf to the same machine as the socket server, to allow multiple users to connect it throught HTTP ( then I suppose flash client and c++ server are inside same domain ), but in this case, I always get a SecurityError 2048.
What could I be missing ?
When you test locally you are in your sandbox which will ignore security issues, that is why it will not work when uploaded( outside of sandbox ).
In your ActionScript you need to include this.
// host is something like dev.mydomain.com
Security.allowDomain( host );
Security.loadPolicyFile( "xmlsocket://" host + ":" port );
On the port you need to listen for this request
<policy-file-request/>
When you get the request for the policy you need to return a cross domain policy with with this node.
<allow-access-from domain="*" to-ports="*" />
Flash requires a policy server to be running on the hosting machine to access any sockets:
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html
This is a separate requirement from a crossdomain file-- it requires an actual policy server app running on port 843.
It may be that Flash inside CS5 ignores the policy requirement because it knows that it's in a development environment.