Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

For our production web/database servers we used CloudBerry to AWS/Dreamhost buckets for backup. If you don't mind doing some scripting of your own you can use the free CloudBerry explorer to do it, otherwise they have paid Server Backup software that actually plays nice with SQL/Exchange/etc (e.g. doesn't lock files). I ended up writing a .NET wrapper that would just firehose changed files to AWS. What I like about them is it's a one time fee.

Adbot
ADBOT LOVES YOU

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes
So I ranted a while back about a client complaining about receiving spam through their third party forms. Well they finally caved and allowed me to pass all submissions through our server first before sending them on to the third party.

I've set it up with Google reCAPTCHA, a Honeypot, custom blacklists for email addresses and website URLs plus I found a couple libraries, one uses a Markov chain to try and detect gibberish and another checks message content against spammy keywords and phrases.

Already stopped 32 submissions that didn't complete the CAPTCHA from being sent through on the first night.

LifeLynx
Feb 27, 2001

Dang so this is like looking over his shoulder in real-time
Grimey Drawer
I've gotten over the death of Firebug as my development tool, but one thing I can't get past is Firefox's inspector tool leaving a blue overlay on the page when I'm using the element inspector. Firebug was REALLY good at knowing that if I move my mouse off the page, it shouldn't keep the ghosted overlay over everything, but Firefox's Developer Tools often gets "stuck" and the only way to fix it is to refresh the page.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

BJPaskoff posted:

I've gotten over the death of Firebug as my development tool

I haven't :(

I guess I should uninstall it and force myself to use Firefox Dev Tools.

SurgicalOntologist
Jun 17, 2004

I have a user in China getting a network timeout error on a JS resource hosted on S3. I don't have many users so it may not be a just China thing, but I can't reproduce it. Is there a way to troubleshoot this without asking the user for too much? I checked all the S3 permissions...what next?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

SurgicalOntologist posted:

I have a user in China getting a network timeout error on a JS resource hosted on S3. I don't have many users so it may not be a just China thing, but I can't reproduce it. Is there a way to troubleshoot this without asking the user for too much? I checked all the S3 permissions...what next?

It's most likely just a China thing. We run into issues all the time with stuff not being accessible from inside China, and things that were working previously will randomly break all of a sudden. I assume it all has to do with the Great Firewall of China.

The only thing we've been able to do is move the resources closer to China (Singapore, Hong Kong, etc), or even host them from servers that reside in China.

Warbird
May 23, 2012

America's Favorite Dumbass

I've played with the Crashplan Linux stuff to limited success. It appears most guides either assume you're trying to back up to the webserver (instead of the opposite) or assume you're using a GUI on the box (I have RasPis with more kick than this server, so nope).

Can anyone recommend a fairly idiot proof backup system? I'd be fine to have it just zip the server wholesale and FTP it to my desktop or Drive storage once every few days. I suspect that wouldn't be viable for the same reasons as copy pasting your C: drive wholesale onto a new Windows install generates more junk than useful saved stuff.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



http://www.tarsnap.com/

Warbird
May 23, 2012

America's Favorite Dumbass

Work web filter blocked it, so it must be good. I'll take a look when I get back to the house.

counterfeitsaint
Feb 26, 2010

I'm a girl, and you're
gnomes, and it's like
what? Yikes.
I messed around with some basic web development stuff a few years ago, but wouldn't consider myself an expert at all, barely an amateur. I also haven't done any of this kind of stuff in at least 3 years. That being said, a old client of mine called me up out of the blue today saying his website is down and he doesn't know anyone else who could fix it, so I agreed to take a look.

He has a version of Wordpress installed that's probably about 2 years out of date, and it got hacked. The site was 'down' because wp-config.php had an include call to a, likely malicious, file that no longer existed. His web host added .SUSPICIOUS to the end of a few php files, and I assume that's why the called file couldn't be found. Removing this include from wp-config.php has fixed the site, which loads correctly now.


My two questions are;

Is the wordpress database possibly compromised as well, or only some of the php files?

Is this a situation where I can update the version of wordpress he's using to remove the vulnerabilities, remove the .SUSPICIOUS file, and it'll be fine, or is the entire thing probably hosed?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

counterfeitsaint posted:

He has a version of Wordpress installed that's probably about 2 years out of date, and it got hacked.

Not sure, but you may get better advice in the Wordpress Megathread.

counterfeitsaint
Feb 26, 2010

I'm a girl, and you're
gnomes, and it's like
what? Yikes.
Oh, I didn't see that, thank you.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Warbird posted:

I've played with the Crashplan Linux stuff to limited success. It appears most guides either assume you're trying to back up to the webserver (instead of the opposite) or assume you're using a GUI on the box (I have RasPis with more kick than this server, so nope).

