com2sec local    localhost        dreamsnmp

com2sec mynetwork 10.10.30.0/24   dreamsnmp


group MyRWGroup v1        local

group MyRWGroup v2c       local

group MyRWGroup usm       local

group MyROGroup v1        mynetwork

group MyROGroup v2c       mynetwork

group MyROGroup usm       mynetwork


view all    included  .1                              80

access MyROGroup ""      any      noauth    exact  all    none  none

access MyRWGroup ""      any      noauth    exact  all    all    none


syslocation DAEGU BUKGU

syscontact <e-mail> <- 관리자 메일주소

sysdescr Redhat linux 9.0

sysname Vitro linux

proc httpd 50 5  <-- 프로세서 정보

proc mysqld 30 2

disk / 10000    <-- 디스크 사용률

disk /var 10000

load 12 14 14    <- 시스템 로드

'Server - Linux' 카테고리의 다른 글

[리눅스] CentOS7 Java 설치  (0) 2020.03.23
[SVN]  (0) 2016.07.04
[RSync]  (0) 2016.07.04
[iptables] 웹서버 방화벽 iptables 실습 (22, 80 Accept)  (0) 2016.07.04
iptables  (0) 2016.07.04

SELinux -> disabled


yum install rsync 설치 후 rsync 포트번호 확인

vi /etc/services

==rsync 873/tcp

==rsync 873/udp


rsync 서버 사용 설정

#vi /etc/xinetd.d/rsync

disable = no


# vi /etc/rsyncd.conf

/etc/rsyncd.conf의 경우 처음에는 없는 파일일 가능성이 높다. 편집기를 이용해 새로 작성해준다.

====================================================

[test]                                 -> 사용할 rsync 서비스 이름

path=/data/test/                  -> 데이터 원본 경로

icomment = test                   -> 코멘트

uid = root                                       -> 권한 사용자

gid = root                                       -> 권한 그룹

use chroot = yes  

read only = yes

hosts allow = 192.168.0.201     -> rsync 클라이언트 IP , local일 경우 입렵 필요 없음

max connections = 3   -> 최대 연결 수

timeout=600


xinetd 서비스 재시작

# /etc/init.d/xinetd restart


rsync client 설정

====================================================

# telnet [rsync 서버 IP] 873

ex) telnet 192.168.1.200 873        rsync 접속 여부 확인

# rsync -avz [IP]::[서비스명] [저장디렉토리]

ex) # rsync -avz 192.168.1.200::test /data/test

혹시 내역을 로그로 남기고 싶을 경우 아래와 같이 입력한다.

# rsync -avz 192.168.1.200::test /data/test > /data/test/rsync.log

====================================================

데이터 동기화 시 crontab 사용 (client server에서 설정)

====================================================

#crontab -e

편집창에 아래와 같이 입력(매분 마다 동기화)

* * * * * rsync -avz 192.168.1.200::test  /data/test

====================================================

Linux = Client <-> Window = Server


Server 설정

1. 윈도우에 cwRsyncServer_4.1.0_Installer 설치

2. 방화벽 해제

3. 인바운드에 새 규칙 추가

4. 설정파일 세팅

use chroot = false

strict modes = false

hosts allow = *

log file = rsyncd.log


# Module definitions

# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work

#

[test]

path = /cygdrive/d/rsyncbackup          cygdrive 포팅

read only = false

hosts allow = 10.10.30.28            client ip를 적어야하지만 virtualbox 이용관계로 server ip 입력

transfer logging = yes

UID = 0

GID = 0


Client 설정

1. 설정파일 수정

2. 공유하고자 하는 디렉토리 앞으로 경로 이동

3. rsync -avr --delete data/ 10.10.30.28::test

                       공유폴더  서버ip   

'Server - Linux' 카테고리의 다른 글

[SVN]  (0) 2016.07.04
[snmp] (Linux-client) 설정  (0) 2016.07.04
[iptables] 웹서버 방화벽 iptables 실습 (22, 80 Accept)  (0) 2016.07.04
iptables  (0) 2016.07.04
Selinux  (0) 2016.07.04

iptables -F

iptables -X

iptables -Z


iptables -P INPUT DROP

iptables -P FORWARD DROP

