How to handle build user access/permissions?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to handle build user access/permissions?
# 1  
Old 01-31-2018
How to handle build user access/permissions?

All,

I am looking for some guidance on how to handle permissions/access for an application build/deployment.

We need to allow for software deployments via Visual Studio Team Services and a build server running on Windows, deploying to RHEL 7 servers. We would like to use a service account, say 'srv_user', to handle the process. The need will be to:
  1. Stop tomcat service on destination server
  2. Push latest code to destination server
  3. Do an 'ant' build of the code on destination server
  4. Start tomcat service on destination server

Thoughts/Concerns:
  • It would be great if the srv_user didn't actually need shell access on the RHEL 7 servers so developers who know the credentials can't ssh into the server. However, given the need to do a build on the destination server that may be difficult. Any thoughts?
    .
  • We want the tomcat service to run as a different user, say 'app_user'. Since the srv_user will need to stop and start tomcat to run the build, I'm thinking to use a custom systemd service that srv_user can run but starts the service as app_user. Does this sound like the best way to handle this need or is there a better way to handle it?
    .
  • The srv_user will be in the same group as app_user but we do want the written files to be owned by app_user. What is the best way to handle file permissions? Is there a good way for srv_user to write files as app_user or is the only way to write and then do a chown/chmod?

Hopefully I haven't confused the need too much, any suggestions are appreciated.

Thanks in advance,

HB

Last edited by rbatte1; 02-01-2018 at 07:24 AM.. Reason: Set formatted bulletted list and numbered list
# 2  
Old 02-02-2018
Here are some general considerations/suggestions. To be more specific is too much dependant on the specific setting in your shop which is hard to appreciate from afar.

First, identify all the necessary roles and what they need to be allowed. You have already started that but you need that in more detail. Do not only define one role ("srv_user") but also the other roles necessary: i.e. "tester", "admin", ...

Only then sort through these specifications and see where they are different. i.e.:

Basic role "user": right1, right2, right3
Role "tester": like "user", but also right4, right5
Role "srv_user": like "tester" plus right6, right7, right8
etc..

This will give you a basic layout for a group hierarchy and which right should go to which group.

A few caveats: it is quite modern to use "ACLs" instead of classic UNIX privileges. This is a great way of getting yourself into deep kimchi beyond all means of maintenance. Experience shows that you end up (usually more sooner than later) with a heap of rights without any structure and no one knows or understands what is going on. Avoid that at all cost, even if it might appeal to you at first. In the long run it tends to be more a problem than a solution. A good (long-term!) solution is not one that does what you want but one that is also easy to understand and painless to maintain.

Have a look at "sudo", but do NOT overuse it! It is often possible to make up for planning deficiencies by overusage of a tool. In practically all cases this is a very bad idea in the long run. If an implementation looks cumbersome rather plan better than undergo the effort of the implementation.

I hope this helps.

bakunin
# 3  
Old 02-02-2018
If in LAN,i would go with NFS and a cron script on the clients.

You have one windows master build server which has multiple NFS mounts from clients (destination servers) you wish to push changes to.
NFS is supported on newer windows and gid / uid can be mapped via registry to tomcat unix/linux user on clients.

A cron job runs on clients which detects if a new file is copied and does the work (stop tomcat, deploy code or whatever, start tomcat).

Be careful you do not catch files while being copied, rename a file after copy to NFS share on the build machine to file you want that client (destination server) to process.

Using NFSv4 you could probably have one port open between build machine and clients.
It would not involve any kind of access expect copying a file via network share, but some shell code running in cron should be produced.

Have you considering deploying application(s) thru web tomcat interface instead ?

Hope that helps
Regards
Peasant.
# 4  
Old 02-15-2018
@bakunin and @Peasant thank you for your replies and suggestions. My apologies for not updating this thread sooner.

What I have ended up doing is:

Created an RSA key and put it in place on the destination server to allow for passwordless SSH connections from the build server. This gives me the ability to change the password for the 'srv_user' and not have a need to distribute the password.