Can anyone recommend a fairly idiot proof backup system? I'd be fine to have it just zip the server wholesale and FTP it to my desktop or Drive storage once every few days. I suspect that wouldn't be viable for the same reasons as copy pasting your C: drive wholesale onto a new Windows install generates more junk than useful saved stuff.

https://support.code42.com/CrashPlan/4/Configuring/Using_CrashPlan_On_A_Headless_Computer

Warbird
May 23, 2012

America's Favorite Dumbass

They're not idiot proof enough for this idiot. I went through that before, but didn't have any success. I'll give it another go and report back. Still need to try that other service that was blocked at work.

The Fool
Oct 16, 2003


https://www.veeam.com/linux-backup-free.html

Veeam has a free Linux agent out now. Don't have any personal experience with it though.

huhu
Feb 24, 2006
I've got several different websites hosted with a single hosting account. I try to keep all the production websites updated to the latest versions such as with WordPress. I also have dev websites hosted. If I don't update a dev WordPress website and someone uses a WordPress security flaw to get in, could they then gain access to my other websites?

The Fool
Oct 16, 2003


huhu posted:

I've got several different websites hosted with a single hosting account. I try to keep all the production websites updated to the latest versions such as with WordPress. I also have dev websites hosted. If I don't update a dev WordPress website and someone uses a WordPress security flaw to get in, could they then gain access to my other websites?

Short answer, Yes.

huhu
Feb 24, 2006

The Fool posted:

Short answer, Yes.

If they found a vulnerability with WordPress, however my file/directory permissions were well set, would they need to discover another vulnerability to go to the parent directory where the other websites are stored?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

huhu posted:

If they found a vulnerability with WordPress, however my file/directory permissions were well set, would they need to discover another vulnerability to go to the parent directory where the other websites are stored?

Depends on the vulnerability and how it's exploited. If it lets them run arbitrary code or escalate privileges or both, then the whole server is compromised.

kedo
Nov 27, 2007

If you're going to keep dev WordPress sites up and running, at least put a htpasswd on the directory. Better to simply pull them down when you don't need them.

Triglav
Jun 2, 2007

IT IS HARAAM TO SEND SMILEY FACES THROUGH THE INTERNET
I have no idea what I'm doing and any help would be appreciated. I have some JSON I'm accessing remotely through PHP. This is a simplified version of its structure:

code:
{
  "metadata": [
    {
      "name": "Current Inventory",
    }
  ],
  "inventory": [
    {
      "id": 654321,
      "item": 1,
      "price": 250,
      "quantity": 2,
    },
    {
      "id": 654322,
      "item": 2,
      "price": 100,
      "quantity": 5,
    },
    {
      "id": 654323,
      "item": 1,
      "price": 225,
      "quantity": 1,
    }
  ]
}
I'm interested in knowing the current lowest price of a specific item, but I have no idea how to write the code that will return the information I want (namely that item 1's current lowest price is 225).

The contents and length of the JSON changes regularly, so it seems to me the best way to evaluate it would be some sort of foreach, but I'm an idiot and don't know how to make it work. This is my current code, with some made up pseudocode gibberish for what I think I'm looking for:

code:
<?php

$inventory = json_decode(file_get_contents('http://website.com/api'),true);
$pricearray = null;

// foreach arrays in $inventory where item===1, find the value of that array's Price and add it to $pricearray;

if ($pricearray==null) { $price="out of stock"; } else { $price=min($pricearray); };

echo $price;

?>

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Triglav posted:

I'm interested in knowing the current lowest price of a specific item, but I have no idea how to write the code that will return the information I want (namely that item 1's current lowest price is 225).

Your code should do something like this.

1) Set a price tracking variable to null.
2) Loop over your item list.
2a) If the item id in the current list entry matches your expected item id, check the price.
2a1) If the price tracker is null, set the price tracker to the current list entry price.
2a2) If the price tracker is a larger numeric value than the current list entry price, set the price tracker to the current list entry price.
3) When the loop finishes, you will have the lowest price for the item stored in the price tracker. If the price tracker is null at the end of the loop, the item was not in the list.

This is simple (hard to get wrong) and brute force (inelegant), but it's also clear and unambiguous.

If you need to perform this operation for more than one item at a time, use an array instead of a single price tracker, using the item id as the array key. You'll need to add some extra code to check that the array index exists before trying to do math on it.

If you need the entire item entry, you can store that in the tracking variable instead of just the price, adjusting the code that checks the price and overwrites the tracker as needed.

Triglav
Jun 2, 2007

IT IS HARAAM TO SEND SMILEY FACES THROUGH THE INTERNET
I couldn't make your suggestion work to my liking, but I figured out how to make it work with my original design:

code:
foreach($inventory['inventory'] as $sale) {
	if ($sale['id']===1) {
		$pricearray[] = $sale['price'];
	}
}

