[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference orarep::nomahs::sql_services

Title:SQL/Services Forum
Notice:kits(3) ft info(7) QAR access (8) SPR access (10)
Moderator:SQLSRV::MAVRIS
Created:Thu Oct 13 1988
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2214
Total number of notes:8586

2169.0. "nopriv when accessing from ODBC" by ORAREP::CURRNT::GILROYC () Tue Mar 18 1997 09:05

I am trying to attach to an RDB database using ODBC & SQL services.  
It fails with a "RMS-E-PRV, insufficient privilege .." error.

The class definition in sqlsrv$config.dat is:-

-- ----------------------------------------------------------
TYPE    "BEST"
STARTUP "PDA_PROXY"
EXECUTE "ATTACH 'FILENAME pda$database'"
USER    "PDA_PROXY"
IDENT   "PDA_USER"
MIN     0
MAX     50
IDLE    1

The pda_proxy account is a non-privileged account, and uses the identifier 
"pda_user" to access the database.  If I log into pda_proxy, I can access
the database ok.

My understanding is that a process should be created by SQL services under 
the username defined by "USER" in the class definition, with the
identifier as defined in the "IDENT" in the class definition; however
it appears from the security alarm (listed below) that the username is 
"system".  This is the username that SQLSRV$SERVER process is running under.

Should sqlsrv$server be running under a different username?

Thanks in advance for any help,

Carol.




The security alarm on the VAX is:-

%%%%%%%%%%  OPCOM  18-MAR-1997 09:56:10.95  %%%%%%%%%%%
Message from user AUDIT$SERVER on RDGE61
Security alarm (SECURITY) and security audit (SECURITY) on RDGE61, system id: 45
776
Auditable event:          Object access
Event information:        directory lookup request (IO$_ACCESS, IO$_MODIFY, IO$_
DELETE, or IO$_ACPCONTROL)
Event time:               18-MAR-1997 09:56:10.93
PID:                      4043727F
Process name:             SS_BEST_0019
Username:                 SYSTEM
Process owner:            [PDA_PROXY]
Terminal name:            MBA6877
Image name:               DSA0:[SYS0.SYSCOMMON.][SYSEXE]LOGINOUT.EXE
Object class name:        FILE
Object owner:             PDA_SYSTEM
Object protection:        SYSTEM:RWE, OWNER:RWE, GROUP:RE, WORLD:E
Directory name:           _DSA104:[000000]PDA.DIR;1
Directory ID:             (30,2,0)
Directory entry:          WRITE.DIR;1
Access requested:         EXECUTE
Matching ACE:             (IDENTIFIER=*,ACCESS=NONE)
Sequence key:             2E4B7AB0
Status:                   %SYSTEM-F-NOPRIV, insufficient privilege or object pro
tection violation

$
%%%%%%%%%%%  OPCOM  18-MAR-1997 09:56:10.97  %%%%%%%%%%%
Message from user AUDIT$SERVER on RDGE61
Security alarm (SECURITY) and security audit (SECURITY) on RDGE61, system id: 45
776
Auditable event:          Detached process login failure
Event time:               18-MAR-1997 09:56:10.93
PID:                      4043727F
Process name:             SS_BEST_0019
Username:                 SYSTEM
Process owner:            [PDA_PROXY]
Terminal name:            MBA6877
Image name:               DSA0:[SYS0.SYSCOMMON.][SYSEXE]LOGINOUT.EXE
Status:                   %RMS-E-PRV, insufficient privilege or file protection
violation


The pda_proxy account is defined as:-

UAF> show pda_proxy

Username: PDA_PROXY                        Owner:  091541 Anita Morley
Account:  HV6 DC                           UIC:    [104,4] ([PDA_PROXY])
CLI:      DCL                              Tables: DCLTABLES
Default:  DISK$APPL_04:[PDA.WRITE.IN]
LGICMD:   DISK$APPL_04:[PDA.COM]PDA$USER_LOGIN.COM
Flags:
Primary days:   Mon Tue Wed Thu Fri
Secondary days:                     Sat Sun
No access restrictions
Expiration:  1-MAR-1998 00:00    Pwdminimum:  8   Login Fails:     1
Pwdlifetime:         30 00:00    Pwdchange:      (pre-expired)
Last Login:  6-MAR-1997 10:57 (interactive), 18-MAR-1997 09:58 (non-interactive)
Maxjobs:         0  Fillm:       300  Bytlm:        32768
Maxacctjobs:     0  Shrfillm:      0  Pbytlm:           0
Maxdetach:       0  BIOlm:        40  JTquota:       4096
Prclm:           2  DIOlm:        40  WSdef:          256
Prio:            4  ASTlm:        40  WSquo:          512
Queprio:         0  TQElm:        40  WSextent:      1024
CPU:        (none)  Enqlm:       200  Pgflquo:      32768
Authorized Privileges:
  NETMBX    TMPMBX
Default Privileges:
  NETMBX    TMPMBX
Identifier                         Value           Attributes
  PDA_USER                         %X80010199



The ACL on the directory mentioned in the security alarm is:-

Directory DSA104:[000000]

PDA.DIR;1            PDA_SYSTEM            (RWE,RWE,RE,E)
          (IDENTIFIER=PDA_SYSTEM,ACCESS=READ+WRITE+EXECUTE)
          (IDENTIFIER=PDA_USER,ACCESS=READ+EXECUTE)
          (IDENTIFIER=*,ACCESS=NONE)
          (DEFAULT_PROTECTION,SYSTEM:RWED,OWNER:RWED,GROUP:,WORLD:)
          (IDENTIFIER=PDA_READONLY,ACCESS=READ+EXECUTE)
               
Directory DSA104:[PDA]

WRITE.DIR;1          PDA_SYSTEM            (RWE,RWE,,)
          (IDENTIFIER=PDA_SYSTEM,ACCESS=READ+WRITE+EXECUTE)
          (IDENTIFIER=PDA_USER,ACCESS=READ+EXECUTE)
          (IDENTIFIER=*,ACCESS=NONE)
          (DEFAULT_PROTECTION,SYSTEM:RWED,OWNER:RWED,GROUP:,WORLD:)
          (IDENTIFIER=PDA_READONLY,ACCESS=READ+EXECUTE)

T.RTitleUserPersonal
Name
DateLines
2169.1Some guidelinesORASQS::OXBURYOracle Corporation, Rdb Desktop Group|DTN 381-2704Tue Mar 18 1997 12:0164
When an SQL/Services executor is started, it is given the UIC and privs of the
STARTUP user name. (This username must be configured to start the executor
correctly; typically, a SQLSRV$SRVnn account is used, since they all have the
correct LGICMD specified, etc. If you don't use one of these accounts, you must
ensure the account you do use is configured in a  simmilar way to an
SQLSRV$SRVnn account. If you don't, the executor won't start.) The STARTUP user
name is also used to determine the quotas of the executor process.

However, and this is the catch, VMS does NOT provide any method to specify a
user name when creating a new process, nor does it provide any way to specify
rights list information. Therefore, the user name of an executor process will
be that of the comm server (<= V6.1) or monitor (>= V7.0), while its rights
list will be empty as the comm server/monitor removes all rights when they
start up. This is not normally an issue as the startup user name is used only
to start the executor process by invoking RDB$SETVER, then running the executor
process image. (It can be an issue if the executor tries to access an
ACL-protected file during process startup, and there's not a lot you can do
about that right now.) Process logical names can be defined by editing the
LOGIN.COM of the STARTUP account (<= V6.1) or creating a process initialization
file (>= V7.0); however, there's not a lot else that can use be usefully
accomplished during the startup of an executor process. Note that any security
checks that are required during this stage are made using the UIC and rights
list of the process. (The user name is not actually used, unless a SPAWN or
SUBMIT command gets used, in which case the resulting process will have the
user name of the executor process.)

When the executor image itself for a database service first starts, it
reconfigures the executor process as the USER user name. It is the USER user
name that is used to access the database. As part of reconfiguring the process,
SQL/Services sets the process user name, account, UIC, privs, rights list,
default directory and so forth. 

Note that the IDENT in a service definition specifies a VMS identifier that
must be held by any client-specified user name wishing to connect to the
server. It is NOT granted to the executor process as a means by which it can
access the database. If that is required, the necessary identifier(s) must be
granted to the USER account, as that is the account used to access the
database.

In summary:

- Using <= V6.1, its best to specify a SQLSRV$SRV(nn) account as the STARTUP
  user name for all services. If you need a service with large quotas, then
  make sure the account you use is configured in a simmilar way to a
  SQLSRV$SRV(nn) account, that it can write to its default directory, that 
  its LGICMD is correct (a SQL/Services start up file), etc, etc.

- Make sure the LOGIN.COM of the STARTUP account doesn't do any fancy stuff;
  logical names are typically all that should be done here. Bear in mind
  that the process will be reconfigured once the executor image itself
  starts running. 

- Make sure the USER user name has the necessary privs and/or rights
  identifiers to attach to the specified database and to perform the 
  necessary data access operations. 

Hope this helps,

Si

ps, this is all much simpler in 7.0 (eg, no more SQLSRV$SRV(nn) accounts), but 
    it is different, so reading the 7.0 server guide when it comes time to 
    upgrade is a must.

2169.2missing identifiersORAREP::CURRNT::GILROYCTue Mar 18 1997 13:4523
Thanks for your quick response, Si.

>correctly; typically, a SQLSRV$SRVnn account is used, since they all have the
>correct LGICMD specified, etc. If you don't use one of these accounts, you must
>ensure the account you do use is configured in a  simmilar way to an
>SQLSRV$SRVnn account. If you don't, the executor won't start.) 

