X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=vm_hosted;h=21950b02675597f3e02d3468a9b3cdad9649752b;hb=fbbdf3cc3b70bafc30320601465d402a5e615d0e;hp=4bfbede44076542ac2409aacea22e7eba82d34b0;hpb=9447dd1f7837e04e0ec922df4b47174b38801874;p=lhc%2Fateliers.git diff --git a/vm_hosted b/vm_hosted index 4bfbede..21950b0 100755 --- a/vm_hosted +++ b/vm_hosted @@ -62,7 +62,7 @@ rule_adduser () { sudo adduser "$@" "$user" } rule_apt_get_install () { # SYNTAX: $package - sudo DEBIAN_FRONTEND=noninteractive apt-get install "$@" + sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes "$@" } rule_dpkg_reconfigure () { # SYNTAX: $package sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure "$@" @@ -74,7 +74,7 @@ rule__chrooted_configure () { # NOTE: est-ce bien utile à un moment ? . /etc/profile } -rule_apache2_configure () { +rule_apache2_configure () { # XXX: cette règle n'est pas testée/mise-à-jour local -; set +f rule apt_get_install \ apache2-mpm-itk \ @@ -259,6 +259,9 @@ rule_apt_configure () { Pin: release a=$vm_lsb_name-backports Pin-Priority: 200 EOF + #sudo install -m 660 -o root -g root /dev/stdin /etc/apt/apt.conf.d/02proxy-grenode <<-EOF + # Acquire::http::Proxy "http://outils.grenode.net:3142"; + # EOF sudo apt-get update rule apt_get_install apticron sudo install -m 644 -o root -g root /dev/stdin /etc/apticron/apticron.conf <<-EOF @@ -276,9 +279,6 @@ rule_apt_configure () { # CUSTOM_NO_UPDATES_SUBJECT="" # CUSTOM_FROM="root@$vm_fqdn" EOF - sudo install -m 660 -o root -g root /dev/stdin /etc/apt/apt.conf.d/01proxy-grenode <<-EOF - Acquire::http::Proxy "http://outils.grenode.net:3142"; - EOF } rule_boot_configure () { #warn "lors de l'installation Debian, surtout n'installer GRUB sur AUCUN disque proposé !" @@ -507,48 +507,29 @@ rule_gitolite_configure () { --home /home/git/log \ --shell /bin/false \ --system - rule adduser git-data\ + rule adduser git-data \ --disabled-login \ --disabled-password \ --group \ --home /home/git/pub \ --shell /bin/false \ --system - rule adduser git-daemon\ - --disabled-login \ - --disabled-password \ - --group \ - --home /home/git/pub \ - --shell /bin/false \ - --system - rule adduser log-git-daemon\ - --disabled-login \ - --disabled-password \ - --group \ - --home /home/git/log/git-daemon \ - --shell /bin/false \ - --system sudo adduser git git-data - sudo adduser git-daemon git-data - sudo adduser log-git log-git-daemon sudo install -d -m 770 -o git -g git \ /etc/gitolite \ /home/git/etc \ /home/git/etc/ssh sudo install -d -m 751 -o git -g git \ /home/git - sudo install -d -m 3771 -o git-data -g git-data \ + sudo install -d -m 2770 -o git-data -g git-data \ /home/git/pub sudo install -d -m 1771 -o git -g git \ /home/git/log sudo install -d -m 2770 -o git -g log-git \ /home/git/log/gitolite \ /home/git/log/gitolite/perf - sudo install -d -m 770 -o log-git-daemon -g log-git-daemon \ - /home/git/log/git-daemon - sudo install -d -m 550 -o www-lhc-git -g www-lhc-git \ - /etc/gitweb \ - /etc/gitweb/cgi + sudo install -d -m 3771 -o git -g git \ + /home/git/hooks sudo ln -fns /etc/gitolite /home/git/etc/gitolite sudo ln -fns /etc/gitweb /home/git/etc/gitweb sudo ln -fns etc/gitolite/gitolite.rc /home/git/.gitolite.rc @@ -598,40 +579,9 @@ rule_gitolite_configure () { \$WEB_INTERFACE = "gitweb"; 1; EOF - sudo install -m 740 -o git -g www-lhc-git /dev/stdin \ - /home/git/etc/gitweb/gitweb.conf <<-EOF - \$commit_oneline_message_width = 70; - \$default_projects_order = 'age'; - \$default_text_plain_charset = 'UTF-8'; - @diff_opts = (); - \$favicon = "img/git-favicon.png"; - \$git_temp = "/run/shm/tmp/gitweb"; - \$home_footer = "/etc/gitweb/cgi/home-footer.cgi.inc"; - \$home_header = "/etc/gitweb/cgi/home-header.cgi.inc"; - \$home_link = "/"; - \$home_link_str = 'dépôts'; - \$home_th_age = 'activité'; - \$home_th_descr = 'description'; - \$home_th_owner = 'contact'; - \$home_th_project = 'dépôt'; - \$javascript = "js/gitweb.js"; - \$logo = "img/git-logo.png"; - \$my_uri = ""; - \$projectroot = "../git"; - \$projects_list = "/etc/gitolite/projects.list"; - \$projects_list_description_width = 42; - \$projects_list_owner_width = 15; - \$search_str = "Filtre :"; - \$site_footer = "/etc/gitweb/cgi/site-footer.bin"; - \$site_header = undef; - \$site_name = "git.$vm_domainname"; - \$space_to_nbsp = 0; - @stylesheets = ("css/gitweb.css");# - \$untabify_tabstop = 2; - EOF sudo install -m 600 -o git -g git \ "$tool"/var/pub/ssh/git.key \ - /home/git/etc/ssh/git.pub + /home/git/etc/ssh/git.pub sudo -u git \ GL_RC=/home/git/etc/gitolite/gitolite.rc \ GIT_AUTHOR_NAME=git \ @@ -641,7 +591,6 @@ rule_gitolite_configure () { do test ! -d /home/git/etc/gitolite/"$d" || rmdir /home/git/etc/gitolite/"$d" done - rule apt_get_install gitweb highlight sudo service tmpfs restart } rule_locales_configure () { @@ -761,13 +710,20 @@ rule_mail_configure () { rule_mysql_configure () { rule apt_get_install mysql-server-5.5 sudo install -m 644 -o root -g root \ - "$tool"/etc/mysql/my.cnf \ - /etc/mysql/my.cnf - if test ! -d /home/mysql; then - sudo install -d -m 750 -o mysql -g mysql \ - /home/mysql - sudo -u mysql mysql_install_db --no-defaults --datadir=/home/mysql/ - fi + "$tool"/etc/mysql/my.cnf \ + /etc/mysql/my.cnf + if test ! -d /home/mysql + then + sudo install -d -m 750 -o mysql -g mysql \ + /home/mysql + sudo install -d -m 750 -o mysql -g mysql \ + /home/mysql/data + sudo -u mysql mysql_install_db \ + --no-defaults \ + --datadir=/home/mysql/data + sudo usermod --home /home/mysql mysql + fi + sudo service tmpfs restart } rule_network_configure () { sudo install -m 644 -o root -g root /dev/stdin /etc/hostname <<-EOF @@ -869,7 +825,7 @@ rule_nginx_configure () { --disabled-login \ --disabled-password \ --group \ - --home /home/www-data/"$site" \ + --home /home/www/pub/"$site" \ --shell /bin/false \ --system rule adduser log-www-"$site" \ @@ -879,7 +835,7 @@ rule_nginx_configure () { --home /home/www/log/"$site"/nginx \ --shell /bin/false \ --system - sudo install -d -m 2770 -o log-www-"$site" -g log-www-"$site" \ + sudo install -d -m 771 -o log-www -g log-www \ /home/www/log/"$site" sudo install -d -m 770 -o www -g www \ /etc/nginx/site.d/"$site" @@ -1182,12 +1138,12 @@ rule_runit_configure () { "$tool"/etc/sv/"$sv"/log/run \ /etc/sv/"$sv"/log/run fi - test ! -x "$tool"/etc/sv/"$sv"/configure || - "$tool"/etc/sv/"$sv"/configure + test ! -r "$tool"/etc/sv/"$sv"/configure.sh || + . "$tool"/etc/sv/"$sv"/configure.sh ln -fns ../sv/"$sv" /etc/service/"$sv" eval local sv_status=\"\${sv_status_$sv_hash-}\" case $sv_status in - ("") sv start "$sv";; + ("") true;; (run:*) sv restart "$sv";; esac done @@ -1204,43 +1160,59 @@ rule_ssh_configure () { /etc/ssh/ssh_host_ecdsa_key \ /etc/ssh/ssh_host_ecdsa_key.pub # NOTE: clefs générées par Debian - sudo install -m 644 -o root -g root /dev/stdin /etc/ssh/sshd_config <<-EOF - Port 22 - ListenAddress $vm_ipv4 - #ListenAddress :: - Protocol 2 + sudo install -m 644 -o root -g root /dev/stdin /etc/ssh/sshd_config <<-EOF + AcceptEnv LANG LC_* + AuthorizedKeysFile %h/etc/ssh/authorized_keys + ChallengeResponseAuthentication no + ClientAliveInterval 0 Compression yes + DebianBanner no + GSSAPIAuthentication no HostKey /etc/ssh/ssh_host_rsa_key - UsePrivilegeSeparation yes + HostbasedAuthentication no + IgnoreRhosts yes + IgnoreUserKnownHosts no + KerberosAuthentication no KeyRegenerationInterval 3600 - ServerKeyBits 768 - SyslogFacility AUTH + Port 22 + ListenAddress 127.0.0.1 + ListenAddress $vm_ipv4 LogLevel INFO LoginGraceTime 120 + PasswordAuthentication no + PermitEmptyPasswords no PermitRootLogin yes - StrictModes yes - RSAAuthentication yes + PrintLastLog yes + PrintMotd no + Protocol 2 PubkeyAuthentication yes - AuthorizedKeysFile %h/etc/ssh/authorized_keys - IgnoreRhosts yes + RSAAuthentication yes RhostsRSAAuthentication no - HostbasedAuthentication no - IgnoreUserKnownHosts no - PermitEmptyPasswords no - ChallengeResponseAuthentication no - PasswordAuthentication no - KerberosAuthentication no - GSSAPIAuthentication no - X11Forwarding no - X11DisplayOffset 10 - PrintMotd no - DebianBanner no - PrintLastLog yes - TCPKeepAlive yes - ClientAliveInterval 0 - AcceptEnv LANG LC_* + ServerKeyBits 768 + StrictModes yes Subsystem sftp /usr/lib/openssh/sftp-server + SyslogFacility AUTH + TCPKeepAlive yes UsePAM yes + UsePrivilegeSeparation yes + X11DisplayOffset 10 + X11Forwarding no + EOF + sudo install -m 644 -o root -g root /dev/stdin /etc/ssh/ssh_config <<-EOF + Host * + #Compression yes + #CompressionLevel 9 + #ControlMaster auto + #ControlPath ~/var/run/ssh/%h-%p-%r.sock + GSSAPIAuthentication no + GSSAPIDelegateCredentials no + HashKnownHosts yes + IdentityFile ~/etc/ssh/id_dsa + IdentityFile ~/etc/ssh/id_rsa + IdentityFile ~/etc/ssh/identity + SendEnv LANG LC_* + StrictHostKeyChecking ask + UserKnownHostsFile ~/etc/ssh/known_hosts EOF sudo service ssh restart } @@ -1426,11 +1398,11 @@ rule_configure () { rule sysctl_configure rule user_configure rule mail_configure + rule gitolite_configure rule www_configure rule php5_fpm_configure rule nginx_configure #rule apache2_configure - rule gitolite_configure rule runit_configure }