mirror of https://github.com/dirtbags/moth.git
Finalize logger, back to mathopd
This commit is contained in:
parent
b04979ea77
commit
ea2d50a270
|
@ -0,0 +1,21 @@
|
||||||
|
LOGGER_PKGDIR = build/logger
|
||||||
|
LOGGER_PACKAGE = logger.pkg
|
||||||
|
|
||||||
|
logger-install: logger-build
|
||||||
|
mkdir -p $(LOGGER_PKGDIR)
|
||||||
|
|
||||||
|
mkdir -p $(LOGGER_PKGDIR)/bin/
|
||||||
|
$(MAKE) -C logger/src install DESTDIR=$(CURDIR)/$(LOGGER_PKGDIR)
|
||||||
|
|
||||||
|
$(call COPYTREE, logger/tokens, $(LOGGER_PKGDIR)/tokens)
|
||||||
|
|
||||||
|
$(call COPYTREE, logger/service, $(LOGGER_PKGDIR)/service)
|
||||||
|
|
||||||
|
logger-clean:
|
||||||
|
rm -rf $(LOGGER_PKGDIR) $(LOGGER_PACKAGE)
|
||||||
|
$(MAKE) -C logger/src clean
|
||||||
|
|
||||||
|
logger-build:
|
||||||
|
$(MAKE) -C logger/src build
|
||||||
|
|
||||||
|
PACKAGES += logger
|
|
@ -1,5 +1,14 @@
|
||||||
all: logger
|
CFLAGS = -Wall -Werror
|
||||||
|
LDFLAGS = -static
|
||||||
|
TARGETS = logger
|
||||||
|
|
||||||
|
all: build
|
||||||
|
build: $(TARGETS)
|
||||||
|
|
||||||
logger: logger.o token.o
|
logger: logger.o token.o
|
||||||
|
|
||||||
|
install: $(TARGETS)
|
||||||
|
install -m 0755 $(TARGETS) $(DESTDIR)/bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o logger
|
rm -f *.o $(TARGETS)
|
|
@ -6,10 +6,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
|
|
||||||
#define NO_DEBUG
|
|
||||||
#define PID_MAX 32768
|
#define PID_MAX 32768
|
||||||
#define QSIZE 200
|
#define QSIZE 200
|
||||||
#define MSGS_PER_SEC 10
|
#define MSGS_PER_SEC_MIN 10
|
||||||
|
#define MSGS_PER_SEC_MAX 40
|
||||||
|
|
||||||
const uint8_t key[] = {0x99, 0xeb, 0xc0, 0xce,
|
const uint8_t key[] = {0x99, 0xeb, 0xc0, 0xce,
|
||||||
0xe0, 0xc9, 0xed, 0x5b,
|
0xe0, 0xc9, 0xed, 0x5b,
|
||||||
|
@ -17,7 +17,7 @@ const uint8_t key[] = {0x99, 0xeb, 0xc0, 0xce,
|
||||||
0xdd, 0x0b, 0x03, 0x10};
|
0xdd, 0x0b, 0x03, 0x10};
|
||||||
|
|
||||||
/* Storage space for tokens */
|
/* Storage space for tokens */
|
||||||
char token[4][TOKEN_MAX];
|
char token[3][TOKEN_MAX];
|
||||||
|
|
||||||
void
|
void
|
||||||
read_tokens()
|
read_tokens()
|
||||||
|
@ -31,7 +31,7 @@ read_tokens()
|
||||||
sprintf(name, "logger%d", i);
|
sprintf(name, "logger%d", i);
|
||||||
|
|
||||||
len = read_token(name, key, sizeof(key), token[i], sizeof(token[i]));
|
len = read_token(name, key, sizeof(key), token[i], sizeof(token[i]));
|
||||||
if (len >= sizeof(token[i])) abort();
|
if ((-1 == len) || (len >= sizeof(token[i]))) abort();
|
||||||
token[i][len] = '\0';
|
token[i][len] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,6 @@ char const *
|
||||||
bogus_token()
|
bogus_token()
|
||||||
{
|
{
|
||||||
static char token[TOKEN_MAX];
|
static char token[TOKEN_MAX];
|
||||||
char bb[bubblebabble_len(5)];
|
|
||||||
unsigned char crap[itokenlen];
|
unsigned char crap[itokenlen];
|
||||||
unsigned char digest[bubblebabble_len(itokenlen)];
|
unsigned char digest[bubblebabble_len(itokenlen)];
|
||||||
int i;
|
int i;
|
||||||
|
@ -345,7 +344,7 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int pid = 52;
|
int pid = 52;
|
||||||
time_t then = time(NULL);
|
time_t then = time(NULL) - 100; /* Assure we get new tokens right away */
|
||||||
|
|
||||||
/* Seed RNG */
|
/* Seed RNG */
|
||||||
srandom(then);
|
srandom(then);
|
||||||
|
@ -387,7 +386,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make some messages */
|
/* Make some messages */
|
||||||
max = randint(MSGS_PER_SEC);
|
max = MSGS_PER_SEC_MIN + randint(MSGS_PER_SEC_MAX - MSGS_PER_SEC_MIN);
|
||||||
|
|
||||||
for (i = 0; i < max; i += 1) {
|
for (i = 0; i < max; i += 1) {
|
||||||
time_t start = now + 1;
|
time_t start = now + 1;
|
||||||
|
@ -471,7 +470,7 @@ main(int argc, char *argv[])
|
||||||
messages[0]->when = start;
|
messages[0]->when = start;
|
||||||
snprintf(messages[0]->text, sizeof(messages[0]->text),
|
snprintf(messages[0]->text, sizeof(messages[0]->text),
|
||||||
"ircd: Accepted connection %d from %d.%d.%d.%d:%d on socket %d.",
|
"ircd: Accepted connection %d from %d.%d.%d.%d:%d on socket %d.",
|
||||||
pid, connection,
|
connection,
|
||||||
randint(256), randint(256),
|
randint(256), randint(256),
|
||||||
randint(256), randint(256),
|
randint(256), randint(256),
|
||||||
port,
|
port,
|
||||||
|
@ -515,8 +514,32 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 6 ... 20:
|
case 6 ... 20:
|
||||||
/* SMTP */
|
/* SMTP */
|
||||||
|
{
|
||||||
|
char const *mytoken;
|
||||||
|
size_t tokenlen;
|
||||||
|
char const *host;
|
||||||
|
size_t hostlen;
|
||||||
|
char const *from;
|
||||||
|
size_t fromlen;
|
||||||
|
char const *to;
|
||||||
|
int is_token;
|
||||||
|
|
||||||
|
if (randint(10) == 0) {
|
||||||
|
is_token = 1;
|
||||||
|
mytoken = token[2];
|
||||||
|
} else {
|
||||||
|
is_token = 0;
|
||||||
|
mytoken = bogus_token();
|
||||||
|
}
|
||||||
|
|
||||||
|
tokenlen = strlen(mytoken);
|
||||||
|
host = mytoken;
|
||||||
|
hostlen = tokenlen/3;
|
||||||
|
from = mytoken + hostlen;
|
||||||
|
fromlen = tokenlen/3;
|
||||||
|
to = mytoken + hostlen + fromlen;
|
||||||
|
|
||||||
if (-1 != get_many_messages(messages, 8)) {
|
if (-1 != get_many_messages(messages, 8)) {
|
||||||
char const *u = user();
|
|
||||||
int o1 = randint(256);
|
int o1 = randint(256);
|
||||||
int o2 = randint(256);
|
int o2 = randint(256);
|
||||||
int o3 = randint(256);
|
int o3 = randint(256);
|
||||||
|
@ -526,13 +549,13 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
messages[0]->when = start;
|
messages[0]->when = start;
|
||||||
snprintf(messages[0]->text, sizeof(messages[0]->text),
|
snprintf(messages[0]->text, sizeof(messages[0]->text),
|
||||||
"smtp/smtpd[%d]: connect from unknown[%d.%d.%d.%d]",
|
"smtp/smtpd[%d]: connect from %.*s[%d.%d.%d.%d]",
|
||||||
pid, o1, o2, o3, o4);
|
pid, hostlen, host, o1, o2, o3, o4);
|
||||||
|
|
||||||
messages[1]->when = messages[0]->when + randint(1);
|
messages[1]->when = messages[0]->when + randint(1);
|
||||||
snprintf(messages[1]->text, sizeof(messages[1]->text),
|
snprintf(messages[1]->text, sizeof(messages[1]->text),
|
||||||
"smtp/smtpd[%d]: %08lX: client=unknown[%d.%d.%d.%d]",
|
"smtp/smtpd[%d]: %08lX: client=%.*s[%d.%d.%d.%d]",
|
||||||
pid, mid, o1, o2, o3, o4);
|
pid, mid, hostlen, host, o1, o2, o3, o4);
|
||||||
|
|
||||||
messages[2]->when = messages[1]->when + 2 + randint(3);
|
messages[2]->when = messages[1]->when + 2 + randint(3);
|
||||||
snprintf(messages[2]->text, sizeof(messages[2]->text),
|
snprintf(messages[2]->text, sizeof(messages[2]->text),
|
||||||
|
@ -548,8 +571,8 @@ main(int argc, char *argv[])
|
||||||
pid = (pid + 1 + randint(5)) % PID_MAX;
|
pid = (pid + 1 + randint(5)) % PID_MAX;
|
||||||
messages[4]->when = messages[3]->when + randint(1);
|
messages[4]->when = messages[3]->when + randint(1);
|
||||||
snprintf(messages[4]->text, sizeof(messages[4]->text),
|
snprintf(messages[4]->text, sizeof(messages[4]->text),
|
||||||
"smtp/qmgr[%d]: %08lX: from=<%s@junkmail.spam>, size=%d, nrcpt=1 (queue active)",
|
"smtp/qmgr[%d]: %08lX: from=<%.*s@junkmail.spam>, size=%d, nrcpt=1 (queue active)",
|
||||||
pid, mid, user(), randint(6000));
|
pid, mid, fromlen, from, randint(6000));
|
||||||
|
|
||||||
messages[5]->when = messages[4]->when + 2 + randint(2);
|
messages[5]->when = messages[4]->when + 2 + randint(2);
|
||||||
snprintf(messages[5]->text, sizeof(messages[5]->text),
|
snprintf(messages[5]->text, sizeof(messages[5]->text),
|
||||||
|
@ -559,16 +582,17 @@ main(int argc, char *argv[])
|
||||||
messages[6]->when = messages[4]->when + randint(1);
|
messages[6]->when = messages[4]->when + randint(1);
|
||||||
snprintf(messages[6]->text, sizeof(messages[6]->text),
|
snprintf(messages[6]->text, sizeof(messages[6]->text),
|
||||||
"smtp/deliver(%s): msgid=<%08lx@junkmail.spam>: saved to INBOX",
|
"smtp/deliver(%s): msgid=<%08lx@junkmail.spam>: saved to INBOX",
|
||||||
u, mid2);
|
to, mid2);
|
||||||
|
|
||||||
pid = (pid + 1 + randint(5)) % PID_MAX;
|
pid = (pid + 1 + randint(5)) % PID_MAX;
|
||||||
messages[7]->when = messages[4]->when + randint(1);
|
messages[7]->when = messages[4]->when + randint(1);
|
||||||
snprintf(messages[7]->text, sizeof(messages[7]->text),
|
snprintf(messages[7]->text, sizeof(messages[7]->text),
|
||||||
"smtp/local[%d]: %08lX: to <%s@dirtbags.net>, relay=local, dsn=2.0.0, status=sent (delivered to command /usr/bin/deliver)",
|
"smtp/local[%d]: %08lX: to <%s@dirtbags.net>, relay=local, dsn=2.0.0, status=sent (delivered to command /usr/bin/deliver)",
|
||||||
pid, mid, u);
|
pid, mid, to);
|
||||||
|
|
||||||
enqueue_messages(messages, 8);
|
enqueue_messages(messages, 8);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 21 ... 30:
|
case 21 ... 30:
|
||||||
/* ssh */
|
/* ssh */
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
logger
|
|
|
@ -1 +0,0 @@
|
||||||
S゙*郢シ緩ミ7<EFBE90>k<13>
|
|
|
@ -1 +0,0 @@
|
||||||
™כְ־אֹם[½ָµ<C2B5>
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
exec logger -t httpd
|
|
@ -6,6 +6,16 @@ ErrorLog /dev/stderr
|
||||||
User nobody
|
User nobody
|
||||||
StayRoot On
|
StayRoot On
|
||||||
|
|
||||||
|
LogFormat {
|
||||||
|
RemoteAddress
|
||||||
|
Method
|
||||||
|
URI
|
||||||
|
Status
|
||||||
|
ContentLength
|
||||||
|
Referer
|
||||||
|
UserAgent
|
||||||
|
}
|
||||||
|
|
||||||
Tuning {
|
Tuning {
|
||||||
Timeout 5
|
Timeout 5
|
||||||
ScriptTimeout 5
|
ScriptTimeout 5
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
mkdir -p /var/www
|
exec 2>&1
|
||||||
cd /var/www
|
|
||||||
|
install -d /var/www
|
||||||
|
|
||||||
# Link in puzzles and web pages
|
# Link in puzzles and web pages
|
||||||
for d in /opt/*; do
|
for d in /opt/*; do
|
||||||
if [ -d $d/puzzles ]; then
|
if [ -d $d/puzzles ]; then
|
||||||
ln -s $d/puzzles $(basename $d)
|
ln -sf $d/puzzles /var/www/$(basename $d)
|
||||||
fi
|
fi
|
||||||
if [ -d $d/www ]; then
|
if [ -d $d/www ]; then
|
||||||
ln -s $d/www/* .
|
ln -sf $d/www/* /var/www/
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exec thttpd -D \
|
exec mathopd -n -f ./mathopd.conf
|
||||||
-nos \
|
|
||||||
-u ctf \
|
|
||||||
-c "**.cgi" \
|
|
||||||
-T "utf-8"
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#! /bin/sh
|
#! /bin/sh -e
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
install -o ctf -m 0644 /dev/null /var/lib/ctf/puzzles.db
|
install -o ctf -m 0644 /dev/null /var/lib/ctf/puzzles.db
|
||||||
|
install -d /var/www
|
||||||
|
|
||||||
# Make an initial listing
|
# Make an initial listing
|
||||||
./puzzled
|
./puzzled
|
||||||
|
|
Loading…
Reference in New Issue