• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

mod_auth_token Installation In Apache

mod_auth_token Apache

mod_auth_token is a apache module that can be used to sign URLs,  using this it can create time based urls that expire after a certain amount of time. It will prevent hot linking as the URLs will expire. This is particularly useful with video and image sharing.

To get started you will need to have an Apache installation already present. If you need to set this up please set Compile Apache 2.4 From Source.

Install mod_auth_token:

First ssh into the server and get the required packages:

cd /usr/src; wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mod-auth-token/mod_auth_token-1.0.5.tar.gz

Un-compress the archive:

tar xfvz mod_auth_token-1.0.5.tar.gz

Go into the directory

cd mod_auth_token-1.0.5

Configure it:

./buildconf && ./configure

Install It:

make && make install

Restart Apache to make sure it loads without a error:

service httpd restart

Make sure the module is loaded:

# httpd -M 2>&1|grep auth_token
 auth_token_module (shared)

You should see auth_token_module in the results

Configure Apache for mod_auth_token

You will need to edit the apache configuration and add the following to the domain you want protected by mod_auth_token:

<Location /download/>
# Secret key, can be anything random
 AuthTokenSecret "randomstring"
# directory to protect
 AuthTokenPrefix /protected/
# Timeout length, this is in seconds
 AuthTokenTimeout 300
# limit requsts by IP
 AuthTokenLimitByIp off
</Location>

Restart Apache again:

service httpd restart

To test that it is working create a php file to generate a URL

<?PHP

$secret = "randomstring"; // AuthTokenSecret
$directory = "/[protected/"; // AuthTokenPrefix
$hexTime = dechex(time()); // Time in Hexadecimal 
$url = "http://www.example.com"; // Replace this with the domain
$filename = "/$filename";  // Filename
 
$token = md5($secret . $filename. $hexTime);
 
$url = $domainname . $protectedPath . $token. "/" . $hexTime . $filename;
print $url;

?>

Go ahead and run that php script and it will output the URL, if you are able to access it. The module is working correctly. You can read more about mod_auth_token on code.google.com

May 3, 2017LinuxAdmin.io
0 0 votes
Article Rating
Compile Apache 2.4 From SourceModSecurity Installation With Apache On CentOS
You Might Also Like
 
FFMpeg Install On CentOS 7
 
PHP-FPM With PHP7 From Source
Subscribe
Notify of
guest

guest

0 Comments
Inline Feedbacks
View all comments
8 years ago Apache, Linux Tutorials, Security, Web Hosting centos, linux, sysadmin3,753
Recent Posts
  • Configuring Firewalld to Work Seamlessly with Docker on CentOS
  • Mastering NGINX Tuning: Optimizing Web Server Performance
  • Exploring eBPF: Revolutionizing Network and System Monitoring
  • Kubernetes: Installation and Overview on CentOS 8
  • Install Docker on Centos 8
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
76,147 views
Zend Opcache
Setup and Optimize Zend OpCache
47,105 views
Install ffmpeg
FFMpeg Install On CentOS 7
21,675 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz