alterator-distro-office-server-1.0/000075500000000000000000000000001213266320500174045ustar00rootroot00000000000000alterator-distro-office-server-1.0/Makefile000064400000000000000000000005351213266320500210470ustar00rootroot00000000000000NAME=office-server PO_SHELL_TRLIST=$(shell find hooks -type f) all: make -C bin clean: make -C bin clean install: install-module install-data include /usr/share/alterator/build/module.mak install-data: install -d $(bindir) cp -a bin/mysql_passwd_sum $(bindir)/ install -d -m 755 $(sysconfdir)/alterator/ cp -a logs $(sysconfdir)/alterator/ alterator-distro-office-server-1.0/applications/000075500000000000000000000000001213266320500220725ustar00rootroot00000000000000alterator-distro-office-server-1.0/applications/firsttime.desktop000064400000000000000000000004171213266320500254750ustar00rootroot00000000000000[Desktop Entry] Type=Application Categories=X-Alterator-FirstTime Icon=root Terminal=false Name=Initial system setup X-Alterator-URI=/office-server/firsttime X-Alterator-Help=office-server-firsttime Name[ru]=Первоначальная настройка системы alterator-distro-office-server-1.0/bin/000075500000000000000000000000001213266320500201545ustar00rootroot00000000000000alterator-distro-office-server-1.0/bin/Makefile000064400000000000000000000000621213266320500216120ustar00rootroot00000000000000all: mysql_passwd_sum clean: rm mysql_passwd_sumalterator-distro-office-server-1.0/bin/mysql_passwd_sum.c000064400000000000000000000024611213266320500237350ustar00rootroot00000000000000#include #include typedef unsigned int uint; typedef unsigned long ulong; typedef unsigned char uchar; /* from mysql-5.0.51/sql/password.c */ /* Generate binary hash from raw text string. Used for Pre-4.1 password handling SYNOPSIS hash_password() result OUT store hash in this location password IN plain text password to build hash password_len IN password length (password may be not null-terminated) */ void hash_password(ulong *result, const char *password, uint password_len) { register ulong nr=1345345333L, add=7, nr2=0x12345671L; ulong tmp; const char *password_end= password + password_len; for (; password < password_end; password++) { if (*password == ' ' || *password == '\t') continue; /* skip space in password */ tmp= (ulong) (uchar) *password; nr^= (((nr & 63)+add)*tmp)+ (nr << 8); nr2+=(nr2 << 8) ^ nr; add+=tmp; } result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */; result[1]=nr2 & (((ulong) 1L << 31) -1L); } int main(int argc, char **argv){ if (argc != 2){ printf ("Usage: sql_passwd_sum \n"); return 1; } ulong res[2]; hash_password(res, argv[1], strlen(argv[1])); printf("%08x%08x",res[0], res[1]); return 0; } alterator-distro-office-server-1.0/hooks/000075500000000000000000000000001213266320500205275ustar00rootroot00000000000000alterator-distro-office-server-1.0/hooks/firsttime.d/000075500000000000000000000000001213266320500227575ustar00rootroot00000000000000alterator-distro-office-server-1.0/hooks/firsttime.d/office-server000075500000000000000000000002211213266320500254370ustar00rootroot00000000000000#!/bin/sh sed -i -e 's/^id:5:initdefault:/id:3:initdefault:/' \ -e 's|^#\(1.*mingetty.*tty\)|\1|' /etc/inittab /sbin/init q /sbin/init 3 alterator-distro-office-server-1.0/hooks/net-eth-precommit.d/000075500000000000000000000000001213266320500243125ustar00rootroot00000000000000alterator-distro-office-server-1.0/hooks/net-eth-precommit.d/office-server000075500000000000000000000010631213266320500267770ustar00rootroot00000000000000#!/bin/sh . alterator-net-functions _() { gettext "alterator-office-server" "$1" } cachedir="/var/cache/alterator/net-eth" for iface in $(list_eth); do iface_dir="$cachedir/$iface" [ -d "$iface_dir" ] || iface_dir="/etc/net/ifaces/$iface" [ "$(read_iface_option "$iface_dir" BOOTPROTO)" != "static" ] || [ -z "$(read_iface_addr "$iface_dir")" ] || exit 0 done startup_param='nostatic' grep "\b$startup_param\b" /proc/cmdline >/dev/null && exit 0 echo "`_ "You must define as minimum one statically configured Ethernet interface"`" exit 1 alterator-distro-office-server-1.0/hooks/root.d/000075500000000000000000000000001213266320500217345ustar00rootroot00000000000000alterator-distro-office-server-1.0/hooks/root.d/office-server000075500000000000000000000014141213266320500244210ustar00rootroot00000000000000#!/bin/sh mysql_root="/var/lib/mysql/" read -r passwd md5="$(echo -n "$passwd" | md5sum | cut -f1 -d' ')" wiki_salt="4$(date | md5sum | head -c7)" # 0x0...0x7FFFFFFF wiki_sum=":B:$wiki_salt:$(echo -n "$wiki_salt-$md5" | md5sum | cut -f1 -d' ')" mysql_sum="$(mysql_passwd_sum "$passwd")" install -D "$mysql_root" # mysql config myst have line init-file=/passwd-init grep -q '^init-file=/passwd-init' "$mysql_root/my.cnf" || echo "init-file=/passwd-init" >> "$mysql_root/my.cnf" cat < "$mysql_root/passwd-init" UPDATE mysql.user SET Password='$mysql_sum' WHERE User='root'; UPDATE moodle.mdl_user SET password='$md5' WHERE username='root'; UPDATE wikidb.user SET user_password='$wiki_sum' WHERE user_name='Root'; FLUSH PRIVILEGES; EOF /sbin/service mysqld restart alterator-distro-office-server-1.0/logs/000075500000000000000000000000001213266320500203505ustar00rootroot00000000000000alterator-distro-office-server-1.0/logs/.order000064400000000000000000000000471213266320500214650ustar00rootroot00000000000000messages secure mail kernel alteratord alterator-distro-office-server-1.0/ui/000075500000000000000000000000001213266320500200215ustar00rootroot00000000000000alterator-distro-office-server-1.0/ui/office-server/000075500000000000000000000000001213266320500225605ustar00rootroot00000000000000alterator-distro-office-server-1.0/ui/office-server/firsttime/000075500000000000000000000000001213266320500245665ustar00rootroot00000000000000alterator-distro-office-server-1.0/ui/office-server/firsttime/ajax.scm000064400000000000000000000055031213266320500262200ustar00rootroot00000000000000(define-module (ui office-server firsttime ajax) :use-module (alterator ajax) :use-module (alterator woo) :use-module (alterator str) :use-module (srfi srfi-13) :export (init)) ;;; root (define (update-root) (let ((is-auto (form-value "auto"))) (form-update-visibility '("passwd_auto" "generate") is-auto) (form-update-visibility '("passwd_1" "passwd_2") (not is-auto)))) (define (read-root) (form-update-value-list '("passwd_auto") (woo-read-first "/root"))) (define (commit-root) (woo-write "/root" 'commit #t 'language (form-value "language") 'auto (form-value "auto") 'passwd_1 (form-value "passwd_1") 'passwd_2 (form-value "passwd_2") 'passwd_auto (form-value "passwd_auto"))) ;;; iptables (define (read-iptables) (form-update-enum "external_ifaces" (woo-list "/net-iptables/ifaces"))) (define (commit-iptables) (woo "firsttime" "/net-iptables" 'external_ifaces (or (form-value "external_ifaces") ""))) ;;; CA (define (read-ca) (form-update-value-list '("O") (woo-read-first "/ca/root"))) (define (commit-ca) (if (string=? (form-value "server_role") "master") (let ((first-lang (car (string-cut (form-value "language") #\;)))) (woo "create" "/ca/root" 'language (form-value "language") 'C (string-take-right first-lang 2) 'O (form-value "O") 'confirm #t) (woo-write "/ca/certs" 'language (form-value "language") 'apply_autoupdate #t 'autoupdate #t 'time "2:00:00")))) ;;; domain (define (read-domain) (form-update-value-list '("domain" "server_role") (woo-read-first "/net-domain"))) (define (commit-domain) (let ((domain (form-value "domain")) (server_role (form-value "server_role"))) (or (not-empty-string? server_role) (woo-error (_ "Please select server role"))) (or (not-empty-string? domain) (woo-error (_ "Please define domain name"))) (woo-write "/net-domain" 'server_role server_role 'domain domain 'language (form-value "language") 'runhooks #t))) ;;; locale (define (update-locale) (form-update-cookie "language" (form-value "locale")) (form-replace "/office-server/firsttime")) (define (read-locale) (catch/message (lambda() (form-update-enum "locale" (woo-list "/login/avail_locale")) (form-update-value "locale" (car (string-cut (form-value "language") #\;)))))) ;;; common (define (commit) (catch/message (lambda() (commit-root) (commit-ca) (commit-iptables) (commit-domain) (form-replace "/firsttime/finish")))) (define (init) (read-locale) (read-ca) (read-domain) (read-root) (read-iptables) (form-bind "locale" "change" update-locale) (form-bind "auto" "click" update-root) (form-bind "generate" "click" read-root) (form-bind "apply" "click" commit)) alterator-distro-office-server-1.0/ui/office-server/firsttime/index.html000064400000000000000000000043271213266320500265710ustar00rootroot00000000000000

Before you begin to work with system you will have to made some initial actions.

  1. Choose interface language: 
  2. Define domain: 
  3. Setup password for system administrator:
    Generate automatically  
    (enter passphrase)
    (repeat passphrase)
     
  4. Choose external interfaces for correct setup of system firewall: