- HTML

	

email@domain.com



- CSS

/* colors */
html {
  width: 100%;
  height: 100%;
}

body {
  background-color: #eff3f4;
  position: relative;
  width: 100%;
  height: 100%;
  font-size: 16px;
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

form {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  display: block;
  width: 100%;
  max-width: 400px;
  background-color: #fff;
  margin: 0;
  padding: 2.25em;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  border: solid 1px #ddd;
  border-radius: 0.5em;
  font-family: "Source Sans Pro", sans-serif;
}
form .svgContainer {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1em;
  border-radius: 50%;
  background: none;
  border: solid 2.5px #3a5e77;
  overflow: hidden;
  pointer-events: none;
}
form .svgContainer div {
  position: relative;
  width: 100%;
  height: 0;
  overflow: hidden;
  padding-bottom: 100%;
}
form .svgContainer .mySVG {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
form .inputGroup {
  margin: 0 0 2em;
  padding: 0;
  position: relative;
}
form .inputGroup:last-of-type {
  margin-bottom: 0;
}
form label {
  margin: 0 0 12px;
  display: block;
  font-size: 1.25em;
  color: #217093;
  font-weight: 700;
  font-family: inherit;
}
form input[type="email"],
form input[type="text"],
form input[type="password"] {
  display: block;
  margin: 0;
  padding: 0 1em 0;
  background-color: #f3fafd;
  border: solid 2px #217093;
  border-radius: 4px;
  -webkit-appearance: none;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  width: 100%;
  height: 65px;
  font-size: 1.55em;
  color: #353538;
  font-weight: 600;
  font-family: inherit;
  -webkit-transition: border-color 0.25s ease-out, -webkit-box-shadow 0.2s linear;
  transition: border-color 0.25s ease-out, -webkit-box-shadow 0.2s linear;
  transition: box-shadow 0.2s linear, border-color 0.25s ease-out;
  transition: box-shadow 0.2s linear, border-color 0.25s ease-out, -webkit-box-shadow 0.2s linear;
}
form input[type="email"]:focus,
form input[type="text"]:focus,
form input[type="password"]:focus {
  outline: none;
  -webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
          box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
  border: solid 2px #4eb8dd;
}
form input[type="email"],
form input[type="text"] {
  padding: 14px 1em 0px;
}
form button {
  display: block;
  margin: 0;
  padding: 0.65em 1em 1em;
  background-color: #4eb8dd;
  border: none;
  border-radius: 4px;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  -webkit-box-shadow: none;
          box-shadow: none;
  width: 100%;
  height: 65px;
  font-size: 1.55em;
  color: #fff;
  font-weight: 600;
  font-family: inherit;
  -webkit-transition: background-color 0.2s ease-out;
  transition: background-color 0.2s ease-out;
}
form button:hover, form button:active {
  background-color: #217093;
}
form .inputGroup1 .helper {
  position: absolute;
  z-index: 1;
  font-family: inherit;
}
form .inputGroup1 .helper1 {
  top: 0;
  left: 0;
  -webkit-transform: translate(1.4em, 2.6em) scale(1);
          transform: translate(1.4em, 2.6em) scale(1);
  -webkit-transform-origin: 0 0;
          transform-origin: 0 0;
  color: #217093;
  font-size: 1.25em;
  font-weight: 400;
  opacity: 0.65;
  pointer-events: none;
  -webkit-transition: opacity 0.2s linear, -webkit-transform 0.2s ease-out;
  transition: opacity 0.2s linear, -webkit-transform 0.2s ease-out;
  transition: transform 0.2s ease-out, opacity 0.2s linear;
  transition: transform 0.2s ease-out, opacity 0.2s linear, -webkit-transform 0.2s ease-out;
}
form .inputGroup1.focusWithText .helper {
  /*input[type='email']:focus + .helper {*/
  -webkit-transform: translate(1.4em, 2em) scale(0.65);
          transform: translate(1.4em, 2em) scale(0.65);
  opacity: 1;
}



- JS

<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>  파일 가져와야함

	var email = document.querySelector('#email'), password = document.querySelector('#password'), mySVG = document.querySelector('.svgContainer'), armL = document.querySelector('.armL'), armR = document.querySelector('.armR'), eyeL = document.querySelector('.eyeL'), eyeR = document.querySelector('.eyeR'), nose = document.querySelector('.nose'), mouth = document.querySelector('.mouth'), mouthBG = document.querySelector('.mouthBG'), mouthSmallBG = document.querySelector('.mouthSmallBG'), mouthMediumBG = document.querySelector('.mouthMediumBG'), mouthLargeBG = document.querySelector('.mouthLargeBG'), mouthMaskPath = document.querySelector('#mouthMaskPath'), mouthOutline = document.querySelector('.mouthOutline'), tooth = document.querySelector('.tooth'), tongue = document.querySelector('.tongue'), chin = document.querySelector('.chin'), face = document.querySelector('.face'), eyebrow = document.querySelector('.eyebrow'), outerEarL = document.querySelector('.earL .outerEar'), outerEarR = document.querySelector('.earR .outerEar'), earHairL = document.querySelector('.earL .earHair'), earHairR = document.querySelector('.earR .earHair'), hair = document.querySelector('.hair');
var caretPos, curEmailIndex, screenCenter, svgCoords, eyeMaxHorizD = 20, eyeMaxVertD = 10, noseMaxHorizD = 23, noseMaxVertD = 10, dFromC, eyeDistH, eyeLDistV, eyeRDistV, eyeDistR, mouthStatus = "small";

function getCoord(e) {
	var 	carPos = email.selectionEnd,
		div = document.createElement('div'),
		span = document.createElement('span'),
		copyStyle = getComputedStyle(email),
		emailCoords = {}, caretCoords = {}, centerCoords = {}
	;
	[].forEach.call(copyStyle, function(prop){
		div.style[prop] = copyStyle[prop];
	});
	div.style.position = 'absolute';
	document.body.appendChild(div);
	div.textContent = email.value.substr(0, carPos);
	span.textContent = email.value.substr(carPos) || '.';
	div.appendChild(span);
	
	emailCoords = getPosition(email);							//console.log("emailCoords.x: " + emailCoords.x + ", emailCoords.y: " + emailCoords.y);
	caretCoords = getPosition(span);							//console.log("caretCoords.x " + caretCoords.x + ", caretCoords.y: " + caretCoords.y);
	centerCoords = getPosition(mySVG);							//console.log("centerCoords.x: " + centerCoords.x);
	svgCoords = getPosition(mySVG);
	screenCenter = centerCoords.x + (mySVG.offsetWidth / 2);		//console.log("screenCenter: " + screenCenter);
	caretPos = caretCoords.x + emailCoords.x;					//console.log("caretPos: " + caretPos);
	
	dFromC = screenCenter - caretPos; 							//console.log("dFromC: " + dFromC);
	var pFromC = Math.round((caretPos / screenCenter) * 100) / 100;
	if(pFromC < 1) {
		
	} else if(pFromC > 1) {
		pFromC -= 2;
		pFromC = Math.abs(pFromC);
	}

	eyeDistH = -dFromC * .05;
	if(eyeDistH > eyeMaxHorizD) {
		eyeDistH = eyeMaxHorizD;
	} else if(eyeDistH < -eyeMaxHorizD) {
		eyeDistH = -eyeMaxHorizD;
	}
	
	var eyeLCoords = {x: svgCoords.x + 84, y: svgCoords.y + 76};
	var eyeRCoords = {x: svgCoords.x + 113, y: svgCoords.y + 76};
	var noseCoords = {x: svgCoords.x + 97, y: svgCoords.y + 81};
	var mouthCoords = {x: svgCoords.x + 100, y: svgCoords.y + 100};
	var eyeLAngle = getAngle(eyeLCoords.x, eyeLCoords.y, emailCoords.x + caretCoords.x, emailCoords.y + 25);
	var eyeLX = Math.cos(eyeLAngle) * eyeMaxHorizD;
	var eyeLY = Math.sin(eyeLAngle) * eyeMaxVertD;
	var eyeRAngle = getAngle(eyeRCoords.x, eyeRCoords.y, emailCoords.x + caretCoords.x, emailCoords.y + 25);
	var eyeRX = Math.cos(eyeRAngle) * eyeMaxHorizD;
	var eyeRY = Math.sin(eyeRAngle) * eyeMaxVertD;
	var noseAngle = getAngle(noseCoords.x, noseCoords.y, emailCoords.x + caretCoords.x, emailCoords.y + 25);
	var noseX = Math.cos(noseAngle) * noseMaxHorizD;
	var noseY = Math.sin(noseAngle) * noseMaxVertD;
	var mouthAngle = getAngle(mouthCoords.x, mouthCoords.y, emailCoords.x + caretCoords.x, emailCoords.y + 25);
	var mouthX = Math.cos(mouthAngle) * noseMaxHorizD;
	var mouthY = Math.sin(mouthAngle) * noseMaxVertD;
	var mouthR = Math.cos(mouthAngle) * 6;
	var chinX = mouthX * .8;
	var chinY = mouthY * .5;
	var chinS = 1 - ((dFromC * .15) / 100);
	if(chinS > 1) {chinS = 1 - (chinS - 1);}
	var faceX = mouthX * .3;
	var faceY = mouthY * .4;
	var faceSkew = Math.cos(mouthAngle) * 5;
	var eyebrowSkew = Math.cos(mouthAngle) * 25;
	var outerEarX = Math.cos(mouthAngle) * 4;
	var outerEarY = Math.cos(mouthAngle) * 5;
	var hairX = Math.cos(mouthAngle) * 6;
	var hairS = 1.2;
	
	TweenMax.to(eyeL, 1, {x: -eyeLX , y: -eyeLY, ease: Expo.easeOut});
	TweenMax.to(eyeR, 1, {x: -eyeRX , y: -eyeRY, ease: Expo.easeOut});
	TweenMax.to(nose, 1, {x: -noseX, y: -noseY, rotation: mouthR, transformOrigin: "center center", ease: Expo.easeOut});
	TweenMax.to(mouth, 1, {x: -mouthX , y: -mouthY, rotation: mouthR, transformOrigin: "center center", ease: Expo.easeOut});
	TweenMax.to(chin, 1, {x: -chinX, y: -chinY, scaleY: chinS, ease: Expo.easeOut});
	TweenMax.to(face, 1, {x: -faceX, y: -faceY, skewX: -faceSkew, transformOrigin: "center top", ease: Expo.easeOut});
	TweenMax.to(eyebrow, 1, {x: -faceX, y: -faceY, skewX: -eyebrowSkew, transformOrigin: "center top", ease: Expo.easeOut});
	TweenMax.to(outerEarL, 1, {x: outerEarX, y: -outerEarY, ease: Expo.easeOut});
	TweenMax.to(outerEarR, 1, {x: outerEarX, y: outerEarY, ease: Expo.easeOut});
	TweenMax.to(earHairL, 1, {x: -outerEarX, y: -outerEarY, ease: Expo.easeOut});
	TweenMax.to(earHairR, 1, {x: -outerEarX, y: outerEarY, ease: Expo.easeOut});
	TweenMax.to(hair, 1, {x: hairX, scaleY: hairS, transformOrigin: "center bottom", ease: Expo.easeOut});
	
	document.body.removeChild(div);
};

function onEmailInput(e) {
	getCoord(e);
	var value = e.target.value;
	curEmailIndex = value.length;
	
	// very crude email validation for now to trigger effects
	if(curEmailIndex > 0) {
		if(mouthStatus == "small") {
			mouthStatus = "medium";
			TweenMax.to([mouthBG, mouthOutline, mouthMaskPath], 1, {morphSVG: mouthMediumBG, shapeIndex: 8, ease: Expo.easeOut});
			TweenMax.to(tooth, 1, {x: 0, y: 0, ease: Expo.easeOut});
			TweenMax.to(tongue, 1, {x: 0, y: 1, ease: Expo.easeOut});
			TweenMax.to([eyeL, eyeR], 1, {scaleX: .85, scaleY: .85, ease: Expo.easeOut});
		}
		if(value.includes("@")) {
			mouthStatus = "large";
			TweenMax.to([mouthBG, mouthOutline, mouthMaskPath], 1, {morphSVG: mouthLargeBG, ease: Expo.easeOut});
			TweenMax.to(tooth, 1, {x: 3, y: -2, ease: Expo.easeOut});
			TweenMax.to(tongue, 1, {y: 2, ease: Expo.easeOut});
			TweenMax.to([eyeL, eyeR], 1, {scaleX: .65, scaleY: .65, ease: Expo.easeOut, transformOrigin: "center center"});
		} else {
			mouthStatus = "medium";
			TweenMax.to([mouthBG, mouthOutline, mouthMaskPath], 1, {morphSVG: mouthMediumBG, ease: Expo.easeOut});
			TweenMax.to(tooth, 1, {x: 0, y: 0, ease: Expo.easeOut});
			TweenMax.to(tongue, 1, {x: 0, y: 1, ease: Expo.easeOut});
			TweenMax.to([eyeL, eyeR], 1, {scaleX: .85, scaleY: .85, ease: Expo.easeOut});
		}
	} else {
		mouthStatus = "small";
		TweenMax.to([mouthBG, mouthOutline, mouthMaskPath], 1, {morphSVG: mouthSmallBG, shapeIndex: 9, ease: Expo.easeOut});
		TweenMax.to(tooth, 1, {x: 0, y: 0, ease: Expo.easeOut});
		TweenMax.to(tongue, 1, {y: 0, ease: Expo.easeOut});
		TweenMax.to([eyeL, eyeR], 1, {scaleX: 1, scaleY: 1, ease: Expo.easeOut});
	}
}

function onEmailFocus(e) {
	e.target.parentElement.classList.add("focusWithText");
	getCoord();
}

function onEmailBlur(e) {
	if(e.target.value == "") {
		e.target.parentElement.classList.remove("focusWithText");
	}
	resetFace();
}

function onPasswordFocus(e) {
	coverEyes();
}

function onPasswordBlur(e) {
	uncoverEyes();
}

function coverEyes() {
	TweenMax.to(armL, .45, {x: -93, y: 2, rotation: 0, ease: Quad.easeOut});
	TweenMax.to(armR, .45, {x: -93, y: 2, rotation: 0, ease: Quad.easeOut, delay: .1});
}

function uncoverEyes() {
	TweenMax.to(armL, 1.35, {y: 220, ease: Quad.easeOut});
	TweenMax.to(armL, 1.35, {rotation: 105, ease: Quad.easeOut, delay: .1});
	TweenMax.to(armR, 1.35, {y: 220, ease: Quad.easeOut});
	TweenMax.to(armR, 1.35, {rotation: -105, ease: Quad.easeOut, delay: .1});
}

function resetFace() {
	TweenMax.to([eyeL, eyeR], 1, {x: 0, y: 0, ease: Expo.easeOut});
	TweenMax.to(nose, 1, {x: 0, y: 0, scaleX: 1, scaleY: 1, ease: Expo.easeOut});
	TweenMax.to(mouth, 1, {x: 0, y: 0, rotation: 0, ease: Expo.easeOut});
	TweenMax.to(chin, 1, {x: 0, y: 0, scaleY: 1, ease: Expo.easeOut});
	TweenMax.to([face, eyebrow], 1, {x: 0, y: 0, skewX: 0, ease: Expo.easeOut});
	TweenMax.to([outerEarL, outerEarR, earHairL, earHairR, hair], 1, {x: 0, y: 0, scaleY: 1, ease: Expo.easeOut});
}

function getAngle(x1, y1, x2, y2) {
	var angle = Math.atan2(y1 - y2, x1 - x2);
	return angle;
}

function getPosition(el) {
	var xPos = 0;
	var yPos = 0;

	while (el) {
		if (el.tagName == "BODY") {
			// deal with browser quirks with body/window/document and page scroll
			var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
			var yScroll = el.scrollTop || document.documentElement.scrollTop;

			xPos += (el.offsetLeft - xScroll + el.clientLeft);
			yPos += (el.offsetTop - yScroll + el.clientTop);
		} else {
			// for all other non-BODY elements
			xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
			yPos += (el.offsetTop - el.scrollTop + el.clientTop);
		}

		el = el.offsetParent;
	}
	return {
		x: xPos,
		y: yPos
	};
}

email.addEventListener('focus', onEmailFocus);
email.addEventListener('blur', onEmailBlur);
email.addEventListener('input', onEmailInput);
password.addEventListener('focus', onPasswordFocus);
password.addEventListener('blur', onPasswordBlur);
TweenMax.set(armL, {x: -93, y: 220, rotation: 105, transformOrigin: "top left"});
TweenMax.set(armR, {x: -93, y: 220, rotation: -105, transformOrigin: "top right"});




출처 : https://codepen.io/dsenneff/pen/QajVxO?editors=0100#0

1 임시 적용[편집]

재부팅시에는 사라지는 적용방법

명령어
route add -net 아이피 netmask 넷마스크 dev 장치명
→ 특정IP에서 들어오는 네트워크 요청에 대해 지정한 장치로 응답함
명령어 예시 (IP 1개)
route add -net 111.222.33.44 netmask 255.255.255.255 dev eth0
→ 111.222.33.44에서 들어오는 네트워크 요청은 eth0 으로 응답함
명령어 예시 (IP 대역)
route add -net 111.222.34.0 netmask 255.255.255.0 dev eth1
→ 111.222.34.x 에서 들어오는 네트워크 요청은 eth1 로 응답함
확인 명령어
route | grep 장치명

2 영구 적용 1 (네트워크 재시작)[편집]

영구 적용(재부팅시에도 적용)을 하려면 route-장치명 파일을 수정하고 network 서비스를 재시작해야 한다.

방법
vi /etc/sysconfig/network-scripts/route-장치명

파일 내용을 다음 형식으로 입력하고 저장

ADDRESS0=아이피
NETMASK0=넷마스크
GATEWAY0=게이트웨이
service network restart
route
실행예시
[root@zetawiki ~]# cat /etc/sysconfig/network-scripts/route-eth1
cat: /etc/sysconfig/network-scripts/route-eth1: No such file or directory
[root@zetawiki ~]# vi /etc/sysconfig/network-scripts/route-eth1
ADDRESS0=111.222.33.0
NETMASK0=255.255.255.0
GATEWAY0=10.20.30.1
[root@zetawiki ~]# cat /etc/sysconfig/network-scripts/route-eth1
ADDRESS0=111.222.33.0
NETMASK0=255.255.255.0
GATEWAY0=10.20.30.1

3 영구 적용 2 (네트워크 재시작 없음)[편집]

영구 적용 1과 임시 적용을 혼합하면 network restart 없이 가능하다.[1]

명령어
vi /etc/sysconfig/network-scripts/route-장치명
route add -net 아이피 netmask 넷마스크 dev 장치명
실행예시
[root@zetawiki ]# vi /etc/sysconfig/network-scripts/route-eth1
[root@zetawiki ]# route add -net 111.222.33.44 netmask 255.255.255.255 dev eth1
→ 수정한 route-eth1 파일은 service network restart 또는 재부팅시에 적용되고,
→ route 명령어는 즉시 적용된다...

4 같이 보기[편집]

5 주석[편집]

  1. 이동 그럼에도 필자가 영구 적용 1을 선호하는 이유는 route-장치명 파일에 오타가 있거나 할 때 즉시 인지할 수 있기 때문이다.

6 참고[편집]




출처 : https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EC%8A%A4%ED%83%9C%ED%8B%B1_%EB%9D%BC%EC%9A%B0%ED%8C%85_%EC%84%A4%EC%A0%95

'프로그래밍 > linux' 카테고리의 다른 글

CentOS 방화벽 사용방법  (0) 2018.03.26
IPTABLE  (0) 2018.03.26
CentOS 7 - 리눅스 방화벽 firewalld  (0) 2018.03.13
VMware CentOS 네트워크 설정  (0) 2018.03.13
RHEL/CentOS 7 에서 방화벽(firewalld) 설정하기  (0) 2018.03.08

CentOS 7부터 기본 방화벽 시스템이 변경되었습니다. 이전에는 iptables 를 사용했었는데.. CentOS 7에서는 firewalld라는 방화벽 시스템이 기본으로 탑재되었습니다. 


그렇다고 iptables이 완전히 없어진 것은 아닙니다. firewalld은 그저 iptables을 기반으로해서 동작하고 있는 것 뿐입니다. firewalld이 iptables을 의존 패키지로 두고 있는 것을 보면 알 수 있습니다. 다만 iptables-service를 조작이 쉬운 firewalld로 바꾼 것 뿐입니다.


centos 7부터는 iptables-service를 더 이상 사용하지않지만, iptables-service를 계속 사용할 수도 있습니다. 리눅스를 계속 사용해온 사용자라면 당연히 익숙했던 iptables-service가 더 편할 것입니다. 하지만 기본 방화벽 시스템이 변경된 이상 iptables-service의 향후 지원도 불확실하고, 어쩌면 익숙해지면 firewalld가 더 편할 수도 있습니다.


이런저런 이유로 기본 firewalld 사용을 권장하고, 그 사용방법에 대해 알아보겠습니다.



1. 방화벽 살펴보기

방화벽에는 zone(영역)이라는 것이 존재합니다. 개방된 네트워크와 연결되어있다면 public zone(공개영역)에 있는 룰이 적용되고, 개인 네트워크에 있다면 다른 zone의 룰의 적용할 수 있습니다. 이 처럼 네트워크 형태에 따라 적용하는 방화벽 룰을 다르게 할 수 있습니다.


우리는 서버 용도로 리눅스를 사용하기때문에 개방된 네트워크 public zone 만 필요합니다. 또한 방화벽에는 public zone이 기본 zone 으로 설정되어있습니다. 이는 방화벽 설정파일에서 변경가능합니다.


* public zone의 설정파일

/etc/firewalld/zones/public.xml


* 방화벽 재로드

# firewall-cmd --reload


설정파일은 xml 형식으로 되어있으며, firewall-cmd --permanent --zone=public 명령으로 추가했던 룰들이 저장되어있습니다. zone의 설정파일을 변경할 경우 방화벽 재로드를 해야 반영이 됩니다. 


또한 firewall-cmd에서 --permanent 옵션이 들어간다면 반영은 되지않고, 해당 zone의 설정파일에서 룰 추가/수정만 이루어집니다. 따라서 --permanent 옵션 넣었다면 방화벽 재로드를 해야합니다. 


참고로 설정파일에 추가된 룰은 영구반영됩니다. 만약 --permanent 옵션을 넣지않으면, 일시적으로 즉시 반영됨을 의미합니다. (재부팅할 경우 zone의 설정파일에 추가되지않은 룰은 전부 삭제됩니다. )



2. 포트

포트를 방화벽에 추가하면 해당 포트는 허용됩니다.


* 포트추가

# firewall-cmd --permanent --zone=public --add-port=포트

예) firewall-cmd --permanent --zone=public --add-port=80/tcp


# firewall-cmd --reload


* 포트 제거

# firewall-cmd --permanent --zone=public --remove-port=포트

예) firewall-cmd --permanent --zone=public --remove-port=80/tcp


# firewall-cmd --reload



3. 서비스

서비스에서 사용하는 룰을 적용하려면 아래와 같이 서비스를 추가하면 됩니다. 

단, 해당 서비스 xml 룰 파일이 /usr/lib/firewalld/services 에 있어야 사용할 수 있습니다. 


* 서비스 추가

firewall-cmd --permanent --zone=public --add-service=서비스

예) firewall-cmd --permanent --zone=public --add-service=http


# firewall-cmd --reload


* 서비스 제거

firewall-cmd --permanent --zone=public --remove-service=서비스

예) firewall-cmd --permanent --zone=public --remove-service=http


# firewall-cmd --reload


그리고 /usr/lib/firewalld/services 디렉토리에 있는 서비스 파일들을 수정하려면 /etc/firewalld/services에 복사후 수정해야 합니다. (/etc/firewalld/services에 있는 서비스 파일들이 우선 적용되기에 관리상 편리합니다..)


4. 임의의 룰 (Rich rule)

포트, 서비스 룰 이외에 원하는 룰을 임의로 적용할 수 있습니다. 예를 들면 ip차단 같은...


* 룰 추가

# firewall-cmd --permanent --zone=public --add-rich-rule="임의의 룰"

예) firewall-cmd --permanent --zone=public --add-rich-rule="rule family=ipv4 source address=192.168.0.4/24 service name=http accept"


