Browse Source

Add initial script.

Nathaniel van Diepen 10 years ago
parent
commit
75b2e67ad0
4 changed files with 102 additions and 0 deletions
  1. 3 0
      data/etc/suders.d/ircd
  2. 4 0
      data/etc/suders.d/web
  3. 30 0
      data/etc/sudoers
  4. 65 0
      install.sh

+ 3 - 0
data/etc/suders.d/ircd

@@ -0,0 +1,3 @@
+%ircd ALL=(ALL) NOPASSWD: /home/ircd/bin/unreal
+%ircd ALL=(ALL) NOPASSWD: /home/ircd/bin/anoperc
+%ircd ALL=(ALL) NOPASSWD: /home/ircd/bin/denorarc

+ 4 - 0
data/etc/suders.d/web

@@ -0,0 +1,4 @@
+ircd%web ALL=(ALL) NOPASSWD: /home/eeems/bin/apachelog
+%web ALL=(ALL) /usr/sbin/service apache2 *
+%web ALL=(ALL) /usr/sbin/service mysql *
+%web ALL=(ALL) NOPASSWD: /home/eeems/bin/mysqllog

+ 30 - 0
data/etc/sudoers

@@ -0,0 +1,30 @@
+#
+# This file MUST be edited with the 'visudo' command as root.
+#
+# Please consider adding local content in /etc/sudoers.d/ instead of
+# directly modifying this file.
+#
+# See the man page for details on how to write a sudoers file.
+#
+Defaults	env_reset
+Defaults	mail_badpass
+Defaults	secure_path="/opt/omnimaga/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+# Host alias specification
+
+# User alias specification
+
+# Cmnd alias specification
+
+# User privilege specification
+root	ALL=(ALL:ALL) ALL
+
+# Members of the admin group may gain root privileges
+%admin ALL=(ALL) ALL
+
+# Allow members of group sudo to execute any command
+%sudo	ALL=(ALL:ALL) ALL
+
+# See sudoers(5) for more information on "#include" directives:
+
+#includedir /etc/sudoers.d

+ 65 - 0
install.sh

@@ -1 +1,66 @@
 #!/bin/bash
+
+section(){
+	echo "=> Starting Section \"$@\"";
+}
+log(){
+	echo "|-> $@";
+}
+sublog(){
+	echo "|--> $@";
+}
+info(){
+	echo "|-> INFO: $@";
+}
+subinfo(){
+	echo "|--> INFO $@";
+}
+install(){
+	apt-get -qq install $@;
+}
+updatesudo(){
+	if visudo -q -c -fdata/etc/$@;then
+		cp data/etc/$@ /etc/$@;
+	fi;
+}
+# Make sure the script is running as root
+if [ "$(id -u)" != "0" ]; then
+	sudo $0;
+	exit;
+fi;
+
+section "Package Installation";
+log "LAMP Stack";
+install lamp-server^;
+log "Node.js"
+install nodejs;
+log "SSH Server";
+install ssh;
+log "Git";
+install git;
+
+section "Custom Packages";
+log "Omnimaga-Server-Utils";
+sublog "Creating directories";
+mkdir /opt/omnimaga/bin -p;
+chown root:users /opt/omnimaga/bin;
+sublog "Adding to path";
+echo "export PATH=$PATH:/opt/omnimaga/bin;" > /etc/profile.d/omnimaga-server-utils.sh;
+. /etc/profile.d/omnimaga-server-utils.sh;
+sublog "getting files";
+rm -rf /opt/omnimaga/bin;
+git clone https://github.com/Omnimaga/server-utils.git /opt/omnimaga/bin/;
+chmod a+x /opt/omnimaga/bin/*;
+subinfo "Add users to the group omnimaga-utils to allow access";
+
+
+section "Config";
+log "Setting up sudoers";
+updatesudo sudoers;
+log "Setting up groups";
+sublog "web";
+groupadd -f web;
+updatesudo sudoers.d/web;
+sublog "ircd";
+groupadd -f ircd;
+updatesudo sudoers.d/ircd;