Page 1 of 1

changing default port problem

Posted: Thu Jan 30, 2020 2:17 pm
by bardiya3
hi
im trying to change openvpn default port from 1194 to 8080

i change port 1194 to port 8080 on server.conf at server and change the client config file like that remote 15.15.15.15 8080
then i restart openvpn but does not worked

i also use this code for opening the port 8080 on firewalld

Code: Select all

firewall-cmd --zone=public --add-port=8070/udp --permanent
firewall-cmd --zone=public --add-port=8070/tcp --permanent


but still connection doesn't work :( :( :( :( [/b]

please help me what can i do for change default port?
i use centos7 os.

Re: changing default port problem

Posted: Fri Jan 31, 2020 10:28 pm
by bardiya3
but when i change the port to 1194 agine openvpn works agine good!!

if otherwise the server.conf (port 1194) i had to change any option or file which thats not works or not?? please help me what can i do for to change default port?

Re: changing default port problem

Posted: Tue Feb 04, 2020 2:57 am
by chilinux
Are you trying to open up port 8080 or 8070? The firewalld commands you provided seem to indicate you opened 8070 in the firewall instead of 8080.

If you are using OpenVPN Access Server, you should try changing the port via the web interface instead of trying to modify the server.conf directly.

Can you try running the following command and post the resulting output?

Code: Select all

rpm -qi openvpn-as

Re: changing default port problem

Posted: Tue Feb 04, 2020 12:15 pm
by TiTex
SELinux is probably in the way when using a RHEL based distribution like Fedora, CentOS
you can check the current ports allowed for openvpn process using this command

Code: Select all

semanage port -l | grep openvpn_port_t
add a new (custom) port to that list

Code: Select all

semanage port -a -t openvpn_port_t -p tcp  8080
and of course you need to allow that port through the firewall as well :)

Re: changing default port problem

Posted: Tue Feb 04, 2020 2:04 pm
by Pippin
Is this about OpenVPN Access Server or Community version?

Re: changing default port problem

Posted: Wed Feb 05, 2020 6:41 pm
by bardiya3
chilinux wrote:
Tue Feb 04, 2020 2:57 am
Are you trying to open up port 8080 or 8070? The firewalld commands you provided seem to indicate you opened 8070 in the firewall instead of 8080.

If you are using OpenVPN Access Server, you should try changing the port via the web interface instead of trying to modify the server.conf directly.

Can you try running the following command and post the resulting output?

Code: Select all

rpm -qi openvpn-as
i open up 8080 and another time open up 8070 and i'm sure that I applied the firewall settings correctly
i cant change port with modify server.conf and add rule to firewall that's not work for me
Image

Re: changing default port problem

Posted: Wed Feb 05, 2020 6:47 pm
by Pippin
Topic moved and there is no need for CAPS!

Re: changing default port problem

Posted: Wed Feb 05, 2020 8:42 pm
by bardiya3
TiTex wrote:
Tue Feb 04, 2020 12:15 pm
SELinux is probably in the way when using a RHEL based distribution like Fedora, CentOS
you can check the current ports allowed for openvpn process using this command

Code: Select all

semanage port -l | grep openvpn_port_t
add a new (custom) port to that list

Code: Select all

semanage port -a -t openvpn_port_t -p tcp  8080
and of course you need to allow that port through the firewall as well :)
i do it but still not works!!!!
just when i back the port to 1194 works :cry: :cry: :cry:
Image

and when i want to use port 8080 i encounter this error
Image

Re: changing default port problem

Posted: Wed Feb 05, 2020 8:45 pm
by bardiya3
Pippin wrote:
Wed Feb 05, 2020 6:47 pm
Topic moved and there is no need for CAPS!
please instead of moving help us for fix the problem :(

Re: changing default port problem

Posted: Sun Feb 09, 2020 3:08 pm
by bardiya3
no one cant help me ????? :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

Re: changing default port problem

Posted: Tue Feb 11, 2020 2:48 am
by chilinux
The reason your post was moved is you placed it in the forum for OpenVPN Access Server. Since you are running OpenVPN as compiled by the EPEL project instead of OpenVPN AS, the advice you would get about OpenVPN AS would probably just frustrate you further.

SElinux policy support is usually best provided by the OS distribution. As you can see from the files listed by the installed RPM, OpenVPN doesn't itself provide any SElinux policy.

The problem appears from what you posted to be that a policy type is already squatting on the port you want to assign.

Have you tried modifying the existing entry such as the following:

Code: Select all

semanage port -m -t openvpn_port_t -p tcp 8080
Otherwise, try deleting the existing entry before adding it such as:

Code: Select all

semanage port -d -p tcp 8080
semanage port -a -t openvpn_port_t -p tcp 8080