Will changing the STARTUP user name for this class to SQLSRV$SRV make 
this connection work correctly?  I am puzzled by the fact that the
security alarm is on a directory lookup request for [PDA]WRITE.DIR

>process image. (It can be an issue if the executor tries to access an
>ACL-protected file during process startup, and there's not a lot you can do
>about that right now.) 

Isn't this my problem?  Is it failing because it doesn't have the
necessary identifier to get to the directory in which it should
create the log file? ie [PDA.WRITE.IN]

I am using SQLSRV version 6.0-0

Carol.

2169.3As a side issue. . .ORAREP::RTOAL2::MAHERTIER3 simply a better RPC!Tue Mar 18 1997 14:237
    re .1
    
    To "specify" a username when creating a process on VMS you can
    first do a $persona_create followed by a $persona_assume followed
    by a $creprc before you return to your original personna.
    
    Regards Richard Maher.
2169.4Some ideas to tryORASQS::OXBURYOracle Corporation, Rdb Desktop Group|DTN 381-2704Tue Mar 18 1997 14:5456
Re: .-2

>Isn't this my problem?  Is it failing because it doesn't have the
>necessary identifier to get to the directory in which it should
>create the log file? ie [PDA.WRITE.IN]

Yep, now I've looked in more detail, the fact that the process doesn't have any
identifiers when it starts, may indeed mean that it won't be able to create its
log file. (I have to confess I always get very confused when I it comes to
mixing ACLs, UICs and rights lists.) 

