MyBB Community Forums

Full Version: [SOLVED]Custon Admin_url - on different virtualhost?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

My Mybb version: 1.8.19 (from github),
Nginx, Mysql, PHP-FPM.

How to place an administration folder on a separate virtualhost protected with x509 / PKCS # 12 certificate?

In Wordpress, you can do this protection wp-admin in the following way:
 wp-config.php:
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);

define( 'WP_CONTENT_URL', 'https://blog.domain.tld/wp-content' );

Nginx:

server {

        server_name blog.domain.tld;
...
        location  ~/wp-admin/  {
           return 301  https://wpadmin.domain.tld$request_uri;
           log_not_found off; access_log off;}
           
         location  ~/wp-login.php  {
           return 301   https://wpadmin.domain.tld$request_uri;
           log_not_found off; access_log off;}   
...
}

server {

        server_name wpadmin.domain.tld;
....
        ssl on;
        ssl_verify_client optional; 
        ssl_verify_depth 5;
           if ( $ssl_client_verify != SUCCESS )
           {return 301 https://blog.domain.tld/index.php?status=403;}
...
}



is it possible to create a similar solution in Mybb?
How to do it?

PKCS#12 example :
https://linuxconfig.org/apache-web-serve...entication
SSL documentation:
https://httpd.apache.org/docs/current/mod/mod_ssl.html
https://nginx.org/en/docs/http/ngx_http_ssl_module.html
https://redmine.lighttpd.net/projects/1/wiki/docs_ssl

Easy PKCS#12 way:
https://www.scriptjunkie.us/2013/11/addi...ny-webapp/
https://www.scriptjunkie.us/getacert
  Rolleyes

PKCS#12 automatic login in Phpbb3:
http://wiki.cacert.org/Technology/Knowle...sion_forum
  Cool  

Cheers
Wink
Solution:

Mybb forum domain

forum.domain.tld


Mybb Admin domain:

forum-admin.domain.tld

and cookie domain:
.domain.tld
Result:

curl -Iv https://forum.example.tld/admin/backups/backup__20181125_172842_sWRkW5ekvD1970ht.sql.gz 2>&1  |egrep 'location:' 
< location: https://forum-admin.example.tld/admin/backups/backup__20181125_172842_sWRkW5ekvD1970ht.sql.gz
location: https://forum-admin.example.tld/admin/backups/backup__20181125_172842_sWRkW5ekvD1970ht.sql.gz


curl -Iv https://forum-admin.example.tld/admin/backups/backup__20181125_172842_sWRkW5ekvD1970ht.sql.gz 2>&1  |egrep 'location:' 
< location: https://goodbye.example.tld
location: https://goodbye.example.tld
Smile 

Cheers
Cool