Apache-DnsZone

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN

    USE_APACI=1 \
    EVERYTHING=1 \
    APACHE_PREFIX=/usr/local/modperl
$ make
$ make test
$ make install

That should get your mod_perl running.

Recommended modules to install before installing DnsZone: Bundle::Apache,
Apache::Request, Apache::AuthCookie, Apache::AuthTicket, Net::DNS,'
CGI::FastTemplate, Email::Valid, Bundle::ABH.

You might be forced to download Apache::Request 0.3103 by hand and
install it, the package is available from:
http://www.cpan.org/authors/id/J/JI/JIMW/libapreq-0.31_03.tar.gz

To install DnsZone:

$ perl Makefile.PL
$ make

INSTALL  view on Meta::CPAN

  TransferLog  logs/dnszone-access_log
  PerlSetVar   DnsZoneDBsrc               'dbi:mysql:dnszone'
  PerlSetVar   DnsZoneDBuser              'dnszone'
  PerlSetVar   DnsZoneDBpass              '*******'
  PerlSetVar   DnsZoneDebugLevel          1
  PerlSetVar   DnsZoneLangDir             '/usr/local/modperl/dnszone'
  PerlSetVar   DnsZoneTemplateDir         '/usr/local/modperl/dnszone/template'
  PerlSetVar   DnsZoneLoginLang           'en'
  # or 'de' 'se' 'dk' 'fr' 'it' 
  # DnsZoneLoginLang is used if the browser doesn't send an 'Accept-Language' header and the language isn't in DnsZone already
  PerlModule   Apache::DnsZone::AuthCookie
  PerlSetVar   DnsZoneTicketTable         'tickets:ticket_hash:ts'
  PerlSetVar   DnsZoneTicketUserTable     'users:username:password'
  PerlSetVar   DnsZoneTicketPasswordStyle cleartext
  PerlSetVar   DnsZoneTicketSecretTable   'ticketsecrets:sec_data:sec_version'
  PerlSetVar   DnsZoneTicketExpires       60
  PerlSetVar   DnsZoneTicketLogoutURI     /
  PerlSetVar   DnsZoneTicketLoginHandler  /login
  PerlSetVar   DnsZoneTicketIdleTimeout   10
  PerlSetVar   DnsZonePath                /
  PerlSetVar   DnsZoneLoginScript         /loginform
  <Location /admin>
    SetHandler        perl-script
    PerlHandler       Apache::DnsZone
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
    PerlAuthenHandler Apache::DnsZone::AuthCookie->authenticate
    PerlAuthzHandler  Apache::DnsZone::AuthCookie->authorize
  </Location>
  <Location /loginform>
    SetHandler        perl-script
    Perlhandler       Apache::DnsZone::AuthCookie->login_screen
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
  </Location>
  <Location /login>
    SetHandler        perl-script
    PerlHandler       Apache::DnsZone::AuthCookie->login
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
  </Location>
</VirtualHost>

Copy the contents of htdocs/ to /path/to/your/apache/htdocs

