talimat 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. # Description: The Shadow package contains programs for handling passwords in a secure way.
  2. # URL: http://shadow.pld.org.pl/
  3. # Maintainer: pkg-shadow-devel@lists.alioth.debian.org
  4. # Packager: pierre at nutyx dot org
  5. name=shadow
  6. version=4.2.1
  7. release=1
  8. source=( http://pkg-shadow.alioth.debian.org/releases/shadow-$version.tar.xz)
  9. build()
  10. {
  11. cd shadow-$version
  12. sed -i 's/groups$(EXEEXT) //' src/Makefile.in
  13. find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
  14. sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
  15. -e 's@/var/spool/mail@/var/mail@' etc/login.defs
  16. sed -i 's/1000/999/' etc/useradd
  17. ./configure --sysconfdir=/etc
  18. make
  19. make DESTDIR=$PKG install
  20. sed -i 's/yes/no/' $PKG/etc/default/useradd
  21. sed -i 's/GROUP/# GROUP/' $PKG/etc/default/useradd
  22. mv -v $PKG/usr/bin/* $PKG/bin
  23. mv -v $PKG/usr/sbin/* $PKG/sbin
  24. #
  25. # Following sed comment appropriate lines in etc/login.defs, and stop login
  26. # from performing these functions. First backup the etc/login.defs
  27. install -v -m644 $PKG/etc/login.defs{,.orig}
  28. for FUNCTION in FAIL_DELAY FAILLOG_ENAB \
  29. LASTLOG_ENAB \
  30. MAIL_CHECK_ENAB \
  31. OBSCURE_CHECKS_ENAB \
  32. PORTTIME_CHECKS_ENAB \
  33. QUOTAS_ENAB \
  34. CONSOLE MOTD_FILE \
  35. FTMP_FILE NOLOGINS_FILE \
  36. ENV_HZ PASS_MIN_LEN \
  37. SU_WHEEL_ONLY \
  38. CRACKLIB_DICTPATH \
  39. PASS_CHANGE_TRIES \
  40. PASS_ALWAYS_WARN \
  41. CHFN_AUTH ENCRYPT_METHOD \
  42. ENVIRON_FILE
  43. do
  44. sed -i "s/^${FUNCTION}/# &/" $PKG/etc/login.defs
  45. done
  46. #
  47. # Configuration files for pam
  48. mkdir -p $PKG/etc/pam.d
  49. cat > $PKG/etc/pam.d/system-account << "EOF"
  50. # Begin /etc/pam.d/system-account
  51. account required pam_unix.so
  52. # End /etc/pam.d/system-account
  53. EOF
  54. cat > $PKG/etc/pam.d/system-auth << "EOF"
  55. # Begin /etc/pam.d/system-auth
  56. auth required pam_unix.so
  57. # End /etc/pam.d/system-auth
  58. EOF
  59. cat > $PKG/etc/pam.d/system-password << "EOF"
  60. # Begin /etc/pam.d/system-password
  61. # use sha512 hash for encryption, use shadow, and try to use any previously
  62. # defined authentication token (chosen password) set by any prior module
  63. password required pam_pwhistory.so retry=3
  64. password required pam_unix.so sha512 shadow try_first_pass
  65. # End /etc/pam.d/system-password
  66. EOF
  67. cat > $PKG/etc/pam.d/system-session << "EOF"
  68. # Begin /etc/pam.d/system-session
  69. session required pam_unix.so
  70. session optional pam_loginuid.so
  71. session optional pam_ck_connector.so nox11
  72. # End /etc/pam.d/system-session
  73. EOF
  74. cat > $PKG/etc/pam.d/login << "EOF"
  75. # Begin /etc/pam.d/login
  76. # Set failure delay before next prompt to 3 seconds
  77. auth optional pam_faildelay.so delay=3000000
  78. # Check to make sure that the user is allowed to login
  79. auth requisite pam_nologin.so
  80. # Check to make sure that root is allowed to login
  81. # Disabled by default. You will need to create /etc/securetty
  82. # file for this module to function. See man 5 securetty.
  83. #auth required pam_securetty.so
  84. # Additional group memberships - disabled by default
  85. #auth optional pam_group.so
  86. # include the default auth settings
  87. auth include system-auth
  88. # check access for the user
  89. account required pam_access.so
  90. # include the default account settings
  91. account include system-account
  92. # Set default environment variables for the user
  93. session required pam_env.so
  94. # Set resource limits for the user
  95. session required pam_limits.so
  96. # Display date of last login - Disabled by default
  97. #session optional pam_lastlog.so
  98. # Display the message of the day - Disabled by default
  99. #session optional pam_motd.so
  100. # Check user's mail - Disabled by default
  101. #session optional pam_mail.so standard quiet
  102. # include the default session and password settings
  103. session include system-session
  104. password include system-password
  105. # End /etc/pam.d/login
  106. EOF
  107. cat > $PKG/etc/pam.d/passwd << "EOF"
  108. # Begin /etc/pam.d/passwd
  109. password include system-password
  110. # End /etc/pam.d/passwd
  111. EOF
  112. cat > $PKG/etc/pam.d/su << "EOF"
  113. # Begin /etc/pam.d/su
  114. # always allow root
  115. auth sufficient pam_rootok.so
  116. auth include system-auth
  117. # include the default account settings
  118. account include system-account
  119. # Set default environment variables for the service user
  120. session required pam_env.so
  121. # include system session defaults
  122. session include system-session
  123. # End /etc/pam.d/su
  124. EOF
  125. cat > $PKG/etc/pam.d/chage << "EOF"
  126. #Begin /etc/pam.d/chage
  127. # always allow root
  128. auth sufficient pam_rootok.so
  129. # include system defaults for auth account and session
  130. auth include system-auth
  131. account include system-account
  132. session include system-session
  133. # Always permit for authentication updates
  134. password required pam_permit.so
  135. # End /etc/pam.d/chage
  136. EOF
  137. for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
  138. groupmems groupmod newusers useradd userdel usermod
  139. do
  140. install -v -m644 $PKG/etc/pam.d/chage $PKG/etc/pam.d/${PROGRAM}
  141. sed -i "s/chage/$PROGRAM/" $PKG/etc/pam.d/${PROGRAM}
  142. done
  143. # Backup others
  144. [ -f $PKG/pam.d/other ] && install -v -m644 $PKG/etc/pam.d/other{,.orig}
  145. # Other
  146. #
  147. cat > $PKG/etc/pam.d/other << "EOF"
  148. # Begin /etc/pam.d/other
  149. auth required pam_warn.so
  150. auth required pam_deny.so
  151. account required pam_warn.so
  152. account required pam_deny.so
  153. password required pam_warn.so
  154. password required pam_deny.so
  155. session required pam_warn.so
  156. session required pam_deny.so
  157. # End /etc/pam.d/other
  158. EOF
  159. # Replace the login and ressource limits file
  160. if [ -f $PKG/etc/login.access ]; then
  161. mv -v $PKG/etc/login.access{,.NOUSE}
  162. fi
  163. if [ -f $PKG/etc/limits ]; then
  164. mv -v $PKG/etc/limits{,.NOUSE}
  165. fi
  166. rm $PKG/usr/share/man/man8/nologin.8
  167. rm $PKG/sbin/nologin
  168. }