2013 開放 Web 軟體安全計畫

2013 開放 Web 軟體安全計畫 – Open Web Application Security Project https://www.owasp.org/index.php/Top_10_2013-Top_10 網站安全標準須防止 OWASP (開放Web軟體安全計畫 – Open Web Application Security Project)十大Web資安漏洞,其安全要求表列入下。 A1 - Injection (注入攻擊): A2 - Broken Authentication and Session Management (失效的驗證與連線管理): A3 - Cross-Site Scripting(XSS) (跨站腳本程式攻擊): A4 - Insecure Direct Object References (不安全的物件參考): A5 - Security Misconfiguration (不當的安全組態設定): A6 - Sensitive Data Exposure (敏感資料暴露): A7 - Missing Function Level Access Control (缺少功能級別的存取控制): A8 - Cross Site Request Forgery (CSRF) (跨站冒名請求): A9 - Using Components with Known Vulnerabilities(使用已知漏洞元件): A10 - Unvalidated Redirects and Forwards (未經驗證的重新導向與轉送): Top 10 A1 - Injection (注入攻擊): 注入攻擊可說是目前最普遍的網站應用程式的攻擊手法 ...

July 11, 2016

CentOS7 安裝 Postfix

Postfix 介紹 Postfix 是一套快速, 安全及容易管理的開源 Mail Transfer Agent (MTA), 也是 Sendmail 很好的替代品。 以下會介紹在 RHEL 及 CentOS 7 安裝 Postfix 及 Dovecot 作為 Email Server. 安裝 前置作業 在開始前, 如果系統內安裝了其他 MTA (例如 Sendmail 或 Exim), 那便需要將它們移除, 以下是移除 Sendmail 及 Exim 的方法: 查詢是否安裝過 rpm -qa | grep sendmail rpm -qa | grep exim 移除 yum remove sendmail yum remove exim 為了使安裝過程簡單一點, 關閉 SELinux, 開啟 /etc/sysconfig/selinux, 將: SELINUX=enforcing 換成 SELINUX=disabled 重開機後生效 開始安裝 Postfix yum install postfix ...

May 26, 2016

安裝 Nginx 1.9+

新增 nginx.repo vi /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 安裝Nginx yum install nginx 啟動服務 service nginx start chkconfig --levels 235 nginx on

May 5, 2016

安裝 PHP5.6

一、更新rpm REMI源 (最新的PHP版本需要修改REMI.REPO中的ENABLED=0為1) vi /etc/yum.repos.d/remi.repo CentOS 6 yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm CentOS 7 yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 二、安裝 PHP 想install其它版本的PHP需要修改REMI.REPO中的ENABLED=0為1 路徑:/etc/yum.repos.d/remi.repo [remi-php55]是PHP5.5 [remi-php56]是PHP5.6 選擇你要的版本做修改即可 vi /etc/yum.repos.d/remi.repo 安裝 PHP yum install php 安裝其他 PHP Lib yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm 設定 php, php-fpm 設定 php 設定內容如下(/etc/php.ini): cgi.fix_pathinfo=0 session.save_handler = files session.save_path = "/var/lib/php/session" date.timezone = "Asia/Taipei" error_reporting = E_ALL & ~E_NOTICE display_errors = On magic_quotes_gpc = Off 設定 php session 檔的權限 mkdir /var/lib/php/session ...

May 5, 2016

安裝 Nexus OSS

Nexus OSS Nexus OSS是用來架設maven私有倉庫的好幫手 安裝其實非常容易 下載網址 下載至您要放置的目錄下即可開始操作以下流程 (這裡放置在/usr/local) tar zxvf nexus-2.11.4-01-bundle.tar.gz ln -s nexus-2.11.4-01/ nexus chown -R nexus:nexus nexus chown -R nexus:nexus nexus-2.11.4-01/ chown -R nexus:nexus sonatype-work/ 修改下面兩個設定 vi /nexus-2.11.4-01/bin/nexus NEXUS_HOME="/usr/local/nexus/nexus" RUN_AS_USER=nexus 修改Port vi /nexus-2.11.4-01/conf/nexus.properties application-port=18081 啟動 sh /var/opt/nexus/nexus/bin/nexus start

December 14, 2015

CentOS7 Tomcat 增加 systemctl 控制

1.增加啟動參數 在Tomcat的bin目錄下增加一個setenv.sh檔,catalina.sh啟動的時候會調用,同時可以在這個檔案設置Java內存 範例如下: #add tomcat pid CATALINA_PID="$CATALINA_BASE/tomcat7.pid" #add java opts JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m" 2.增加 tomcat.service 在 /usr/lib/systemd/system 目錄下增加 tomcat7.service, 內容的目錄必須是絕對路徑。 vi /usr/lib/systemd/system/tomcat7.service PIDFile就指到tomcat所在的目錄 Description=Tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/data/tomcat/tomcat7.pid ExecStart=/data/tomcat/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target [unit]設定服務的描述 [service]設定服務的啟動,停止等 [install]設定使用用戶 systemctl 命令 查看全部服務 systemctl list-unit-files --type service 查看服務 systemctl status name.service 啟動服務 systemctl start name.service 停止服務 systemctl stop name.service ...

October 1, 2015

CentOS6.5 Tomcat開機自動啟動

1.設定啟動腳本 在目錄 /etc/init.d 新增一個 tomcat 的腳本 vi /etc/init.d/tomcat 記得修改你的 JAVA_HOME, CATALINA_HOME 到你所在的目錄下 #startup script for jakarta tomcat # # chkconfig: - 85 20 # description: Tomcat running # processname: tomcat7 # pidfile: /var/run/tomcat.pid # config:# Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0# Set Tomcat environment. export JAVA_HOME=/usr/java/jdk1.8.0_25 export CATALINA_HOME=/usr/local/tomcat7 export CATALINA_OPTS="-Dbuild.compiler.emacs=true" export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar export PATH=$JAVA_HOME/bin:$PATH [ -f /usr/local/tomcat7/bin/startup.sh ] || exit 0 [ -f /usr/local/tomcat7/bin/shutdown.sh ] || exit 0 export PATH=$PATH:/usr/bin:/usr/lib/bin # See how we were called. case "$1" in start) # Start daemon. echo -n "Starting Tomcat: " /usr/local/tomcat7/bin/startup.sh RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat ;; stop) # Stop daemons. echo -n "Shutting down Tomcat: " /usr/local/tomcat7/bin/shutdown.sh RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat ;; restart) $0 stop $0 start ;; condrestart) [ -e /var/lock/subsys/tomcat ] && $0 restart ;; status) status tomcat ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0 2.修改執行權限 chmod 755 /etc/init.d/tomcat ...

September 30, 2015