Webmin login continues loop until session_login.cgi

I had a working webmin setup on a VPS, however after trying to get it to connect over HTTPS, I was already doing goof and now when I try to login, the login page is not displayed correctly (no blue rectangle background) and trying to login via https://server1.domain.me:10000

transfers me on https://server1.domain.me:10000/webmin/session_login.cgi

, which is again the login page.

Before it started working with an error, I had the following file in /etc/apache2/sites-available

<VirtualHost *:80>
        ServerAdmin webmaster@domain.me
        ServerName domain.me
        ServerAlias www.domain.me

        DocumentRoot /var/www/domain.me/
        <Directory />
                RedirectMatch temp ^/$ /public_html
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/domain.me>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        <Directory /var/www/domain.me/redmine>
                AllowOverride None
                order allow,deny
                allow from all
                RailsBaseURI /redmine
                PassengerResolveSymlinksInDocumentRoot on
        </Directory>

       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerSignature On

        RailsEnv production
        RailsBaseURI /redmine 

</VirtualHost>

      

When I was trying to get webmin (and owncloud, if it matters) to use HTTPS, I created a new Virtualhost for port 443 using my SSL keys, and updated Virtualhost for port 80 for the proxy all http://domain.me/webmin

before https://server1.domain.me:10000

(I kept the commented configurations for you so that see what I've tried):

<VirtualHost *:443>
        ServerAdmin webmaster@domain.me
        ServerName server1.domain.me
        alias /owncloud /var/www/domain.me/owncloud

        DocumentRoot /var/www/domain.me/

        SSLEngine On
        SSLProxyEngine On
        SSLCertificateFile /etc/ssl/ssl.crt/server1_domain_me.crt
        SSLCertificateKeyFile /etc/ssl/ssl.crt/server1.key
        SSLCACertificateFile /etc/ssl/ssl.crt/COMODORSADomainValidationSecureServerCA.crt

        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

#       <Location /webmin>
#               RewriteEngine On
#               #RewriteRule (.*) https://server1.domain.me:10000/$1 [R,L]
#               ProxyPass https://server1.domain.me:10000/
#               ProxyPassReverse https://server1.domain.me:10000/
#       </Location>

        <Directory /var/www/domain.me/owncloud>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all

                Satisfy Any

                <IfModule mod_rewrite.c>
                        RewriteEngine on
                        <IfModule mod_ssl.c>
                                RewriteEngine On
                                RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/owncloud$
                        </IfModule>
                </IfModule>
        </Directory>


#       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#        <Directory "/usr/lib/cgi-bin">
#                AllowOverride None
#                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
#                Order allow,deny
#                Allow from all
#        </Directory>


        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerSignature On

</VirtualHost>

      

and updated myhost.me virtualhost file to:

<VirtualHost *:80>
        ServerAdmin webmaster@domain.me
        ServerName domain.me
        ServerAlias www.domain.me

        #SSLEngine On
        SSLProxyEngine On
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerExpire off

        <Proxy *>
                Order allow,deny
                Allow from all
        </Proxy>

        DocumentRoot /var/www/domain.me/
        <Directory />
                RedirectMatch temp ^/$ /public_html
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/domain.me>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        <Directory /var/www/domain.me/redmine>
                AllowOverride None
                order allow,deny
                allow from all
                RailsBaseURI /redmine
                PassengerResolveSymlinksInDocumentRoot on
        </Directory>

        <Location /owncloud>
                ProxyPass https://server1.domain.me/owncloud/
        </Location>

        <Location /server1>
                ProxyPass https://server1.domain.me/webmin/
        </Location>

       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerSignature On

        RailsEnv production
        RailsBaseURI /redmine


        #ProxyPassReverse /owncloud https://server1.domain.me/owncloud/
        #ProxyPassReverse /webmin https://server1.domain.me:10000/



</VirtualHost>

      

I also added lines webprefix=/webmin

, webprefixnoredir=1

and referer=domain.me

in/etc/webmin/config

However, there is clearly something wrong here because I cannot login to webmin at all. I've searched the internet for answers in the last 5 hours, doing a lot of things and still no luck.

Any ideas?

+3


source to share


3 answers


There are four critical (and undocumented!) Keys to getting this to work, as I've found a lot of sharpening!

1) When you are editing /etc/webmin/config

, make sure webprefix=/webmin

there is no WHITE SPACE at the end of the line . This will fix the issue where the login screen formatting is scary.

2) You must be extremely precise about using forward slashes in your ProxyPass (and they don't match the official documentation!)

ProxyPass /webmin/ http://localhost:10000/
ProxyPassReverse /webmin/ http://localhost:10000/

      

3) You need to enable ProxyPass lines for cookies (again not in the documentation!).

ProxyPassReverseCookieDomain /webmin/ http://localhost:10000/
ProxyPassReverseCookiePath /webmin/ http://localhost:10000/

      



4) When you go to Webmin you MUST INCLUDE the trailing slash!

http://your.domain.name/webmin/

      

* UPDATE *

Refers to point 4:

To make sure the trailing slash is always present when browsing in Webmin add these lines (before your proxy pass, if it matters?). By adding this, if you forget to add the forward slash, Apache will simply do it for you:

RewriteEngine On                    
RewriteRule ^/webmin$ /webmin/ [R]

      

+3


source


@Buvinj I'm afraid that's not enough.

To use correct SSL on proxies, you need to disable mini SSL servers

/etc/webmin/miniserv.conf

ssl=0
ssl_redirect=1
cookiepath=/webmin  

      

/ etc / webmin / config

webprefix=/webmin
webprefixnoredir=1

      

Still having problems with redirecting after login, so this should help:

in the edit file webmin host / usr / share / webmin / miniserv.pl

and on line 4043 replace
&write_data("Location: $prot://$hostport$in{'page'}\r\n");
to
&write_data("Location: $prot://$host$in{'page'}\r\n");

      



Source: https://sourceforge.net/p/webadmin/discussion/600155/thread/6eb89f60/

But it doesn't work for me, I am redirected to context root (/) after login, not to / webmin context

EDIT: $ prot always evaluates to http even if you have ssl_redirect = 1 in miniserv.conf

/usr/share/webmin/miniserv.pl

&write_data("Location: https://$hostport$config{'cookiepath'}$in{'page'}\r\n");

      

Rewriting rule for location: The headers should also fix this issue.

EDIT2: https://github.com/webmin/webmin/issues/350

https://github.com/webmin/webmin/issues/351

+1


source


I had the same problem. I installed webmin by installing apache with it and no redirection happened after login screen. But @MUHAHA was right. I installed my webmin without no / webmin directory, no nuthin!

I wrote a CNAME redirect rule on my domain provider. CNAME webmin.example.com to my raspberry pi name dynamic-dns.

my webmin.conf file in / etc / apache 2 / sites-enabled / directory:

<VirtualHost *:80> 
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName webmin.example.com
  ServerAlias webmin.example.com
  ProxyPass / http://localhost:10000/
  ProxyPassReverse / http://localhost:10000/
  ProxyPassReverseCookieDomain / http://localhost:10000/
  ProxyPassReverseCookiePath / http://localhost:10000/
</VirtualHost> 

      

after that i installed webmin ... you know! :)

and then thanks to @MUHAHA, I changed this 4043 line in /usr/share/webmin/miniserv.pl

change
&write_data("Location: $prot://$hostport$in{'page'}\r\n");
to
&write_data("Location: $prot://$host$in{'page'}\r\n");

      

and all the peaches! Go to your homepage with ease!

+1


source







All Articles