# firewall-cmd --reload


* 룰 제거

# firewall-cmd --permanent --zone=public --remove-rich-rule="임의의 룰"

예) firewall-cmd --permanent --zone=public --remove-rich-rule="rule family=ipv4 source address=192.168.0.4/24 service name=http accept"


# firewall-cmd --reload



* 응용예시 - http(80번 포트) 서비스에서 특정 ip 차단

웹서버를 운영하다보면 특정ip(스팸같은)를 차단시키고 싶을 때가 있습니다. 그럴경우 아래와 같이 임의의 룰을 활용하면 됩니다.


차단시)

# firewall-cmd --permanent --zone=public --add-rich-rule="rule family=ipv4 source address=차단ip service name=http reject"


차단해제시)

# firewall-cmd --permanent --zone=public --remove-rich-rule="rule family=ipv4 source address=차단ip service name=http reject"


# firewall-cmd --reload


위 명령을 실행하면 즉시 , 영구적으로 해당 ip를 웹사이트에 접속하지못하게 차단시킬 수 있습니다. 이 방법은 웹서버 자체에서 ip를 차단시키는 것보다 효과적입니다.



5. 방화벽 기타 명령어

방화벽에서 유용 명령어들입니다


* 허용한 포트 목록

# firewall-cmd --list-ports


* 방화벽 상태 확인

# firewall-cmd --state


* 활성화된 zone 목록

# firewall-cmd --get-active-zones


* 현재 존재하는 서비스 목록

# firewall-cmd --get-service


public zone에 있는 서비스 목록

# firewall-cmd --zone=public --list-services




※ 출처 : https://conory.com/blog/42477

'프로그래밍 > linux' 카테고리의 다른 글

IPTABLE  (0) 2018.03.26
스태틱 라우팅 설정  (0) 2018.03.13
VMware CentOS 네트워크 설정  (0) 2018.03.13
RHEL/CentOS 7 에서 방화벽(firewalld) 설정하기  (0) 2018.03.08
CentOS SELinux 설정 및 해제하기  (0) 2018.03.08

+ Recent posts