Friday, July 28, 2017

ලිනක්ස්වලදී ssh login වීමට පෙර හා පසු Warning Message එකක් පෙන්වීම

Display SSH Warning Message before the Login


               ලිනක්ස් සර්වර් එකකට ssh login වීමට පෙර අනතුරු හැඟවීමේ messege එකක් ලබාදෙන්නේ කොහොමද බලමු. මෙම Warning Message එක මඟින් legal warnings සහ අදාල ආයතනට අනුකූල නීති සහ රෙගුලාසි අනුව unauthorized user කෙනෙක්ට අනතුරු හැඟවීමක් සිදු කිරීමට පුලුවන්. ඒ වගේම authorized user කෙනෙක්ට තමන් ssh ආකාරයට login එකක් ගෙන අදාල server එක තුල කරන වෙනස්කම් විනිවිදභාවයකින් සිදු කරන ලෙසත් එම සියලුම activiteis monitor කරන බවටත් අනතුරු හැඟවිය හැකියි.
            ලිනක්ස් වලදී අපි මේ  Warning Message එක සාමාන්‍යයෙන් locate කරන්නේ ‘/etc/issue.net’ කියන තැනයි. කැමති නම් ‘/etc/ssh/sshd-banner’ වගේ තැනක හෝ තමන්ට කැමති තැනක ඒක locate කරන්න පුලුවනි. මේ file එක ඇතුලේ තියෙන දේවල් තමයි user කෙනෙක් authenticate වෙන්න කලින් එයාට දර්ශනය වෙන්නේ.

Warning Message එකකට උදාහරණයක් -

WARNING:  
All connections are monitored and recorded.
Disconnect IMMEDIATELY if you are not an authorized user!
Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your actions may be monitored if unauthorized usage is suspected.

මේ තියෙන්නේ ඒ වගේ Warning Message එකකට උදාහරණයක්
(පින්තූරය සඳහා ස්තුතිය google එකට)


දැන් තියෙන්නේ Banner එක enable කරන්න.

Open the sshd_config file:
$ vi /etc/ssh/sshd_config

Edit the path to the banner file:
Banner /etc/ssh/sshd-banner
(අපි Warning Message එක locate කරපු තැන දෙන්න)

ඉහතින් දක්වන ලද path එක තියෙන තැන
(පින්තූරය සඳහා ස්තුතිය google එකට)


Save the file and reload the sshd:
$ service sshd reload

දැන් login වෙන්න කලින් Warning Message එකක් දෙනවා. 
අපි දැන් බලමු login වුනාට පස්සේ Warning Message එකක් පෙන්වන්නේ කොහොමද කියලා.

Display SSH Welcome Message AFTER the Login

මේ  Welcome Message එක පෙන්වන්නේ user අදාල server එකට login වුනාට පස්සේ. ඉතින් මේක Warning Message එකකට වඩා වෙනස් ආකාරයක තොරතුරු දක්වන්නක් වන මෙය system announcements සහ වෙනත් වැදගත් තොරතුරු  userට දැනුම් දීම සඳහා භාවිතා කල හැකියි. 

$ vi /etc/motd 

ඉහත path එකේ අවශ්‍ය තොරතුරු සටහන් කර save කරන්න. 

මුලින්ම පෙන්නුවේ unauthorized user කෙනෙක්ට අනතුරු හැඟවීමක් සිදු කිරීමයි. දෙවනුව සාර්ථකව ssh හරහා login වුන user ට තොරතුරු පෙන්වීමයි සිදුකලේ. මේ විදි දෙකෙන්ම කරන්නේ Cisco වල motd එකකින් කරන කාර්ය භාරයමයි. 




No comments:

Post a Comment