# sudoers file for hostting-tools
# in case of exceptions you can become sudo by "pkexec visudo" and remove line "#includedir /etc/sudoers.d"

User_Alias ENNIT_IA_ADMIN_USER = eiadmin, efoadmin
User_Alias ENNIT_IA_DEPLOY_USER = interactive, eformation, eiadmin, efoadmin

# rsync ...
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /usr/bin/rsync

# mysql ...
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /usr/bin/mysql
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /usr/bin/mysql_upgrade

# exec commands as user interactive or eformation (e.g. delete cache files created by www-data)
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /bin/su interactive *
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /bin/su -l interactive *
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /bin/su eformation *
ENNIT_IA_ADMIN_USER ALL = NOPASSWD: /bin/su -l eformation *

# deploy nginx configurations ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/nginx_add_host, /usr/local/bin/nginx_del_host
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/sbin/nginx, /etc/init.d/nginx

# deploy helper tool for nginx or certbot
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/set_symlink

# deploy apache configurations ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/apache_add_host, /usr/local/bin/apache_del_host
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/sbin/apachectl, /etc/init.d/apache2

# deploy mysql credentials ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/createMysqlUser
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/importMysqlCredentials

# deploy ftp credentials ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/createFtpUser
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/importFtpCredentials

# deploy cron.d scripts ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/installCronScript.sh

# reboot the system ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/reboot.sh

# update the apt-packages (this runs also within cron) ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/aptUpgrade.sh

# install apt-packages
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/aptInstall.sh

# execute a cli-dev-build
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/devBuildSS4.sh

# change hosting-tools settings ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/setHostingToolsSetting.sh

# change hosting-tools rsnapshot settings ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/setHostingToolsRsnapshotSetting.sh

# deploy log rotation config files ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/installLogRotationConfig.sh

# deploy init.d scripts ...
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/service_add
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/service_del

# varnish
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/sbin/varnishd

# docker
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/bin/docker *

# allow restart of services
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/bin/service *
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/sbin/service *

# allow generating of locale files
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/sbin/locale-gen *

# exec commands as user www-data (e.g. delete cache files created by www-data)
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/bin/su www-data *
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/bin/sudo -u www-data *

# exec command for typo3 production and update mode
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /srv/www/*/cli/production-mode.sh
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /srv/www/*/cli/update-mode.sh

# exec command for clean_templates.sh and clean_temp_files.sh
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /srv/www/*/cli/clean_templates.sh
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /srv/www/*/cli/clean_temp_files.sh

# mysql
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/mysql_show_privileges.sh
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/local/bin/mysql_grant_privilege.sh

# delete sessions
ENNIT_IA_DEPLOY_USER ALL = NOPASSWD: /usr/bin/rm /tmp/sess_*
