Raised This Month: $51 Target: $400
 12% 

Updater


Post New Thread Reply   
 
Thread Tools Display Modes
Nefarius
Member
Join Date: Sep 2010
Old 03-29-2014 , 18:13   Re: Updater
Reply With Quote #401

Sine all my projects where already on Github I had a similar problem to solve. I built a small PHP wrapper script running on my web server delivering the files via HTTP instead of HTTPS:

PHP Code:
<?php

$path 
$_GET['path'];

if(empty(
$path))
    die(
"No path specified!");

$url "https://raw.github.com/nefarius/WorkshopMapLoader/master/";
$ch curl_init();
$timeout 30;
$userAgent $_SERVER['HTTP_USER_AGENT'];
curl_setopt($chCURLOPT_URL$url.$path);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_CONNECTTIMEOUT$timeout);
curl_setopt($chCURLOPT_USERAGENT$userAgent);
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);

$response curl_exec($ch);
if (
curl_errno($ch)) {
    echo 
curl_error($ch);
} else {
    
curl_close($ch);
    
header("Content-Type: text/plain; charset=utf-8");
    echo 
$response;
}

?>
Feel free to use and adapt if you have a web server with PHP and the PHP-CURL extension.
__________________
Let the future tell the truth and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I really worked, is mine.
- Nikola Tesla
Nefarius is offline
Miss.Xantis
Senior Member
Join Date: Oct 2009
Old 04-02-2014 , 06:09   Re: Updater
Reply With Quote #402

L 04/01/2014 - 18:11:23: SMC parsing error on line 0
L 04/01/2014 - 18:11:23: [0] URL: http://dev.xadgaming.com/simple-chat...er/updater.txt
L 04/01/2014 - 18:11:23: [1] ERROR: Line contained too many invalid tokens

We have this error on our server.
__________________
Miss.Xantis is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-02-2014 , 10:34   Re: Updater
Reply With Quote #403

http://dev.xadgaming.com/simple-chat...er/updater.txt

That doesn't look like a valid updater text file...
__________________
ddhoward is offline
Donski
Senior Member
Join Date: Sep 2012
Old 04-02-2014 , 10:37   Re: Updater
Reply With Quote #404

Quote:
Originally Posted by Miss.Xantis View Post
L 04/01/2014 - 18:11:23: SMC parsing error on line 0
L 04/01/2014 - 18:11:23: [0] URL: http://dev.xadgaming.com/simple-chat...er/updater.txt
L 04/01/2014 - 18:11:23: [1] ERROR: Line contained too many invalid tokens

We have this error on our server.
It's due to the domain where the updater file for Simple Chat Processor is hosted being expired, you can just ignore that error.
Donski is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-02-2014 , 15:27   Re: Updater
Reply With Quote #405

Is there ever going to be an option to have paths be different on the download server than the game server?

For instance, to make it easier to create distributions, I store my source and resource files using the full path (addons/sourcemod/scripting/whatever.sp or sound/prophunt/whatever.mp3) but I don't want to put my updater files... or models/materials/sounds... under the sourcemod directory.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-02-2014 at 15:31.
Powerlord is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 04-09-2014 , 06:14   Re: Updater
Reply With Quote #406

First thanks GoD-Tony for this powerfull and usefull tool.
And well, I have read your finals notes, not sure if you still want give a look about how I added Updater to my plugin, here is a link.
__________________
Want to check my plugins ?
Arkarr is offline
Lordearon
Member
Join Date: Jan 2013
Location: Vietnam
Old 04-11-2014 , 06:08   Re: Updater
Reply With Quote #407

How vulnerable is this to EvilGrade if DNS records are compromised?
http://www.infobyte.com.ar/down/Fran...%20-%20ENG.pdf
__________________
iGame.vn
Lordearon is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-11-2014 , 06:12   Re: Updater
Reply With Quote #408

Quote:
Originally Posted by Lordearon View Post
How vulnerable is this to EvilGrade if DNS records are compromised?
http://www.infobyte.com.ar/down/Fran...%20-%20ENG.pdf
Extremely.
__________________
asherkin is offline
Lordearon
Member
Join Date: Jan 2013
Location: Vietnam
Old 04-11-2014 , 06:14   Re: Updater
Reply With Quote #409

should add functionality to check downloaded file signatures (public/private key) before doing the update? Is that possible?

let's say I target the BGF warmod plugin. the dns redirects the update request to my compromised add-on.

If the updater had functionality to download the plugin together with a hash, signed with the warmod author private key and the updater was configured to read the public key the server admin stored on the server, it would reject the compromised add-on, no?

or does the SSL handle this already?
__________________
iGame.vn

Last edited by Lordearon; 04-11-2014 at 06:22.
Lordearon is offline
Nefarius
Member
Join Date: Sep 2010
Old 04-11-2014 , 14:07   Re: Updater
Reply With Quote #410

If you can ensure the safety of your DNS-Server you may use SSL/TLS (HTTPS) to protect the content of the connection once established. I managed to get it working with Github using SSL/TLS, just edit scripting/updater/download_curl.sp and add the following after line 41:
Code:
curl_easy_setopt_int(curl, CURLOPT_SSLVERSION, 3);
This will tell cURL to use SSL protocol version 3 and connect successful. This will only work if you use the cURL extension!

If you still can't use SSL, try these steps (still requires cURL extension, no Socket or SteamTools support!):
  1. Create a new directory called ssl in your sourcemod folder
  2. Download this semi-official root CA collection and put it in the new ssl folder (don't rename it!)
  3. Add this snippet after line 34 in download_curl.sp:
    Code:
    decl String:sCAPath[PLATFORM_MAX_PATH];
    BuildPath(Path_SM, sCAPath, sizeof(sCAPath), "ssl/cacert.pem");
  4. Add this snippet after line 41 in download_curl.sp:
    Code:
    if(FileExists(sCAPath))
    {
    	LogMessage("Found custom cacert.pem, using supplied root CA store for SSL connections");
    	curl_easy_setopt_string(curl, CURLOPT_CAINFO, sCAPath);
    }
    curl_easy_setopt_int(curl, CURLOPT_SSLVERSION, 3);
  5. Recompile, update your servers updater.smx and reload it
  6. Plugins using updater should now be able to use HTTPS-enabled websites as update source

If you trust me and don't want to compile yourself you can use the attached updater.smx (as it can't be compiled on the forum), I increased the version number to 1.2.1 so it won't get confused with the official one.
Attached Files
File Type: smx updater_ssl.smx (20.4 KB, 120 views)
File Type: zip updater_ssl_2014-04-11.zip (14.8 KB, 111 views)
__________________
Let the future tell the truth and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I really worked, is mine.
- Nikola Tesla

Last edited by Nefarius; 04-11-2014 at 14:20.
Nefarius is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode