[Server-devel] Server-devel Digest, Vol 75, Issue 25

Jerry Vonau jvonau at shaw.ca
Mon Aug 5 23:40:13 EDT 2013


Thank you Tony, I'll see if I can intergrade this into the XSCE as a
optional module. More below.

On Fri, 2013-08-02 at 12:02 +0200, Tony Anderson wrote:
> On 08/01/2013 06:33 PM, Sameer Verma wrote:
> > On Mon, Jul 29, 2013 at 11:33 PM, Tony Anderson<tony at olenepal.org>  wrote:
> >> >Hi,
> >> >
> >> >As I have unsuccessfully tried to explain many times. OLE Nepal, with help
> >> >from Daniel Drake, an effective and proven means to add selected
> >> >capabilities
> >> >to the base server. Since this capability takes advantage of the running
> >> >base
> >> >server, all of its normal system administration capabilities are available
> >> >(ssh,
> >> >yum, etc.).
> >> >
> > This is true, but not documented well and not known. For instance, we
> > use munin and openvpn on the XS 0.7 in Jamaica, and those are
> > "add-ons". It would be good to document this and discuss approaches
> > for installing complementary services.
> 
> The process is straightforward.
> 
> At install time, the script xs-custom is executed.
> 
> #!/bin/bash
> cp 20-xc-generic /etc/usbmount/mount.d
> cp path.py /usr/lib/python2.6/site-packages
> python fixssh.py
> adduser -padmin admin
> xs-setup domain
> poweroff
> 
> It installs a modified version of Daniel Drake's script 20-xc-generic 
> which will be executed when a removable drive is mounted.
> It puts path.py (a utility I use in many python cgi-scripts).
> It executes a script fixssh.py which enables password authentication.
> Finally, it adds user admin with password admin.
> The xs-setup script is executed to complete the process.
> The poweroff is a clear signal when the script is finished and forces a 
> reboot.
> 
> The 20-xc-generic script is attached. 

Think the attachment got scrubbed in digest mode. Can you reply to this
tread with the contents of 20-xc-generic script please?

> It checks the removable device for 
> a root folder
> XC. If this exists, it checks for a script in that folder 'xc-install'. 
> If so, it is executed. This allows a usb drive or hard drive to be used 
> for this install or for other purposes by renaming the XC folder (e.g. 
> xc) so that it is ignored.
> 
> The fixsh.py scripts enables password authentication:
> 
> #!/usr/bin/python
> 
> test = 'PasswordAuthentication'
> 
> fin=open('/etc/ssh/sshd_config.in','r')
> txt = fin.read()
> fin.close()
> lines = txt.split('\n')
> txtout = ''
> fout = open('/etc/ssh/sshd_config.in','w')
> for line in lines:
>      if test in line and not '#' in line:
>          print >> fout, test + ' yes'
>      else:
>          print >> fout, line
> fout.close()
> 
> 
> This is another reason for poweroff and reboot so that 
> /etc/ssh/sshd_config is also
> updated.
> 

Think a sshd restart might suffice.

> This enables login from an XO or other PC via ssh admin at schoolserver for
> system administration.
> 

That is part of the stock XSCE build.

The below needs the 20-xc-generic file to be present on the XS correct?

> The xc-install script in XC looks like this:
> 
> #!/bin/bash
> # Author: Daniel Drake <dsd at laptop.org>
> # XS auto-usbmount import script for code parts of the e-library
> #modified for Rwanda configuration <tony_anderson at usa.net>
> 
> set -e
> 
> VERBOSE=No
> 
> # Log a string via the syslog facility.
> log()
> {
>          if test $1 != debug || expr "$VERBOSE" : "[yY]" > /dev/null; then
>                  logger -p user.$1 -t "xc-code[$$]" -- "$2"
>                  echo "$(date "+%F %T") xc-code: $2"
>          fi
> }
> 
> error_beep()
> {
>          echo -en '\033[10;1000]\033[11;100]\007' > /dev/console
>          sleep 0.2
>          echo -en '\033[10;1000]\033[11;100]\007' > /dev/console
>          sleep 0.2
>          echo -en '\033[10]\033[11]' > /dev/console
>          return 0
> }
> 
> UM_MOUNTPOINT="/media/usb0"
> 
> cd "$UM_MOUNTPOINT"/XC
> if [ -f xc-wiki/xc-wiki4schools-install ]; then
>          log notice "Installing Wiki4Schools"
>          cd xc-wiki
>          if bash xc-wiki4schools-install; then
>              log notice "wiki4schools installed successfully"
>          else
>              log notice "wiki4schools install failed with code $?"
>              error beep
>          fi
> else
>          log notice 'xc-wiki not found'
> 
> It normally has several of these install sections. The install section 
> looks for a
> folder: xc-wiki and in that folder for an install script: 
> xc-wiki4schools-install.
> The contents of the folder are:
> 
> wiki.conf
> xc-wiki4schools-install
> xc-wiki4schools.tar.gz
> xc-wiki4schools.tar.gz.sha1
> 
> The xc-wiki4schools-install is:
> 
> #!/bin/bash
> 
> wktar=xc-wiki4schools.tar.gz
> 
> log() {
>      logger -p user.notice -t nexc-wiktionary-inst -s -- "$1"
> }
> 
> cp wiki.conf /etc/httpd/conf.d
> 
> rm -rf /library/wiki
> mkdir -p /library/wiki
> 
> cp $wktar /library/wiki
> cd /library/wiki
> 
> if ! tar -xzf $wktar; then
>          log "could not extract $wktar"
>          exit 1
> fi
> 
> rm -rf /library/wiki/$wktar
> 
> chown -R apache:apache /library/wiki
> chmod -R 755 /library/wiki
> 
> This script installs wiki.conf in /etc/httpd/conf.d, makes a folder 
> /library/wiki,
> copies the tarball to this folder and extracts it there. The tarball is 
> removed and
> permissions set. Note that the script removes previous content so that 
> it can
> be rerun.
> 
> The wiki.conf file is:
> 
> Alias /wiki4schools/ /library/wiki/
> <Directory /library/wiki>
> Order deny,allow
> Allow from all
> </Directory>
> 
> This makes the wiki accessible via: http://schoolserver/wiki4schools/.
> 
> 

We do similar things on the XSCE for things like the portal, IIAB,
pathagar plug-ins.

> For simplicity, each folder in XC has this style. For example, xc-moodle 
> installs
> the Moodle courses and so on. If xc-moodle is renamed to xcc-moodle, it 
> gets
> ignored by xc-install. This way a deployment can select which packages 
> or bundles to install.
> 

I'd be interested in the contents of the xs-moodle files or is that an
example? Sounds like 20-xc-generic looks for xc-* directories and files
in those directories to execute, need to see the code to be sure on what
you require. 

> As you can see bash scripting or python scripting works fine. The only 
> really tricky
> part is to make sure the bundles are self-contained as many school 
> servers have no internet access.
> 

That is part of the XSCE goals also, no internet needed to install.
Without having the code your running I have no clue on what you what to
see implemented for your needs. Help me out with what you need and I'll
do my best to have it as an add-on in the XSCE.

Jerry




More information about the Server-devel mailing list