Servers, Services and Service Accounts
If you want to use or set up a service, you of course need a computer to set it up on.
Some services can be run simultaneously on the same computer, some services are better off with a dedicated computer.
The content of your service is of course always your own responsability, but for setting up and administering the service itself and/or the computer it runs on, you have a choice: do it yourself or let us do it for you.
Servers and Services
Most computers of the department are owned by a research group, there are only a few that are provided for general use by the department itself. So unless your service is of very general use and/or a rather small one, you will need to find a computer it can be run on in your own research group.
If you have your own computer/hardware, you have to decide who will set it up: the system group of the department or yourself. Because of experiences from the past, we strongly advise against doing it yourself: most examples from the past ended up with a computer that was not being looked after as it should.
If you want to set up your service on a computer that is administered by the system group of the department, you still have the choice whether you set up your service yourself or you use a service that is set up system wide by the system group. In both cases, special dedicated accounts can be created/used to administer/use these services. Some technical and other considerations about these service accounts are described on a separate page. The rest of this page gives more details about typical service accounts for some typical services.
A special case to consider is a web site/application:
- if you want your web site/application to be accessible via a (base)URL that already exists:
- you must contact the administrator of that web server/service to consult how and where your site/application can be installed on that server/service
- e.g. you want to use http://dtai.cs.kuleuven.be/... contact the web admins of the dtai research group
- do notice that it might not always be possible or not advisable to install your site/application on an existing web service because it might interfere too much
- if you want to use a new (base)URL:
- you must look for a web server that can host your new URL:
- either use an existing machine with an active web service and set up your site as a new virtual host on that web service
- cs-sys: set up and add the new virtual host to apachevirthosts in config.hosts
- or ask to start a new web service on an existing machine that does not yet have an active web service
- cs-sys: add machine to cfengine group cs_apache
- or provide new hardware or, if your research group has an existing cloud infrastructure, (ask to) create a new virtual machine
- cs-sys: install and set up new machine in cfengine group cs_apache
- either use an existing machine with an active web service and set up your site as a new virtual host on that web service
- if you do not want to use the (real) hostname of the web server you will be using, you most probably have to register that new URL in either the departmental DNS (*.cs.kuleuven.be) or via some external DNS registrar (*.be or *.org or ...)
- you must look for a web server that can host your new URL:
- if you want to use a web site as a wrapper to access your own application, you can use either perl (or python) from within a cgi-bin or php from within the sites DocumentRoot.
- your system group representative should be able to help you with all of the above ;-)
Services and Service Accounts
Tomcat
For each tomcat instance we will create a single, dedicated local account with which you both configure and run the tomcat.
More information about our tomcat setup is available at http://www.cs.kuleuven.be/cs/system/software/www/tomcat/.
Apache Virtual Host with PHP
For each apache virtual host instance that needs php we will create a single, dedicated local account with which the php is run.
More information about our apache virtual host setup is available at http://www.cs.kuleuven.be/cs/system/software/www/virtualhosts/.
Web-site/application via system/default apache service
For each web-site or web-application that must/should be used via the apache service that is started on the system level, we will create a directory in the apache DocumentRoot.
If the DocumentRoot of that web service is accessible via NFS this might be enough. You can then access the files of your web-site/application via your normal, departmental login account and the automounter path that is provided for that DocumentRoot (/cw/something/...). You can also access the web service log files via some other automounter path (/cw/somelogs/...).
If your web-site/application will grow out to a large application with several people involved, local account(s) on the web server itself might be a better way of working.
The difference is mainly where to define the group-members: either in the authorized_keys file of the local account(s) or in the LDAP-group that is used to give everybody write access to the files.
You can start with your departmental login account and NFS and switch to local account(s) later when the need arises. It is probably wise not to mix both way of working unless you really know what you are doing ;-)
When using local account(s) you have a choice between using a single local account to which every group member has access (using ssh keys) or several local accounts with a specific purpose for each of them as you need it.
- If you want several accounts to have access to that web-application directory (to be able to organize your own work), we will also create a group they all belong to, so you can create/use group-writable files and directories.
- If you regularly change the web-site/application, it is probably best to use different/personal accounts for each team member and to make the files/directories group-writable
- If you rarely change the web-site/application, a single account might be enough
- the disadvantage of using a single account is that you don't know who did what since all team members use the same account to change/configure the site/application
Moreover departmental web servers are executed using php safe mode so this means that:
- storing and re-using data in files from within the web-application might not be possible (depending on the actual use case)
- executing other processes/commands is only possible if these commands are registered in the php safe execution directory
If you think you need to write files or call other commands from within a (php) web-application, we can probably help in figuring out what your best options is ... let us know and we will try to sort something out.
Your own service(s)
If you want to run a self-compiled/self-installed service do not forget that the departmental networks are protected by a firewall ... your service will not be accessible for the outside world unless access to it is specified in the firewall rules. You can set it up and test it from within the departmental intranet before opening it up to the outside world though.
Moreover it is best to use several dedicated local accounts:
- account1 to compile/install/configure the service with
- will be owner of the source, binaries and configuration directories (e.g. /home/account1/src, /home/account1/bin and /home/account1/conf)
- account2 to run the service with
- will be owner of the actual processes and (probably) the log files (e.g. /home/account2/log)
- account3 for the service data
- will be owner of the data directory (e.g. /home/account3/data)
If you have several people working with the same such self-compiled/installed service, it might even be best to use different accounts for:
- the compilation/installation (/home/account1/src, /home/account1/bin) and for the configuration (/home/account4/conf)
- the different parts in the data and put the data in a shared directory (/path/to/data)
The run-account has (must have) read-access to the run, configuration and data files.
Other accounts most probably do not need access to each others directories (except for the shared data directory if any of course).
No account has/needs write-permission to the files/directories of the other accounts (except for the shared data directory if any of course).
Most certainly does the run-account never should/needs to have write-access to other files/directories than his own home directory and/or other run/log directories.
- In this way, if there is a vulnerability in the service, or the service is compromised in some other way, neither the executables, the configuration nor the data can be changed by exploiting that vulnerability.
- To implement read-access when using a shared/writable data directory, you probably need a dedicated group as well:
- see Technical Notes on separate page
- use the group to give shared write-access to the data (so at least: ----rws---)
- do not add the run-account to that group such that:
- the run-account can never change files that are group-writable for this group
- the run-account can never create new files that belong to this group (pretending to be regular/normal files and remaining so unnoticed)
- if you do not need to restrict (read-)access to the data, just make it readable for others/world
- if you need to restrict (read-)access to the data so that only team-members and the run-account can access it:
- use a top-level data directory that:
- is owned by and accessible for the run-account
- has that group as group
- is read- and write-accessible for that group
- has no rights for others
- therefore: drwxrws--- run-account group
- use a subdirectory that is not owned by the run-account but read- and writable for the group and read-able for others because the run-account is not a member of that group:
- therefore: drwxrwsr-x root group
- put the data in that subdirectory to protect it from being changed by the run-account (because the top-level of the data directory is owned by that run-account)
- the data itself must also be readable for others since the run-account is not a member of that group
- the data itself is most probably writable for the group
- use a top-level data directory that:
- the login group for the data accounts can be set to this group, it will allow files to receive the correct permissions automatically, but in that case, do consider carefully whether the home directory of these accounts must/can be group-readable
As an example, if you compare this kind of personal service with the standard apache web service, the accounts correspond to:
- account1 = root
- account2 = www-data
- account4 = root (but could be any other account, but certainly not www-data)
- other accounts are used to own the web pages
- installation directory (/home/account1/bin) = /usr/bin
- run/log directory (/home/account2/log) = /var/log/apache2
- configuration directory (/home/account4/conf) = /etc/apache2
- data directory (/path/to/data) = /var/www (standard ubuntu) or /localhost/apache/public_html (our departmental setup)
If you want to have your service started and stopped automatically at boot/shutdown of the machine it is running on, ask us to have it enabled to do so in /etc/cs-localservices:
- you need to create (or maybe your service already has it) a start/stop script that accepts (at least) the start and stop arguments as in the example below:
#!/bin/bash case "$1" in # start and stop are obligatory start) /path/to/your/service options-to-start ... ;; stop) # If possible/needed uncomment the line below # and implement the right way to stop the service. # This is not really needed because at shutdown # all remaining processes are sent the TERM signal anyway # but this start/stop script MUST accept the stop # argument to avoid unnecessary errors/warnings. # Whether or not you actually implement the stop action # is up to you (but might be handy while testing ;-) # /path/to/your/service options-to-stop ... ;; # the arguments below are optional but might be handy for yourself # these arguments are not used by the start/stop sequence as executed # at boot/shutdown-time and are therefore only meant for manual/command line # use by the service owner/maintainer restart) $0 stop sleep 2 $0 start ;; status) # commands to give the status of your service: running/stopped/how busy/... ;; *) echo "Usage: $0 { start | stop | restart | status }" exit 1 ;; esac
account-to-execute-service-with /path/to/start-stop-script
You can use the start-stop-script yourself to start/stop your own services by executing it manually on the command line (using the right account and the right start/stop argument of course).
cs-sys can use the /etc/cs-localservices/yourservice configuration to start/stop your service(s) as needed (e.g. to test the setup) by using:
/etc/init.d/cs-local -c yourservice { start | stop | ... }
Do notice that the service is started at boot time with an environment that is not the same as the environment you have when you log in interactively. So you might have to make sure to put the necessary environment variables in the start-stop-script. It might help to ask helpdesk to test starting your services manually as described above to make sure your service starts correctly at boot time.
Do also notice that you can access your service via an (existing) web server by means of the proxy mechanism in the same way as our Tomcat instances are made available.

