-
Notifications
You must be signed in to change notification settings - Fork 155
[fixed] replacement error & /etc/sysctl.conf path fixed #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DG9Jww
wants to merge
2
commits into
iw4p:master
Choose a base branch
from
DG9Jww:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,19 @@ install() { | |
|
|
||
| apt update -y | ||
|
|
||
| ip=$(hostname -I|cut -f1 -d ' ') | ||
| echo "Your Server IP address is:$ip" | ||
|
|
||
| echo "Please select connection method:" | ||
| echo "1) Domain Name" | ||
| echo "2) IP Address" | ||
| read -p "Input number [1-2]: " host_type | ||
|
|
||
| if [ "$host_type" == "1" ]; then | ||
| read -p "Enter Your Domain Name: " ip | ||
| else | ||
| ip=$(hostname -I | cut -f1 -d ' ') | ||
| echo " Auto-detected IP: $ip" | ||
| fi | ||
| echo "Your Server Host Name is:$ip" | ||
|
|
||
| echo -e "\e[32mInstalling gnutls-bin\e[39m" | ||
|
|
||
|
|
@@ -41,17 +52,18 @@ certtool --generate-privkey --outfile server-key.pem | |
| certtool --generate-certificate --load-privkey server-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template server.tmpl --outfile server-cert.pem | ||
|
|
||
| echo -e "\e[32mInstalling ocserv\e[39m" | ||
| # ocserv will use /etc/ocserv/ocserv.conf as config file by default | ||
| apt install ocserv | ||
| cp /etc/ocserv/ocserv.conf ~/certificates/ | ||
|
|
||
| sed -i -e 's@auth = "@#auth = "@g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@auth = "pam@auth = "#auth = "pam"@g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@try-mtu-discovery = @try-mtu-discovery = true@g' /etc/ocserv/ocserv.conf | ||
| sed -i 's|^[# ]*try-mtu-discovery.*|try-mtu-discovery = true|' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@dns = @#dns = @g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@# multiple servers.@dns = 8.8.8.8@g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@route =@#route =@g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@no-route =@#no-route =@g' /etc/ocserv/ocserv.conf | ||
| sed -i -e 's@cisco-client-compat@cisco-client-compat = true@g' /etc/ocserv/ocserv.conf | ||
| sed -i 's|^[# ]*cisco-client-compat.*|cisco-client-compat = true|' ocserv.conf | ||
| sed -i -e 's@##auth = "#auth = "pam""@auth = "plain[passwd=/etc/ocserv/ocpasswd]"@g' /etc/ocserv/ocserv.conf | ||
|
|
||
| sed -i -e 's@server-cert = /etc/ssl/certs/ssl-cert-snakeoil.pem@server-cert = /etc/ocserv/server-cert.pem@g' /etc/ocserv/ocserv.conf | ||
|
|
@@ -62,9 +74,12 @@ read username | |
|
|
||
| ocpasswd -c /etc/ocserv/ocpasswd $username | ||
| iptables -t nat -A POSTROUTING -j MASQUERADE | ||
| sed -i -e 's@#net.ipv4.ip_forward=@net.ipv4.ip_forward=@g' /etc/sysctl.conf | ||
| #sed -i -e 's@#net.ipv4.ip_forward=@net.ipv4.ip_forward=@g' /etc/sysctl.conf | ||
| #The config file might be different in different OS. The command below works for debain 6.12.48. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of making this specific and customized for Debian, let's find out the distro and decide based on that |
||
| #The most important thing is path!! | ||
| echo 'net.ipv4.ip_forward = 1' > /etc/sysctl.d/ocserv-custom.conf | ||
| sysctl -p /etc/sysctl.d/ocserv-custom.conf | ||
|
|
||
| sysctl -p /etc/sysctl.conf | ||
| cp ~/certificates/server-key.pem /etc/ocserv/ | ||
| cp ~/certificates/server-cert.pem /etc/ocserv/ | ||
| echo -e "\e[32mStopping ocserv service\e[39m" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you tell me what's the reason behind these two changes?