iptables -P OUTPUT DROP


iptables -A INPUT -i lo -j ACCEPT -m comment --comment "ACCEPT IN - LOOP BACK"

iptables -A OUTPUT -o lo -j ACCEPT -m comment --comment "ACCEPT OUT - LOOP BACK"


#ESTABLISHED, RELATED state

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment -comment "ACCEPT IN - ESTABLISHED, RELATED"

iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment -comment "ACCEPT OUT - ESTABLISHED, RELATED"



#ICMP

iptables -A INPUT -p icmp -j ACCEPT -m comment --comment "ACCEPT IN - ICMP"


#ssh

iptables -A INPUT -s 10.10.30.28 -p tcp --dport 22 -j ACCEPT


#http

iptables -A INPUT -s 10.10.30.28 -p tcp --dport 80 -j ACCEPT




service iptables save

service iptables restart

'Server - Linux' 카테고리의 다른 글

[snmp] (Linux-client) 설정  (0) 2016.07.04
[RSync]  (0) 2016.07.04
iptables  (0) 2016.07.04
Selinux  (0) 2016.07.04
MySql 사용법  (0) 2016.07.04

iptables


옵션

-A --append

-C --check

-D --delete

-I --insert

-R --replace

-L --list

-S --list-rules

-F --flush

-Z --zero

-N --new-chain

-X --delete-chain

-P --policy chain target

-E --rename-chain old-chain new-chain

-p, --protocol protocol

-s, --source address

-d, --destination address

-j, --jump target  

-g, --goto chain

-i, --in-interface name

-o, --out-interface name

-f, --fragment

-c, --set-counters packets bytes



ssh 포트 열기

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

service iptables save    (/etc/sysconfig/iptables 자동등록)


# iptables -P INPUT DROP

# iptables -P OUTPUT DROP

# iptables -P FORWARD DROP


# iptables -A INPUT -j DROP

-A    :룰을 추가한다 

INPUT : 패킷이 들어오는 체인에 

-j    :패킷의 운명을 결정한다. 

DROP  : 패킷을 버려라.



새로운 체인 만들기 (-N). 

비어있는 체인을 제거하기 (-X).

※ 이 두옵션은 직접체인을 만들었을경우와 제어할경우에 해당된다.

기본체인(INPUT,OUTPUT,FORWARD) 에는 해당되지 않는다.


미리 만들어진 체인의 정책을 바꾸기 (-P) 

어떤 체인의 규칙들을 나열하기 (-L) 

체인으로부터 규칙들을 지우기 (-F) 

체인내의 모든 규칙들의 패킷과 바이트의 카운드를 0 으로 만들기 (-Z)



# 스크립트로 등록하는 방법

/etc/rc.d/rc.local 에 

if [ -f /etc/sysconfig/iptables ] ; then

/etc/sysconfig/iptables

fi



iptables -A INPUT -p tcp --dport 22 -j ACCEPT

iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT



iptables -P INPUT DROP

iptables -P FORWARD DROP

iptables -P OUTPUT DROP




IP 주소 지정


신뢰할 만한 ip에 대해 모든 패킷을 허용


# iptables -A INPUT -s 192.168.0.3 -j ACCEPT


신뢰할 만한 ip 대역에 대해 모든 패킷을 허용


# iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT


신뢰할 만한 ip 대역에 대해 모든 패킷을 허용


# iptables -A INPUT -s 192.168.0.0/255.255.255.0 -j ACCEPT


신뢰할 만한 ip와 MAC주소에 대해 모든 패킷을 허용


# iptables -A INPUT -s 192.168.0.3 -m mac --mac-source 00:50:80:FD:E6:32 -j ACCEPT


포트 범위지정

# iptables -A INPUT -p tcp --dport 6881:6890 -j ACCEPT



state - tcp/udp/icmp 등의 전송 프로토콜의 연결 '상태'를 가지고 확인한다

NEW - 세션을 만들 때의 첫 번째 패킷

ESTABLISHED - 이미 세션이 연결된 후에 오가는 패킷

INVALID - 열리지 않는 세션에 대한 데이터 전송 패킷

RELATED - 기존의 연결 세션을 바탕으로 새로 만들어지는 세션의 패킷




 ip 대역으로 차단할때

