Could not open input file

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
vicn1222
OpenVPN User
Posts: 25
Joined: Mon Jul 12, 2021 2:31 pm

Could not open input file

Post by vicn1222 » Mon Jul 12, 2021 2:42 pm

Hi,

I set up an openvpn server with username/password authentication by adding auth-user-pass-verify line as below

auth-user-pass-verify "/usr/bin/php /home/www/domains/openvpn/scripts/login.php" via-env

I start the openvpn services by "sudo systemctl start openvpn-server@server.service". when I try to login, the log file complains "Could not open input file: /home/www/domains/openvpn/scripts/login.php", and the authentication fails.

I tried both

user nobody
group nobody

and

user root
group root

All have the same error. The /home/www/domains/openvpn/scripts/login.php exists.

I then run openvpn from command line as below, everything works perfectly.

sudo /usr/sbin/openvpn --config /etc/openvpn/server.conf

Can anyone show me how to handle this problem?

Thank you.

vicn1222
OpenVPN User
Posts: 25
Joined: Mon Jul 12, 2021 2:31 pm

Re: Could not open input file

Post by vicn1222 » Mon Jul 12, 2021 2:52 pm

By the way, script-security is set to 3, as below:

script-security 3

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Could not open input file

Post by TinCanTech » Mon Jul 12, 2021 3:05 pm

Which version of openvpn ?

Please start here:
viewtopic.php?f=30&t=22603

vicn1222
OpenVPN User
Posts: 25
Joined: Mon Jul 12, 2021 2:31 pm

Re: Could not open input file

Post by vicn1222 » Mon Jul 12, 2021 3:25 pm

TinCanTech wrote:
Mon Jul 12, 2021 3:05 pm
Which version of openvpn ?

Please start here:
viewtopic.php?f=30&t=22603
Thank you TinCanTech. The Version is 2.4.11 under CentOS 8.

Strangely, I changed ProtectHome=true to ProtectHome=false in /etc/systemd/system/multi-user.target.wants/openvpn-server@server.service,
then it works.

I have no idea what it means. I just try everything and hit the trigger at this point (so you know how much time I have spent on this error). Anyone know what it is? I also used ddd to debug openvpn, but can't find the bug.

Thank you.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Could not open input file

Post by TinCanTech » Mon Jul 12, 2021 3:37 pm

vicn1222 wrote:
Mon Jul 12, 2021 3:25 pm
The Version is 2.4.11
Moved to correct board.
vicn1222 wrote:
Mon Jul 12, 2021 3:25 pm
I changed ProtectHome=true to ProtectHome=false in /etc/systemd/system/multi-user.target.wants/openvpn-server@server.service, then it works.
Yes, it would.

If you want to use the proper openvpn-server@.service file then you cannot use /home for your server scripts.

vicn1222
OpenVPN User
Posts: 25
Joined: Mon Jul 12, 2021 2:31 pm

Re: Could not open input file

Post by vicn1222 » Mon Jul 12, 2021 4:07 pm

TinCanTech wrote:
Mon Jul 12, 2021 3:37 pm

vicn1222 wrote:
Mon Jul 12, 2021 3:25 pm
I changed ProtectHome=true to ProtectHome=false in /etc/systemd/system/multi-user.target.wants/openvpn-server@server.service, then it works.
Yes, it would.

If you want to use the proper openvpn-server@.service file then you cannot use /home for your server scripts.
Hi,.

Do you have a doc link that explains ProtectHome, or point me the source code file and line number, where I can get more information?

Thank you!

User avatar
openvpn_inc
OpenVPN Inc.
Posts: 1333
Joined: Tue Feb 16, 2021 10:41 am

Re: Could not open input file

Post by openvpn_inc » Mon Jul 12, 2021 4:30 pm

vicn1222 wrote:
Mon Jul 12, 2021 4:07 pm
Do you have a doc link that explains ProtectHome, or point me the source code file and line number, where I can get more information?
This might be of interest:
https://www.freedesktop.org/software/sy ... .exec.html

Hope this helps, regards, rob0
Image OpenVPN Inc.
Answers provided by OpenVPN Inc. staff members here are provided on a voluntary best-effort basis, and no rights can be claimed on the basis of answers posted in this public forum. If you wish to get official support from OpenVPN Inc. please use the official support ticket system: https://openvpn.net/support

vicn1222
OpenVPN User
Posts: 25
Joined: Mon Jul 12, 2021 2:31 pm

Re: Could not open input file

Post by vicn1222 » Mon Jul 12, 2021 5:53 pm

openvpn_inc wrote:
Mon Jul 12, 2021 4:30 pm
vicn1222 wrote:
Mon Jul 12, 2021 4:07 pm
Do you have a doc link that explains ProtectHome, or point me the source code file and line number, where I can get more information?
This might be of interest:
https://www.freedesktop.org/software/sy ... .exec.html

Hope this helps, regards, rob0
Thank you!

Post Reply