473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

software that knows how to update itself

I've written and tested a *very basic* socket server that I'll have to
deploy soon... sooner than I'd like as much of the functionality that I
want to include hasn't been implemented or even tested yet. So, I've
been thinking about writing a function that has the ability to upgrade
the socket server remotely. However, I have never done anything like
this so I'm looking for tips and advice on the subject.

The socket server runs continuously listening for connections so I'll
always be able to communicate with it. Here's some pseudo code that
captures the essence of what I'd like to do:

def update_urself():
receive updated socket server code & write it to a file
verify file with crc or md5sum check on both ends
if verify is OK:
close all connections
replace sock_serv.py with sock_serv_update.py

if conn.recv == 'UPDATE'
update_urself()

Does this look sane?


Jul 18 '05 #1
2 1263
Hi,

the update thing looks sane to me, but only IF you can really trust
that crc/md5 part, which you didn't flesh out very much. I really don't
know enough about crypto stuff to comment on this part. Some things to
think about, anyway: How exactly will this work? How can you be sure
that hackers won't use this mechanism to replace your code with theirs?
You might argue that you won't have enough installations to get hackers
interested in your server. In closed networks, well okay. But I
wouldn't run this on an internetwide accessible machine.

I don't know what your situation is; if this is for a larger
organization: do you run an automatic software deployment tool in your
organization? These do the same thing, but for all kinds of apps. Why
not use that to deliver updates? If you don't have such a thing but can
afford it, think about buying one. I can give you some pointers if
you're interested; I used to work in that field.

Cheers,
Stefan

On 15.09.2004, at 14:46, Brad Tilley wrote:
I've written and tested a *very basic* socket server that I'll have to
deploy soon... sooner than I'd like as much of the functionality that
I want to include hasn't been implemented or even tested yet. So, I've
been thinking about writing a function that has the ability to upgrade
the socket server remotely. However, I have never done anything like
this so I'm looking for tips and advice on the subject.

The socket server runs continuously listening for connections so I'll
always be able to communicate with it. Here's some pseudo code that
captures the essence of what I'd like to do:

def update_urself():
receive updated socket server code & write it to a file
verify file with crc or md5sum check on both ends
if verify is OK:
close all connections
replace sock_serv.py with sock_serv_update.py

if conn.recv == 'UPDATE'
update_urself()

Does this look sane?


--
http://mail.python.org/mailman/listinfo/python-list

// st****@eischet.com //

Jul 18 '05 #2
Am Mittwoch, 15. September 2004 14:46 schrieb Brad Tilley:
def update_urself():
receive updated socket server code & write it to a file
verify file with crc or md5sum check on both ends
This step is very dangerous, as only checking a hash on the client and server
side can really lead to problems when you have a malicious client giving out
the new file.

What you should do:

--- Generate private/public key pair for the client which will update the
server.
--- Export the public key, and hand it out with each distributed server.
--- Now, when sending a new sock_serv.py, the server can check the digital
signature which is also sent by the client (which it can create, because it
has the private key, and which the server can check because it has the public
key as distributed in step 2).
--- Only if this signature check is okay (better use some form of SHA for
creating the signature) will the client accept the new file.
if verify is OK:
close all connections
replace sock_serv.py with sock_serv_update.py

if conn.recv == 'UPDATE'
update_urself()


For the rest, it looks okay.

If you need to implement something like this, I'd like to point you to Sophie
(a crypto library I've written, which directly works on top of libgmp, the
gnu multi precision integer library).

http://www.heim-d.de/~heikowu/Crypto

HTH!

Heiko.
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: joo | last post by:
Hi! I need to implement something similar to "Automatic Update" feature which we see in windows 2000. We need this support for our software, basically to provide the software update. How can I...
4
by: R.H. | last post by:
I was wondering if anyone knows or could possibly point me to a web site that develops software tools for vb.net that are written in csharp. I have been all over the web trying to find such a...
6
by: S.Sigal | last post by:
Hello: Always wanted to do this -- but never knew how... The goal is to write software that goes out to clients -- but I want to be able to auto-update them when there is a later release...
102
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality...
4
by: P1ayboy | last post by:
I need advice on how to best to protect software with licenses. We are developing a windows application that people can purchase and download off the net, but the software needs to be protected...
191
by: Xah Lee | last post by:
Software Needs Philosophers by Steve Yegge, 2006-04-15. Software needs philosophers. This thought has been nagging at me for a year now, and recently it's been growing like a tumor. One...
3
by: DurumDara | last post by:
Hi ! I need to speedup my MD5/SHA1 calculator app that working on filesystem's files. I use the Python standard modules, but I think that it can be faster if I use C, or other module for it. ...
4
by: LW | last post by:
Who among this group believes that Microsoft (or any other creator of intellectual property) does NOT have both a RIGHT and a DUTY to protect the product of their minds?...
9
by: Michael Sparks | last post by:
Hi, I'm interested in writing a simple, minimalistic, non persistent (at this stage) software transactional memory (STM) module. The idea being it should be possible to write such a beast in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.