# iptables -A INPUT ?-m iprange --src-range 1.169.0.0-1.169.255.255 -j DROP

'Server - Linux' 카테고리의 다른 글

[snmp] (Linux-client) 설정  (0) 2016.07.04
[RSync]  (0) 2016.07.04
[iptables] 웹서버 방화벽 iptables 실습 (22, 80 Accept)  (0) 2016.07.04
Selinux  (0) 2016.07.04
MySql 사용법  (0) 2016.07.04

vi /etc/sysconfig/selinux


SELinux 는 Linux의 보안을 강화해 주는 보안 강화 커널이고 zero-day 공격 및 buffer overflow 등 어플리케이션 취약점으로 인한 해킹을 방지해 주는 핵심 구성요소이다.


동작모드

enforce, permissive, disable 세 가지 모드

enforce : SELinux의 rule에 어긋나는 operation은 거부된다.

permissive mode : role에 어긋나는 동작이 있을 경우 audit log를 남기고 해당 operation은 허용된다. 개발 서버일 경우 특정 daemon이나 서비스에 문제가 있을 경우 setenforce 0으로 Permissive mode로 전환하여 문제 해결 후 enforce mode로 전환하는 것이 좋다.


# setenforce 0

# sestatus

'Server - Linux' 카테고리의 다른 글

[snmp] (Linux-client) 설정  (0) 2016.07.04
[RSync]  (0) 2016.07.04
[iptables] 웹서버 방화벽 iptables 실습 (22, 80 Accept)  (0) 2016.07.04
iptables  (0) 2016.07.04
MySql 사용법  (0) 2016.07.04

설치 후 초기 패스워드 변경

mysql -u root -p

Enter로 접속

mysql> update user set password=password('패스워드') where user='root';

mysql> flush privileges;


계정 생성

mysql> grant all privileges on *.* to 'parkhs'@localhost identified by '1234';

mysql> flush privileges;


Mysql PW 확인 및 변경


mysql –u root –p


mysql> use mysql; (데이터베이스 지정)


mysql> select host, user, password from user; (패스워드 확인)


mysql> update user set password=password(“asdf1234’) where user=’root’; (패스워드 변경)


Database 생성


create database Name; (Database 생성)


show databases; (Database 확인)


Table 생성

auto_increment 사용하는 컬럼은 primary key 명시해야함


create table table명(

.............number int(50),

.............name varchar(50)

);

Table 삭제

drop table [table명]


필드값과 입력값을 지정할 때

mysql > insert into table(name, id, age) values('박호성‘, ’lalla90', '30);


Column 정보조회

show full columns from table;


특정 데이터 삭제 id가 admin인 데이터 삭제

delete from member where id='admin';

Column 추가

alter table [테이블명] add [컬럼명] varchar(20) not null '';


Column 변경

alter table [테이블명] change [컬럼명] [변경할컬럼명] varchar(12);


Column 삭제

alter table [테이블명] drop [컬럼명];


컬럼값 추가

insert into comment (id, bid, comment, wdate, name) values('80', '30', 'as', 'as', 'aa');


FOREIGN KEY 지정

FOREIGN KEY(bid) REFERENCES bbs(doc_idx) ON DELETE CASCADE


MySql 덤프

mysqldump --user=[id] --password=[pw] --databases board > /home/parkhs/board.db


Auto Increment

alter table [테이블명] auto_increment=1;


mysql 덤프/복구

mysqldump -u 사용자명 -p 비밀번호 > 파일명.sql - DB전체 덤프

mysql -u 사용자명 -p -e "source 덤프파일명.sql" DB이름 - DB전체 복구 

mysqldump -u parkhs -p board bbs > bbs.sql - board 데이터베이스의 bbs테이블 덤프

mysql -u 아이디 -p DB명 < 불러올파일명.sql - 특정테이블 복구

'Server - Linux' 카테고리의 다른 글

[snmp] (Linux-client) 설정  (0) 2016.07.04
[RSync]  (0) 2016.07.04
[iptables] 웹서버 방화벽 iptables 실습 (22, 80 Accept)  (0) 2016.07.04
iptables  (0) 2016.07.04
Selinux  (0) 2016.07.04

+ Recent posts