LoginSignup
0
0

More than 5 years have passed since last update.

CentOS7+pxe+dhcp(ネットワークブートinstall)-2 postscript sample

Posted at
%post
## set sudo ##
cp /etc/sudoers /etc/sudoers.org
echo 'hoge        ALL=(ALL)       ALL' >> /etc/sudoers

### set sshd #####
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.org
cat << EOF >> /etc/ssh/sshd_config
### change sshd settings #####
AddressFamily inet
UseDNS no
PermitRootLogin no
PubkeyAuthentication yes
EOF

### set ntp #####
cp /etc/chrony.conf /etc/chrony.conf.org
cat /dev/null > /etc/chrony.conf
cat << EOF >> /etc/chrony.conf
### change ntp settings #####
server 192.168.1.10 iburst
stratumweight 0
driftfile /var/lib/chrony/drift
rtcsync
makestep 10 3
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
keyfile /etc/chrony.keys
commandkey 1
generatecommandkey
noclientlog
logchange 0.5
logdir /var/log/chrony
EOF

#snmp setting
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
cat /dev/null > /etc/snmp/snmpd.conf
cat << EOF >> /etc/snmp/snmpd.conf
### change snmp settings #####
rocommunity    hogehoge
trapCommunity  hogehoge
trap2sink      192.168.1.11
com2sec devnet     192.168.1.11  hogehoge
group   devGroup   v2c           devnet
view    all        included      .1
access  devGroup   "" any noauth exact all none none
EOF

# mail setting
cat << EOF >> /root/.mailrc
set smtp=smtp://192.168.1.11:25
set from=tst11@hoge.test
EOF

# mail alias
cat << EOF >> /etc/aliases
root: admin@hoge.test
EOF
newaliases
%end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0