The best way to think of the STARTUP user name for a database service in
SQL/Services <= V6.1 is that it supplies the quotas for the process (directly)
and specifies the version of Rdb the executor should use (indirectly, via the 
LGICMD attribute, which invokes a SYS$SYSTEM:SQLSRV$LOGIN_LOGIN(nn).COM
procedure, which in turn invokes SYS$LOGIN:LOGIN.COM, if it exists). In
contrast, the USER user name specifies the account (plus UIC, privs, rights
list and so on) which is used to attach and to access the database. Typically,
the STARTUP user name has no special privs and just gets the process going,
while the USER user name is responsible for doing most of the work.

Not knowing the details of your particular setup, I'm not sure exactly what to
do to fix it. If you don't need quotas that are different from SQLSRV$SRV(nn)
and don't need any special setup like logicals, then just modify the service to
use SQLSRV$SRV(nn) as the STARTUP user name. If you do need different quotas or
special setup like logicals, then:

- MODIFY pda_proxy/LGICMD=SYS$SYSTEM:SQLSRV$SERVER_LOGIN(nn).COM
- MODIFY pda_proxy/DEV=<a-disk>/DIR=[a-dir] ! to which pda_proxy can write
- REVOKE/ID PDA_USER pda_proxy ! not needed/doesn't do any good

Create a_disk:[a-dir]LOGIN.COM:
$ @DISK$APPL_04:[PDA.COM]PDA$USER_LOGIN.COM
$ ! assuming PDA_PROXY has execute access or @ some other command procedure 
$ ! which does the minimum necessary, in terms of defining logicals and
$ ! the like, so PDA_PROXY can find the database.

If you need PDA_PROXY for other uses, such as remote Rdb access, then create
a new account, eg PDA_SQS, which does the same sort of thing and leave
PDA_PROXY alone.

Hope that helps...

Re: .-1

While I was typing in .1, I was vaguely wondering if we could use the existing
SQL/Services process reconfiguration [impersonation] mechanism, currently used
only in executor's, to temporarily change the identity of the comm
server/monitor process while creating the executor process. We don't want to
use the new VMS impersonation code, because its not supported in our base
version of VMS, which is still V5.2-something. But neither do we need to,
because the SQL/Services code does all we need. I don't work on SQL/Services
any more, but I'll pass this on to Sue as a request.a

Si

2169.5no_mchrhtORAREP::CURRNT::GILROYCTue Mar 18 1997 15:3819
>do to fix it. If you don't need quotas that are different from SQLSRV$SRV(nn)
>and don't need any special setup like logicals, then just modify the service to
>use SQLSRV$SRV(nn) as the STARTUP user name. 

OK, I tried this and got an error on SQLSRV$STARTUP (in sqlsrv$.log) saying

0318 16481556  %SQLSRV-F-GETACCINF, SQL Services authorization failed
0318 16481556  -SQLSRV-F-NO_MCHRHT, Account does not have rights access to class
0318 16481557  -SQLSRV-I-LOGINFAILINFO, Username: SQLSRV$SRV; client: 16.37.80.8
4

Is this because SQLSRV$SRV doesn't have access to the database specified
in the EXECUTE statement?

NB This may be unrelated, but I notice the address 16.37.80.84 mentioned in
the log file is not the address of this node (which is 16.37.80.83).

Carol.
2169.6Ooops, USER user name needs IDENT identifierORASQS::OXBURYOracle Corporation, Rdb Desktop Group|DTN 381-2704Tue Mar 18 1997 16:379
    Ooops, I think I might have told a fib a little while back... 
    
    From memory, I thought it was only client-supplied accounts that needed
    the IDENT identifier (to authorize access to the service), but it looks
    like the USER user name account needs it too.
    
    Sorry about that.
    
    Si
2169.7got it working!!ORAREP::CURRNT::GILROYCThu Mar 20 1997 07:0939
    
>    From memory, I thought it was only client-supplied accounts that needed
>    the IDENT identifier (to authorize access to the service), but it looks
>    like the USER user name account needs it too.

I presume you mean the STARTUP user name here, as my USER user name 
already has the IDENT identifier.


The good news is that I have got it working.  Thanks very much for all
your help, Si.


For future reference, here's what I did:-

I don't want to grant the IDENT identifer to SQLSRV$SRV, partly for
security reasons, and partly in case it was lost next time SQL services
was upgraded, so I have copied SQLSRV$SRV to a new account (PDA_SQLSRV),
and created a top level home directory (with no ACL) and a login.com 
which defines the database logical (PDA$DATABASE).  I granted the 
IDENT identifer (PDA_USER) to the new account (PDA_SQLSRV).

I modified the STARTUP in the class definition use the new account:-

TYPE    "BEST"
STARTUP "PDA_SQLSRV"
EXECUTE "ATTACH 'FILENAME PDA$DATABASE'"
USER    "PDA_PROXY"
IDENT   "PDA_USER"
MIN     0
MAX     50
IDLE    1

and shut down SQL services, waited ~10 minutes and started it up (any
sooner gave me a DUPLNAM error).  The next connection worked fine.

 Thanks again,

Carol.