diff options
Diffstat (limited to 'abs/core/supplemental-web')
-rw-r--r-- | abs/core/supplemental-web/PKGBUILD | 15 | ||||
-rw-r--r-- | abs/core/supplemental-web/backend_control.sh | 28 | ||||
-rw-r--r-- | abs/core/supplemental-web/cgi/diskless.py | 2 | ||||
-rw-r--r-- | abs/core/supplemental-web/contents/calllog.py | 2 | ||||
-rw-r--r-- | abs/core/supplemental-web/contents/count.py | 4 | ||||
-rwxr-xr-x | abs/core/supplemental-web/contents/exports.shtml | 20 | ||||
-rw-r--r-- | abs/core/supplemental-web/contents/links.html | 1 | ||||
-rwxr-xr-x | abs/core/supplemental-web/contents/list_exports.py | 82 | ||||
-rw-r--r-- | abs/core/supplemental-web/contents/process.py | 2 | ||||
-rw-r--r-- | abs/core/supplemental-web/grabkey.py | 145 | ||||
-rw-r--r-- | abs/core/supplemental-web/lighttpd-supplement.conf | 2 | ||||
-rw-r--r-- | abs/core/supplemental-web/supplemental-web.install | 2 |
12 files changed, 197 insertions, 108 deletions
diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index a756347..311292f 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,12 +1,12 @@ pkgname=supplemental-web pkgver=1.0 -pkgrel=17 -arch=('i686') +pkgrel=25 +arch=('i686' 'x86_64') MVDIR=$startdir/pkg/usr/MythVantage install=supplemental-web.install backup=('extra.cfg.txt') -source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh backend_control.sh) -depends=('lighttpd' 'php' 'fcgi' 'python' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') +source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh ) +depends=('lighttpd' 'php' 'fcgi' 'python2' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') @@ -18,7 +18,7 @@ build() { install -m755 -D lighttpd-supplement.conf $MVDIR/etc/lighttpd-supplement.conf install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh - install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh +# install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh mkdir -p $startdir/pkg/data/srv/httpd/htdocs/ cp -rp $startdir/contents/* $startdir/pkg/data/srv/httpd/htdocs chmod -R 755 $startdir/pkg/data/srv/httpd/htdocs @@ -32,7 +32,6 @@ build() { } -md5sums=('30aa4235aff78c77d544f930f3d92b62' +md5sums=('400abe98c97848f8b12c5eb111ac47e4' '3d8c7b430c1319d706ca420825918d2a' - '81cdb6ee6804fa36366c6e259a80e7b4' - 'f37e10ef9fc84b384b9a2d41f82ef744') + '81cdb6ee6804fa36366c6e259a80e7b4') diff --git a/abs/core/supplemental-web/backend_control.sh b/abs/core/supplemental-web/backend_control.sh deleted file mode 100644 index 2cf8a49..0000000 --- a/abs/core/supplemental-web/backend_control.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#. /etc/systemconfig -#echo $@ > /tmp/parms -#start Slavebackend: fusion 192.168.1.120 -COMMAND=$1 -BETYPE=$2 -eval LAST=\$$# -dbhost=`echo $LAST` - - -MESSAGE="" -case $COMMAND in - stop) MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestop.cgi 2>/dev/null` - ;; - - start ) - MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestart.cgi 2>/dev/null` - ;; - - restart) - /usr/bin/backend_control.sh stop $dbhost - sleep 2 - /usr/bin/backend_control.sh start $dbhost - ;; - clearcache) - MESSAGE2=`/usr/bin/curl http://$dbhost:1337/beclear.cgi 2>/dev/null` -esac - diff --git a/abs/core/supplemental-web/cgi/diskless.py b/abs/core/supplemental-web/cgi/diskless.py index d8d960b..30dbaa7 100644 --- a/abs/core/supplemental-web/cgi/diskless.py +++ b/abs/core/supplemental-web/cgi/diskless.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import cgi import os #http://192.168.1.200:1337/diskless.py?HOSTNAME=Envynetfe&MAC=00:0C:29:2D:08:82 diff --git a/abs/core/supplemental-web/contents/calllog.py b/abs/core/supplemental-web/contents/calllog.py index a96813e..908a9c6 100644 --- a/abs/core/supplemental-web/contents/calllog.py +++ b/abs/core/supplemental-web/contents/calllog.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # import MySQL module import MySQLdb diff --git a/abs/core/supplemental-web/contents/count.py b/abs/core/supplemental-web/contents/count.py index d59144a..2889af1 100644 --- a/abs/core/supplemental-web/contents/count.py +++ b/abs/core/supplemental-web/contents/count.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # import MySQL module import MySQLdb @@ -89,4 +89,4 @@ def main(argv): print "</div>" if __name__ == "__main__": - main(sys.argv[1:])
\ No newline at end of file + main(sys.argv[1:]) diff --git a/abs/core/supplemental-web/contents/exports.shtml b/abs/core/supplemental-web/contents/exports.shtml new file mode 100755 index 0000000..9a26dc9 --- /dev/null +++ b/abs/core/supplemental-web/contents/exports.shtml @@ -0,0 +1,20 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +<div id="mainContainer"> +<!-- <div id="header"><p></p></div> + <div id="content"> + <p></p>--> + + <!--#exec cmd="/data/srv/httpd/htdocs/list_exports.py" --> + + +</br> +</br> + +</body> +</html> + diff --git a/abs/core/supplemental-web/contents/links.html b/abs/core/supplemental-web/contents/links.html index cfc7311..883c273 100644 --- a/abs/core/supplemental-web/contents/links.html +++ b/abs/core/supplemental-web/contents/links.html @@ -24,6 +24,7 @@ Other Links <li><a href="http://forums.linhes.org" >Online User Forums</a></li> <li><a href="http://www.mythtv.org" >mythtv.org</a></li> <li><a href="http://smolt.mythtv.org" >mythtv smolt server</a></li> + <li><a href="/exports.shtml" >List file shares </a></li> </ul> diff --git a/abs/core/supplemental-web/contents/list_exports.py b/abs/core/supplemental-web/contents/list_exports.py new file mode 100755 index 0000000..13ec690 --- /dev/null +++ b/abs/core/supplemental-web/contents/list_exports.py @@ -0,0 +1,82 @@ +#!/usr/bin/python2 +import subprocess + +def nfs_export_list(): + nfslist = [] + exportfile = "/etc/exports" + proc = subprocess.Popen(["showmount", "-a"] , stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + rc = proc.returncode + if rc == 0: + try: + f = open(exportfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split() + if len(item) <= 1 : + continue + nfslist.append(item) + except : + pass + else: + nfslist.append(["NFS server is not running",'NFS server is not running']) + return nfslist + + +def smb_share_list(): + smblist=[] + + proc = subprocess.Popen(["smbclient", "-L", "\\localhost" , "-N"], stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + outstuff = stderr.split("\n") + for line in outstuff: + try: + heading1 = line.split()[0] + except: + continue + #print heading1 + #print heading1.find("Domain") + if heading1.find("Domain") > -1 : + #smblist.append('') + smblist.append(heading1) + break + + outstuff = stdout.split("\n") + for line in outstuff: + try: + heading1,heading2 = line.split() + except: + continue + if heading1 == "Server" and heading2 == "Comment": + break + smblist.append(line) + + return smblist + + +nfslist = nfs_export_list() +smblist = smb_share_list() + + +print "---------NFS SHARES-----------\n" +print "</br>" +for sharename in nfslist: + if sharename[1].find("noaccess") > -1 : + print "%s \t no access" %sharename[0] + print "</br>" + else: + print sharename[0] + print "</br>" + +print "\n---------SMB SHARES----------\n" +print "</br>" + +if len(smblist) == 0: + print "Samba is not running or no shares listed" + print "</br>" +else: + for sharename in smblist: + print "%s" %(sharename.split()[0]) + print "</br>" + diff --git a/abs/core/supplemental-web/contents/process.py b/abs/core/supplemental-web/contents/process.py index 9098ad6..6ae7363 100644 --- a/abs/core/supplemental-web/contents/process.py +++ b/abs/core/supplemental-web/contents/process.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import sys import cgi import os diff --git a/abs/core/supplemental-web/grabkey.py b/abs/core/supplemental-web/grabkey.py index 66d630b..d079607 100644 --- a/abs/core/supplemental-web/grabkey.py +++ b/abs/core/supplemental-web/grabkey.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 #polls the hobbit server for ghost clients. If it finds ghosts it will make a new bb-hosts file #with the new clients. #Will not add duplicate clients @@ -9,103 +9,118 @@ import sys import os def readkeyfile(): - global keylist - try: - infile = open('/data/home/mythtv/.ssh/authorized_keys', 'r') - except(IOError), e: - keylist='' - else: - keylist = infile.readlines() - infile.close() + global keylist + global data_config + try: + f = "%s/.ssh/authorized_keys" %data_config.MYTHHOME + infile = open(f, 'r') + except(IOError), e: + keylist='' + else: + keylist = infile.readlines() + infile.close() def grabkey(server): - global numberlines - global mbekey - url="http://" + server + ":1337/serverkey.cgi" - - try: - f = urllib2.urlopen(url) - except urllib2.HTTPError, e: - if e.code != 200: - print 'error find key' - sys.exit(1) - else: - mbekey = f.readlines() - f.close() + global numberlines + global mbekey + global data_config + url="http://" + server + ":1337/serverkey.cgi" + + try: + f = urllib2.urlopen(url) + except urllib2.HTTPError, e: + if e.code != 200: + print 'error find key' + sys.exit(1) + else: + mbekey = f.readlines() + f.close() numberlines = len(mbekey) #print mbekey def makenewkeyfile(): - global keylist - global mbekey - global numberlines - global numinserts - numinserts=0 - outlist = [] - for item in keylist: - if item not in outlist: - outlist.append(item) - - for item in mbekey: + global keylist + global mbekey + global numberlines + global numinserts + global data_config + numinserts=0 + outlist = [] + for item in keylist: + if item not in outlist: + outlist.append(item) + + for item in mbekey: # line = item.rstrip() - #nline = "%s #" % (line) - #nline = nline + '\n' - if item not in outlist: - outlist.append(item) - #print "adding: " + item - numinserts = numinserts + 1 - if numinserts > 0: - try: - outfile = open("/data/home/mythtv/.ssh/authorized_keys","w") - except(IOError), e: - os.system('mkdir -p /data/home/mythtv/.ssh') - outfile = open("/data/home/mythtv/.ssh/authorized_keys","w") - for i in outlist: - outfile.write(i + '\n' ) - outfile.close - os.system('chown -R mythtv /data/home/mythtv/.ssh') - os.system('chmod 700 /data/home/mythtv/.ssh/authorized_keys') - + #nline = "%s #" % (line) + #nline = nline + '\n' + if item not in outlist: + outlist.append(item) + #print "adding: " + item + numinserts = numinserts + 1 + if numinserts > 0: + f = "%s/.ssh/authorized_keys" %data_config.MYTHHOME + try: + outfile = open(f,"w") + except(IOError), e: + os.system('mkdir -p %s/.ssh' %data_config.MYTHHOME) + outfile = open(f,"w") + for i in outlist: + outfile.write(i + '\n' ) + outfile.close + os.system('chown -R mythtv %s/.ssh' %data_config.MYTHHOME ) + os.system('chmod 700 %s' %f) + global infile global keylist global numberlines global numinserts global mbekey +global data_config +sys.path.append('/usr/MythVantage/bin/') +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + + + numinserts = 0 readkeyfile() #print numberlines #print mbekey +#data_config.MYTHHOME + + try: - infile = open('/etc/systemconfig', 'r') + infile = open('/etc/systemconfig', 'r') except(IOError), e: - sys.exit(1) + sys.exit(1) else: - keylist = infile.readlines() - infile.close() + keylist = infile.readlines() + infile.close() for item in keylist: - if item.startswith("dbhost"): - itemlist=item.split("=") - server=itemlist[1].strip() - server=server.rstrip() - server=server.strip('"') - server=server.rstrip('"') + if item.startswith("dbhost"): + itemlist=item.split("=") + server=itemlist[1].strip() + server=server.rstrip() + server=server.strip('"') + server=server.rstrip('"') grabkey(server) if numberlines > 0: - makenewkeyfile() + makenewkeyfile() else: - print "nothing to add" + print "nothing to add" if numinserts < 1: - sys.exit(1) + sys.exit(1) else: - sys.exit(0) + sys.exit(0) diff --git a/abs/core/supplemental-web/lighttpd-supplement.conf b/abs/core/supplemental-web/lighttpd-supplement.conf index 24e1b4a..a07564a 100644 --- a/abs/core/supplemental-web/lighttpd-supplement.conf +++ b/abs/core/supplemental-web/lighttpd-supplement.conf @@ -41,7 +41,7 @@ dir-listing.external-css = "/frame.css" $SERVER["socket"] == ":1337" { server.document-root = "/data/srv/httpd/cgi/" - alias.url = ( "/templates/" => "/data/home/mythtv/templates/" ) + alias.url = ( "/templates/" => "/home/mythtv/templates/" ) } diff --git a/abs/core/supplemental-web/supplemental-web.install b/abs/core/supplemental-web/supplemental-web.install index 7dc0214..eec33fd 100644 --- a/abs/core/supplemental-web/supplemental-web.install +++ b/abs/core/supplemental-web/supplemental-web.install @@ -8,7 +8,7 @@ pre_install() { # arg 1: the new package version post_install() { - /bin/true + setfacl -m u:http:rx /home/mythtv/ COUNT=`grep -c "lighttpd-supplement.conf" /etc/lighttpd/conf.include` if [ $COUNT == 0 ] |