X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=vm_hosted;h=4f305bebb8e072f102b1b02542a094d663ee122c;hb=0c31c835855a6e8d9a03b06361bb707dda0b17a7;hp=69cbfb96ede9b44fc083ba7fa87efa8099113edc;hpb=aa267863afddd5c3286de97b6e3e3941b41954e9;p=lhc%2Fateliers.git diff --git a/vm_hosted b/vm_hosted index 69cbfb9..4f305be 100755 --- a/vm_hosted +++ b/vm_hosted @@ -413,24 +413,7 @@ rule_filesystem_configure () { ${vm_lvm_lv}_home_deciphered /dev/$vm_lvm_vg/${vm_lvm_lv}_home ${vm_lvm_lv}_root_deciphered luks,lvm=$vm_lvm_vg,keyscript=/lib/cryptsetup/scripts/decrypt_derived ${vm_lvm_lv}_swap_deciphered /dev/$vm_lvm_vg/${vm_lvm_lv}_swap ${vm_lvm_lv}_root_deciphered luks,lvm=$vm_lvm_vg,keyscript=/lib/cryptsetup/scripts/decrypt_derived EOF - sudo install -m 644 -o root -g root /dev/stdin /etc/default/tmpfs <<-EOF - LOCK_SIZE=5242880 # NOTE: 5MiB - RAMLOCK=yes - RAMSHM=yes - RAMTMP=yes - RUN_SIZE=10% - SHM_SIZE= - TMP_MODE=1777,nr_inodes=1000k,noatime - TMP_OVERFLOW_LIMIT=1024 - # NOTE: mount tmpfs on /tmp if there is less than the limit size (in kiB) - # on the root filesystem (overriding RAMTMP). - TMP_SIZE=200m - TMPFS_SIZE=20%VM - EOF - sudo install -m 775 -o root -g root \ - "$tool"/etc/init.d/tmpfs \ - /etc/init.d/tmpfs - sudo update-rc.d tmpfs defaults + rule tmpfs_configure } rule_initramfs_configure () { sudo install -m 644 -o root -g root /dev/stdin /etc/initramfs-tools/initramfs.conf <<-EOF @@ -610,7 +593,7 @@ rule_gitolite_configure () { #sudo sv restart spawn-fcgi.git.80.git.heureux-cyclage.org #sudo sv restart git-daemon.git.9418 } -rule_locale_configure () { +rule_locales_configure () { sudo debconf-set-selections <<-EOF locales locales/default_environment_locale select None locales locales/locales_to_be_generated multiselect fr_FR.UTF-8 UTF-8 @@ -1140,7 +1123,7 @@ rule_runit_configure () { then ln -fns ../sv/"$sv" /etc/service/"$sv" sv restart "$sv" - else + fi done } rule_ssh_configure () { @@ -1205,6 +1188,26 @@ rule_sysctl_configure () { done sudo sysctl --system } +rule_tmpfs_configure () { + sudo install -m 644 -o root -g root /dev/stdin /etc/default/tmpfs <<-EOF + LOCK_SIZE=5242880 # NOTE: 5MiB + RAMLOCK=yes + RAMSHM=yes + RAMTMP=yes + RUN_SIZE=10% + SHM_SIZE= + TMP_MODE=1777,nr_inodes=1000k,noatime + TMP_OVERFLOW_LIMIT=1024 + # NOTE: mount tmpfs on /tmp if there is less than the limit size (in kiB) + # on the root filesystem (overriding RAMTMP). + TMP_SIZE=200m + TMPFS_SIZE=20%VM + EOF + sudo install -m 775 -o root -g root \ + "$tool"/etc/init.d/tmpfs \ + /etc/init.d/tmpfs + sudo update-rc.d tmpfs defaults + } rule_time_configure () { sudo install -m 644 -o root -g root /dev/stdin /etc/timezone <<-EOF Europe/Paris @@ -1219,7 +1222,7 @@ rule_time_configure () { rule_user_add () { # SYNTAX: $user rule user_configure local user=$1 - id "$user" >/dev/null || + getent passwd "$user" >/dev/null || sudo adduser --disabled-password "$user" # NOTE: le mot-de-passe doit être initialisé par l'utilisateur à l'aide de passwd-init . eval local home\; home="~$user" @@ -1233,16 +1236,39 @@ rule_user_add () { # SYNTAX: $user done } rule_user_configure () { - true + sudo install -m 660 -o root -g root /dev/stdin \ + /etc/adduser.conf <<-EOF + ADD_EXTRA_GROUPS=1 + DHOME=/home + DIR_MODE=0750 + DSHELL=/bin/bash + EXTRA_GROUPS="users" + FIRST_GID=1000 + FIRST_SYSTEM_GID=100 + FIRST_SYSTEM_UID=100 + FIRST_UID=1000 + GROUPHOMES=no + LAST_GID=29999 + LAST_SYSTEM_GID=999 + LAST_SYSTEM_UID=999 + LAST_UID=29999 + LETTERHOMES=no + NAME_REGEX="^[a-z][-a-z0-9_.]*\$" + QUOTAUSER="" # TODO: init + SETGID_HOME=no + SKEL=/etc/skel + SKEL_IGNORE_REGEX="dpkg-(old|new|dist|save)" + USERGROUPS=yes + USERS_GID=100 + EOF } rule_user_admin_add () { # SYNTAX: $user rule user_configure local user=$1 - id "$user" >/dev/null || + getent passwd "$user" >/dev/null || sudo adduser --disabled-password "$user" eval local home\; home="~$user" sudo adduser "$user" sudo - sudo adduser "$user" users sudo install -m 640 -o root -g root \ "$tool"/var/pub/ssh/"$user".key \ "$home"/etc/ssh/authorized_keys @@ -1326,7 +1352,7 @@ rule_configure () { rule apt_configure rule git_configure rule etckeeper_configure - rule locale_configure + rule locales_configure rule time_configure rule network_configure rule filesystem_configure