This is quick how to on basic steps securing /tmp directory on CentOS 7

dd if=/dev/zero of=/dev/tmpDIR bs=1024 count=1000000
/sbin/mkfs.ext3 /dev/tmpDIR
cp -Rpf /tmp /tmpbak

Mount /tmp directory

mount -o loop,noexec,nosuid,rw /dev/tmpDIR /tmp

Adjust permissions on /tmp directory

chmod 1777 /tmp

Copy backup files back to /tmp directory

cd /tmpbak
cp -Rpf * /tmp/

Add the following line to /etc/fstab file

/dev/tmpDIR /tmp	 ext3	loop,nosuid,noexec,rw	 0 0

Secure /var/tmp

mv /var/tmp /var/tmpbak
ln -s /tmp /var/tmp
cp -pR /var/tmpbak/* /tmp

The other way is to mount it on tmpfs
Add below to your /etc/fstab file

tmpfs /tmp tmpfs size=512m,loop,nosuid,noexec,mode=1777,rw 0 0
tmpfs /dev/shm	tmpfs	defaults,nodev,nosuid,noexec	0 0
/tmp /var/tmp none rw,noexec,nosuid,nodev,bind 0 0