$price = min($pricearray);

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Triglav posted:

I couldn't make your suggestion work to my liking, but I figured out how to make it work with my original design:

code:
foreach($inventory['inventory'] as $sale) {
	if ($sale['id']===1) {
		$pricearray[] = $sale['price'];
	}
}

$price = min($pricearray);

What you want to do for the general case is to use a hashtable to store the min price for all possible items in the array. As you iterate over the array, you check the hashtable for that items min price. If it exists, compare to new price, and adjust accordingly. If it doesn't exist, unconditionally add the current price. This will run in O(n) time for any number of items.

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

I have setup Wordpress on AWS EC2 using this guide but I'm struggling to connect via SFTP. From what I can gather from the web the server should be my instance's public DNS, the username should be bitnami (since I installed the Wordpress by Bitnami image), and instead of a password I'm using the .pem file downloaded from the AWS console Network & Security -> Key Pairs. This does not work. I've also tried other usernames such as ec2-user, ubuntu, and root. I think an underlying issue I'm having is Amazon's approach of having 100 Amazon Key Marketing Terms per page. I don't know what is actually the web host I want to get into and what is a Containerized Lightsail Elastic Beanstalk Patch Baseline AMI Bundle. Any guidance would be much appreciated.



Edit: A new twist :nono:

awesomeolion fucked around with this message at 19:34 on Jan 24, 2017

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

awesomeolion posted:

I have setup Wordpress on AWS EC2 using this guide but I'm struggling to connect via SFTP. From what I can gather from the web the server should be my instance's public DNS, the username should be bitnami (since I installed the Wordpress by Bitnami image), and instead of a password I'm using the .pem file downloaded from the AWS console Network & Security -> Key Pairs. This does not work. I've also tried other usernames such as ec2-user, ubuntu, and root. I think an underlying issue I'm having is Amazon's approach of having 100 Amazon Key Marketing Terms per page. I don't know what is actually the web host I want to get into and what is a Containerized Lightsail Elastic Beanstalk Patch Baseline AMI Bundle. Any guidance would be much appreciated.



Edit: A new twist :nono:


Did you open up port 22 on the AWS boundary firewall?

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

Skandranon posted:

Did you open up port 22 on the AWS boundary firewall?

I believe so, that's this thing right?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

awesomeolion posted:

I believe so, that's this thing right?

Yeah, looks right. Hmm, the guide you linked to said to create without using a PEM file, not with. It's possible the image you created server from does not support keys? I'm not to familiar with Linux, but one of the things I had to do when I was setting up some Linux servers on AWS is convert the PEM key files AWS gives you to PPK files that PuTTY uses. Maybe you need to do something similar?

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

Skandranon posted:

Yeah, looks right. Hmm, the guide you linked to said to create without using a PEM file, not with. It's possible the image you created server from does not support keys? I'm not to familiar with Linux, but one of the things I had to do when I was setting up some Linux servers on AWS is convert the PEM key files AWS gives you to PPK files that PuTTY uses. Maybe you need to do something similar?

That's one thing that was confusing me. An instance is different than an image right? And an image is an AMI? I don't have an AMI launched, maybe that's the problem.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

awesomeolion posted:

That's one thing that was confusing me. An instance is different than an image right? And an image is an AMI? I don't have an AMI launched, maybe that's the problem.

Yeah, an AMI (Amazon Machine Image) is the system image your instance is cloned from. However, after that your instance is a real thing that you change. All instances are cloned from some AMI (I think, yours almost certainly was). If the connection is being made but refused, it's either you are giving it the wrong file, or it isn't using the file at all and just expects a password. If connection not accepted, a firewall issue somewhere.

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

Thanks Skandranon! Makes sense regarding the image. By the time I got the right credentials i used up all my tries and was locked out. So deleted that instance and cloned a new one from the bitnami Wordpress image and I was able to get into that one :)

No Gravitas
Jun 12, 2013

by FactsAreUseless
Ugh. I'm really frustrated with this one, guys. This is a thing for bragging rights, but I want a page that render really quickly according to https://www.webpagetest.org

For some unknown reason the page does not render until about 0.8s in. The CSS and the complete HTML are with the user at 0.25s in, why don't things render then?

I am trying to get a website to load really, really fast. The whole response is in one packet, about 5kb of compressed data in total. The HTML is very simple, just a bunch of paragraphs and tables with basic styles. The only CSS is inline. The only Javascript is listed as deferred and the only thing it does is load two Google fonts asynchronously, using zenfont to give me the right font appearance that I'd like while Google Fonts are loading. I did eliminate the deferred load of the font stylesheet as a reason for the rendering delay, the browser still visually idles for about 250ms after everything it needs has arrived. What can be possibly taking so long? This is true for Chrome, Firefox and Edge, all don't render for about the same amount of time.