$ cp -R htdocs/* /path/to/your/apache/htdocs

Now you need to import the tables that DnsZone needs into your database.

MANIFEST  view on Meta::CPAN

MANIFEST
INSTALL
conf/dnszone.conf
lib/Apache/DnsZone/DB/MySQL.pm
lib/Apache/DnsZone/DB/Postgresql.pm
lib/Apache/DnsZone/DB/Oracle.pm
lib/Apache/DnsZone/Config.pm
lib/Apache/DnsZone/DB.pm
lib/Apache/DnsZone/Resolver.pm
lib/Apache/DnsZone/Language.pm
lib/Apache/DnsZone/AuthCookie.pm
lib/Apache/DnsZone.pm
Makefile.PL
test.pl
sql/mysql.sql
sql/postgresql.sql
sql/oracle.sql
sql/upgrade/mysql-0.1-0.2.sql
bin/mysql/addzone.pl
bin/mysql/addreversezone.pl
bin/mysql/conf.pl

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;
use Apache::src ();

require 5.005;

WriteMakefile(
	      'NAME' => __PACKAGE__,
	      'VERSION_FROM' => 'lib/Apache/DnsZone.pm', 
	      'INC' => Apache::src->new->inc,
	      'PREREQ_PM' => {
		  'Apache::AuthCookie' => 0,
		  'Apache::AuthTicket' => 0,
		  'Apache::Request' => 0.3103,
		  'mod_perl' => 1.24,
		  'Net::DNS' => 0.12,
		  'DBI' => 1.13,
		  'Email::Valid' => 0,
		  'CGI::FastTemplate' => 1.09,
		  'MLDBM' => 0,
                  'GDBM_File' => 0,
                  'Net::IP' => 0

TODO  view on Meta::CPAN

[Fixed] Duplicate records || round robin! + database lookups
[Fixed] $DEBUG record in templates, for giving information about duplicate hostnames and bad hostnames/ips/whatever Call it $EXPLANATION?
[Fixed] Clean up after old header outputing stuff
[Fixed] Check wheter the "edit" submission is the changed at all
[Fixed] import scripts!
[Fixed] soa_locks? are soa locks enforced?
[Fixed] || Apache->request on all handlers
[Fixed] redo global vars shit! instead of $DnsZone::whatever, just have a global my $whatever
[Fixed] Ability to set a default language for login page? (DnsZoneLoginLang); Default login language!!
[Fixed] cookie stuff error codes in language files uc(cookiereturn)
[Fixed] Implement own Apache::AuthCookie derivate with templates! (use Apache::(AuthTicket|AuthCookieDBI) as examples)
[Fixed] TimeOut of cookie + 15 minute renewal of each cookie! If not done anything for the last 15 minutes and request another page => re-login; subclass of Apache::AuthCookie; Needs to take defaults from Apache::DnsZone::Config
[Fixed] Login template needs to be unfucked!
[Fixed] Maybe a layer above the menu system so that menus and stuff wont be on login page?
[Fixed] Template system outputter (so menu will only be shown on non-login page && list_domains (maybe even show all the domains you have in the url?))
[Fixed] logout?
[Fixed] is_updated_SOA? (Is SOA updated in edit submit request)
[Fixed] GET/POST where? POST => when submitting forms to avoid 4K limit
[Fixed] is_updated_* ttl eq and not == ?
[Fixed] which pages need caching and which don't? All pages should have caching turned off so no pages will be in cache if user is not authenticated
[Fixed] Settings, Logout, Menu, List domain texts! Menu with list_domains and settings and logout (if appropriate)
[Fixed] SSL - why would there be any issues with using ssl?

conf/dnszone.conf  view on Meta::CPAN

  ErrorLog     logs/dnszone-error_log
  TransferLog  logs/dnszone-access_log
  PerlSetVar   DnsZoneDBsrc               'dbi:mysql:dnszone'
  PerlSetVar   DnsZoneDBuser              'dnszone'
  PerlSetVar   DnsZoneDBpass              '*******'
  PerlSetVar   DnsZoneDebugLevel          1
  PerlSetVar   DnsZoneLangDir             '/usr/local/modperl/dnszone'
  PerlSetVar   DnsZoneTemplateDir         '/usr/local/modperl/dnszone/template'
  PerlSetVar   DnsZoneLoginLang           'en'
  PerlSetVar   DnsZoneLogoutHandler       /logout
  PerlModule   Apache::DnsZone::AuthCookie
  PerlSetVar   DnsZoneTicketTable         'tickets:ticket_hash:ts'
  PerlSetVar   DnsZoneTicketUserTable     'users:username:password'
  PerlSetVar   DnsZoneTicketPasswordStyle cleartext
  PerlSetVar   DnsZoneTicketSecretTable   'ticketsecrets:sec_data:sec_version'
  PerlSetVar   DnsZoneTicketExpires       60
  PerlSetVar   DnsZoneTicketLogoutURI     /
  PerlSetVar   DnsZoneTicketLoginHandler  /login
  PerlSetVar   DnsZoneTicketIdleTimeout   10
  PerlSetVar   DnsZonePath                /
  PerlSetVar   DnsZoneLoginScript         /loginform
  <Location /admin>
    SetHandler        perl-script
    PerlHandler       Apache::DnsZone
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
    PerlAuthenHandler Apache::DnsZone::AuthCookie->authenticate
    PerlAuthzHandler  Apache::DnsZone::AuthCookie->authorize
    require           valid-user
  </Location>
  <Location /loginform>
    SetHandler        perl-script
    Perlhandler       Apache::DnsZone::AuthCookie->login_screen
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
  </Location>
  <Location /login>
    SetHandler        perl-script
    PerlHandler       Apache::DnsZone::AuthCookie->login
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
  </Location>
  <Location /logout>
    SetHandler        perl-script
    PerlHandler       Apache::DnsZone::AuthCookie->logout
    AuthType          Apache::DnsZone::AuthCookie
    AuthName          DnsZone
  </Location>
</VirtualHost>

lang/br.lang  view on Meta::CPAN

		'ERROR_REFRESH'     => 'Valor do Tempo de Atualiza&ccedil;&atilde;o Inv&aacute;lido',
		'ERROR_RETRY'       => 'Valor para o Tempo de Tentativa Inv&aacute;lido',
		'ERROR_EXPIRE'      => 'Valor do Tempo de Expira&ccedil;&atilde;o Inv&aacute;lido',
		'FILLOUT_FIELDS'    => 'Por Favor Complete os Seguintes Campos:',
		'EDIT_FIELDS'       => 'Por Favor Altere os Campos:',
		'DELETE_RECORD'     => 'Voc&ecirc; Ir&aacute; Apagar os Seguintes Registros:',
		'USERNAME'          => 'Usu&aacute;rio',
		'PASSWORD'          => 'Senha',
		'LOGIN_BUTTON'      => 'Entrar',
		'PAGE_LOGIN'        => 'P&aacute;gina de Login',
		'LOGIN_NOTE'        => 'Nota: Configure seu Navegador para Aceitar Cooks para poder se logar. Sua Senha Ser&aacute; Solicitada depois de algum tempo.',
		'IDLE_TIMEOUT'      => 'Motivo da Desconex&atilde;oao: Tempo Esgotado',
		'MALFORMED_TICKET'  => 'Motivo da Desconex&atilde;o: Ticket com Malforma&ccedil;&atilde;o',
		'INVALID_HASH'      => 'Motivo da Desconex&atilde;o: Ticket Desconhecido',
		'EXPIRED_TICKET'    => 'Motivo da Desconex&atilde;o: Ticket Expirou',
		'MISSING_SECRET'    => 'Motivo da Desconex&atilde;o: Server secret n&atilde;o pode ser carregado',
		'TAMPERED_HASH'     => 'Motivo da Desconex&atilde;o: Ticket dados alterados com',
		'PASSWORD_CHANGE'   => 'A senha s&oacute; ser&aacute; alterada se voc&ecirc; digitar algo nos campos abaixo.'
		);
    
    return %text;

lang/de.lang  view on Meta::CPAN

		'ERROR_REFRESH'     => 'Ung&uuml;ltiger Wert f&uuml;r Aktualisierungszeit',
		'ERROR_RETRY'       => 'Ung&uuml;ltiger Wert f&uuml;r Wiederholungszeit',
		'ERROR_EXPIRE'      => 'Ung&uuml;ltiger Wert f&uuml;r Ablaufzeit',
		'FILLOUT_FIELDS'    => 'Bitte f&uuml;llen sie die folgenden Felder aus:',
		'EDIT_FIELDS'       => 'Bitte bearbeiten sie diese Felder:',
		'DELETE_RECORD'     => 'Sie sind dabei folgenden Eintrag zu l&ouml;schen:',
		'USERNAME'          => 'Benutzername',
		'PASSWORD'          => 'Passwort',
		'LOGIN_BUTTON'      => 'Anmelden',
		'PAGE_LOGIN'        => 'Anmeldeseite',
		'LOGIN_NOTE'        => 'Anmerkung: Cookies m&uuml;ssen bei Ihrem Browser aktiviert sein, um sich anmelden zu k&ouml;nnen. Nach einiger Zeit werden Sie aufgefordert sicher erneut anzumelden.',
		'IDLE_TIMEOUT'      => 'Abmeldegrund: Zeitablauf nach Unt&auml;tigkeit',
		'MALFORMED_TICKET'  => 'Abmeldegrund: Ticket besch&auml;digt',
		'INVALID_HASH'      => 'Abmeldegrund: Unbekanntes Ticket',
		'EXPIRED_TICKET'    => 'Abmeldegrund: Ticket ist abgelaufen',
		'MISSING_SECRET'    => 'Abmeldegrund: Server Secret konnte nicht geladen werden',
		'TAMPERED_HASH'     => 'Abmeldegrund: Ticket Daten wurden manipuliert',
		'PASSWORD_CHANGE'   => 'Das Passwort wird nur ver&auml;ndert wenn Sie die untenstehenden Felder ausf&uuml;llen.'
		);
    
    return %text;

lib/Apache/DnsZone.pm  view on Meta::CPAN

%EXPORT_TAGS = ();
$VERSION = '0.2';

use Apache ();
use Apache::Constants qw(:common REDIRECT);
use Apache::Request ();
use Apache::DnsZone::Config;
use Apache::DnsZone::Resolver;
use Apache::DnsZone::DB;
use Apache::DnsZone::Language;
use Apache::DnsZone::AuthCookie;
use Net::DNS;
use Net::IP qw(:PROC);
use HTML::Entities;
use Email::Valid;
use CGI::FastTemplate;
use Data::Dumper;

my %lang = ();
my $cfg;
my $res;

lib/Apache/DnsZone.pm  view on Meta::CPAN

    $dbh->close();
    return OK;
}

sub logout {
    my $r = shift || Apache->request();
    Debug(3, qq{calling logout()});
    init($r);
    output_redirect($r, 1, $cfg->{'cfg'}->{DnsZoneLogoutHandler});
#    $r->push_handlers(PerlHandler => sub {
#      Apache::DnsZone::AuthCookie->logout(Apache->request);
#    });
    $dbh->close();
    return REDIRECT;
}

sub list_domains {
    my $r = shift || Apache->request();
    Debug(3, qq{calling list_domains()});
    init($r); 
    my ($uid, $email, $lang_id, $lang) = $dbh->get_user_info($r->connection->user);

lib/Apache/DnsZone/AuthCookie.pm  view on Meta::CPAN

package Apache::DnsZone::AuthCookie;

# $Id: AuthCookie.pm,v 1.8 2001/06/03 11:10:23 thomas Exp $

use strict;
use vars qw(@ISA $VERSION);

use Apache::Constants qw(OK);
use Apache::AuthTicket ();
use Apache::AuthCookie ();
use Apache::DnsZone;
use Apache::DnsZone::Config;
use Apache::DnsZone::Language;
use Apache::DnsZone::DB;
use CGI::FastTemplate ();
use DBI;
use Digest::MD5 qw(md5_hex);

($VERSION) = qq$Revision: 1.8 $ =~ /([\d\.]+)/;
@ISA = qw(Apache::AuthTicket);

sub make_login_screen {
    my ($self, $r, $action, $destination) = @_;
    my $reason = $r->prev->subprocess_env("AuthCookieReason");
    my $ticket_reason = undef;
    Apache::DnsZone::Debug(5, qq{make_login_screen called});
    if ($reason eq 'bad_cookie') {
	$ticket_reason = $r->prev->subprocess_env("AuthTicketReason");
    }

    my $cfg = Apache::DnsZone::Config->new($r);

    my $lang = $cfg->{'cfg'}->{DnsZoneLoginLang}; # choose default login language

lib/Apache/DnsZone/AuthCookie.pm  view on Meta::CPAN


    Apache::DnsZone::output_headers($r, 1, length(${$content_ref}));

    $r->print(${$content_ref});

    return OK;
}

sub dbi_connect {
    my ($this) = @_;
    Apache::DnsZone::Debug(5, qq{Apache::DnsZone::AuthCookie::dbi_connect called});    
    my $r = $this->request;
    
    my $cfg = Apache::DnsZone::Config->new($r);
    my $dbh = Apache::DnsZone::DB->new($cfg);

    return $dbh->db();
}

1;



( run in 1.113 second using v1.01-cache-2.11-cpan-e9199f4ba4c )