336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

iptables 사용

#sudo iptables -A INPUT -p tcp --dport 5432 -s 192.168.0.0/16 -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 1:65526 -j DROP

sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -I OUTPUT -p tcp --sport 22 -j ACCEPT

sudo iptables -I INPUT -p tcp --dport 22 -s 1.1.1.1 -j ACCEPT
sudo iptables -I OUTPUT -p tcp --dport 22 -d 1.1.1.1 -j ACCEPT

참고 : http://srzero.tistory.com/entry/Ubuntu-iptables-%EB%B0%A9%ED%99%94%EB%B2%BD-%EC%97%B4%EA%B3%A0-%EB%8B%AB%EA%B8%B0-%EB%B0%A9%EB%B2%95
참고 : https://blog.lael.be/post/69

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

ufw 방화벽 사용


sudo ufw allow from 192.168.0.0 to any port 5432

특정IP(port) 허용 :ufw allow from 111.111.111.111 to port 22
특정IP(port) 막음 :ufw deny from 111.111.111.111 to port 22

sudo ufw allow proto udp to any port 137 from 192.168.1.0/24
sudo ufw allow proto udp to any port 138 from 192.168.1.0/24
sudo ufw allow proto tcp to any port 139 from 192.168.1.0/24
sudo ufw allow proto tcp to any port 445 from 192.168.1.0/24

[방화벽 켜기]
 sudo ufw enable

[방화벽 끄기]
 sudo ufw disable

[방화벽 특정 포트/프로토콜 개방]
 sudo ufw allow (개방할 포트번호) / (프로토콜)
 ex> sudo ufw allow 3306/tcp
 ex> sudo ufw allow 3306/udp

[방화벽 특정 포트/프로토콜 차단]
 sudo ufw deny (차단할 포트) / (프로토콜)
 ex> sudo ufw deny 8080/tcp

[방화벽 규칙 제거]
 sudo ufw delete (allow/deny) (포트)/(프로토콜)
 ex> sudo ufw delete allow 3306/tcp

[특정 ip 막기]
 sudo ufw deny from (아이피 주소)
 ex> sudo ufw deny from 192.168.0.100

[utf 상태 보기]
 sudo ufw status
 기타 자세한 사항은 man 이용해보세요^^

'Sandbox > Cuckoo' 카테고리의 다른 글

02 : cuckoo 설치  (0) 2016.07.18
04 : 몽고DB 설정 및 설치  (0) 2016.07.18
08 : IP설정  (0) 2016.07.18
06 : Psql 설치 for cuckoo  (0) 2016.07.18
이슈 : What is the virbr0 interface used for ...  (0) 2016.07.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

참고 : chess72.tistory.com/113, gurubee.net/lecture/2939
매뉴얼 : http://www.postgresql.org/docs


sudo -u postgres psql

* postgresql 설치
sudo apt-get install postgresql

* postgresql 문서 받기
sudo apt-get install postgresql-doc-8.4

* postgresql tool 설치
sudo apt-get install pgadmin3

* 설정
sudo gedit /etc/postgresql/8.4/main/postgresql.conf
아래의 문장을 찾아 주석을 해제한다
#listen_addresses = 'localhost'
listen_addresses = 'localhost'

sudo gedit /etc/postgresql/8.4/main/pg_hba.conf
아래의 문장을 찾아 peer를 md5로 변경한다.
# Database administrative login by Unix domain socket
local   all         postgres                          md5

sudo /etc/init.d/postgresql restart
sudo /etc/init.d/postgresql reload

sudo -u postgres psql
위의 문장은 postgres 유저 이름으로 postgress db 를 로그인한다.
위의 문장을 수행하면 postgress 명령을 수행할 수 있고 아래와 같이 표시가 변경된다

postgres=#
위의 상태에서 sql 및 psql 명령어를 입력할 수 있으며 종료 명령은 \q 이며
도움말은 \? 이다

* DB 생성
sudo -u postgres createdb < db name >

* DB 접속
sudo -u postgres psql < db name >

사용자계정 조회
SELECT * FROM PG_SHADOW;
또는 \du

CREATE USER TEST;
ALTER USER TEST ENCRYPTED PASSWORD 'aa' CREATEDB;
ALTER USER TEST CREATEROLE;
DROP USER TEST;

psql -U TEST

\l #데이터베이스 리스트

user : cuckoo
db : cuckoo_db
포트 :5432

접속 리셋
http://www.mozmorris.com/2011/11/15/configure-postgresql-to-accept-tcpip-connections.html

중요! 원격접속시 설정
postgresql.conf
listen_addresses = '*'

sudo gedit /etc/postgresql/9.3/main/pg_hba.conf
#IPv4 local connections:
host  all  all  0.0.0.0/0  trust

pgAdmin3 설치
sudo apt-get install pgadmin3

쿼리 테스트
select * from [table] where [row] = '1234a'
delete from table

iptables 설정
sudo iptables -A INPUT -p tcp --dport 5432 -s 192.168.0.0/16 -j ACCEPT

sudo sh -c "iptables-save > /etc/iptables.rules"
sudo gedit /etc/network/interfaces
 - 작성 : pre-up iptables-restore < /etc/iptables.rules
---------------------------------------------------------------

cuckoo에서 postgre db 사용시 설치
 - sudo apt-get install libpq-dev
 - sudo pip install psycopg2

cuckoo/conf cuckoo.conf 수정
connection = postgresql://cuckoo:pw@192.168.202.137:5432/cuckoo_db

'Sandbox > Cuckoo' 카테고리의 다른 글

02 : cuckoo 설치  (0) 2016.07.18
04 : 몽고DB 설정 및 설치  (0) 2016.07.18
08 : IP설정  (0) 2016.07.18
07 : 방화벽 설정  (0) 2016.07.18
이슈 : What is the virbr0 interface used for ...  (0) 2016.07.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

What is the virbr0 interface used for .... 

sudo brctl delbr virbr0
sudo cp /var/lib/libvirt/network/default.xml /tmp/default.xml
sudo vi /tmp/default.xml  #edit the ip address
sudo virsh net-destroy default
sudo virsh net-define /tmp/default.xml
sudo virsh net-start default
virsh net-destroy default
virsh net-undefine default

service libvirtd restart


'Sandbox > Cuckoo' 카테고리의 다른 글

02 : cuckoo 설치  (0) 2016.07.18
04 : 몽고DB 설정 및 설치  (0) 2016.07.18
08 : IP설정  (0) 2016.07.18
07 : 방화벽 설정  (0) 2016.07.18
06 : Psql 설치 for cuckoo  (0) 2016.07.18

+ Recent posts