Anything I can do to make the drat thing just render faster?

Attached is the test image. I have since eliminated the Google Fonts CSS, but it did not make things any faster for the initial render.

Only registered members can see post attachments!

Gul Banana
Nov 28, 2003

not much we can do to diagnose it without seeing your code. i will note that webfonts are extremely bad for initial-load perf though - are you sure you've fully ripped them out?

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
How are your tables defined and are they truly necessary?

Tables can not be rendered progressively and require multiple passes over the data as contents of one cell can affect the layout of other cells and elements before them.

Sergeant Rock
Apr 28, 2002

"... call the expert at kissing and stuff..."

ynohtna posted:

How are your tables defined and are they truly necessary?

Tables can not be rendered progressively and require multiple passes over the data as contents of one cell can affect the layout of other cells and elements before them.

You can improve table performance (and often their visuals) by using table-layout:fixed in your CSS.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Sergeant Rock posted:

You can improve table performance (and often their visuals) by using table-layout:fixed in your CSS.

Fix your sigs man. I can't handle seeing those broken image icons!

No Gravitas
Jun 12, 2013

by FactsAreUseless
Thanks, guys!

I was not using fixed tables, but mine are tiny and required anyway. (8x4 was the biggest one.)

Tables, fonts ripped out, still slow. Will try ripping out one item at a time until I get some major effect.

EDIT:

code:
<!DOCTYPE html>
<html lang="en"><head>
</head>
<body>
<h1>LOL</h1>
</body>
</html>
160 miliseconds to completely render this, measured from the time the user has everything.

Please tell me I'm insane or something.

No Gravitas fucked around with this message at 17:19 on Jan 25, 2017

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

No Gravitas posted:

160 miliseconds to completely render this, measured from the time the user has everything.

Please tell me I'm insane or something.

E: You said from the time the user has everything sorry...What about the time it takes your server to give you a response? I'm guessing that would be a big chunk of the total time required to load a blank page. Speaking of which for your testing I would literally load an empty file and see how long that takes.

What about the time to render a 1px by 1px image from the time the user has everything? Could it be just browser overhead?

E2: Having some more issues with AWS. I emailed Bitnami support but thought I'd put this here too just incase :)

I have a Wordpress multisite that uses Pusher. I've recently migrated this site to AWS by cloning your Wordpress Multisite image. I have now got everything set up but I'm having one issue with Pusher. This was tested and working consistently on the previous host so I believe it is an issue with Bitnami's current setup rather than the code itself.

Here are the relevant files:

1. /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/ds-orao/game/js/game-script-level-four.js
2. /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/ds-orao/game/presence_auth.php
3. /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/ds-orao/game/Pusher.php

The error occurs when 1 calls 2, and 2 includes 3. The response 1 gets from 2 is "pusher.min.js:8 POST http://multi.lovelinesonline.com/hiestand/wp-content/themes/ds-orao/game/presence_auth.php 500 (Internal Server Error)"

I know that htaccess is setup correctly to allow access to individual php files because I made a test file at /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/ds-orao/game/testtt.php which I can access no problem.

This is the code for 2, you can see it uses POST parameters as well as headers. Is there something in Bitnami that needs to be enabled to support this?
php:
<?php
/**
 * Pusher - Presence Auth
 */
if ( strlen($_POST['channel_name']) > ) {
    doThings();
}

function doThings() {
    require('Pusher.php');
    $pusher_name '';
    $pusher_id '';
    foreach (getallheaders() as $name => $value) {
        if ( strtolower($name) == 'pushername') {
            $pusher_name $value;
        } else if ( strtolower($name) == 'pusherid' ) {
            $pusher_id $value;
        }
    }
    $options = array(
        'encrypted' => true
    );
    // Live -- x'd out for posting
    $pusher = new Pusher('xxx','xxx','xxx',$options);

    $presence_data = array('name' => $pusher_name);
    echo $pusher->presence_auth($_POST['channel_name'], $_POST['socket_id'], $pusher_id$presence_data);
}
?>

E3: Found in the apache error logs that it was getallheaders() throwing an error.

awesomeolion fucked around with this message at 19:48 on Jan 27, 2017

Tarnien
Jul 4, 2003
Champion of the World!!!
Disclaimer: Fairly new to this. Using django/python, trying to build a cataloging website where you can submit videos and have them automatically embedded. The issue is that most of these videos come from instagram -- I can paste the embed link into the form, but having difficulty translating this to actually embedding the video on the resulting page -- just the raw code shows up instead. Any suggestions? Should I ask this in the python thread instead?

Adbot
ADBOT LOVES YOU

Data Graham
Dec 28, 2009

📈📊🍪😋



Use the "| safe" template tag.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply