We help IT Professionals succeed at work.
Private
Troubleshooting Question

How to encrypt the Apache config file?

77 Views
Last Modified: 2020-09-18
Hi All,
 We have one Apache web server with java web application (PL SQL and Java). There is a config file (mod_owa_.conf) under  /etc/httpd/conf.d which used for Oracle 12c database.

Our we are planning to migrate this application to cloud and the requirement to encrypt the file (Encrypt password). Can you please give us some suggestion to encrypt this file.

Below is the line which have database credential.
 OwaUserid         schema/password!@servicename

Contents of the file
LoadModule owa_module modules/mod_owa.so
OwaSharedMemory 1M
OwaSharedThread 10min
<Location /pls/App_PROD>
        SetHandler                      owa_handler
        order                           deny,allow
        allow                           from all
   OwaUserid         schema/password!@servicename
   OwaDiag            COMMAND ARGS COOKIES CGIENV POOL HEADER RESPONSE TIMING SQL MEMORY THREADS ERROR
   OwaLog            "/opt/cloudhost/logs/apache/mod_owa.log"
   OwaPool            20
        OwaStart                   "CLS_WWW_ACCESS.logon"
   OwaUploadMax         10M
   OwaWait            20000
</Location>


Comment
Watch Question

Dr. KlahnPrincipal Software Engineer
CERTIFIED EXPERT

Commented:
Apache does not have the capability to read encrypted files.

Nor in this case would encrypting the file be of any benefit, since the decryption key must exist on the same system in order to decrypt the file.

I agree that plaintext keys are not a good practice but if the system is penetrated by a hostile all bets are off anyway because access to that database is already available in the running server.

Perhaps somebody on one of the Oracle forums has an approach to this issue.

https://community.oracle.com/welcome
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
As Dr. Klahn mentioned, you'll have to write some sort of Apache module for this.
Fractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Suggestion: When you close this question. Ask another question, where you define your exact problem (what you're trying to resolve), then ask for input about how other people have solved this problem.

Author

Commented:
Thank you Dr Klahn and David for your comment.  What i understand as per my config file there is no way to encrypt and Apache does not have the capability to read encrypted files.  

What is the alternate solution for this? If you can provide some links which can help me.

Thank You
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Encrypting any files provides no benefit if a machine/container is hacked.

Your focus is to prevent hacks, rather than encrypt a specific config file.

Said differently, if you're hacked it's all over, so no encrypted config file will save you.

Thus the alternative is... make your Sites/Apps/APIs as... hacker resistant as possible, then make frequent backups + keep many months of backups.

Author

Commented:
Thank You David for the information.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
You're welcome!

Do consider opening another question detailing the exact problem you're trying to solve by config file encryption.

Likely someone has resolved this same problem + will provide you with their solution.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
>>Do consider opening another question detailing the exact problem you're trying to solve by config file encryption.

I believe it was stated:  The need is to not store the connect string in clear text in the config file.

I cannot help directly with this because I don't use Apache.  This has to be a pretty common thing in the Web world.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.