Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #9182

Re: web server that displays temp, humitdy etc

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.sys.raspberry-pi
Subject Re: web server that displays temp, humitdy etc
Date 2015-07-22 22:51 +0000
Organization A noiseless patient Spider
Message-ID <mop6ps$hj2$1@dont-email.me> (permalink)
References (3 earlier) <5c997b0a-9bf3-48e0-adcf-7cf52f6636c2@googlegroups.com> <DzSrx.4579$577.3084@fx46.am4> <5cfbda24-e587-4d0b-a3a9-fcf0ac7ed5ca@googlegroups.com> <K_Trx.7084$vh6.723@fx12.am4> <179b290d-abad-4d4f-aa00-faddfd706a1b@googlegroups.com>

Show all headers | View raw


On Wed, 22 Jul 2015 15:16:23 -0700, Glen_Ossman wrote:

> if i use a cron job to SUDO Python file_name and it creates a text file
> in my home directory then have Apache read the text file every time it
> is accessed.
> i am not sure i understand my web security issue ??
>
As I said above, compartmentalise for good security. I know Windows often 
makes this impossible, but it works well with Linux and is something you 
really should get used to doing.

Run the Python code in its own user so it is walled off from everybody 
else and (carefully, sparingly) let that user inherit any extra 
permissions in needs to access stuff such as I2C ports. Run it with a cron 
script that copies each newly produced web page to wherever Apache 
expects to find it.

> <html>
> 
> 	<head>
> 	<title>Reading from text files</title>
> 	</head>
> 	<body>
> 
> 	<?php
> 
> 	$f = fopen("unitednations.txt", "r");
>
This isn't needed unless you're doing something you haven't told us 
about. The Python code can easily can build a static page complete with 
all the latest instrument readings and a timestamp. There is no need for 
all that <php>...</php> stuff.

Then copy this static HTML page to wherever Apache expects to find it and 
you're done.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.sys.raspberry-pi | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: web server that displays temp, humitdy etc Glen_Ossman@ossman-cg.net - 2015-07-22 04:33 -0700
  Re: web server that displays temp, humitdy etc Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-22 18:15 +0000
  Re: web server that displays temp, humitdy etc mm0fmf <none@mailinator.com> - 2015-07-22 20:56 +0100
    Re: web server that displays temp, humitdy etc David James <david@tcs01.demon.co.uk> - 2015-07-22 21:01 +0000
    Re: web server that displays temp, humitdy etc Glen_Ossman@ossman-cg.net - 2015-07-22 14:11 -0700
      Re: web server that displays temp, humitdy etc mm0fmf <none@mailinator.com> - 2015-07-22 22:33 +0100
        Re: web server that displays temp, humitdy etc Glen_Ossman@ossman-cg.net - 2015-07-22 15:16 -0700
          Re: web server that displays temp, humitdy etc Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-22 22:51 +0000
        Re: web server that displays temp, humitdy etc Gordon Henderson <gordon+usenet@drogon.net> - 2015-07-23 17:11 +0000

csiph-web