天天看點

配置 Self service passwordreset 服務

最近把一個舊的服務需要遷移到EKS上。這個服務是用于給AD的使用者自己重設密碼用的。之前是部署在AWS的EC2上,現在需要容器化 然後部署在EKS上。

簡單的記錄一下過程

官方的文檔在這裡

https://self-service-password.readthedocs.io/en/latest/installation.html

幾個注意要點:

  1. 安裝的時候需要注意的一點就是,他是通過ldaps的方式綁定AD的,是以必須在AD的域裡安裝CA,并激活LDAPS。參考下面的方式

    https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_ldap_server_side.html

  2. 因為涉及修改使用者的屬性,是以需要建立單獨的AD 使用者,并授權
  3. 官方提供了一個docker 鏡像,但是經我測試,這個鏡像有問題,php template 需要的smarty3包沒有安裝,而且我也無法安裝,于是幹脆自己重新寫了個Dockerfile。寫的比較粗糙,可以優化的layer很多,但是工作的。
FROM nginx
RUN  apt-get update && \
     apt install  -y software-properties-common ca-certificates lsb-release apt-transport-https && \
     sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' && \
     apt install -y wget gnupg && \
     wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -  && \
     apt-get update && \
     apt -y install php7.4 && \
     apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-ldap php7.4-fpm
RUN  apt-get install -y smarty3 && \
     sh -c 'echo "deb [arch=amd64] https://ltb-project.org/debian/stable stable main" > /etc/apt/sources.list.d/ltbproject.list' && \
     wget -O - https://ltb-project.org/documentation/_static/RPM-GPG-KEY-LTB-project | apt-key add -  && \
     apt update && \
     apt install self-service-password
RUN  echo "postfix postfix/mailname string example.com" | debconf-set-selections && \
     echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections && \
     apt install -y postfix && \
     apt install -y mailutils

COPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf /etc/nginx/conf.d/default.conf
COPY *.php /usr/share/self-service-password/conf/
COPY main.cf /etc/postfix/main.cf
RUN apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
    rm /var/log/lastlog /var/log/faillog
CMD /etc/init.d/php7.4-fpm start && /etc/init.d/postfix start && nginx -g "daemon off;"
           
  1. 發送郵件我是用的mailx+postfix,指定了一個公司的一個smtp relay的伺服器發給外網

繼續閱讀