Tobias von Dewitz 7 éve
commit
3c0241688c
10 módosított fájl, 108 hozzáadás és 0 törlés
  1. 7 0
      Dockerfile
  2. 3 0
      build.sh
  3. 40 0
      docker-compose.yml
  4. 23 0
      enc.rb
  5. 1 0
      htdocs
  6. 13 0
      ips.rb
  7. 1 0
      lua
  8. 9 0
      run.sh
  9. 10 0
      test.go
  10. 1 0
      x.conf

+ 7 - 0
Dockerfile

@@ -0,0 +1,7 @@
+FROM httpd:2.4-alpine
+
+RUN echo "Include conf/extra/httpd-lua.conf" >> /usr/local/apache2/conf/httpd.conf
+RUN apk add --no-cache lua
+RUN apk add --no-cache lua-redis lua-socket lua-cjson
+RUN apk add --no-cache lua-rex-pcre
+RUN apk add --no-cache lua-ossl

+ 3 - 0
build.sh

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+docker build -t httpd-lua:latest .

+ 40 - 0
docker-compose.yml

@@ -0,0 +1,40 @@
+version: '3' 
+services:
+  redis:
+    image: redis:latest
+    volumes:
+     - /docker-filesystem/httpd/redis:/data
+    restart: always
+    ports:
+      - 8002:6379
+  captcha:
+    image: registry.scw.systems/captcha:1.2.5.1
+    restart: always
+    environment:
+      - COOKIE_NAME=hicludes
+      - COOKIE_KEY=DydmRdMMZWcRF91mNj/CWLPzzQQi5Rew0cBP0qiBUZI=
+      - BIND=0.0.0.0
+      - REDIS_HOST=redis
+      - REDIS_PORT=6379
+      - HUMAN_TTL=10m
+    ports:
+      - 8003:8080
+  apache:
+    image: httpd-lua:latest
+    depends_on:
+      - redis
+    volumes:
+      - /docker-filesystem/httpd/apache/httpd-lua.conf:/usr/local/apache2/conf/extra/httpd-lua.conf
+      - /docker-filesystem/httpd/apache/htdocs:/usr/local/apache2/htdocs
+      - /docker-filesystem/httpd/apache/lua:/usr/local/apache2/lua
+    environment:
+      - SCW_IGNORE=(^/assets/|\.(png|jpe?g|svg|gif|js|css)$$)
+      - SCW_KEY=DydmRdMMZWcRF91mNj/CWLPzzQQi5Rew0cBP0qiBUZI=
+      - SCW_COOKIE=hicludes
+      - SCW_CAPTCHA_URL=http://docker.scw.systems:8003/?src=%s&r=%s
+      - SCW_REDIS_HOST=redis
+      - SCW_REDIS_PORT=6379
+      - SCW_TEST=yes
+    ports:
+      - 8001:80
+    restart: always

+ 23 - 0
enc.rb

@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+#
+
+require 'openssl'
+require 'uri'
+require 'base64'
+
+key = Base64.decode64 'DydmRdMMZWcRF91mNj/CWLPzzQQi5Rew0cBP0qiBUZI='
+cookie = URI.decode "SCIiflMqREyV3wuA%2FHAOOU0tdieMeSb764kd3r3wz%2Bqeo6QhBcCCycP5y1Zal1ul"
+iv = cookie[0..15]
+enc = cookie[16..-1]
+
+
+cipher = OpenSSL::Cipher.new 'AES-256-CBC'
+cipher.decrypt
+cipher.key = key
+cipher.iv = iv
+
+msg = cipher.update enc
+msg << cipher.final
+
+puts msg

+ 1 - 0
htdocs

@@ -0,0 +1 @@
+/docker-filesystem/httpd/apache/htdocs

+ 13 - 0
ips.rb

@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+#
+#
+
+require 'redis'
+
+redis = Redis.new(host: "127.0.0.1", port: 8002)
+
+1.upto(100000) do
+  ip = "%d.%d.%d.%d" % [rand(253)+1, rand(254), rand(254), rand(254)]
+
+  redis.set "bl:#{ip}", 1
+end

+ 1 - 0
lua

@@ -0,0 +1 @@
+/docker-filesystem/httpd/apache/lua

+ 9 - 0
run.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+
+docker run \
+   -d \
+   --name httpd-lua \
+   -v $PWD/httpd-lua.conf:/usr/local/apache2/conf/extra/httpd-lua.conf \
+   -p 8000:80 \
+   httpd:2.4-alpine

+ 10 - 0
test.go

@@ -0,0 +1,10 @@
+package main
+
+import "fmt"
+import "time"
+
+func main() {
+  t := 10*time.Minute
+
+  fmt.Println(t.Seconds())
+}

+ 1 - 0
x.conf

@@ -0,0 +1 @@
+/docker-filesystem/httpd/apache/httpd-lua.conf