본문 바로가기

리눅스121

Syslog: log all bash history from every user There are sometimes I wish I had kept all of my history actions within the last 3 days, or I wish I could supervise what an other user have done to a system, I tried to find a way to log all ssh sessions to the server, logging them to syslog and keeping any action performed by every user! This is good for auditing some systems.I thought that a good idea is to pass to system wide bashrc a prompt .. 2014. 12. 15.
How to Disable Your Bash_History or Log Users ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ██ ██ █▌ - DISABLING BASH_HISTORY AND/OR LOGGING ALL USER'S CMDS - █▌ █▌ █▌ █ ▐▌ █ Once you have logged out of your shell by default bash will store the last ▐▌ █ 500 previous cmds (commands), and/or 500 lines, you executed to your ▐▌ █ .bash_history file for easy recall on future sessions (Ctrl+R or ! or !!). ▐▌ █ Even pa.. 2014. 12. 12.
Bourne Again Shell (Bash) 임의코드 실행 취약점 보안 업데이트 개요리눅스 계열 등 운영체제에서 사용중인 GNU Bash에서 발생하는 임의코드 실행 취약점 (CVE-2014-6271) 보안 업데이트를 우회하여 악용할 수 있는 취약점 발생 (CVE-2014-7169)공격자는 해당 취약점이 존재하는 시스템을 대상으로 원격에서 악의적인 시스템 명령을 실행시킬 수 있으므로 해결방안에 따라 보안 업데이트 적용 권고 해당 시스템영향 받는 시스템GNU Bash를 사용하는 시스템 해결방안해당 취약점에 대한 보안업데이트가 공개된 OS를 운영하고 있을 경우, 참고사이트의 내용을 참조하여 보안업데이트 수행CentOS [1]Debian [2]Redhat [3]Ubuntu [4] 용어 정리Shell : 사용자가 입력한 문장을 해석하여 시스템 기능을 수행하는 명령어 해석기 기타 문의사항한국인.. 2014. 9. 26.
Bash Vulnerability Code Injection Attack bash_ld_preload.c#include #include #include static void __attribute__ ((constructor)) strip_env(void); extern char **environ; static void strip_env() { char *p,*c; int i = 0; for (p = environ[i]; p!=NULL;i++ ) { c = strstr(p,"=() {"); if (c != NULL) { *(c+2) = '\0'; } p = environ[i]; } } Compile it:gcc bash_ld_preload.c -fPIC -shared -Wl,-soname,bash_ld_preload.so.1 -o bash_ld_preload.so Copy ba.. 2014. 9. 25.
Bash Script: How read file line by line (best and worst way) Input: $ cat sample.txt This is sample file This is normal text file Source: $ cat readfile.sh #!/bin/bash i=1; FILE=sample.txt # Wrong way to read the file. # This may cause problem, check the value of 'i' at the end of the loopecho "###############################" cat $FILE | while read line; do echo "Line # $i: $line" ((i++)) done echo "Total number of lines in file: $i" # The worst way to r.. 2014. 9. 19.