Created a systemd service for Tomcat so that the processes are always run as 'app_user'. The 'srv_user' connects via ssh, uses sudo to stop Tomcat via the systemd service, does the get of new files, does a build, uses sudo to change permissions back to 'app_user' owner and group, and uses sudo to start Tomcat via systemd service.

So far it seems like the best way to handle the process. I'll be fine tuning it as we progress.

Any thoughts and/or suggestions are welcome.

Thanks,

HB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Access permissions chmod 606

Hi All I am running Ubuntu linux flavour. I need provide multiple users belonging to the same group access to a dir where they can write files but are not supposed to remove or rename files. users outside the group should be able to read and write to the dir. i have set the permission of... (7 Replies)
Discussion started by: Simza
7 Replies

2. Linux

Permissions and access to data

Hi Operating system Red Hat Enterprise 5.8, Data access Mac/PC environment on various OS levels. Access via smb I am trying to set up a data shared area where a user group can read and write to its own directory, but can only write to another groups directory. Example: I have set up two... (1 Reply)
Discussion started by: treds
1 Replies

3. OS X (Apple)

Change access permissions

I purchased a 2TB hard drive, split it into two partitions, and formatted it as NTFS. I want to use the drive on my pc and my mac. How can I change the access permissions so Mac OS 10.4.11 will let me write to the drive? I tried this: $ chmod +a "admin allow write" /volumes/V2_Mac chmod:... (3 Replies)
Discussion started by: Me&MyMac
3 Replies

4. UNIX for Advanced & Expert Users

file access permissions

Hi everybody, following is the scenario; OS HP UX 11.23 two users: # id bodi uid=109(bodi) gid=20(users) groups=1(other),2(bin),3(sys),106(oinstall) # id ossmed uid=121(ossmed) gid=20(users) umask 077 directory name /home/mydir directory permissions drwxrwxrwx requirement: to... (1 Reply)
Discussion started by: ajays
1 Replies

5. Solaris

user permissions

hi i want to display the usernames,usergroups user permissions and user home directory's with in a single command.and possibities are their for getting this output .. (9 Replies)
Discussion started by: tv.praveenkumar
9 Replies

6. Shell Programming and Scripting

script to change the access permissions of the files

Hi, I want to change the access permissions of the files whose extension is same.For example *.c but these are inside a directory and inside that other directory is there and it contains the .c files..for example-- So my aim is to search the files under src and change the access permissions... (3 Replies)
Discussion started by: smartgupta
3 Replies

7. UNIX for Dummies Questions & Answers

Setting permissions and restricting access

Hi all, I have user called "Z". The home directory is /home/Z. I have another directory /home/Z/OP. Within /home/Z/OP, i have 2 directories /home/Z/OP/OP1 and /home/Z/OP2. I want to restrict access for Z to only access /home/Z/OP and /home/Z/OP1 and /home/Z/OP2. What kind of... (4 Replies)
Discussion started by: new2ss
4 Replies

8. UNIX for Dummies Questions & Answers

Side-Effect of write access permissions for a subdirectory

Hi Unix Gurus, I'm a newbie to unix and need some help from you. I'm going to give full access (777) to a subdirectory to an FTP account. Let's say the subdirectory is /usr/local/dir1/dir2/dir3 There are files in dir1, say a.txt b.cfg c.xml Will this account be able to access... (3 Replies)
Discussion started by: xinu299
3 Replies

9. AIX

Strange error with file access permissions

All, I am trying to copy some data from /admin/reports/Sept/ccn/c_ivsstr01 to /home/users/myhomedir and I am getting an error I have never seen before: The file access permissions do not allow the specified action. The permissions on the file are -rw-r--r-- and I am the owner of the file... (3 Replies)
Discussion started by: kjbaumann
3 Replies

10. UNIX for Dummies Questions & Answers

root access on sun os and permissions

Currently have root access to our own boxes on site. HQ wants to take root access away from us. What does root access provide that is unavailable for users as it is essential for us to keep local control. We log in as users but have su for special needs. On all other os boxes we have admin... (2 Replies)
Discussion started by: allinone
2 Replies
Login or Register to Ask a Question